mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gautam Gala <ggala@linux.ibm.com>
To: kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>,
	David Hildenbrand <david@kernel.org>,
	Steffen Eiden <seiden@linux.ibm.com>,
	Andreas Grapentin <gra@linux.ibm.com>,
	Marc Zyngier <maz@kernel.org>, Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>
Subject: [PATCH v1 2/2] KVM: s390: make kvm_s390_vm_stop_migration() void
Date: Fri, 20 Nov 2026 08:53:45 +0100	[thread overview]
Message-ID: <20261120075345.116521-3-ggala@linux.ibm.com> (raw)
In-Reply-To: <20261120075345.116521-1-ggala@linux.ibm.com>

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@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 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


      parent reply	other threads:[~2026-11-20  7:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  7:53 [PATCH v1 0/2] KVM: s390: fix migration mode teardown in memslot handling Gautam Gala
2026-11-20  7:53 ` [PATCH v1 1/2] KVM: s390: reserve mmu cache before stopping migration mode Gautam Gala
2026-11-20  7:53 ` Gautam Gala [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=20261120075345.116521-3-ggala@linux.ibm.com \
    --to=ggala@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=david@kernel.org \
    --cc=frankja@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=gra@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=seiden@linux.ibm.com \
    --cc=svens@linux.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®