KVM: s390: use created_vcpus in more places

"Linux Kernel Mailing List" <[email protected]> Sat, 10 Feb 2018 22:00:21 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/241e3ec0faf5ab1a0d9b1f6c43eefa919fb9c112
Commit:     241e3ec0faf5ab1a0d9b1f6c43eefa919fb9c112
Parent:     9696594158ec43d210137c1b93313efde8f7315a
Refname:    refs/heads/master
Author:     Christian Borntraeger <[email protected]>
AuthorDate: Thu Nov 16 15:12:52 2017 +0100
Committer:  Christian Borntraeger <[email protected]>
CommitDate: Tue Jan 16 16:15:17 2018 +0100

    KVM: s390: use created_vcpus in more places
    
    commit a03825bbd0c3 ("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 <[email protected]>
    Signed-off-by: Christian Borntraeger <[email protected]>
    Reviewed-by: Halil Pasic <[email protected]>
    Reviewed-by: Cornelia Huck <[email protected]>
    Reviewed-by: David Hildenbrand <[email protected]>
    Fixes: 4e0b1ab72b8a ("KVM: s390: gs support for kvm guests")
    Fixes: a03825bbd0c3 ("KVM: s390: use kvm->created_vcpus")
---
 arch/s390/kvm/kvm-s390.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index ec8b68e97d3c..f579bf5c2620 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -573,7 +573,7 @@ static int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap)
 	case KVM_CAP_S390_GS:
 		r = -EINVAL;
 		mutex_lock(&kvm->lock);
-		if (atomic_read(&kvm->online_vcpus)) {
+		if (kvm->created_vcpus) {
 			r = -EBUSY;
 		} else if (test_facility(133)) {
 			set_kvm_facility(kvm->arch.model.fac_mask, 133);
@@ -1094,7 +1094,7 @@ static int kvm_s390_set_processor_feat(struct kvm *kvm,
 		return -EINVAL;
 
 	mutex_lock(&kvm->lock);
-	if (!atomic_read(&kvm->online_vcpus)) {
+	if (!kvm->created_vcpus) {
 		bitmap_copy(kvm->arch.cpu_feat, (unsigned long *) data.feat,
 			    KVM_S390_VM_CPU_FEAT_NR_BITS);
 		ret = 0;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html