RE: [RFC PATCH 20/56] x86/bugs: Move bugs.c logic out of .init section

Kaplan, David
2025-10-16T13:46:02Z

[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Brendan Jackman <jackmanb@google.com>
> Sent: Thursday, October 16, 2025 7:32 AM
> To: Kaplan, David <David.Kaplan@amd.com>; Thomas Gleixner
> <tglx@linutronix.de>; Borislav Petkov <bp@alien8.de>; Peter Zijlstra
> <peterz@infradead.org>; Josh Poimboeuf <jpoimboe@kernel.org>; Pawan Gupta
> <pawan.kumar.gupta@linux.intel.com>; Ingo Molnar <mingo@redhat.com>; Dave
> Hansen <dave.hansen@linux.intel.com>; x86@kernel.org; H . Peter Anvin
> <hpa@zytor.com>
> Cc: Alexander Graf <graf@amazon.com>; Boris Ostrovsky
> <boris.ostrovsky@oracle.com>; linux-kernel@vger.kernel.org
> Subject: Re: [RFC PATCH 20/56] x86/bugs: Move bugs.c logic out of .init section
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Mon Oct 13, 2025 at 2:34 PM UTC, David Kaplan wrote:
> > If dynamic mitigations are supported, all the mitigation selection
> > functions and mitigation choices may change at runtime. Therefore, none of
> > the functions may exist in .init and the data must not be read-only.
>
> I suppose we should have something akin to
> __meminit/__init_or_module/__net_init here (like __init, but conditional
> on Kconfig), so that users with CONFIG_DYNAMIC_MITIGATIONS=n can still
> get the RAM back?

Yeah, that's an option (maybe like __bugs_init). Initial feedback I got was just to remove them from .init since they're now sometimes used later, but we could create a separate attribute tag. Similar for the __ro_after_init ones.

Thanks
--David Kaplan