Re: [PATCH v1 2/2] KVM: s390: make kvm_s390_vm_stop_migration() void

From: Andreas Grapentin

Date: Fri Nov 20 2026 - 05:30:37 EST


On Nov 20 26, Gautam Gala wrote:
> 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 <ggala@xxxxxxxxxxxxx>
> Reviewed-by: Claudio Imbrenda <imbrenda@xxxxxxxxxxxxx>
> ---
> 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;

should we maybe add something like BUILD_BUG_ON(1) here, so it doesn't
fail silently when the underlying assumption (will never be called
because kvm_s390_is_migration_mode() always return false) stops holding
for some reason?

BUILD_BUG_ON(1) won't fire if the compiler can prove the path is
never taken.

Beyond that, this change makes sense to me on the arm64 side.

Reviewed-by: Andreas Grapentin <gra@xxxxxxxxxxxxx>