[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <62ff5c86-a63a-46f2-88f8-6c1589433a89@intel.com>
Date: Wed, 13 Dec 2023 09:01:35 -0800
From: "Chang S. Bae" <chang.seok.bae@...el.com>
To: "Yang, Weijiang" <weijiang.yang@...el.com>,
Maxim Levitsky <mlevitsk@...hat.com>
CC: <linux-kernel@...r.kernel.org>, <kvm@...r.kernel.org>,
<dave.hansen@...el.com>, <pbonzini@...hat.com>,
<seanjc@...gle.com>, <peterz@...radead.org>, <chao.gao@...el.com>,
<rick.p.edgecombe@...el.com>, <john.allen@....com>
Subject: Re: [PATCH v7 02/26] x86/fpu/xstate: Refine CET user xstate bit
enabling
On 12/13/2023 1:30 AM, Yang, Weijiang wrote:
>
> Let me involve Chang, the author of the code in question.
>
> Hi, Chang,
> In commit 70c3f1671b0c ("x86/fpu/xstate: Prepare XSAVE feature table for
> gaps in state component numbers"),
> you modified the loop as below:
> for (i = 0; i < ARRAY_SIZE(xsave_cpuid_features); i++) {
> - if (!boot_cpu_has(xsave_cpuid_features[i]))
> + unsigned short cid = xsave_cpuid_features[i];
> +
> + /* Careful: X86_FEATURE_FPU is 0! */
> + if ((i != XFEATURE_FP && !cid) || !boot_cpu_has(cid))
> fpu_kernel_cfg.max_features &= ~BIT_ULL(i);
> }
>
> IMHO the change resulted functional change of the loop, i.e., before
> that only it only clears the bits without CPUIDs,
> but after the change, the side-effect of the loop will clear the bits of
> blank entries ( where xsave_cpuid_features[i] == 0 )
> since the loop hits (i != XFEATURE_FP && !cid), is it intended or
> something else?
The code was considered as much *simpler* than the other [1]. Yes, it
clears those not listed in the table but they were either non-existed or
disabled at that moment.
Thanks,
Chang
[1] https://lore.kernel.org/lkml/87y2eha576.fsf@nanos.tec.linutronix.de/
Powered by blists - more mailing lists