Re: [RFC] #MC mess

From: Steven Rostedt
Date: Tue Feb 18 2020 - 15:09:00 EST


On Tue, 18 Feb 2020 20:50:35 +0100
Borislav Petkov <bp@xxxxxxxxx> wrote:

> True story, thanks for that hint!
>
> static_key_disable()
> |-> cpus_read_lock()
> |-> percpu_down_read(&cpu_hotplug_lock)
> |->might_sleep()
>
> Yuck. Which means, the #MC handler must switch to __rdmsr()/__wrmsr()
> now.
>
> I wish I could travel back in time and NAK the hell of that MSR
> tracepoint crap.

Can we create a per_cpu variable that gets set when we enter the MC
handler, and not call the msr trace points when that is set?

Now, is jump labels bad in these cases (note, it is possible to trigger
a breakpoint in them, does an iret disable the MC as well, which means
we could get nested MC handlers corrupting the IST stack?).

You could have the msr_tracepoint_active() check this per cpu variable?

msr reading and writing is rather slow, and I'm sure reading a per_cpu
variable is going to be in the noise of it.

-- Steve