From: Janosch Frank <frankja@linux.ibm.com>
To: pbonzini@redhat.com
Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@kernel.org,
borntraeger@linux.ibm.com, cohuck@redhat.com,
linux-s390@vger.kernel.org, imbrenda@linux.ibm.com
Subject: [GIT PULL 4/4] KVM: s390: Don't kick vcpus for floating IRQs that are no longer pending
Date: Wed, 2 Dec 2026 13:14:10 +0100 [thread overview]
Message-ID: <20261202122437.289764-5-frankja@linux.ibm.com> (raw)
In-Reply-To: <20261202122437.289764-1-frankja@linux.ibm.com>
From: Christian Borntraeger <borntraeger@linux.ibm.com>
kick_cpu_irq() searches for a vcpu that can take the injected floating
IRQ, starting with last_sleep_cpu, and, if it does not find one that
is suitable it wakes up all vcpus to avoid starvation.
For GISA interrupts, __inject_io() only sets the IPM bit and the
hardware may deliver the interrupt to a vcpu running in SIE before
kick_cpu_irq() looks at it. The IPM bit is then already clear, so
deliverable_irqs() returns 0 for every vcpu and all vcpus are woken up
for an interrupt that has already been delivered.
Whenever a candidate vcpu cannot take the IRQ, check whether the IRQ is
still pending for the VM at all and skip the kick if it is not. The
common case, where the last_sleep_cpu guess works, is not affected:
deliverable_irqs() has already looked at the pending IRQs then.
Measured with a 12 vcpu guest doing 4k random reads (4 jobs, iodepth
32) on a host NVMe attached as virtio-blk with 4 queues mapped to 2
iothreads, all QEMU threads pinned to vertical high/medium CPUs of a
shared LPAR (function profile via ftrace, so absolute times include
tracing overhead):
before after
vcpu wakeups per kick 9.05 1.40
kick_cpu_irq() avg 4.77us 0.41us
eventfd_write() avg (irqfd) 3.67us 0.70us
IOPS 773k - 774k 806k - 809k
host CPU per I/O 7.7us 7.1 - 7.3us
virtio-net also shows benefit.
Fixes: 370b3a89cbd9 ("KVM: s390: Improve floating IRQ injection behavior")
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
arch/s390/kvm/s390/interrupt.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/arch/s390/kvm/s390/interrupt.c b/arch/s390/kvm/s390/interrupt.c
index 31a6074feffc..df0f89b33147 100644
--- a/arch/s390/kvm/s390/interrupt.c
+++ b/arch/s390/kvm/s390/interrupt.c
@@ -1963,6 +1963,17 @@ static void vcpu_intervention_kick(struct kvm_vcpu *vcpu, u64 type)
kvm_s390_vcpu_wakeup(vcpu);
}
+/* Floating IRQs (including GISA IPM) pending for the VM */
+static unsigned long pending_float_irqs(struct kvm *kvm)
+{
+ struct kvm_s390_gisa_interrupt *gi = &kvm->arch.gisa_int;
+ unsigned long pending = kvm->arch.float_int.pending_irqs;
+
+ if (gi->origin)
+ pending |= (unsigned long)gisa_get_ipm(gi->origin) << IRQ_PEND_IO_ISC_7;
+ return pending & ~kvm->arch.float_int.masked_irqs;
+}
+
static void kick_cpu_irq(struct kvm *kvm, u64 type, u64 parm)
{
struct kvm_vcpu *dst_vcpu;
@@ -1981,6 +1992,9 @@ static void kick_cpu_irq(struct kvm *kvm, u64 type, u64 parm)
if (!is_vcpu_stopped(dst_vcpu) &&
deliverable_irqs(dst_vcpu) & irq_pend_mask)
break;
+ /* IRQ already delivered (e.g. via GISA), nobody to kick */
+ if (!(pending_float_irqs(kvm) & irq_pend_mask))
+ return;
/* avoid endless loops if all vcpus are stopped */
if (nr_tries++ >= online_vcpus) {
dst_vcpu = NULL;
--
2.56.1
prev parent reply other threads:[~2026-12-02 12:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 12:14 [GIT PULL 0/4] KVM: s390: Third round of fixes for 7.4 Janosch Frank
2026-12-02 12:14 ` [GIT PULL 1/4] KVM: s390: reserve mmu cache before stopping migration mode Janosch Frank
2026-12-02 12:14 ` [GIT PULL 2/4] KVM: s390: vsie: Do not overwrite guest 3 state on early validity icpt Janosch Frank
2026-12-02 12:14 ` [GIT PULL 3/4] KVM: s390: vsie: Rewind the PSW of ESA mode guests in the right format Janosch Frank
2026-12-02 12:14 ` Janosch Frank [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=20261202122437.289764-5-frankja@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@kernel.org \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pbonzini@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.