KVM: s390: Remove unneeded srcu lock
authorClaudio Imbrenda <imbrenda@linux.ibm.com>
Wed, 28 May 2025 09:55:00 +0000 (11:55 +0200)
committerClaudio Imbrenda <imbrenda@linux.ibm.com>
Wed, 28 May 2025 15:48:04 +0000 (17:48 +0200)
All paths leading to handle_essa() already hold the kvm->srcu.
Remove unneeded srcu locking from handle_essa().
Add lockdep assertion to make sure we will always be holding kvm->srcu
when entering handle_essa().

Reviewed-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Link: https://lore.kernel.org/r/20250528095502.226213-3-imbrenda@linux.ibm.com
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Message-ID: <20250528095502.226213-3-imbrenda@linux.ibm.com>

arch/s390/kvm/priv.c

index 1a49b89706f86e75544d765e2a19ff0b2f11cc11..9253c70897a8d4f16c2c21e2aa684febc562ecaa 100644 (file)
@@ -1248,6 +1248,8 @@ static inline int __do_essa(struct kvm_vcpu *vcpu, const int orc)
 
 static int handle_essa(struct kvm_vcpu *vcpu)
 {
+       lockdep_assert_held(&vcpu->kvm->srcu);
+
        /* entries expected to be 1FF */
        int entries = (vcpu->arch.sie_block->cbrlo & ~PAGE_MASK) >> 3;
        unsigned long *cbrlo;
@@ -1297,12 +1299,8 @@ static int handle_essa(struct kvm_vcpu *vcpu)
                /* Retry the ESSA instruction */
                kvm_s390_retry_instr(vcpu);
        } else {
-               int srcu_idx;
-
                mmap_read_lock(vcpu->kvm->mm);
-               srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
                i = __do_essa(vcpu, orc);
-               srcu_read_unlock(&vcpu->kvm->srcu, srcu_idx);
                mmap_read_unlock(vcpu->kvm->mm);
                if (i < 0)
                        return i;