From: Janosch Frank <frankja@linux.ibm.com>
To: pbonzini@redhat.com
Cc: kvm@vger.kernel.org, frankja@linux.ibm.com, david@kernel.org,
borntraeger@linux.ibm.com, cohuck@redhat.com,
linux-s390@vger.kernel.org, imbrenda@linux.ibm.com,
Gautam Gala <ggala@linux.ibm.com>
Subject: [GIT PULL 1/4] KVM: s390: reserve mmu cache before stopping migration mode
Date: Wed, 2 Dec 2026 13:14:07 +0100 [thread overview]
Message-ID: <20261202122437.289764-2-frankja@linux.ibm.com> (raw)
In-Reply-To: <20261202122437.289764-1-frankja@linux.ibm.com>
From: Gautam Gala <ggala@linux.ibm.com>
Creating or moving a memslot without KVM_MEM_LOG_DIRTY_PAGES stops
migration mode in s390_kvm_mmu_prepare_memory_region(). If the mmu
cache reservation fails afterwards, the ioctl returns -ENOMEM with
the memslots unchanged, but migration mode stays stopped: the CMMA
state cleared by kvm_s390_vm_stop_migration() cannot be restored,
so an in-flight migration aborts over an unrelated allocation
failure.
Reserve the mmu cache before tearing down migration mode so the
error path leaves both memslots and migration state untouched.
Fixes: 19192a404327 ("KVM: s390: Move all code into s390_kvm_mmu_prepare_memory_region()")
Reported-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Gautam Gala <ggala@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
---
arch/s390/kvm/gmap/kvm_mmu.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/arch/s390/kvm/gmap/kvm_mmu.c b/arch/s390/kvm/gmap/kvm_mmu.c
index 4e2da60b9859..b9b56390ae6d 100644
--- a/arch/s390/kvm/gmap/kvm_mmu.c
+++ b/arch/s390/kvm/gmap/kvm_mmu.c
@@ -78,6 +78,14 @@ int s390_kvm_mmu_prepare_memory_region(struct kvm *kvm,
return -EINVAL;
if (!asce_contains_gfn(kvm->arch.gmap->asce, new->base_gfn + new->npages - 1))
return -EINVAL;
+
+ /*
+ * Must be allocated before migration mode is stopped below:
+ * kvm_s390_vm_stop_migration() is not rolled back on failure.
+ */
+ mc = kvm_s390_new_mmu_cache();
+ if (!mc)
+ return -ENOMEM;
}
if (kvm_s390_is_migration_mode(kvm)) {
@@ -97,12 +105,7 @@ int s390_kvm_mmu_prepare_memory_region(struct kvm *kvm,
if (change == KVM_MR_FLAGS_ONLY)
return 0;
- if (change != KVM_MR_DELETE) {
- /* Enough capacity to add a new memslot */
- mc = kvm_s390_new_mmu_cache();
- if (!mc)
- return -ENOMEM;
- }
+
scoped_guard(write_lock, &kvm->mmu_lock) {
kvm_s390_update_cmma_dirty(kvm, old);
if (change == KVM_MR_DELETE || change == KVM_MR_MOVE)
--
2.56.1
next prev parent reply other threads:[~2026-12-02 12:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 12:14 [GIT PULL 0/4] KVM: s390: Third round of fixes for 7.4 Janosch Frank
2026-12-02 12:14 ` Janosch Frank [this message]
2026-12-02 12:14 ` [GIT PULL 2/4] KVM: s390: vsie: Do not overwrite guest 3 state on early validity icpt Janosch Frank
2026-12-02 12:14 ` [GIT PULL 3/4] KVM: s390: vsie: Rewind the PSW of ESA mode guests in the right format Janosch Frank
2026-12-02 12:14 ` [GIT PULL 4/4] KVM: s390: Don't kick vcpus for floating IRQs that are no longer pending Janosch Frank
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=20261202122437.289764-2-frankja@linux.ibm.com \
--to=frankja@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@kernel.org \
--cc=ggala@linux.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pbonzini@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.