KVM: s390: Enable vCPU kick infrastructure
cover KVM: s390: Enable vCPU kick infrastructure
Future extensions to arm on s390 will require the vcpu kick infrastructure from KVM.
Today that infrastructure is compiled out on s390: Commit 0266c894b51c ("KVM: put back #ifndef CONFIG_S390 around kvm_vcpu_kick") guarded it with #ifndef CONFIG_S390 for exactly one reason: kvm_vcpu_kick() calls smp_send_reschedule(), which s390 did not export, and therefore the s390 KVM module failed to link.
So Patch 1 exports arch_smp_send_reschedule and patch 2 drops the CONFIG_S390 guards around __kvm_vcpu_kick() and its inline wrappers.
As this is a non-invasive change and eases the integration of future code I send it in beforehand. These two patches need to come in before arm patches which add the sharing of code using this e.g. vcpu_power_off, vcpu_suspend, ... which will be used in the near future.
Native KVM/s390 is unaffected. It keeps its own wakeup and request paths and gains no callers of the generic kick. __kvm_vcpu_kick() is now compiled into the native module but unused; it cannot send an IPI for a native vCPU anyway, as native s390 never sets vcpu->mode to IN_GUEST_MODE. Then kvm_request_needs_ipi() declines and the kick would result in a plain wakeup of a halted vCPU.DITME: cover title for vcpu_kick
Steffen
---
Steffen Eiden (2):
s390: Export arch_smp_send_reschedule
KVM: s390: Enable the generic vCPU kick infrastructure
arch/s390/kernel/smp.c | 1 + include/linux/kvm_host.h | 4 ---- virt/kvm/kvm_main.c | 2 -- 3 files changed, 1 insertion(+), 6 deletions(-)
base-commit: 4dce97c6c265544342e716e62fd24bbb232590c5
change-id: 20261125-vcpu_kick-339caf770bb8
PATCH 1/2 s390: Export arch_smp_send_reschedule
Export arch_smp_send_reschedule in order to be able to use the generic vcpu_kick infrastructure which is required for arm on s390 smp support.
--- arch/s390/kernel/smp.c | 1 + 1 file changed, 1 insertion(+)
arch/s390/kernel/smp.c +1 -0
@@ -531,6 +531,7 @@ void arch_smp_send_reschedule(int cpu) {pcpu_ec_call (per_cpu_ptr (&pcpu_devices, cpu), ec_schedule); } +EXPORT_SYMBOL_GPL (arch_smp_send_reschedule);#ifdef CONFIG_IRQ_WORK void arch_irq_work_raise (void )
Signature · 1 line
2.56.1
Christian Borntraeger
reviewerRe: [PATCH 1/2] s390: Export arch_smp_send_reschedule
Am 25.11.26 um 17:38 schrieb Steffen Eiden:
Quoted 14 lines
Export
arch_smp_send_reschedulein order to be able to use the genericvcpu_kickinfrastructure which is required for arm on s390 smp support.Signed-off-by Steffen Eiden <[email protected]>--- arch/s390/kernel/smp.c | 1 + 1 file changed, 1 insertion(+)arch/s390/kernel/smp.c +0
-0
arch/s390/kernel/smp.c void arch_smp_send_reschedule(int cpu) · line 537
Quoted 7 lines
arch/s390/kernel/smp.c +1
-0@@ -531,6 +531,7 @@ void arch_smp_send_reschedule(int cpu) {pcpu_ec_call (per_cpu_ptr (&pcpu_devices, cpu), ec_schedule); } +EXPORT_SYMBOL_GPL (arch_smp_send_reschedule);#ifdef CONFIG_IRQ_WORK void arch_irq_work_raise (void )
There is a similar patch from Sean already.
PATCH 2/2 KVM: s390: Enable the generic vCPU kick infrastructure
In reply to Steffen EidenDrop the #ifndef CONFIG_S390 around __kvm_vcpu_kick() and its inline wrappers so that arm on s390 can use the vCPU kick infrastructure.
Commit 0266c894b51c ("KVM: put back #ifndef CONFIG_S390 around kvm_vcpu_kick") added the guard around the kick itself for exactly one
reason: kvm_vcpu_kick() calls smp_send_reschedule(), which s390 did not export, and so the s390 KVM module failed to link.
KVM for arm64 guests on s390 builds on the shared arm64 KVM code, which relies on the generic kick infrastructure. s390 will have a user for the kick infrastructure. Let's activate it.
Native KVM/s390 is unaffected by the guards going away. It keeps its own wakeup and request paths and gains no callers of the generic kick.
--- include/linux/kvm_host.h | 4 ---- virt/kvm/kvm_main.c | 2 -- 2 files changed, 6 deletions(-)
include/linux/kvm_host.h +0 -4
@@ -1590,14 +1590,12 @@ void kvm_arch_vcpu_blocking(struct kvm_vcpu *vcpu);void kvm_arch_vcpu_unblocking (struct kvm_vcpu *vcpu);bool kvm_vcpu_wake_up (struct kvm_vcpu *vcpu); -#ifndef CONFIG_S390 void __kvm_vcpu_kick (struct kvm_vcpu *vcpu,int request,bool force);static inline void kvm_vcpu_kick (struct kvm_vcpu *vcpu) {__kvm_vcpu_kick (vcpu,0 , false); } -#endif int kvm_vcpu_yield_to (struct kvm_vcpu *target);void kvm_vcpu_on_spin (struct kvm_vcpu *vcpu,bool yield_to_kernel_mode);
@@ -2331,13 +2329,11 @@ static __always_inline void kvm_make_request(int req, struct kvm_vcpu *vcpu)__kvm_make_request (req, vcpu); } -#ifndef CONFIG_S390 static inline void kvm_make_request_and_kick (int req,struct kvm_vcpu *vcpu) {kvm_make_request (req, vcpu);__kvm_vcpu_kick (vcpu, req, false); } -#endif static inline bool kvm_request_pending (struct kvm_vcpu *vcpu) {
virt/kvm/kvm_main.c +0 -2
@@ -3903,7 +3903,6 @@ bool kvm_vcpu_wake_up(struct kvm_vcpu *vcpu) }EXPORT_SYMBOL_FOR_KVM_INTERNAL (kvm_vcpu_wake_up); -#ifndef CONFIG_S390 /* * Kick a sleeping VCPU, or a guest VCPU in guest mode, into host kernel mode. */
@@ -3959,7 +3958,6 @@ void __kvm_vcpu_kick(struct kvm_vcpu *vcpu, int req, bool force)put_cpu (); }EXPORT_SYMBOL_FOR_KVM_INTERNAL (__kvm_vcpu_kick); -#endif /* !CONFIG_S390 */ int kvm_vcpu_yield_to (struct kvm_vcpu *target) {
Signature · 1 line
2.56.1
[email protected]
AI reviewSashiko has reviewed this 2-patch series and found no issues.
Sashiko has reviewed this 2-patch series and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]