Re: [PATCH v3 1/3] x86/idle: Disable IBRS when cpu is offline

From: Josh Poimboeuf
Date: Thu Jun 22 2023 - 01:41:02 EST


On Wed, Jun 21, 2023 at 08:36:01PM -0400, Waiman Long wrote:
> +/*
> + * naitve_play_dead() is essentially a __noreturn function, but it can't
> + * be marked as such as the compiler may complain about it.
> + */

FWIW, we could in theory do so by marking the smp_ops.play_dead function
pointer as __noreturn, but it would be tricky to teach objtool how to
understand that.

> void native_play_dead(void)
> {
> + if (cpu_feature_enabled(X86_FEATURE_KERNEL_IBRS)) {
> + this_cpu_write(x86_spec_ctrl_current, 0);
> + native_wrmsrl(MSR_IA32_SPEC_CTRL, 0);
> + }

Can update_spec_ctrl() be used instead?

--
Josh