RE: [RFC PATCH 53/56] drivers/cpu: Re-patch mitigations through sysfs

Kaplan, David
2025-10-27T13:59:47Z

[AMD Official Use Only - AMD Internal Distribution Only]

> -----Original Message-----
> From: Nikolay Borisov <nik.borisov@suse.com>
> Sent: Monday, October 27, 2025 7:25 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 53/56] drivers/cpu: Re-patch mitigations through sysfs
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On 10/13/25 17:34, David Kaplan wrote:
> > Create a new file at /sys/devices/system/cpu/mitigations that prints the
> > current set of mitigation options and can be written to in order to
> > re-select mitigations.
> >
> > Only options related to mitigations are handled, with the file initially
> > returning the relevant options from the command line. When the file is
> > written, any existing selections are discarded and the new options are
> > evaluated.
> >
> > Signed-off-by: David Kaplan <david.kaplan@amd.com>
> > ---
> > .../ABI/testing/sysfs-devices-system-cpu | 8 ++
> > drivers/base/cpu.c | 113 ++++++++++++++++++
> > include/linux/cpu.h | 3 +
> > 3 files changed, 124 insertions(+)
> >
>
> <snip>
>
> > +
> > +ssize_t cpu_show_mitigation_options(struct device *dev, struct device_attribute
> *attr, char *buf);
> > +ssize_t cpu_show_mitigation_options(struct device *dev, struct device_attribute
> *attr, char *buf)
>
> Make it static
>
> > +{
> > + return sysfs_emit(buf, saved_opts);
> > +}
> > +
> > +ssize_t cpu_write_mitigation_options(struct device *dev,
> > + struct device_attribute *attr,
> > + const char *buf, size_t count);
> > +
> > +void __weak cpu_prepare_repatch_alternatives(void)
> > +{
> > +}
> > +
> > +void __weak cpu_update_alternatives(void)
> > +{
> > +}
> > +
> > +void __weak cpu_select_mitigations(void)
> > +{
> > +}
> > +
> > +ssize_t cpu_write_mitigation_options(struct device *dev,
> > + struct device_attribute *attr,
> > + const char *buf, size_t count)
> Ditto
>
> <snip>

Ack, thanks

--David Kaplan