@@ -405,7 +405,7 @@ DEFINE_IDTENTRY_DF(exc_double_fault)
405405 }
406406#endif
407407
408- nmi_enter ( );
408+ idtentry_enter_nmi ( regs );
409409 instrumentation_begin ();
410410 notify_die (DIE_TRAP , str , regs , error_code , X86_TRAP_DF , SIGSEGV );
411411
@@ -651,15 +651,12 @@ DEFINE_IDTENTRY_RAW(exc_int3)
651651 instrumentation_end ();
652652 irqentry_exit_to_user_mode (regs );
653653 } else {
654- nmi_enter ( );
654+ bool irq_state = idtentry_enter_nmi ( regs );
655655 instrumentation_begin ();
656- trace_hardirqs_off_finish ();
657656 if (!do_int3 (regs ))
658657 die ("int3" , regs , 0 );
659- if (regs -> flags & X86_EFLAGS_IF )
660- trace_hardirqs_on_prepare ();
661658 instrumentation_end ();
662- nmi_exit ( );
659+ idtentry_exit_nmi ( regs , irq_state );
663660 }
664661}
665662
@@ -867,9 +864,8 @@ static void handle_debug(struct pt_regs *regs, unsigned long dr6, bool user)
867864static __always_inline void exc_debug_kernel (struct pt_regs * regs ,
868865 unsigned long dr6 )
869866{
870- nmi_enter ( );
867+ bool irq_state = idtentry_enter_nmi ( regs );
871868 instrumentation_begin ();
872- trace_hardirqs_off_finish ();
873869
874870 /*
875871 * If something gets miswired and we end up here for a user mode
@@ -886,10 +882,8 @@ static __always_inline void exc_debug_kernel(struct pt_regs *regs,
886882
887883 handle_debug (regs , dr6 , false);
888884
889- if (regs -> flags & X86_EFLAGS_IF )
890- trace_hardirqs_on_prepare ();
891885 instrumentation_end ();
892- nmi_exit ( );
886+ idtentry_exit_nmi ( regs , irq_state );
893887}
894888
895889static __always_inline void exc_debug_user (struct pt_regs * regs ,
@@ -905,6 +899,7 @@ static __always_inline void exc_debug_user(struct pt_regs *regs,
905899 instrumentation_begin ();
906900
907901 handle_debug (regs , dr6 , true);
902+
908903 instrumentation_end ();
909904 irqentry_exit_to_user_mode (regs );
910905}
0 commit comments