Skip to content

Commit 80bd91a

Browse files
Christian Borntraegergregkh
authored andcommitted
KVM: s390: use created_vcpus in more places
[ Upstream commit 241e3ec ] commit a03825b ("KVM: s390: use kvm->created_vcpus") introduced kvm->created_vcpus to avoid races with the existing kvm->online_vcpus scheme. One place was "forgotten" and one new place was "added". Let's fix those. Reported-by: Halil Pasic <pasic@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Fixes: 4e0b1ab ("KVM: s390: gs support for kvm guests") Fixes: a03825b ("KVM: s390: use kvm->created_vcpus") Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent a5a8ca7 commit 80bd91a

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎arch/s390/kvm/kvm-s390.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap)
601601
case KVM_CAP_S390_GS:
602602
r = -EINVAL;
603603
mutex_lock(&kvm->lock);
604-
if (atomic_read(&kvm->online_vcpus)) {
604+
if (kvm->created_vcpus) {
605605
r = -EBUSY;
606606
} else if (test_facility(133)) {
607607
set_kvm_facility(kvm->arch.model.fac_mask, 133);
@@ -1121,7 +1121,7 @@ static int kvm_s390_set_processor_feat(struct kvm *kvm,
11211121
return -EINVAL;
11221122

11231123
mutex_lock(&kvm->lock);
1124-
if (!atomic_read(&kvm->online_vcpus)) {
1124+
if (!kvm->created_vcpus) {
11251125
bitmap_copy(kvm->arch.cpu_feat, (unsigned long *) data.feat,
11261126
KVM_S390_VM_CPU_FEAT_NR_BITS);
11271127
ret = 0;

0 commit comments

Comments
 (0)