From: Christian Borntraeger <borntraeger@linux.ibm.com>
To: Janosch Frank <frankja@linux.ibm.com>, Halil Pasic <pasic@linux.ibm.com>
Cc: sashiko-reviews@lists.linux.dev, linux-s390@vger.kernel.org,
kvm@vger.kernel.org, Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Michael Mueller <mimu@linux.ibm.com>,
Eric Farman <farman@linux.ibm.com>,
Matthew Rosato <mjrosato@linux.ibm.com>
Subject: Re: [PATCH v2] KVM: s390: Improve floating IRQ injection behavior
Date: Wed, 19 Aug 2026 14:57:23 +0200 [thread overview]
Message-ID: <f4f4f72d-981c-43b8-a72a-e5ce26734277@linux.ibm.com> (raw)
In-Reply-To: <30016a7a-85e8-4a66-99e1-a1545f7fe323@linux.ibm.com>
Am 19.08.26 um 14:54 schrieb Janosch Frank:
> On 8/18/26 6:58 PM, Halil Pasic wrote:
>> On Tue, 18 Aug 2026 17:14:52 +0200
>> Christian Borntraeger <borntraeger@linux.ibm.com> wrote:
>>
>>> Am 18.08.26 um 16:32 schrieb Halil Pasic:
>>>> On Mon, 17 Aug 2026 15:22:41 +0200
>>>> Christian Borntraeger <borntraeger@linux.ibm.com> wrote:
>>>>>>> + irq_pend_mask = inti_to_irq_pend_mask(inti);
>>>>>>> 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;
>>>>>>
>>>>>> [Severity: High]
>>>>>> Does this code drop the interrupt kick entirely if all vCPUs currently
>>>>>> have their interrupt masks closed?
>>>>>
>>>>> I think this is a corner case but still a valid finding. We can probably consider this
>>>>> slowpath and wakeup/set cpuflags for ALL cpus? maybe after doing 2 rounds instead of one?
>>>>
>>>> With GISA, I think the FW is supposed to deliver the floating interrupts
>>>> without dropping the vCPU out of SIE. I'm not 100% sure but I think we
>>>> can rely on that mechanism for the CPUs that are in SIE. Without GISA,
>>>> I think, it is reasonable to assume that vCPUs don't keep running for
>>>> ever. It has been a while since I have looked at this code, but I think
>>>> the SIE exit path would catch this. If that is true we would not really
>>>> lose initiative, but just see delayed interrupt delivery.
>>>>
>>>> Sleeping vCPUs on the other hand are not of interest in this context, I
>>>> think.
>>> This is all corner case handling. Imagine one CPU running with IO disabled
>>> and all other CPUs sleeping. If now the "opportunistic" wakeup fails the
>>> GISA IO interrupt will never be delivered unless there is another wakeup.
>>> In reality this is a will not happen, but see the latest kvm unit test
>>> patch from Janosch and it might also create latencies, the "pick one CPU
>>> to deliver and wake it up if normal processing does not work" obviously
>>> has a hole in specific cases.
>>
>> Right, but that is not the "if all vCPUs currently have their interrupt
>> masks closed" case that Sashiko is talking about. Or did I misunderstand
>> that?
>>
>> Yes, I agree there are holes, and I was hoping to contribute to a better
>> understanding on where the holes actually are and what are the
>> implications of those holes.
>>
> Yesterday I managed to find the actual problem behind this code for PV guests:
Thanks for digging through that.>
> Non-ev Service IRQs are not allowed to be injected on re-entry when SCLP emulation has finished. They can only be injected when we receive the instruction notification for SCLP.
>
> So having wakeups for service IRQs in the flic is useless. At the time they are injected (after SCLP processing and before SIE re-entry) there's no way to make one pending for a PV cpu.
>
> I've since created a patch to kick cpus in the handling of the sclp instruction notification and that "fixes" the problems with the firq test.
>
>
>
> For Linux we'll see delayed delivery at most since the masks are open most of the time. My guess is that the IRQ injection actually happens pretty fast. There are other OSs which might benefit though and we should generally ask ourselves if good enough for Linux is the right answer.
>
> The stat counter did actually trigger a couple hundred times on an IPL so we're hitting the redistribution code path. Let's see what insights we can get from the performance measurements.
there are also ideas about disabling IO interrupts on some CPUs (e.g. vertical low)
and other OSes like zOS have the concept of CPUs excplictely disabled for IO
interrupts. So we better have a least a KVM implementation that works in those
situations.
prev parent reply other threads:[~2026-08-19 12:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 12:13 [PATCH v2] KVM: s390: Improve floating IRQ injection behavior Janosch Frank
2026-08-17 12:28 ` sashiko-bot
2026-08-17 13:22 ` Christian Borntraeger
2026-08-18 14:32 ` Halil Pasic
2026-08-18 15:14 ` Christian Borntraeger
2026-08-18 16:58 ` Halil Pasic
2026-08-19 12:54 ` Janosch Frank
2026-08-19 12:57 ` Christian Borntraeger [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=f4f4f72d-981c-43b8-a72a-e5ce26734277@linux.ibm.com \
--to=borntraeger@linux.ibm.com \
--cc=agordeev@linux.ibm.com \
--cc=farman@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=mimu@linux.ibm.com \
--cc=mjrosato@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--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 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.