Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp882015rdb; Fri, 1 Dec 2023 00:37:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIgdmWsTgkvHcLdaTZtXfZk92t6aINcegeMJgTYGWTGuC0EFhnkPeWodVWt/y/P67rmq0X X-Received: by 2002:a05:6358:2783:b0:16d:f6c8:22fd with SMTP id l3-20020a056358278300b0016df6c822fdmr27161891rwb.29.1701419825933; Fri, 01 Dec 2023 00:37:05 -0800 (PST) Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id cm8-20020a056a020a0800b0058bc1c85714si3230639pgb.467.2023.12.01.00.37.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 00:37:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Uje+JAoo; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 2CF93835A6B4; Fri, 1 Dec 2023 00:37:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377909AbjLAIgs (ORCPT + 99 others); Fri, 1 Dec 2023 03:36:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377901AbjLAIgn (ORCPT ); Fri, 1 Dec 2023 03:36:43 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB7121734; Fri, 1 Dec 2023 00:36:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701419805; x=1732955805; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=MCgYLcYgkOax5YtbmCdjJgLnyCnJeNlAADAWrK5xm/U=; b=Uje+JAooEq8wykulTUBsiK5S6YS81tbpwEnpSO02rd5exuGH/rZfsYv1 XjanPqwPxUQJkqp4rLa5e5xGPCeiPpsHFI62BKSpoS2l5RpjCd23jzcco rboAmKnBbHfS0mIoYVBG19g1/OM/hxpMSAFXnBZYuJjT04XyZvtW5Jey1 PSh7bE6yD2eGLgXLc0Yd0cJtESLeoCKgYaxfboClGVXC/rsbdRtl+Z2IW wFkXCjwJmRJO3GJRb+LWDyFp5Pc8VJ2CqBvjEqLFgY3mVuGvk/9U6kH0B kSmuOkEj7wbwgseGy2jCz5npUSBmTOqROa3Qlgz8kXNVMbH/k9LvgMxIa Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10910"; a="383858789" X-IronPort-AV: E=Sophos;i="6.04,241,1695711600"; d="scan'208";a="383858789" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2023 00:36:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10910"; a="745921780" X-IronPort-AV: E=Sophos;i="6.04,241,1695711600"; d="scan'208";a="745921780" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga006.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 01 Dec 2023 00:36:36 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Fri, 1 Dec 2023 00:36:35 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34 via Frontend Transport; Fri, 1 Dec 2023 00:36:35 -0800 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.41) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Fri, 1 Dec 2023 00:36:35 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WB3zjnz89tYSXS/ZvxnZoMelfaQqEgUSrQYzCCPf/9208mn9WJzfGBKDjidy/voawvuylWcd+0gW781Q1HrulFIJsfBKTtK+3qSvtXMKahC3Okxct9B/JHawjyHAsz+6K4jiVn4Ar291/Z9EW0xJxAo8u66NxgXy7pZsCGwrFeH+b0zdhvzWkJfALaWzIRQ5h/AjOjs6oiptGoTtReKIu+AVOIYB+D/v6+i+gFMTBS2/KfIcNLvxbvq78KQ2qG0GY+XoL5QBE1xU0OMfTthgCgwU5dWMDnLRPvKInACumrjS/3uKlkSOcfooTQjaPep3Rx4CU7iy/mpOE4/KbgvdTw== 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=FimKDzaa/dqn+BsDlHORWANuL00hza7iwFGj4qIxFtI=; b=K4OLg90agjCPOAr6Gg9aMl1iNSteL5fMBkJso0CLUaE6/VUVKpxPlUT7BTBZIOPpUsdV4VzJ4is/mgngO09IHDN8gpbD4Cw+xtOGt4O+O4VddPRVCraU0in6oQu7rbaSNwhHcPpAxWVxunzzKUTylKdVumIjLj6OeHo6Ul/1ZGV4k6Lmdab7h7ZhpGb3XNYozQUOZLkqE9/7oMwTPPS1TlxAzkq31bv0UsinSMSufCTFM5J1fB8hss1vdC5fvbnpwSh6zlpOCxd6uTg3KPOMpcDiEtegH26F3e6faxCRLySPA9Z3QH0RjyRD8cCCNct+Ar7h13r/dDQn9//pPkASww== 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 DS7PR11MB7907.namprd11.prod.outlook.com (2603:10b6:8:db::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.27; Fri, 1 Dec 2023 08:36:33 +0000 Received: from PH0PR11MB4965.namprd11.prod.outlook.com ([fe80::ea04:122f:f20c:94e8]) by PH0PR11MB4965.namprd11.prod.outlook.com ([fe80::ea04:122f:f20c:94e8%2]) with mapi id 15.20.7046.027; Fri, 1 Dec 2023 08:36:33 +0000 Message-ID: <0112b446-ee7e-4b78-b3a4-671d3ba67299@intel.com> Date: Fri, 1 Dec 2023 16:36:23 +0800 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v7 06/26] x86/fpu/xstate: Create guest fpstate with guest specific config Content-Language: en-US To: Maxim Levitsky CC: , , , , , , , , References: <20231124055330.138870-1-weijiang.yang@intel.com> <20231124055330.138870-7-weijiang.yang@intel.com> From: "Yang, Weijiang" In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SGXP274CA0019.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::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_|DS7PR11MB7907:EE_ X-MS-Office365-Filtering-Correlation-Id: 11b98808-49c5-4894-b95c-08dbf2489f69 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: pIW9PHkNpjXwPlHm2c0J5+yrpkX6nm4Yfg2ps/wiU3KAkNskM0x7/DL4hRUP8oVRp4JPoZDcPYfv4o34LSTOnR2Kjx1FZxbGbrJBS0qG/lff6wBUI9+OokB/TbrwhKqv52nnzIvN3w19IW+XLVkGfDUZqnFyDSsfXHIx0hDUhbzLj2xRY48Mxf+eJejPa7McUmKMxZ0sJeLTh9yYLNSjZoowSdukuvaBME+aeoPvmXvyfhYF/vQWQyAX8x46BfM19wlrkkWJGvQ85iLkzKvQpZ9iKIh09Ggr9uAyXec8UQ4Zgv1kBcx48rUQBfMgpEKwVSkfujIa5OnZpejXc1qqREAlCqyuot3Hja+rNMTQF6oWCYTUX6yEVNoQYCUPjEtLJEM+IiMTh+ys4MGDN7gXYXaR4mPcvF4YQJ164zypHAge20fYRMErFWUGFVtBf3Pb2q8v10l/AnR70qDVUgxVva2z0GBFnXTHQeELCn0BGPARTJv0GrTTFE71RyrSWNfeQYEnbQLUOY7zvDm3wU78CyMMYVN0lDudniqhIkabOzgEnOYzZTIqnjs+u7+QYeoSgemhNwUZyojNp81q6OcP24UwT4PEbrh3RhTz8uIgp7CTwgPOdiMNXG/jlGLmTaRJmHv0RsTSIP++tQ6eSihSMw== 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)(39860400002)(346002)(366004)(136003)(396003)(376002)(230922051799003)(1800799012)(186009)(64100799003)(451199024)(2616005)(31686004)(8936002)(8676002)(86362001)(53546011)(6506007)(83380400001)(82960400001)(6512007)(4326008)(26005)(478600001)(6486002)(6666004)(66476007)(66946007)(66556008)(6916009)(316002)(2906002)(38100700002)(36756003)(41300700001)(31696002)(5660300002)(45980500001)(43740500002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?U0EvOGhOU2tEbG40OUZ0dnNRWEpyYkdlZ3Y4SFFackl0VU9ONTI0aVZvUDJp?= =?utf-8?B?U2ErV0Q1QnB2UWt3NEdDL1B3Q0pFMEYwUTNObVkvQXZhR3lack5LUXliTXlI?= =?utf-8?B?dG0rZGtLZjlnMkR2Q1JwOW13UFg1elJIa0Q5c1RPdzIyZWtFNVhxSlU0UHZj?= =?utf-8?B?RnNYZnJKTys5eWN2Z0dLdThLb0dleUlJcTRUcEdHRC9SWVZtemV2NnFhU3NC?= =?utf-8?B?Rlp4a3VJQ0Nwcmc0UmJqQlBHblhsV3JGa1NReVZrSUdCRlMxSHZrdWVnTHRy?= =?utf-8?B?NDVSYU96Z0llVzJNTXpJQmRQMW1DSlorMEZUY0tMSVRZWWE1UTNtalRjaTF3?= =?utf-8?B?S2UrYm03MUk3aVltMW82K2IycXViVjdpc1NLYXRLY3p0Zm5IdnM2bWV0SU1Y?= =?utf-8?B?SHllaTM2ejRUdHJQWkc5VWROUHVoaTRoalBJb3dTNnVQZTRIbG5ncGFOK2FB?= =?utf-8?B?d2NWMytqWWZrN2dTZC8yMzg0N3gvUjZab3loQ3hWVE9BQXV2YmFDYzZMcUl6?= =?utf-8?B?V3lOMEJBUUU3VkV6L0lxZG1pMkZBQ0dtR2lqOG9SK0ttVisrcUYyekswV2dl?= =?utf-8?B?a1hqYmQwT3BidlYyYzJDL0dINFNuMzV3ano1R3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NWUm8ycDd4WkhGTmZmZkFvMndMS1hISHQ1?= =?utf-8?B?Z2IrNHZuc05McTdwU3lKcWYvR3lVYU9KNTF1dURBR3pzdEJUSVB1T0hyVmZk?= =?utf-8?B?SXdJa004NTRZTWVHajV6Y2JnUmlNOUJnVmhaS3M3NHlwK0RITE5WRjRPck0x?= =?utf-8?B?ZDQvVWtqUzZ1SUFwTXgyd2hiYm5SZmxtbkJYMjVYK3pXcUtPbTV3SnpLalYz?= =?utf-8?B?Vk1melBpMkgwTDBRSWlyMjlWYnEwdHRUU2Y0REtjd2dHaHU5U3MvR1B2bGMy?= =?utf-8?B?RC9PbUxUSUR2YzVKcUQvc2QvUG5RMUdxMzJVUVpKUlB0dVdYbnh6ZDBXUXpu?= =?utf-8?B?ODJ2aFhuZDN3TVpJcDNaOUwxbVl4cmNBRTRDVUlGMExsZFlEbkg3YUFyREw5?= =?utf-8?B?bmQrQ1ZOQ3I3RFNQVVNRc2NCd0NxR0t3YlRKS3hlRWFHMm1iL2pPVzRwSW84?= =?utf-8?B?UEk1b3FLTGVReUJIMzdiVGoyWlp0TzIvdFdRR0pvclErQWZUcUcwdC9aeVFJ?= =?utf-8?B?VVR2ZmZCTlV1SnRvOWZBcGhjMGFTSW8wbHVxc0cyZnZrdW9INVl1NWlTMGFW?= =?utf-8?B?MktyK1laWDFSTmFGc2xXekR3QkEyY2pzVEx4aWhTVFNPd3ltQ0orK0VmYUJK?= =?utf-8?B?Y1E9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 11b98808-49c5-4894-b95c-08dbf2489f69 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB4965.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2023 08:36:33.6413 (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: ecfrUcTKwG3DBY2b5/b0x7X3pggVVxGx+xn0lxeMeWlq5I/pK4kO5TqKCnHVVvWoY/kP7HLMmLVIOK870RIk6g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR11MB7907 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Fri, 01 Dec 2023 00:37:02 -0800 (PST) On 12/1/2023 1:36 AM, Maxim Levitsky wrote: [...] >> + fpstate->user_size = fpu_user_cfg.default_size; >> + fpstate->user_xfeatures = fpu_user_cfg.default_features; > The whole thing makes my head spin like the good old CD/DVD writers used to .... > > So just to summarize this is what we have: > > > KERNEL FPU CONFIG > > /* > all known and CPU supported user and supervisor features except > - "dynamic" kernel features" (CET_S) > - "independent" kernel features (XFEATURE_LBR) > */ > fpu_kernel_cfg.max_features; > > /* > all known and CPU supported user and supervisor features except > - "dynamic" kernel features" (CET_S) > - "independent" kernel features (arch LBRs) > - "dynamic" userspace features (AMX state) > */ > fpu_kernel_cfg.default_features; > > > // size of compacted buffer with 'fpu_kernel_cfg.max_features' > fpu_kernel_cfg.max_size; > > > // size of compacted buffer with 'fpu_kernel_cfg.default_features' > fpu_kernel_cfg.default_size; > > > USER FPU CONFIG > > /* > all known and CPU supported user features > */ > fpu_user_cfg.max_features; > > /* > all known and CPU supported user features except > - "dynamic" userspace features (AMX state) > */ > fpu_user_cfg.default_features; > > // size of non compacted buffer with 'fpu_user_cfg.max_features' > fpu_user_cfg.max_size; > > // size of non compacted buffer with 'fpu_user_cfg.default_features' > fpu_user_cfg.default_size; > > > GUEST FPU CONFIG > /* > all known and CPU supported user and supervisor features except > - "independent" kernel features (XFEATURE_LBR) > */ > fpu_guest_cfg.max_features; > > /* > all known and CPU supported user and supervisor features except > - "independent" kernel features (arch LBRs) > - "dynamic" userspace features (AMX state) > */ > fpu_guest_cfg.default_features; > > // size of compacted buffer with 'fpu_guest_cfg.max_features' > fpu_guest_cfg.max_size; > > // size of compacted buffer with 'fpu_guest_cfg.default_features' > fpu_guest_cfg.default_size; Good suggestion! Thanks! how about adding them in patch 5 to make the summaries manifested? > --- > > > So in essence, guest FPU config is guest kernel fpu config and that is why > 'fpu_user_cfg.default_size' had to be used above. > > How about that we have fpu_guest_kernel_config and fpu_guest_user_config instead > to make the whole horrible thing maybe even more complicated but at least a bit more orthogonal? I think it becomes necessary when there were more guest user/kernel xfeaures requiring special handling like CET-S MSRs, then it looks much reasonable to split guest config into two, but now we only have one single outstanding xfeature for guest. IMHO, existing definitions still work with a few comments. But I really like your ideas of making things clean and tidy :-)