[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <jee4jnrwcpwukdibgwxts75wyevdj3kuog6qbutnd5jxtnhwqm@4yglpeq3bz3x>
Date: Wed, 23 Jul 2025 19:13:52 +0200
From: Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com>
To: "H. Peter Anvin" <hpa@...or.com>
CC: Borislav Petkov <bp@...en8.de>, Thomas Gleixner <tglx@...utronix.de>,
"Ingo Molnar" <mingo@...hat.com>, Dave Hansen <dave.hansen@...ux.intel.com>,
<x86@...nel.org>, "Kirill A. Shutemov" <kas@...nel.org>, Alexander Potapenko
<glider@...gle.com>, "Peter Zijlstra (Intel)" <peterz@...radead.org>, Xin Li
<xin3.li@...el.com>, Sai Praneeth <sai.praneeth.prakhya@...el.com>, "Jethro
Beekman" <jethro@...tanix.com>, Jarkko Sakkinen <jarkko@...nel.org>, "Sean
Christopherson" <seanjc@...gle.com>, Tony Luck <tony.luck@...el.com>,
"Fenghua Yu" <fenghua.yu@...el.com>, "Mike Rapoport (IBM)" <rppt@...nel.org>,
Kees Cook <kees@...nel.org>, Rick Edgecombe <rick.p.edgecombe@...el.com>,
Yu-cheng Yu <yu-cheng.yu@...el.com>, <stable@...r.kernel.org>, Borislav
Petkov <bp@...e.de>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] x86: Clear feature bits disabled at compile-time
On 2025-07-23 at 08:28:32 -0700, H. Peter Anvin wrote:
>On July 23, 2025 8:13:07 AM PDT, Maciej Wieczor-Retman <maciej.wieczor-retman@...el.com> wrote:
>>On 2025-07-23 at 15:46:40 +0200, Borislav Petkov wrote:
>>>On Wed, Jul 23, 2025 at 11:22:49AM +0200, Maciej Wieczor-Retman wrote:
>>>> +static __init void init_cpu_cap(struct cpuinfo_x86 *c)
>>>> +{
>>>> + int i;
>>>> +
>>>> + for (i = 0; i < NCAPINTS; i++) {
>>>> + cpu_caps_set[i] = REQUIRED_MASK(i);
>>>> + cpu_caps_cleared[i] = DISABLED_MASK(i);
>>>> + }
>>>> +}
>>>
>>>There's already apply_forced_caps(). Not another cap massaging function
>>>please. Add that stuff there.
>>
>>I'll try that, but can't it overwrite some things? apply_forced_caps() is called
>>three times and cpu_caps_set/cleared are modified in between from what I can
>>see. init_cpu_cap() was supposed to only initialize these arrays.
>>
>What are you concerned it would overwrite? I'm confused.
I thought that cpu_caps_set/cleared could change in-between apply_forced_caps()
calls. Therefore if we also applied the DISABLED_MASK() in every
apply_forced_caps() call I thought it might clear some flag that other function
might set.
But I've been looking at these calls for a while now and that doesn't seem
possible. Changes are made only if features are compiled, so it doesn't
interfere with the DISABLED_MASK().
Sorry for the confusion.
--
Kind regards
Maciej Wieczór-Retman
Powered by blists - more mailing lists