From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AG47ELu/djYmrpH5zuCPcLt8qX2r0fOYl/RYAOLThQ1MlsOCCus3Owq8pJRIBuwyEYBnHkcyPG+H ARC-Seal: i=1; a=rsa-sha256; t=1521239179; cv=none; d=google.com; s=arc-20160816; b=rjfAMGW4pbYqucUBfOSpga04cAKxMMfXxAmAXVvwZ+H7oogLWTwwYguhxDnabKWf7/ uCmtMZ0fw1SnxtXmIVQzVzKnxQl9x5iZmKsGJFizcXzMU9vlqxZC9+kI4xCyxyCS+re6 jT5i0WonL3UMDiyOrVfARafMxds/1+moUbo8gn2fMVZbTPRKElEeb66Wzm+9NtzmGPk6 +9WOX2nwlb7itljnapj2EmqAbwpCKHu4dzjZJzWdYOjZt/Bgt/zK+62ExLPQagPCzBcA e+kQKMFyJeKQjLIqLRU7zULtf4OKzRw+g/K/u7Pi2uJoH79FdM5E+CpEMzbK6bfr599N pwBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:cc:references:to:subject:arc-authentication-results; bh=TIx5Rmdph1E5I72p1yHgie23XJq92oDlRDt5tqdy7qw=; b=dUScA0cgB3/pgcJw3YVpoQYU6xntC86uoLp/xV3YF/iHqCyoIACOxhRL3VNXiSp69Y j3dmxU41/FlfRdf9if1hZ0jBawUPz3sGrVyRP3rYs+Eedzsu3wJY3M6uF7TpEbFNzA2p 4+HrSG1ZvdUbW+WUGZ0Ja4ivjhHXkz3kWjWzzxMhHzy1VzcifBCkEiZ76eeMH+khNRPg or6nAKFA9/qRwabEmQkvaZNcjNYRaMHErUk1DveUGPcIlcXxdopiatSYz0mht9fUFBhd kFwSvZxEAU4keBOmuWxplE4TSypQbFxtBh3YW+6IUrlVLtInVG0ofg0hxy1PtCyH0WlH sB1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kselftest-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kselftest-owner@vger.kernel.org Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kselftest-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kselftest-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751372AbeCPW0T (ORCPT ); Fri, 16 Mar 2018 18:26:19 -0400 Received: from mga05.intel.com ([192.55.52.43]:37272 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751319AbeCPW0S (ORCPT ); Fri, 16 Mar 2018 18:26:18 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,317,1517904000"; d="scan'208";a="25372433" Subject: Re: [PATCH v12 15/22] selftests/vm: powerpc implementation to check support for pkey To: Ram Pai , shuahkh@osg.samsung.com, linux-kselftest@vger.kernel.org References: <1519264541-7621-1-git-send-email-linuxram@us.ibm.com> <1519264541-7621-16-git-send-email-linuxram@us.ibm.com> Cc: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, akpm@linux-foundation.org, benh@kernel.crashing.org, paulus@samba.org, khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com, hbabu@us.ibm.com, mhocko@kernel.org, bauerman@linux.vnet.ibm.com, ebiederm@xmission.com, arnd@arndb.de From: Dave Hansen Message-ID: Date: Fri, 16 Mar 2018 15:26:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1519264541-7621-16-git-send-email-linuxram@us.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kselftest-owner@vger.kernel.org X-Mailing-List: linux-kselftest@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1593064575819973717?= X-GMAIL-MSGID: =?utf-8?q?1595134894128082987?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On 02/21/2018 05:55 PM, Ram Pai wrote: > #define PAGE_SIZE (0x1UL << 16) > -static inline int cpu_has_pku(void) > +static inline bool is_pkey_supported(void) > { > - return 1; > + /* > + * No simple way to determine this. > + * lets try allocating a key and see if it succeeds. > + */ > + int ret = sys_pkey_alloc(0, 0); > + > + if (ret > 0) { > + sys_pkey_free(ret); > + return true; > + } > + return false; > } The point of doing this was to have a test for the CPU that way separate from the syscalls. Can you leave cpu_has_pkeys() in place? From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-4.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id EF47D7E66E for ; Fri, 16 Mar 2018 22:26:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751475AbeCPW0T (ORCPT ); Fri, 16 Mar 2018 18:26:19 -0400 Received: from mga05.intel.com ([192.55.52.43]:37272 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751319AbeCPW0S (ORCPT ); Fri, 16 Mar 2018 18:26:18 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Mar 2018 15:26:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,317,1517904000"; d="scan'208";a="25372433" Received: from ray.jf.intel.com (HELO [10.7.201.16]) ([10.7.201.16]) by orsmga007.jf.intel.com with ESMTP; 16 Mar 2018 15:26:17 -0700 Subject: Re: [PATCH v12 15/22] selftests/vm: powerpc implementation to check support for pkey To: Ram Pai , shuahkh@osg.samsung.com, linux-kselftest@vger.kernel.org References: <1519264541-7621-1-git-send-email-linuxram@us.ibm.com> <1519264541-7621-16-git-send-email-linuxram@us.ibm.com> Cc: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, mingo@redhat.com, akpm@linux-foundation.org, benh@kernel.crashing.org, paulus@samba.org, khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com, hbabu@us.ibm.com, mhocko@kernel.org, bauerman@linux.vnet.ibm.com, ebiederm@xmission.com, arnd@arndb.de From: Dave Hansen Message-ID: Date: Fri, 16 Mar 2018 15:26:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1519264541-7621-16-git-send-email-linuxram@us.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On 02/21/2018 05:55 PM, Ram Pai wrote: > #define PAGE_SIZE (0x1UL << 16) > -static inline int cpu_has_pku(void) > +static inline bool is_pkey_supported(void) > { > - return 1; > + /* > + * No simple way to determine this. > + * lets try allocating a key and see if it succeeds. > + */ > + int ret = sys_pkey_alloc(0, 0); > + > + if (ret > 0) { > + sys_pkey_free(ret); > + return true; > + } > + return false; > } The point of doing this was to have a test for the CPU that way separate from the syscalls. Can you leave cpu_has_pkeys() in place? -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: dave.hansen at intel.com (Dave Hansen) Date: Fri, 16 Mar 2018 15:26:09 -0700 Subject: [PATCH v12 15/22] selftests/vm: powerpc implementation to check support for pkey In-Reply-To: <1519264541-7621-16-git-send-email-linuxram@us.ibm.com> References: <1519264541-7621-1-git-send-email-linuxram@us.ibm.com> <1519264541-7621-16-git-send-email-linuxram@us.ibm.com> Message-ID: On 02/21/2018 05:55 PM, Ram Pai wrote: > #define PAGE_SIZE (0x1UL << 16) > -static inline int cpu_has_pku(void) > +static inline bool is_pkey_supported(void) > { > - return 1; > + /* > + * No simple way to determine this. > + * lets try allocating a key and see if it succeeds. > + */ > + int ret = sys_pkey_alloc(0, 0); > + > + if (ret > 0) { > + sys_pkey_free(ret); > + return true; > + } > + return false; > } The point of doing this was to have a test for the CPU that way separate from the syscalls. Can you leave cpu_has_pkeys() in place? -- To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: dave.hansen@intel.com (Dave Hansen) Date: Fri, 16 Mar 2018 15:26:09 -0700 Subject: [PATCH v12 15/22] selftests/vm: powerpc implementation to check support for pkey In-Reply-To: <1519264541-7621-16-git-send-email-linuxram@us.ibm.com> References: <1519264541-7621-1-git-send-email-linuxram@us.ibm.com> <1519264541-7621-16-git-send-email-linuxram@us.ibm.com> Message-ID: Content-Type: text/plain; charset="UTF-8" Message-ID: <20180316222609.T0xeOES_vwCOULAib1REJYZOzANbLVzMAXuGozTsK0Q@z> On 02/21/2018 05:55 PM, Ram Pai wrote: > #define PAGE_SIZE (0x1UL << 16) > -static inline int cpu_has_pku(void) > +static inline bool is_pkey_supported(void) > { > - return 1; > + /* > + * No simple way to determine this. > + * lets try allocating a key and see if it succeeds. > + */ > + int ret = sys_pkey_alloc(0, 0); > + > + if (ret > 0) { > + sys_pkey_free(ret); > + return true; > + } > + return false; > } The point of doing this was to have a test for the CPU that way separate from the syscalls. Can you leave cpu_has_pkeys() in place? -- To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html