Skip to content

Commit 07d495d

Browse files
0xAXKAGA-KOKO
authored andcommitted
x86/traps: Get rid of unnecessary preempt_disable/preempt_enable_no_resched
Exception handlers which may run on IST stack call ist_enter() at the start of execution and ist_exit() in the end. ist_enter() disables preemption unconditionally and ist_exit() enables it. So the extra preempt_disable/enable() pairs nested inside the ist_enter/exit() regions are pointless and can be removed. Signed-off-by: Alexander Kuleshov <[email protected]> Cc: Tony Luck <[email protected]> Cc: Jianyu Zhan <[email protected]> Cc: Paul Gortmaker <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
1 parent 68dee8e commit 07d495d

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

arch/x86/kernel/traps.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -563,11 +563,9 @@ dotraplinkage void notrace do_int3(struct pt_regs *regs, long error_code)
563563
* as we may switch to the interrupt stack.
564564
*/
565565
debug_stack_usage_inc();
566-
preempt_disable();
567566
cond_local_irq_enable(regs);
568567
do_trap(X86_TRAP_BP, SIGTRAP, "int3", regs, error_code, NULL);
569568
cond_local_irq_disable(regs);
570-
preempt_enable_no_resched();
571569
debug_stack_usage_dec();
572570
exit:
573571
ist_exit(regs);
@@ -742,14 +740,12 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)
742740
debug_stack_usage_inc();
743741

744742
/* It's safe to allow irq's after DR6 has been saved */
745-
preempt_disable();
746743
cond_local_irq_enable(regs);
747744

748745
if (v8086_mode(regs)) {
749746
handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code,
750747
X86_TRAP_DB);
751748
cond_local_irq_disable(regs);
752-
preempt_enable_no_resched();
753749
debug_stack_usage_dec();
754750
goto exit;
755751
}
@@ -769,7 +765,6 @@ dotraplinkage void do_debug(struct pt_regs *regs, long error_code)
769765
if (tsk->thread.debugreg6 & (DR_STEP | DR_TRAP_BITS) || user_icebp)
770766
send_sigtrap(tsk, regs, error_code, si_code);
771767
cond_local_irq_disable(regs);
772-
preempt_enable_no_resched();
773768
debug_stack_usage_dec();
774769

775770
exit:

0 commit comments

Comments
 (0)