kvm_s390_vm_stop_migration() returns 0 on all paths; it cannot fail. Its caller in s390_kvm_mmu_prepare_memory_region() wraps it in WARN(), producing a condition that is always false. The arm64 stub returns -EINVAL but is unreachable because kvm_s390_is_migration_mode() returns false there. Change the return type to void and drop the dead WARN(). The KVM_S390_VM_MIGRATION_STOP attribute handler sets its result to 0 explicitly; userspace behavior is unchanged since stopping migration never failed. Signed-off-by: Gautam Gala Reviewed-by: Claudio Imbrenda --- arch/s390/kvm/arm64/arm.h | 3 +-- arch/s390/kvm/gmap/kvm_mmu.c | 3 +-- arch/s390/kvm/s390/s390.c | 10 +++++----- arch/s390/kvm/s390/s390.h | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/arch/s390/kvm/arm64/arm.h b/arch/s390/kvm/arm64/arm.h index 760230685ca1..e60801e4a467 100644 --- a/arch/s390/kvm/arm64/arm.h +++ b/arch/s390/kvm/arm64/arm.h @@ -50,9 +50,8 @@ static __always_inline void kvm_s390_update_cmma_dirty(struct kvm *kvm, const st } /* should never be called */ -static __always_inline int kvm_s390_vm_stop_migration(struct kvm *kvm) +static __always_inline void kvm_s390_vm_stop_migration(struct kvm *kvm) { - return -EINVAL; } #endif /* ARCH_S390_KVM_ARM64_H */ diff --git a/arch/s390/kvm/gmap/kvm_mmu.c b/arch/s390/kvm/gmap/kvm_mmu.c index 120980cf6ac6..f1d1374c92a1 100644 --- a/arch/s390/kvm/gmap/kvm_mmu.c +++ b/arch/s390/kvm/gmap/kvm_mmu.c @@ -99,8 +99,7 @@ int s390_kvm_mmu_prepare_memory_region(struct kvm *kvm, */ if (change != KVM_MR_DELETE && !(new->flags & KVM_MEM_LOG_DIRTY_PAGES)) - WARN(kvm_s390_vm_stop_migration(kvm), - "Failed to stop migration mode"); + kvm_s390_vm_stop_migration(kvm); } if (change == KVM_MR_FLAGS_ONLY) diff --git a/arch/s390/kvm/s390/s390.c b/arch/s390/kvm/s390/s390.c index 18fb200f854a..04e4fa7dfd1d 100644 --- a/arch/s390/kvm/s390/s390.c +++ b/arch/s390/kvm/s390/s390.c @@ -1242,11 +1242,11 @@ static int kvm_s390_vm_start_migration(struct kvm *kvm) * Must be called with kvm->slots_arch_lock to avoid races with ourselves, * kvm_s390_vm_start_migration() and kvm_s390_get_cmma_bits(). */ -int kvm_s390_vm_stop_migration(struct kvm *kvm) +void kvm_s390_vm_stop_migration(struct kvm *kvm) { /* migration mode already disabled */ if (!kvm->arch.migration_mode) - return 0; + return; /* * Unset the flag and propagate to all vCPUs. From now on the cmma_d * bit will not be touched on any PGSTE. @@ -1255,7 +1255,7 @@ int kvm_s390_vm_stop_migration(struct kvm *kvm) */ WRITE_ONCE(kvm->arch.migration_mode, 0); if (!kvm->arch.use_cmma) - return 0; + return; kvm_s390_sync_request_broadcast(kvm, KVM_REQ_STOP_MIGRATION); /* Clear cmma_d on all existing PGSTEs and set cmma_dirty_pages to 0. */ @@ -1266,7 +1266,6 @@ int kvm_s390_vm_stop_migration(struct kvm *kvm) * cmma_dirty_pages is 0, and all existing PGSTEs have their cmma_d bit * set to 0. */ - return 0; } static int kvm_s390_vm_set_migration(struct kvm *kvm, @@ -1282,7 +1281,8 @@ static int kvm_s390_vm_set_migration(struct kvm *kvm, res = kvm_s390_vm_start_migration(kvm); break; case KVM_S390_VM_MIGRATION_STOP: - res = kvm_s390_vm_stop_migration(kvm); + kvm_s390_vm_stop_migration(kvm); + res = 0; break; default: break; diff --git a/arch/s390/kvm/s390/s390.h b/arch/s390/kvm/s390/s390.h index 9ed1af5583e3..45f397663d5f 100644 --- a/arch/s390/kvm/s390/s390.h +++ b/arch/s390/kvm/s390/s390.h @@ -474,7 +474,7 @@ int __kvm_s390_mprotect_many(struct gmap *gmap, gpa_t gpa, u8 npages, unsigned i bool kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu); void kvm_s390_update_cmma_dirty(struct kvm *kvm, const struct kvm_memory_slot *old); -int kvm_s390_vm_stop_migration(struct kvm *kvm); +void kvm_s390_vm_stop_migration(struct kvm *kvm); /* implemented in diag.c */ -- 2.56.0