Re: [patch v3 4/7] x86/smp: Use dedicated cache-line for mwait_play_dead()

From: Borislav Petkov
Date: Tue Jun 20 2023 - 05:02:28 EST


On Thu, Jun 15, 2023 at 10:33:55PM +0200, Thomas Gleixner wrote:
> Monitoring idletask::thread_info::flags in mwait_play_dead() has been an
> obvious choice as all what is needed is a cache line which is not written
> by other CPUs.
>
> But there is a use case where a "dead" CPU needs to be brought out of that
> mwait(): kexec().

s/mwait()/wait state/

I guess.

> The CPU needs to be brought out of mwait before kexec() as kexec() can

Ditto.

> overwrite text, pagetables, stacks and the monitored cacheline of the
> original kernel.

Yikes.

> The latter causes mwait to resume execution which
> obviously causes havoc on the kexec kernel which results usually in triple
> faults.

This sounds like a stable fix, no?

Reviewed-by: Borislav Petkov (AMD) <bp@xxxxxxxxx>

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette