Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp299598pxu; Wed, 14 Oct 2020 01:23:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOZnAZi9inyaalxzDt4kB6tcT/Pnu7matZdgtjY2P6aFhh43nwg/JbRqcuR6DkMEhVHgG5 X-Received: by 2002:a17:906:4b18:: with SMTP id y24mr4222684eju.416.1602663789917; Wed, 14 Oct 2020 01:23:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602663789; cv=none; d=google.com; s=arc-20160816; b=XX5DGtnDotuWVXn6kUjjeX0EmKNTBrSCy4a3naTvf8jsU4nc9OznPnZli8OtCRIlkG czFI/fuCNPmnDJuJZr/XUvw2fE5m4NThhhM6MjqPevof0vMGPDBJYCVK+l0EDCsR28FP Ml6ear95u+EcHKxm2wtfI0nQwHIDgVZF0/1EasiTYo/EPl0bqne7ZgrMLhTqKE5YDZcD uRE0SLiP1jBhH4g+FnDJ7hz17AbpIOS2UB2p4DN7azgotdBVxOWHiTPM7lVjE6+DUnnw WSTyhPOAZ7l+fyAyWE4LIKDycf+48HYxcgSncsucCVVi1rye7YZ3Ht4+NG3dyotlBxGP lHJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=p8i9BB6rICw8oQHZgPnpXr515x3Htc0PGzG7EXs03ZU=; b=l3jayl59X4asL0WWpGiyXywwDQ78RU4WZJTBFsBiEjRveqrRwTb2lfBQFzxOiV2rVC rmQ8vy86nDcK41xQ/7iGKkTqsznH4igAjjdBIQRqbBt4CmV7IV4TN5r3JnY1ZXD5vozI sMUSY5jrbzCIrOAX2Nn5g6rFZvhRlGQJ8zLNAliZZGOfJhN5WCEWNhUXYJ7on2rYSkhi goZnNqaf2lS/jWiYQ4kfNZVJXyfxpG0KUBo1eYC4M/twni1BbvHnltxnMhaUXmbV2rDF IYKCLJcjy8s1BMAkYeEu8Ee745oSUpBbZ3g7yf3l6Uqs63LFF5kc/U/o4cxP6cf1xtyZ DDBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k22si1701728ejq.706.2020.10.14.01.22.47; Wed, 14 Oct 2020 01:23:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728827AbgJNCI3 (ORCPT + 99 others); Tue, 13 Oct 2020 22:08:29 -0400 Received: from mga17.intel.com ([192.55.52.151]:22912 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725874AbgJNCI3 (ORCPT ); Tue, 13 Oct 2020 22:08:29 -0400 IronPort-SDR: yBPi+WL7a4DNdUvyrh1MJhTW+GyOOMVGIX1S38Tc37EzWAxgs4WvuDTApBhoYjxT5xoHjKRQD/ ifcKXwlt0QhQ== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="145879786" X-IronPort-AV: E=Sophos;i="5.77,373,1596524400"; d="scan'208";a="145879786" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga107.fm.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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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" > > >