Re: [patch V4 part 1 35/36] x86: Replace ist_enter() with nmi_enter()

Mathieu Desnoyers
2020-05-14T00:12:40Z

----- On May 5, 2020, at 9:16 AM, Thomas Gleixner tglx@linutronix.de wrote:

> From: Peter Zijlstra <peterz@infradead.org>
>
> A few exceptions (like #DB and #BP) can happen at any location in the code,
> this then means that tracers should treat events from these exceptions as
> NMI-like. The interrupted context could be holding locks with interrupts
> disabled for instance.
>
> Similarly, #MC is an actual NMI-like exception.
>
> All of them use ist_enter() which only concerns itself with RCU, but does
> not do any of the other setup that NMIs need. This means things like:
>
> printk()
> raw_spin_lock_irq(&logbuf_lock);
> <#DB/#BP/#MC>
> printk()
> raw_spin_lock_irq(&logbuf_lock);
>
> are entirely possible (well, not really since printk tries hard to
> play nice, but the concept stands).
>
> So replace ist_enter() with nmi_enter(). Also observe that any nmi_enter()
> caller must be both notrace and NOKPROBE, or in the noinstr text section.

Are there similar issues with non-x86 architectures, or is this
exception-behaves-like-an-interrupt issue specific to x86 ?

Thanks,

Mathieu

--
Mathieu Desnoyers
EfficiOS Inc.