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 03693C43457 for ; Wed, 14 Oct 2020 02:08:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7CD58221FF for ; Wed, 14 Oct 2020 02:08:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7CD58221FF 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 A45806B0062; Tue, 13 Oct 2020 22:08:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F4EB6B0068; Tue, 13 Oct 2020 22:08:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E3E36B006E; Tue, 13 Oct 2020 22:08:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0084.hostedemail.com [216.40.44.84]) by kanga.kvack.org (Postfix) with ESMTP id 5F2986B0062 for ; Tue, 13 Oct 2020 22:08:32 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id F2E4E181AEF07 for ; Wed, 14 Oct 2020 02:08:31 +0000 (UTC) X-FDA: 77368896864.29.girl05_5117ccf27208 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin29.hostedemail.com (Postfix) with ESMTP id C379B18086CDD for ; Wed, 14 Oct 2020 02:08:31 +0000 (UTC) X-HE-Tag: girl05_5117ccf27208 X-Filterd-Recvd-Size: 3628 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Wed, 14 Oct 2020 02:08:30 +0000 (UTC) IronPort-SDR: P6BZp1ffN44F2jbIJPQ3W8fmjmaUn/N1Ds7rptv9Xj9ceAu6Nbw07UR00pm25kL+07zDyBsmlw SvzMA2hq0eDw== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="166080578" X-IronPort-AV: E=Sophos;i="5.77,373,1596524400"; d="scan'208";a="166080578" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2020 19:08:27 -0700 IronPort-SDR: inQ4qbS0lmxsXC1fa/JBY45Zh6JLJm29uxHgtI4QzSetpkgZ6qu/XIxzj094gWeTQWPgLeSmUk brKTQAX3Hb1w== X-IronPort-AV: E=Sophos;i="5.77,373,1596524400"; d="scan'208";a="530644675" 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; 13 Oct 2020 19:08:26 -0700 Date: Tue, 13 Oct 2020 19:08:25 -0700 From: Ira Weiny To: Dave Hansen Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Peter Zijlstra , Fenghua Yu , Dan Williams , x86@kernel.org, Dave Hansen , 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 3/9] x86/pks: Enable Protection Keys Supervisor (PKS) Message-ID: <20201014020825.GM2046448@iweiny-DESK2.sc.intel.com> References: <20201009194258.3207172-1-ira.weiny@intel.com> <20201009194258.3207172-4-ira.weiny@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 11:23:08AM -0700, Dave Hansen wrote: > On 10/9/20 12:42 PM, ira.weiny@intel.com wrote: > > +/* > > + * PKS is independent of PKU and either or both may be supported on a CPU. > > + * Configure PKS if the cpu supports the feature. > > + */ > > Let's at least be consistent about CPU vs. cpu in a single comment. :) Sorry, done. > > > +static void setup_pks(void) > > +{ > > + if (!IS_ENABLED(CONFIG_ARCH_HAS_SUPERVISOR_PKEYS)) > > + return; > > + if (!cpu_feature_enabled(X86_FEATURE_PKS)) > > + return; > > If you put X86_FEATURE_PKS in disabled-features.h, you can get rid of > the explicit CONFIG_ check. Done. > > > + cr4_set_bits(X86_CR4_PKS); > > +} > > + > > /* > > * This does the hard work of actually picking apart the CPU stuff... > > */ > > @@ -1544,6 +1558,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) > > > > x86_init_rdrand(c); > > setup_pku(c); > > + setup_pks(); > > > > /* > > * Clear/Set all flags overridden by options, need do it > > diff --git a/mm/Kconfig b/mm/Kconfig > > index 6c974888f86f..1b9bc004d9bc 100644 > > --- a/mm/Kconfig > > +++ b/mm/Kconfig > > @@ -822,6 +822,8 @@ config ARCH_USES_HIGH_VMA_FLAGS > > bool > > config ARCH_HAS_PKEYS > > bool > > +config ARCH_HAS_SUPERVISOR_PKEYS > > + bool > > > > config PERCPU_STATS > > bool "Collect percpu memory statistics" > > >