提交 432c4786 编写于 作者: Y Youquan Song 提交者: Caspar Zhang

x86/entry: Get rid of ist_begin/end_non_atomic()

fix #29415191

commit b052df3da821adfd6be26a6eb16624fb50e90e56 upstream

This is completely overengineered and definitely not an interface which
should be made available to anything else than this particular MCE case.
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Reviewed-by: NAlexandre Chartre <alexandre.chartre@oracle.com>
Acked-by: NPeter Zijlstra <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200505134059.462640294@linutronix.deSigned-off-by: NYouquan Song <youquan.song@intel.com>
Signed-off-by: NWetp Zhang <wetp.zy@linux.alibaba.com>
Reviewed-by: NArtie Ding <artie.ding@linux.alibaba.com>
上级 f9d84468
...@@ -111,8 +111,6 @@ asmlinkage void smp_deferred_error_interrupt(struct pt_regs *regs); ...@@ -111,8 +111,6 @@ asmlinkage void smp_deferred_error_interrupt(struct pt_regs *regs);
extern void ist_enter(struct pt_regs *regs); extern void ist_enter(struct pt_regs *regs);
extern void ist_exit(struct pt_regs *regs); extern void ist_exit(struct pt_regs *regs);
extern void ist_begin_non_atomic(struct pt_regs *regs);
extern void ist_end_non_atomic(void);
#ifdef CONFIG_VMAP_STACK #ifdef CONFIG_VMAP_STACK
void __noreturn handle_stack_overflow(const char *message, void __noreturn handle_stack_overflow(const char *message,
......
...@@ -1350,13 +1350,15 @@ void do_machine_check(struct pt_regs *regs, long error_code) ...@@ -1350,13 +1350,15 @@ void do_machine_check(struct pt_regs *regs, long error_code)
/* Fault was in user mode and we need to take some action */ /* Fault was in user mode and we need to take some action */
if ((m.cs & 3) == 3) { if ((m.cs & 3) == 3) {
ist_begin_non_atomic(regs); /* If this triggers there is no way to recover. Die hard. */
BUG_ON(!on_thread_stack() || !user_mode(regs));
local_irq_enable(); local_irq_enable();
preempt_enable();
if (kill_it || do_memory_failure(&m)) if (kill_it || do_memory_failure(&m))
force_sig(SIGBUS, current); force_sig(SIGBUS, current);
preempt_disable();
local_irq_disable(); local_irq_disable();
ist_end_non_atomic();
} else { } else {
if (!fixup_exception(regs, X86_TRAP_MC)) if (!fixup_exception(regs, X86_TRAP_MC))
mce_panic("Failed kernel mode recovery", &m, NULL); mce_panic("Failed kernel mode recovery", &m, NULL);
......
...@@ -120,43 +120,6 @@ void ist_exit(struct pt_regs *regs) ...@@ -120,43 +120,6 @@ void ist_exit(struct pt_regs *regs)
rcu_nmi_exit(); rcu_nmi_exit();
} }
/**
* ist_begin_non_atomic() - begin a non-atomic section in an IST exception
* @regs: regs passed to the IST exception handler
*
* IST exception handlers normally cannot schedule. As a special
* exception, if the exception interrupted userspace code (i.e.
* user_mode(regs) would return true) and the exception was not
* a double fault, it can be safe to schedule. ist_begin_non_atomic()
* begins a non-atomic section within an ist_enter()/ist_exit() region.
* Callers are responsible for enabling interrupts themselves inside
* the non-atomic section, and callers must call ist_end_non_atomic()
* before ist_exit().
*/
void ist_begin_non_atomic(struct pt_regs *regs)
{
BUG_ON(!user_mode(regs));
/*
* Sanity check: we need to be on the normal thread stack. This
* will catch asm bugs and any attempt to use ist_preempt_enable
* from double_fault.
*/
BUG_ON(!on_thread_stack());
preempt_enable_no_resched();
}
/**
* ist_end_non_atomic() - begin a non-atomic section in an IST exception
*
* Ends a non-atomic section started with ist_begin_non_atomic().
*/
void ist_end_non_atomic(void)
{
preempt_disable();
}
int is_valid_bugaddr(unsigned long addr) int is_valid_bugaddr(unsigned long addr)
{ {
unsigned short ud; unsigned short ud;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册