mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Narayana Murty N <nnmlinux@linux.ibm.com>
To: Gautam Menghani <gautam@linux.ibm.com>,
	maddy@linux.ibm.com, npiggin@gmail.com, mpe@ellerman.id.au,
	chleroy@kernel.org, tpearson@raptorengineering.com
Cc: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] KVM: PPC: Book3S HV: Avoid triggering an extra interrupt for a vCPU
Date: Tue, 15 Sep 2026 14:08:28 +0530	[thread overview]
Message-ID: <647f3494-1e79-43ea-a8ed-157b3f0e6c54@linux.ibm.com> (raw)
In-Reply-To: <20260915060146.33410-1-gautam@linux.ibm.com>

Hi Gautam,

On 15/09/26 11:31 AM, Gautam Menghani wrote:
> A huge number of spurious interrupts can be seen immediately after a KVM
> on PowerNV guest boots up in XIVE mode.
> 
> $ cat /proc/interrupts  | grep SPU
> SPU:     223705     192439     273526     147623   Spurious interrupts
> 
> This bug was introduced by commit ecd10702baae5 ("KVM: PPC: Book3S HV:
> Handle pending exceptions on guest entry with MSR_EE"). The root cause
> is that when there is an interrupt pending for a vCPU
> (xive_interrupt_pending() returns true) and MSR_EE is disabled for the
> vCPU, LPCR_MER ends up getting set for the VCPU. When the vCPU starts
> running, the XIVE hardware presents the pending interrupt to the vCPU
> (since the KVM guest has native XIVE support) and then a second spurious
> interrupt gets presented to the vCPU due to the LPCR_MER bit being set.
I agree that we should avoid setting LPCR_MER when the pending interrupt 
will already be delivered natively by XIVE on PowerNV.
> 
> Fix this behaviour by not queuing up any extra interrupts with LPCR_MER
> if there is an interrupt already pending in the case of KVM on PowerNV.
> This reduces the number of spurious interrupts drastically.
> 
> Fixes: ecd10702baae5 ("KVM: PPC: Book3S HV: Handle pending exceptions on guest entry with MSR_EE")
> Cc: stable@vger.kernel.org #6.8+
> Reported-by: Timothy Pearson <tpearson@raptorengineering.com>
> Closes: https://lore.kernel.org/linuxppc-dev/582904882.11159.1786719390349.JavaMail.zimbra@raptorengineeringinc.com
> Signed-off-by: Gautam Menghani <gautam@linux.ibm.com>
> ---
>   arch/powerpc/kvm/book3s_hv.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 7667563fb9ff..fda3767ebc9e 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -4937,9 +4937,8 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
>   
>   	if (!nested) {
>   		kvmppc_core_prepare_to_enter(vcpu);
The current code handles two different indications of an external interrupt:
> -		if (test_bit(BOOK3S_IRQPRIO_EXTERNAL,
> -			     &vcpu->arch.pending_exceptions) ||
> -		    xive_interrupt_pending(vcpu)) {
> +		if (!xive_interrupt_pending(vcpu) && test_bit(BOOK3S_IRQPRIO_EXTERNAL,
> +							      &vcpu->arch.pending_exceptions)) {
>   			/*
>   			 * For nested HV, don't synthesize but always pass MER,
>   			 * the L0 will be able to optimise that more
This means xive_interrupt_pending() now gates the entire block, 
including the BOOK3S_IRQPRIO_EXTERNAL handling, rather than only 
avoiding the LPCR_MER which causes the duplicate interrupt.

Also, the changelog describes the issue as specific to KVM on PowerNV, 
while this condition also affects the pSeries/nested handling in the 
same block.

Thanks,
Narayana Murty N

  reply	other threads:[~2026-09-15  8:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15  6:01 Gautam Menghani
2026-09-15  8:38 ` Narayana Murty N [this message]
2026-09-15  9:38   ` Gautam Menghani

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=647f3494-1e79-43ea-a8ed-157b3f0e6c54@linux.ibm.com \
    --to=nnmlinux@linux.ibm.com \
    --cc=chleroy@kernel.org \
    --cc=gautam@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=tpearson@raptorengineering.com \
    /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®