[PATCH v4 0/5] x86: Rework IST interrupts

Andy Lutomirski
2014-11-21T21:26:19Z

Following Linus' feedback, this series has grown. When I say "IST
interrupt" below, I'm excluding NMIs. They are their own thing. This
patch does *not* change NMI handling.

This adds new functions ist_enter and ist_exit to handle entry to and
exit from ist handlers. This is, I think, a bugfix for RCU handling,
and I've cc'd some RCU people on that patch. It will also catch bugs
involving scheduling on the IST stack.

This series then changes the entry code to switch to the normal stack if
an IST interrupt came from userspace and wasn't a double-fault. This
simplifies the exit logic.

Building on that, I add new functions ist_begin_non_atomic and
ist_end_non_atomic. They next inside ist_enter and ist_exit, and they
allow scheduling if the right conditions are met and they BUG if not.
They're meant to be used in do_machine_check to handle userspace memory
failures.

NB: Tony has seen odd behavior when stress-testing injected machine
checks with earlier versions of this series applied. I suspect that
it's a bug in something else, possibly his BIOS. Bugs in this series
shouldn't be ruled out, though.

Changes from v3:
- Reworked everything except the asm.

Changes from v2:
- double_fault is no longer affected.
- Other changes, but those are obsolete now.

Changes from RFC/v1: I forgot. Sorry.

Andy Lutomirski (5):
uprobes, x86: Fix _TIF_UPROBE vs _TIF_NOTIFY_RESUME
x86, traps: Track entry into and exit from IST context
x86, entry: Switch stacks on a paranoid entry from userspace
x86: Clean up current_stack_pointer
x86, traps: Add ist_begin_non_atomic and ist_end_non_atomic

Documentation/x86/entry_64.txt | 18 ++++--
Documentation/x86/x86_64/kernel-stacks | 8 ++-
arch/x86/include/asm/thread_info.h | 13 +++-
arch/x86/include/asm/traps.h | 6 ++
arch/x86/kernel/cpu/mcheck/mce.c | 5 ++
arch/x86/kernel/cpu/mcheck/p5.c | 6 ++
arch/x86/kernel/cpu/mcheck/winchip.c | 5 ++
arch/x86/kernel/entry_64.S | 86 ++++++++++++++------------
arch/x86/kernel/irq_32.c | 13 +---
arch/x86/kernel/traps.c | 110 +++++++++++++++++++++++++--------
kernel/events/uprobes.c | 1 -
11 files changed, 183 insertions(+), 88 deletions(-)

--
1.9.3