Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4693902rdb; Fri, 15 Sep 2023 09:26:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGiT0DLPuGbzo0mTrMluhJ9Vyg8NEJRF0IVh8U9hirah7uWntLjf9hkY+57xjnngxBK11bh X-Received: by 2002:a05:6358:898:b0:135:499a:382b with SMTP id m24-20020a056358089800b00135499a382bmr2905824rwj.7.1694795197836; Fri, 15 Sep 2023 09:26:37 -0700 (PDT) Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id z16-20020a656650000000b00577723d24b0si565276pgv.46.2023.09.15.09.26.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 09:26:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=es52aVU0; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 9A29982A1F72; Thu, 14 Sep 2023 23:42:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232335AbjIOGmg (ORCPT + 99 others); Fri, 15 Sep 2023 02:42:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231997AbjIOGmf (ORCPT ); Fri, 15 Sep 2023 02:42:35 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69A2DCCD; Thu, 14 Sep 2023 23:42:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694760150; x=1726296150; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=fbFNWoG87CkGWumd9CDqbSMn/0iKQi7CjuLIhO+Im/E=; b=es52aVU0LG0ucCMRCENe0LtWdPSEzX9yrpAXhrHNb28TS3xNFaDSlt9l MIc8BmUbhBP8u5h/hPbyQf/Z3UYd0VLP5P44oAWvKlhAQR5iN+MCO5c9V hL47nun431j75CY472Aakmf2Yjqa7JVYg+9sNf2Wa+zw18kRKEGCoHlyH NUsUG17C8WOb/ONtb1x6XR3DEsy2Vd2z6tO87U6irWqw7zY7RSfegoP8f toReJMs6puUJHkdIfMjQVwZp3GEtr777Dw+hfyuVCFg2G3vaewobfBiLF w6SGJQ7nIR6EDLUnv53++haeybuXCRJgT2HUWVQzcBJMxP/fUXh85HI4b w==; X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="358587939" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="358587939" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2023 23:42:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10833"; a="888120142" X-IronPort-AV: E=Sophos;i="6.02,148,1688454000"; d="scan'208";a="888120142" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 14 Sep 2023 23:41:55 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 14 Sep 2023 23:42:29 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Thu, 14 Sep 2023 23:42:29 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32 via Frontend Transport; Thu, 14 Sep 2023 23:42:29 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.168) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.32; Thu, 14 Sep 2023 23:42:28 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eO8doeMnvrohxbgQKErjQ+Rg0RcFHONa6/lcRHsvZpq2P8jHulP8rPPY9M3rNa4/WJpP/z9CJSq6D0K/p2mF70zVeb0wRnViW41pAKv/1yriPsoaMF8i/GXLv8BKyJqsvhbGqc8Opuaqj6UO8/DVsmCFSG2lYZqSEu7MzNDNSH/Tiqe9Gb49i1rkF7aZn3fo6/7yy7iLdPIEaQC4ebPx9kH5b9dtPZJS96Mgb8OuDs5k7OziY544Ubyw3AOx35kgIEiba9f27HLSsWvkJ31EhDz9X1r/R34cd8b9MNdFT+nGRaF2K+XIvabGdIEEQ3HYJ54ltV5U/XAcAnP0RWIQqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fbFNWoG87CkGWumd9CDqbSMn/0iKQi7CjuLIhO+Im/E=; b=HqEcHopX5g7KOWL+fwXw5h2GNkd8dxWOk99Olh4opTRHmxue3d5IAGUBjmlM9P0A6+IiSfwCOy4KXNiQgVzArPHBsudkG38+2LYXj8VqyHvlz8AUncNGEZGiztvfvUFha5h2MVQvI8olPqAefCc73R1zpOVcdkZkzqaQiLgjYDD2AE8zZ42Hvx6EIgE2IL92yH37ddQyIFRDAKs5QwaMX8cNRvQydHY93vRSQaMzLSkwMklaIK7U1NhrzpJwsidY/IpPq6lqi0cadr/8TXFeYO67aZL+0qF80nMTvxOq6IpHCgUcdjPIKu5vI/uOlIzshdN6/aRNYj+JyZOwEgU3wA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB4965.namprd11.prod.outlook.com (2603:10b6:510:34::7) by LV8PR11MB8557.namprd11.prod.outlook.com (2603:10b6:408:1e8::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.38; Fri, 15 Sep 2023 06:42:26 +0000 Received: from PH0PR11MB4965.namprd11.prod.outlook.com ([fe80::a64d:9793:1235:dd90]) by PH0PR11MB4965.namprd11.prod.outlook.com ([fe80::a64d:9793:1235:dd90%7]) with mapi id 15.20.6792.021; Fri, 15 Sep 2023 06:42:26 +0000 Message-ID: Date: Fri, 15 Sep 2023 14:42:15 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [PATCH v6 04/25] x86/fpu/xstate: Introduce kernel dynamic xfeature set Content-Language: en-US To: "Edgecombe, Rick P" , "kvm@vger.kernel.org" , "pbonzini@redhat.com" , "Christopherson,, Sean" , "linux-kernel@vger.kernel.org" CC: "peterz@infradead.org" , "Hansen, Dave" , "Gao, Chao" , "john.allen@amd.com" References: <20230914063325.85503-1-weijiang.yang@intel.com> <20230914063325.85503-5-weijiang.yang@intel.com> From: "Yang, Weijiang" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR04CA0193.apcprd04.prod.outlook.com (2603:1096:4:14::31) To PH0PR11MB4965.namprd11.prod.outlook.com (2603:10b6:510:34::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR11MB4965:EE_|LV8PR11MB8557:EE_ X-MS-Office365-Filtering-Correlation-Id: 81c2d9e1-f3d3-4915-e885-08dbb5b6ec71 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XLD0qlVK6tIJg2K+a2vQocSYvusiqI4XzbrqRpWu/9ufm6Q4hCzW5M34w2ErOxLmWLKeXRP/26aHV6D5P4MCtW0BtY/ujmzLre1u/dAKtWLjaVxBzArIHC77CuefTM2thA4+Q6nWZUECchvLJcee7UpqSpMa4OFp/3uzPUa1g1TJJ7ML6BMEjzC986Mi3Pfegc36O14/HFtuPxlb2a2UhSkXi9MxBWfXvZmjCJoHicLFrNAk1OdgGQFwTCsgQNS2W47EPYA/NgogxMJ1a5EqbXjJzocV2x5syYyh4/6k58lh5g3SgyBlNx/p+YkiHhVyjQBClnsMv5EhOBLXddHQpdazbN0V2ReB3WIHXvTP6qQHAFTGe6ePUCGeu3U4lj0nlFhY90dZKY8Mp6wr7v9xxDcpeJenNMadrvboA55Hz8asLWyOe3jYOwGWTzdliusMfodZ7i2tG/OMu1hEnkyPBH07qzCcagGni6XKBnkTG1QMLNejAazG69fnxId4G9HdfmLb/DVjVCj1oCcuyvB1XfAiIIevabJNi6RGm1VJrPwniIR3A4VtKWBYtPQuNVKvI65gAluVJlp/X3BoqK3V6+SEftpRyLeFQ9GgbOL6oDRZYMzVF/Bzu6PKndo1Ei37c7F/nDIs4wlAN4sTpAy75w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB4965.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(346002)(376002)(136003)(396003)(39860400002)(451199024)(1800799009)(186009)(2906002)(4744005)(5660300002)(478600001)(6506007)(6486002)(53546011)(6666004)(4326008)(66946007)(66476007)(8936002)(41300700001)(66556008)(8676002)(54906003)(110136005)(316002)(31696002)(86362001)(36756003)(26005)(6512007)(2616005)(38100700002)(82960400001)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?eVJLWkJwcHBxWnNlL2lnYnlWd1lwdjMyVlhiMFJwaWlkY2JIQVFtTXE1SUpI?= =?utf-8?B?Ti9seWpMMmc1bnMyb3hyV1ZJVWZhdG5oeWRUakd1clkyVHpZZzVLK21UNmpH?= =?utf-8?B?bmNQeFFKUTg1VzFYcnpRTFZEakUySFJ3TXBDbGszK3Y5Q3NNK214bFJvL0Yz?= =?utf-8?B?Zncvb1VaanE0WFBBTUhCNGI4YVM3cjN2cTYrL0NTaWUxaytxT2J4UXIvckZN?= =?utf-8?B?amhvVndpdllSRk9RclVvbUF2Zk55dmVtM1V1ZVNvMkdBZFZYcUd1TkYrQVpT?= =?utf-8?B?NWZvcGQxeEVGZXk1Tk1rZTZkYTJERHg2NkFLYVhrc0JnVERuc3VqaXBHR1Nr?= =?utf-8?B?R2tCSUd4c29DbDZpcHd0ME02K2dMaGFQWVBUajEzdzk2WHFJYkM1MWdhMXFH?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id: 81c2d9e1-f3d3-4915-e885-08dbb5b6ec71 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB4965.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 06:42:26.2103 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WqQlq7Izv0i5k4MinmHQr5zf6VohC4jbHaUZje4acsBSelE5VSs6WMWA7ubTf6DWasBOMAhFi9G8F1wyXvWykg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR11MB8557 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 14 Sep 2023 23:42:43 -0700 (PDT) On 9/15/2023 8:24 AM, Edgecombe, Rick P wrote: > On Thu, 2023-09-14 at 02:33 -0400, Yang Weijiang wrote: >> +static void __init init_kernel_dynamic_xfeatures(void) >> +{ >> +       unsigned short cid; >> +       int i; >> + >> +       for (i = 0; i < ARRAY_SIZE(xsave_kernel_dynamic_xfeatures); >> i++) { >> +               cid = xsave_kernel_dynamic_xfeatures[i]; >> + >> +               if (cid && boot_cpu_has(cid)) >> +                       fpu_kernel_dynamic_xfeatures |= BIT_ULL(i); >> +       } >> +} >> + > I think this can be part of the max_features calculation that uses > xsave_cpuid_features when you use use a fixed mask like Dave suggested > in the other patch. Yes, the max_features has already included CET supervisor state bit. After  use fixed mask, this function is not needed.