提交 241e3ec0 编写于 作者: C Christian Borntraeger

KVM: s390: use created_vcpus in more places

commit a03825bb ("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: NHalil Pasic <pasic@linux.vnet.ibm.com>
Signed-off-by: NChristian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: NHalil Pasic <pasic@linux.vnet.ibm.com>
Reviewed-by: NCornelia Huck <cohuck@redhat.com>
Reviewed-by: NDavid Hildenbrand <david@redhat.com>
Fixes: 4e0b1ab7 ("KVM: s390: gs support for kvm guests")
Fixes: a03825bb ("KVM: s390: use kvm->created_vcpus")
上级 96965941
...@@ -573,7 +573,7 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap) ...@@ -573,7 +573,7 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap)
case KVM_CAP_S390_GS: case KVM_CAP_S390_GS:
r = -EINVAL; r = -EINVAL;
mutex_lock(&kvm->lock); mutex_lock(&kvm->lock);
if (atomic_read(&kvm->online_vcpus)) { if (kvm->created_vcpus) {
r = -EBUSY; r = -EBUSY;
} else if (test_facility(133)) { } else if (test_facility(133)) {
set_kvm_facility(kvm->arch.model.fac_mask, 133); set_kvm_facility(kvm->arch.model.fac_mask, 133);
...@@ -1094,7 +1094,7 @@ static int kvm_s390_set_processor_feat(struct kvm *kvm, ...@@ -1094,7 +1094,7 @@ static int kvm_s390_set_processor_feat(struct kvm *kvm,
return -EINVAL; return -EINVAL;
mutex_lock(&kvm->lock); mutex_lock(&kvm->lock);
if (!atomic_read(&kvm->online_vcpus)) { if (!kvm->created_vcpus) {
bitmap_copy(kvm->arch.cpu_feat, (unsigned long *) data.feat, bitmap_copy(kvm->arch.cpu_feat, (unsigned long *) data.feat,
KVM_S390_VM_CPU_FEAT_NR_BITS); KVM_S390_VM_CPU_FEAT_NR_BITS);
ret = 0; ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册