On Jun 12, 2020, at 2:01 AM, Thomas Gleixner tglx@linutronix.de wrote:
Andy Lutomirski luto@kernel.org writes:
On Thu, Jun 11, 2020 at 4:22 PM Andy Lutomirski luto@kernel.org wrote:
Two bugs here.
- We had an issue with WARN. Patch sent.
Grabbed it
- idtentry.h has, for x86_32:
# define DEFINE_IDTENTRY_IST DEFINE_IDTENTRY
This is nonsense. It's getting late over here and I'd rather focus on the more interesting RCU issue, so that's all from me today.
Well, this might be nonsense, but it's exactly matching the current code in mainline which, e.g. for #DB does:
SYM_CODE_START(debug) /* * Entry from sysenter is now handled in common_exception */ ASM_CLAC pushl $0 pushl $do_debug jmp common_exception SYM_CODE_END(debug)
There is no IST on 32bit, never was. We do software stack switching for device interrupts, but that's a different story.
DEFINE_IDTENTRY does the idtentry_enter_cond_rcu() dance, which isn’t intended to be safe from NMI context. It should probably map to DEFINE_IDTENTRY_RAW() instead. The specific issue is that NMI ends up there, and at least DEFINE_IDTENTRY_NMI should be raw.
I haven’t tried this at all, nor have I dug through all the users of these macros to check what they expect. Perhaps we should not have the _IST one defined at all on 32 bit and rename it to DEFINE_IDTENTRY_IST_RAW on 64 bit to make it more clear what’s going on when reading the C code.
Or maybe I’m too sleepy and I’m nuts. But I don’t think I am.
Thanks,
tglx