[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240506080156.GBZjiOdHjn-NdmbnTw@fat_crate.local>
Date: Mon, 6 May 2024 10:01:56 +0200
From: Borislav Petkov <bp@...en8.de>
To: Oliver Sang <oliver.sang@...el.com>
Cc: Sean Christopherson <seanjc@...gle.com>, oe-lkp@...ts.linux.dev,
lkp@...el.com, linux-kernel@...r.kernel.org, x86@...nel.org,
Ingo Molnar <mingo@...nel.org>, Srikanth Aithal <sraithal@....com>
Subject: Re: [tip:x86/alternatives] [x86/alternatives] ee8962082a:
WARNING:at_arch/x86/kernel/cpu/cpuid-deps.c:#do_clear_cpu_cap
On Mon, May 06, 2024 at 09:39:03AM +0200, Borislav Petkov wrote:
> On Mon, May 06, 2024 at 03:09:27PM +0800, Oliver Sang wrote:
> > we confirmed after applying them upon ee8962082a, the WARNING which was reported
> > in our original report cannot be reproduced any longer.
> >
> > Tested-by: kernel test robot <oliver.sang@...el.com>
>
> Thanks a lot for testing - much appreciated.
Hm, ok, after looking at this more, I think I'm going to go with patch
2 only.
And patch 1 is wrong. At least for now, lemme explain:
So before it, we'd do
if (boot_cpu_has(feature))
WARN_ON(alternatives_patched);
when clearing feature flags, meaning: if the flag is set on the BSP,
that means, alternatives have patched already and we're clearing
potentially on another CPU and it'll warn because it will be wrong.
If we do:
if (c && cpu_has(c, feature))
WARN_ON(alternatives_patched);
then it would warn on *every* CPU but it doesn't need to *BECAUSE* the
alternatives patching is controlled by the boot_cpu_data checks for the
BSP - not the AP ones.
So if the BSP doesn't have the feature, we can just as well clear it on
the APs as it wouldn't have any effect on conditionals further on.
Otherwise, we'll have to go and move every clear_cpu_cap() call after
alternatives have patched to before that, which would be insane.
I mean, we'll do that eventually but can't now.
Lemme write that as a comment in the function so that we don't forget.
Oh boy, I love our feature flags infra. :-\
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists