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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 36297C71156 for ; Tue, 1 Dec 2020 22:35:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B1E8D208DB for ; Tue, 1 Dec 2020 22:35:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B1E8D208DB 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 BB71B8D0003; Tue, 1 Dec 2020 17:35:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B41AB8D0001; Tue, 1 Dec 2020 17:35:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A0A238D0003; Tue, 1 Dec 2020 17:35:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0137.hostedemail.com [216.40.44.137]) by kanga.kvack.org (Postfix) with ESMTP id 831408D0001 for ; Tue, 1 Dec 2020 17:35:42 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4F08B181AEF1A for ; Tue, 1 Dec 2020 22:35:42 +0000 (UTC) X-FDA: 77546171724.05.maid12_4616612273ae Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 28A461802E63B for ; Tue, 1 Dec 2020 22:35:42 +0000 (UTC) X-HE-Tag: maid12_4616612273ae X-Filterd-Recvd-Size: 4298 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Tue, 1 Dec 2020 22:35:40 +0000 (UTC) IronPort-SDR: pa7UNOdIYcoYfLf5+RBObWPDtIHbPGD2w6a3oanqymRSqy6fkfWSKtlymZhFb8MyZn4dwTk490 ueuHlL2/9Z9Q== X-IronPort-AV: E=McAfee;i="6000,8403,9822"; a="237047838" X-IronPort-AV: E=Sophos;i="5.78,385,1599548400"; d="scan'208";a="237047838" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2020 14:35:23 -0800 IronPort-SDR: gGWS34BVjbVpM4Uca8QWpPqLLyH3hOV2FpuAteOqq+yvG+kmvBOlnGPfBBytF1SEuTL/OtAik5 zNhntxWdRYwQ== X-IronPort-AV: E=Sophos;i="5.78,385,1599548400"; d="scan'208";a="537714613" Received: from yyu32-mobl1.amr.corp.intel.com (HELO [10.209.4.202]) ([10.209.4.202]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2020 14:35:20 -0800 Subject: Re: [PATCH v15 03/26] x86/fpu/xstate: Introduce CET MSR XSAVES supervisor states To: Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Borislav Petkov , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang , Pengfei Xu References: <20201110162211.9207-1-yu-cheng.yu@intel.com> <20201110162211.9207-4-yu-cheng.yu@intel.com> <3b83517e-17d6-3b53-6dbf-8ad727707b16@intel.com> <705fdfec-25a4-60bc-868e-af515c731273@intel.com> From: "Yu, Yu-cheng" Message-ID: <87f6309f-d5b4-a66f-99a1-d96a655290b6@intel.com> Date: Tue, 1 Dec 2020 14:35:18 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <705fdfec-25a4-60bc-868e-af515c731273@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable 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 12/1/2020 2:26 PM, Dave Hansen wrote: > On 11/30/20 3:16 PM, Yu, Yu-cheng wrote: >>> >>> Do we have any other spots in the kernel where we care about: >>> >>> =C2=A0=C2=A0=C2=A0=C2=A0boot_cpu_has(X86_FEATURE_SHSTK) || >>> =C2=A0=C2=A0=C2=A0=C2=A0boot_cpu_has(X86_FEATURE_IBT) >>> >>> ?=C2=A0 If so, we could also address this by declaring a software-def= ined >>> X86_FEATURE_CET and then setting it if SHSTK||IBT is supported, then = we >>> just put that one feature in xsave_cpuid_features[]. >>> >> >> These features have different CPUIDs but are complementary parts.=C2=A0= I >> don't know if someday there will be shadow-stack-only CPUs, but an >> IBT-only CPU is weird.=C2=A0 What if the kernel checks that the CPU ha= s both >> features and presents only one feature flag (X86_FEATURE_CET), no >> X86_FEATURE_SHSTK or X86_FEATURE_IBT? >=20 > Logically, that's probably fine. But, X86_FEATURE_IBT/SHSTK are in a > non-scattered leaf, so we'll kinda define them whether we like it or > not. We'd have to go out of our way to *not* define them. >=20 After more thoughts, I think it is better to just add X86_FEATURE_CET=20 and not more. We cannot predict what is going to happen later. So, like what you suggested, X86_FEATURE_CET means (X86_FEATURE_SHSTK |=20 X86_FEATURE_IBT). Thanks, Yu-cheng