[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z+yr8iOndr/WUOG4@intel.com>
Date: Wed, 2 Apr 2025 11:16:02 +0800
From: Chao Gao <chao.gao@...el.com>
To: "Chang S. Bae" <chang.seok.bae@...el.com>
CC: <x86@...nel.org>, <linux-kernel@...r.kernel.org>, <kvm@...r.kernel.org>,
<tglx@...utronix.de>, <dave.hansen@...el.com>, <seanjc@...gle.com>,
<pbonzini@...hat.com>, <peterz@...radead.org>, <rick.p.edgecombe@...el.com>,
<weijiang.yang@...el.com>, <john.allen@....com>, <bp@...en8.de>,
<xin3.li@...el.com>, Ingo Molnar <mingo@...hat.com>, Dave Hansen
<dave.hansen@...ux.intel.com>, "H. Peter Anvin" <hpa@...or.com>, "Maxim
Levitsky" <mlevitsk@...hat.com>, Mitchell Levy <levymitchell0@...il.com>,
Samuel Holland <samuel.holland@...ive.com>, Vignesh Balasubramanian
<vigbalas@....com>, Aruna Ramakrishna <aruna.ramakrishna@...cle.com>
Subject: Re: [PATCH v4 4/8] x86/fpu/xstate: Differentiate default features
for host and guest FPUs
On Tue, Apr 01, 2025 at 10:18:07AM -0700, Chang S. Bae wrote:
>On 3/18/2025 8:31 AM, Chao Gao wrote:
>>
>> @@ -807,9 +811,11 @@ void __init fpu__init_system_xstate(unsigned int legacy_size)
>> /* Clean out dynamic features from default */
>> fpu_kernel_cfg.default_features = fpu_kernel_cfg.max_features;
>> fpu_kernel_cfg.default_features &= ~XFEATURE_MASK_USER_DYNAMIC;
>> + fpu_kernel_cfg.guest_default_features = fpu_kernel_cfg.default_features;
>> fpu_user_cfg.default_features = fpu_user_cfg.max_features;
>> fpu_user_cfg.default_features &= ~XFEATURE_MASK_USER_DYNAMIC;
>> + fpu_user_cfg.guest_default_features = fpu_user_cfg.default_features;
>
>And you'll add up this on patch7:
>
> + /* Clean out guest-only features from default */
> + fpu_kernel_cfg.default_features &= ~XFEATURE_MASK_SUPERVISOR_GUEST;
>
>
>I'm not sure this overall hunk is entirely clear.
I agree that this hunk is unclear, and your version is much better.
>
>
>Taking a step back, we currently define three types of xfeature sets:
>
> 1. 'default_features' in a task-inlined buffer
> 2. 'max_features' in an extended buffer
> 3. 'independent_features' in a separate buffer (only for LBR)
>
>The VCPU fpstate has so far followed (1) and (2). Now, since we're
>introducing divergence at (1), you've named it guest_default_features:
>
> 'default_features' < 'guest_default_features' < 'max_features'
>
>I don’t see a strong reason against introducing this new field, as 'guest'
>already implies the VCPU state. However, rather than directly modifying or
>extending struct fpu_state_config — which may not align well with VCPU FPU
>properties — a dedicated struct could provide a cleaner and more structured
>alternative:
>
> struct vcpu_fpu_config {
> unsigned int size;
> unsigned int user_size;
> u64 features;
> u64 user_features;
> } guest_default_cfg;
Your suggestion looks good to me, and I can definitely incorporate the change
in the next version. Thanks a lot, Chang.
Powered by blists - more mailing lists