Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Janosch Frank" <frankja@linux.ibm.com>
Cc: "Vasily Gorbik" <gor@linux.ibm.com>,
	kvm@vger.kernel.org, linux-s390@vger.kernel.org,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Heiko Carstens" <hca@linux.ibm.com>,
	"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH v5 3/3] KVM: s390: Add opportunistic floating IRQ delivery
Date: Mon, 28 Sep 2026 12:50:05 +0000	[thread overview]
Message-ID: <20260928125005.DD2F21F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260928123639.34226-4-frankja@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] kvm: s390: timer-less wait bypasses floating IRQ distribution
--

commit f14594a6a744fbc4a4f3602b18d73cbd397d4076
Author: Janosch Frank <frankja@linux.ibm.com>

KVM: s390: Add opportunistic floating IRQ delivery

This commit attempts to distribute floating IRQs which haven't been taken by
a vCPU yet to sleeping vCPUs. This lowers the risk of floating IRQs not being
delivered.

> diff --git a/arch/s390/kvm/s390/interrupt.c b/arch/s390/kvm/s390/interrupt.c
> index 3c0e6216eee3b..1b06775e581bf 100644
> --- a/arch/s390/kvm/s390/interrupt.c
> +++ b/arch/s390/kvm/s390/interrupt.c
[ ... ]
> @@ -1294,6 +1326,8 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
>  	if (!sltime)
>  		return 0;
>  
> +	distribute_float_irqs(vcpu->kvm);
> +
>  	__set_cpu_idle(vcpu);
>  	hrtimer_start(&vcpu->arch.ckc_timer, sltime, HRTIMER_MODE_REL);
>  	VCPU_EVENT(vcpu, 4, "enabled wait: %llu ns", sltime);

[Severity: High]
Does this bypass distribute_float_irqs() when a guest enters an enabled wait
state with clock comparator and CPU timer interrupts disabled?

If a guest disables timer interrupts and enters a wait state, it appears
kvm_s390_handle_wait() jumps directly to the no_timer label:

arch/s390/kvm/s390/interrupt.c:kvm_s390_handle_wait() {
    ...
	if (!ckc_interrupts_enabled(vcpu) &&
	    !cpu_timer_interrupts_enabled(vcpu)) {
		VCPU_EVENT(vcpu, 3, "%s", "enabled wait w/o timer");
		__set_cpu_idle(vcpu);
		goto no_timer;
	}

	sltime = __calculate_sltime(vcpu);
	if (!sltime)
		return 0;

	distribute_float_irqs(vcpu->kvm);

	__set_cpu_idle(vcpu);
	hrtimer_start(&vcpu->arch.ckc_timer, sltime, HRTIMER_MODE_REL);
	VCPU_EVENT(vcpu, 4, "enabled wait: %llu ns", sltime);
no_timer:
    ...
}

Because the goto completely bypasses the newly added distribute_float_irqs()
call, any pending floating IRQs that this vCPU cannot deliver might remain
undelivered when the current vCPU goes to sleep. Could this lead to guest
stalls or deadlocks?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260928123639.34226-1-frankja@linux.ibm.com?part=3

      reply	other threads:[~2026-09-28 12:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 12:30 [PATCH v5 0/3] KVM: s390: Improve floating IRQ injection behavior Janosch Frank
2026-09-28 12:30 ` [PATCH v5 1/3] " Janosch Frank
2026-09-28 12:45   ` sashiko-bot
2026-09-28 12:30 ` [PATCH v5 2/3] KVM: s390: Kick PV cpus at the right time for service irqs Janosch Frank
2026-09-28 12:48   ` sashiko-bot
2026-09-28 12:30 ` [PATCH v5 3/3] KVM: s390: Add opportunistic floating IRQ delivery Janosch Frank
2026-09-28 12:50   ` sashiko-bot [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=20260928125005.DD2F21F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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