Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@linux.ibm.com>
To: Janosch Frank <frankja@linux.ibm.com>, kvm@vger.kernel.org
Cc: imbrenda@linux.ibm.com, linux-s390@vger.kernel.org, pasic@linux.ibm.com
Subject: Re: [PATCH v4 1/3] KVM: s390: Improve floating IRQ injection behavior
Date: Fri, 25 Sep 2026 11:26:08 +0200	[thread overview]
Message-ID: <b7707a7e-26bc-4b0b-ad58-9cd7f8f820fa@linux.ibm.com> (raw)
In-Reply-To: <20260820121546.24694-2-frankja@linux.ibm.com>



Am 20.08.26 um 14:12 schrieb Janosch Frank:
> Floating IRQs can be handled by any VCPU that opened its masks. The
> current design does not check if the mask is open when a floating IRQ
> is injected via the FLIC. It will wakeup the last VCPU that went
> sleeping hoping it's the correct one.
> 
> Improve this by checking if the VCPU has pending IRQs and if not try
                                        can deliver that particular IRQ> to find another VCPU which can take the IRQ.
> 
> This is not the final fix around this topic but we'll eventually
> inject a pending IRQ. The current code can easily deadlock a VM and
> with this fix we work around that.


One question below.


probably not the last version of that code ara but certainly a necessary
fix in the right direction.

Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>

We should apply this and add it to kvms390. We will get some
performance regression testing via the next kernel then and wait
for the results before sending out a pull request.


> [...]
>   /*
>    * Find a destination VCPU for a floating irq and kick it.
>    */
> -static void __floating_irq_kick(struct kvm *kvm, u64 type)
> +static void __floating_irq_kick(struct kvm *kvm, u64 type, int isc)
>   {
>   	struct kvm_vcpu *dst_vcpu;
>   	int sigcpu, online_vcpus, nr_tries = 0;
> +	u64 irq_pend_mask;
> +	unsigned long i;
>   
>   	online_vcpus = atomic_read(&kvm->online_vcpus);
>   	if (!online_vcpus)
>   		return;
>   
> +	irq_pend_mask = inti_to_irq_pend_mask(type, isc);
>   	for (sigcpu = kvm->arch.float_int.last_sleep_cpu; ; sigcpu++) {
>   		sigcpu %= online_vcpus;
>   		dst_vcpu = kvm_get_vcpu(kvm, sigcpu);
> -		if (!is_vcpu_stopped(dst_vcpu))
> +		if (!is_vcpu_stopped(dst_vcpu) &&
> +		    deliverable_irqs(dst_vcpu) & irq_pend_mask)
>   			break;
>   		/* avoid endless loops if all vcpus are stopped */
> -		if (nr_tries++ >= online_vcpus)
> -			return;
> +		if (nr_tries++ >= online_vcpus * 2) {

why 2 rounds?

> +			dst_vcpu = NULL;
> +			break;
> +		}
>   	}
>   

  parent reply	other threads:[~2026-09-25  9:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-20 12:12 [PATCH v4 0/3] KVM: s390: Improve floating IRQ injection behavior Janosch Frank
2026-08-20 12:12 ` [PATCH v4 1/3] " Janosch Frank
2026-08-20 12:31   ` sashiko-bot
2026-09-25  9:26   ` Christian Borntraeger [this message]
2026-09-25 13:45     ` Janosch Frank
2026-09-25 13:48       ` Christian Borntraeger
2026-08-20 12:12 ` [PATCH v4 2/3] KVM: s390: Kick PV cpus at the right time for service irqs Janosch Frank
2026-08-20 12:30   ` sashiko-bot
2026-09-25  9:35   ` Christian Borntraeger
2026-09-25 10:11   ` Christian Borntraeger
2026-08-20 12:12 ` [PATCH v4 3/3] KVM: s390: Add opportunistic floating IRQ injection Janosch Frank
2026-08-20 12:27   ` sashiko-bot
2026-09-25 10:04   ` Christian Borntraeger

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=b7707a7e-26bc-4b0b-ad58-9cd7f8f820fa@linux.ibm.com \
    --to=borntraeger@linux.ibm.com \
    --cc=frankja@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=pasic@linux.ibm.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