Re: [PATCH v6 06/14] KVM: s390: Fix race in __do_essa()
| Newsgroups | org.kernel.vger.linux-s390,org.kernel.vger.kvm |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] System stall / SRCU stall warning due to holding `kvm->srcu` across a long-running page table walk. -- --- Patch [6]: [PATCH v6 06/14] KVM: s390: Fix race in __do_essa() --- commit 8a0e7e6fefae191da0effc8b1bcdd717dfb5216b Author: Claudio Imbrenda <[email protected]> KVM: s390: Fix race in __do_essa() This commit modifies the locking around KVM s390 migration and CMMA handling, replacing slots_lock with slots_arch_lock to fix a race with __do_essa(). It also adds a srcu guard to kvm_s390_vm_set_migration(). > diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c > index de3cb6111bd44..24c3bfcd5db26 100644 > --- a/arch/s390/kvm/kvm-s390.c > +++ b/arch/s390/kvm/kvm-s390.c [ ... ] > @@ -1300,7 +1300,9 @@ static int kvm_s390_vm_set_migration(struct kvm *kvm, > { > int res = -ENXIO; > > - mutex_lock(&kvm->slots_lock); > + guard(srcu)(&kvm->srcu); > + guard(mutex)(&kvm->slots_arch_lock); > + > switch (attr->attr) { > case KVM_S390_VM_MIGRATION_START: > res = kvm_s390_vm_start_migration(kvm); [Severity: High] Will holding kvm->srcu across the entire migration start/stop cause an SRCU stall for large VMs? Looking at kvm_s390_vm_start_migration(), it eventually calls gmap_set_cmma_all_dirty() (and kvm_s390_vm_stop_migration() calls gmap_set_cmma_all_clean()), which iterates over the entire guest address space: kvm_s390_vm_set_migration() kvm_s390_vm_start_migration() gmap_set_cmma_all_dirty() While the page table walk yields with cond_resched() to prevent soft lockups, yielding inside an SRCU read-side critical section does not allow the SRCU grace period to advance. Could this stall the SRCU grace period and block concurrent memslot updates across the system? -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6