Skip to content

Commit f0e256f

Browse files
author
CKI KWF Bot
committed
Merge: RHEL9.8 - KVM: s390: improve interrupt cpu for wakeup
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7487 JIRA: https://issues.redhat.com/browse/RHEL-121783 ``` commit 352ccf8 Author: Christian Borntraeger <borntraeger@linux.ibm.com> Date: Thu Sep 4 13:39:27 2025 +0200 KVM: s390: improve interrupt cpu for wakeup Turns out that picking an idle CPU for floating interrupts has some negative side effects. The guest will keep the IO workload on its CPU and rather use an IPI from the interrupt CPU instead of moving workload. For example a guest with 2 vCPUs and 1 fio process might run that fio on vcpu1. If after diag500 both vCPUs are idle then vcpu0 is woken up. The guest will then do an IPI from vcpu0 to vcpu1. So lets change the heuristics and prefer the last CPU that went to sleep. This one is likely still in halt polling and can be woken up quickly. This patch shows significant improvements in terms of bandwidth or cpu consumption for fio and uperf workloads and seems to be a net win. Link: https://lore.kernel.org/linux-s390/20250904113927.119306-1-borntraeger@linux.ibm.com/ Reviewed-by: Christoph Schlameuß <schlameuss@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com> ``` Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com> --- <small>Created 2025-10-16 11:40 UTC by backporter - [KWF FAQ](https://red.ht/kernel_workflow_doc) - [Slack #team-kernel-workflow](https://redhat-internal.slack.com/archives/C04LRUPMJQ5) - [Source](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/webhook/utils/backporter.py) - [Documentation](https://gitlab.com/cki-project/kernel-workflow/-/blob/main/docs/README.backporter.md) - [Report an issue](https://issues.redhat.com/secure/CreateIssueDetails!init.jspa?pid=12334433&issuetype=1&priority=4&summary=backporter+webhook+issue&components=kernel-workflow+/+backporter)</small> Approved-by: Thomas Huth <thuth@redhat.com> Approved-by: Cornelia Huck <cohuck@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 9e94992 + 7c6adaa commit f0e256f

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

arch/s390/include/asm/kvm_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ struct kvm_s390_float_interrupt {
351351
int counters[FIRQ_MAX_COUNT];
352352
struct kvm_s390_mchk_info mchk;
353353
struct kvm_s390_ext_info srv_signal;
354-
int next_rr_cpu;
354+
int last_sleep_cpu;
355355
struct mutex ais_lock;
356356
u8 simm;
357357
u8 nimm;

arch/s390/kvm/interrupt.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,7 @@ int kvm_s390_handle_wait(struct kvm_vcpu *vcpu)
13211321
VCPU_EVENT(vcpu, 4, "enabled wait: %llu ns", sltime);
13221322
no_timer:
13231323
kvm_vcpu_srcu_read_unlock(vcpu);
1324+
vcpu->kvm->arch.float_int.last_sleep_cpu = vcpu->vcpu_idx;
13241325
kvm_vcpu_halt(vcpu);
13251326
vcpu->valid_wakeup = false;
13261327
__unset_cpu_idle(vcpu);
@@ -1947,18 +1948,15 @@ static void __floating_irq_kick(struct kvm *kvm, u64 type)
19471948
if (!online_vcpus)
19481949
return;
19491950

1950-
/* find idle VCPUs first, then round robin */
1951-
sigcpu = find_first_bit(kvm->arch.idle_mask, online_vcpus);
1952-
if (sigcpu == online_vcpus) {
1953-
do {
1954-
sigcpu = kvm->arch.float_int.next_rr_cpu++;
1955-
kvm->arch.float_int.next_rr_cpu %= online_vcpus;
1956-
/* avoid endless loops if all vcpus are stopped */
1957-
if (nr_tries++ >= online_vcpus)
1958-
return;
1959-
} while (is_vcpu_stopped(kvm_get_vcpu(kvm, sigcpu)));
1951+
for (sigcpu = kvm->arch.float_int.last_sleep_cpu; ; sigcpu++) {
1952+
sigcpu %= online_vcpus;
1953+
dst_vcpu = kvm_get_vcpu(kvm, sigcpu);
1954+
if (!is_vcpu_stopped(dst_vcpu))
1955+
break;
1956+
/* avoid endless loops if all vcpus are stopped */
1957+
if (nr_tries++ >= online_vcpus)
1958+
return;
19601959
}
1961-
dst_vcpu = kvm_get_vcpu(kvm, sigcpu);
19621960

19631961
/* make the VCPU drop out of the SIE, or wake it up if sleeping */
19641962
switch (type) {

0 commit comments

Comments
 (0)