[PATCH] x86/bugs: Explicitly clear speculative MSR bits

Breno Leitao leitao at debian.org
Tue Nov 22 07:55:36 PST 2022


On Mon, Nov 21, 2022 at 02:20:31PM -0800, Pawan Gupta wrote:
> On Sun, Nov 20, 2022 at 12:02:55PM +0000, Breno Leitao wrote:
...
> > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> > index 3e3230cccaa7..970b277d02a6 100644
> > --- a/arch/x86/kernel/cpu/bugs.c
> > +++ b/arch/x86/kernel/cpu/bugs.c
> > @@ -137,8 +137,16 @@ void __init check_bugs(void)
> > 	 * have unknown values. AMD64_LS_CFG MSR is cached in the early AMD
> > 	 * init code as it is not enumerated and depends on the family.
> > 	 */
> > -	if (boot_cpu_has(X86_FEATURE_MSR_SPEC_CTRL))
> > +	if (boot_cpu_has(X86_FEATURE_MSR_SPEC_CTRL)) {
> > 		rdmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);
> > +		/*
> > +		 * Previously running software may have some controls turned ON.
> > +		 * Clear them and let kernel decide which controls to use.
> > +		 */
> > +		x86_spec_ctrl_base &= ~SPEC_CTRL_MASK;
> > +		wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);
> > +	}
> > +
> 
> Nit, extra newline.

Thanks. If no other comment about the diff come until tomorrow, I will
send a v2 without this extra line.



More information about the kexec mailing list