mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	 Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org,  "H. Peter Anvin" <hpa@zytor.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] x86/irq: Drop redundant irq_{enter,exit}() calls from posted MSI handler
Date: Wed, 4 Nov 2026 11:15:08 -0800	[thread overview]
Message-ID: <auuEPPzOjkdnQBFb@google.com> (raw)
In-Reply-To: <20260701002152.546245-1-seanjc@google.com>

On Tue, Jun 30, 2026, Sean Christopherson wrote:
> 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?
> 
> Link: https://lore.kernel.org/all/20200521200513.656533920@linutronix.de [1]
> Fixes: 1b03d82ba15e ("x86/irq: Install posted MSI notification handler")
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
> 
> 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(-)
> 
> diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
> index 30122f0b3af9..0ac63628a585 100644
> --- a/arch/x86/kernel/irq.c
> +++ b/arch/x86/kernel/irq.c
> @@ -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
> -- 
> 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.

      reply	other threads:[~2026-11-04 19:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01  0:21 Sean Christopherson
2026-11-04 19:15 ` Sean Christopherson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=auuEPPzOjkdnQBFb@google.com \
    --to=seanjc@google.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@kernel.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®