Skip to contentSkip to conversation

x86/irq: Drop redundant irq_{enter,exit}() calls from posted MSI handler

RFC PATCH In review Sean Christopherson 1 participant 2 messages Jul 1 – Nov 4 x86

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 x86/irq: Drop redundant irq_{enter,exit}() calls from posted MSI handler

Drop the unnecessary irq_{enter,exit}() calls from the posted MSI handler, as the wrapper provided by DEFINE_IDTENTRY_SYSVEC() does all of the necessary bookkeeping (the x86 specific entry/exit code provides a superset of functionality).

Note, in the series[1] that added DEFINE_IDTENTRY_SYSVEC(), the follow-up patches that actually use DEFINE_IDTENTRY_SYSVEC() drop all {entering,exiting}_irq() pairs (including entering_ack_irq()), where {entering,exiting}_irq() were little more than wrappers to irq_{enter,exit}().

TODO: Explain what, if anything, can go wrong?

Fixes 1b03d82ba15e ("x86/irq: Install posted MSI notification handler")

---

RFC purely because I have no idea what can go wrong, and I'd like to document any potential issues in the changelog. I'm confident in the change itself, or I've failed miserably at reading the code. :-)

Found by inspection when looking at a bizarre code fetch from RIP=0 #PF that traces back to the irq_enter() (no reproducer for the #PF at this time). I don't know if the redundant bookkeeping contributed in any way, but the calls to irq_enter() and irq_exit() really stand out, because AFAICT, these are the *only* calls to those APIs in x86.

 arch/x86/kernel/irq.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/kernel/irq.c +0 -2
index 30122f0b3af9..0ac63628a585 100644
@@ -430,7 +430,6 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_posted_msi_notification)
 	/* Mark the handler active for intel_ack_posted_msi_irq() */
 	__this_cpu_write(posted_msi_handler_active, true);
 	inc_irq_stat(POSTED_MSI_NOTIFICATION);
-	irq_enter();
 
 	/*
 	 * Loop only MAX_POSTED_MSI_COALESCING_LOOP - 1 times here to take
@@ -456,7 +455,6 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_posted_msi_notification)
 	handle_pending_pir(pid->pir, regs);
 
 	apic_eoi();
-	irq_exit();
 	__this_cpu_write(posted_msi_handler_active, false);
 	set_irq_regs(old_regs);
 }

base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482

Signature · 1 line
2.55.0.rc0.799.gd6f94ed593-goog
#1 lore raw
Quoted 52 lines · Sean Christopherson

Drop the unnecessary irq_{enter,exit}() calls from the posted MSI handler, as the wrapper provided by DEFINE_IDTENTRY_SYSVEC() does all of the necessary bookkeeping (the x86 specific entry/exit code provides a superset of functionality).

Note, in the series[1] that added DEFINE_IDTENTRY_SYSVEC(), the follow-up patches that actually use DEFINE_IDTENTRY_SYSVEC() drop all {entering,exiting}_irq() pairs (including entering_ack_irq()), where {entering,exiting}_irq() were little more than wrappers to irq_{enter,exit}().

TODO: Explain what, if anything, can go wrong?

Fixes 1b03d82ba15e ("x86/irq: Install posted MSI notification handler")

---

RFC purely because I have no idea what can go wrong, and I'd like to document any potential issues in the changelog. I'm confident in the change itself, or I've failed miserably at reading the code. :-)

Found by inspection when looking at a bizarre code fetch from RIP=0 #PF that traces back to the irq_enter() (no reproducer for the #PF at this time). I don't know if the redundant bookkeeping contributed in any way, but the calls to irq_enter() and irq_exit() really stand out, because AFAICT, these are the *only* calls to those APIs in x86.

 arch/x86/kernel/irq.c | 2 --
 1 file changed, 2 deletions(-)
arch/x86/kernel/irq.c +0 -2
index 30122f0b3af9..0ac63628a585 100644
@@ -430,7 +430,6 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_posted_msi_notification)
 	/* Mark the handler active for intel_ack_posted_msi_irq() */
 	__this_cpu_write(posted_msi_handler_active, true);
 	inc_irq_stat(POSTED_MSI_NOTIFICATION);
-	irq_enter();
 
 	/*
 	 * Loop only MAX_POSTED_MSI_COALESCING_LOOP - 1 times here to take
@@ -456,7 +455,6 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_posted_msi_notification)
 	handle_pending_pir(pid->pir, regs);
 
 	apic_eoi();
-	irq_exit();
 	__this_cpu_write(posted_msi_handler_active, false);
 	set_irq_regs(old_regs);
 }
Quoted 3 lines

base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482

Signature · 1 line
2.55.0.rc0.799.gd6f94ed593-goog

Ping. I don't care terribly about landing the fix, but I would love input on what, if anything, could go wrong.