From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02594C04EBE for ; Thu, 15 Oct 2020 04:46:39 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5F47A22257 for ; Thu, 15 Oct 2020 04:46:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5F47A22257 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 32FF26B0062; Thu, 15 Oct 2020 00:46:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B86C6B0068; Thu, 15 Oct 2020 00:46:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1810E6B006E; Thu, 15 Oct 2020 00:46:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id DCB826B0062 for ; Thu, 15 Oct 2020 00:46:36 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6E26B8249980 for ; Thu, 15 Oct 2020 04:46:36 +0000 (UTC) X-FDA: 77372923992.15.bike96_4510c9627211 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 47F121814B0C1 for ; Thu, 15 Oct 2020 04:46:36 +0000 (UTC) X-HE-Tag: bike96_4510c9627211 X-Filterd-Recvd-Size: 5206 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf47.hostedemail.com (Postfix) with ESMTP for ; Thu, 15 Oct 2020 04:46:34 +0000 (UTC) IronPort-SDR: JuldFwFfUEAIEIDeSzQI/6BH7rV7hfucOqwDaquTfgJHSYWLKsHlh3XE4jwpoadiX3kERSISTf izbIP55Bk2vQ== X-IronPort-AV: E=McAfee;i="6000,8403,9774"; a="163629357" X-IronPort-AV: E=Sophos;i="5.77,377,1596524400"; d="scan'208";a="163629357" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 21:46:33 -0700 IronPort-SDR: okZevJNyFoB0pDRj0graDCFAGBe85RU4H4aY8F5klmxXZx1X/fo3dQRhH8k0J0Lzctn9GCjeCZ aeWfHIgGHVcw== X-IronPort-AV: E=Sophos;i="5.77,377,1596524400"; d="scan'208";a="531105799" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 21:46:32 -0700 Date: Wed, 14 Oct 2020 21:46:32 -0700 From: Ira Weiny To: Dave Hansen Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Peter Zijlstra , Fenghua Yu , x86@kernel.org, Dave Hansen , Dan Williams , Andrew Morton , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH RFC V3 9/9] x86/pks: Add PKS test code Message-ID: <20201015044632.GT2046448@iweiny-DESK2.sc.intel.com> References: <20201009194258.3207172-1-ira.weiny@intel.com> <20201009194258.3207172-10-ira.weiny@intel.com> <3f9ebe3b-5c1c-6a69-3779-6f90d66227bd@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3f9ebe3b-5c1c-6a69-3779-6f90d66227bd@intel.com> User-Agent: Mutt/1.11.1 (2018-12-01) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Oct 13, 2020 at 12:02:07PM -0700, Dave Hansen wrote: > On 10/9/20 12:42 PM, ira.weiny@intel.com wrote: > > #ifdef CONFIG_X86_32 > > /* > > * We can fault-in kernel-space virtual memory on-demand. The > > diff --git a/include/linux/pkeys.h b/include/linux/pkeys.h > > index cc3510cde64e..f9552bd9341f 100644 > > --- a/include/linux/pkeys.h > > +++ b/include/linux/pkeys.h > > @@ -47,7 +47,6 @@ static inline bool arch_pkeys_enabled(void) > > static inline void copy_init_pkru_to_fpregs(void) > > { > > } > > - > > #endif /* ! CONFIG_ARCH_HAS_PKEYS */ > > ^ Whitespace damage Done. > > > #ifndef CONFIG_ARCH_HAS_SUPERVISOR_PKEYS > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > > index 0c781f912f9f..f015c09ba5a1 100644 > > --- a/lib/Kconfig.debug > > +++ b/lib/Kconfig.debug > > @@ -2400,6 +2400,18 @@ config HYPERV_TESTING > > help > > Select this option to enable Hyper-V vmbus testing. > > > > +config PKS_TESTING > > + bool "PKey(S)upervisor testing" > > Seems like we need a space in there somewhere. heheh... yea... > > > + pid = fork(); > > + if (pid == 0) { > > + fd = open("/sys/kernel/debug/x86/run_pks", O_RDWR); > > + if (fd < 0) { > > + printf("cannot open file\n"); > > + return -1; > > + } > > + > > Will this return code make anybody mad? Should we have a nicer return > code for when this is running on non-PKS hardware? I'm not sure it will matter much but I think it is better to report the missing file.[1] > > I'm not going to be too picky about this. I'll just ask one question: > Has this found real bugs for you? Many, especially regressions as things have changed. > > Reviewed-by: Dave Hansen > Thanks, Ira [1] diff --git a/tools/testing/selftests/x86/test_pks.c b/tools/testing/selftests/x86/test_pks.c index 8037a2a9ff5f..11be4e212d54 100644 --- a/tools/testing/selftests/x86/test_pks.c +++ b/tools/testing/selftests/x86/test_pks.c @@ -11,6 +11,8 @@ #include #include +#define PKS_TEST_FILE "/sys/kernel/debug/x86/run_pks" + int main(void) { cpu_set_t cpuset; @@ -25,9 +27,9 @@ int main(void) pid = fork(); if (pid == 0) { - fd = open("/sys/kernel/debug/x86/run_pks", O_RDWR); + fd = open(PKS_TEST_FILE, O_RDWR); if (fd < 0) { - printf("cannot open file\n"); + printf("cannot open %s\n", PKS_TEST_FILE); return -1; } @@ -45,9 +47,9 @@ int main(void) } else { sleep(2); - fd = open("/sys/kernel/debug/x86/run_pks", O_RDWR); + fd = open(PKS_TEST_FILE, O_RDWR); if (fd < 0) { - printf("cannot open file\n"); + printf("cannot open %s\n", PKS_TEST_FILE); return -1; }