From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Borntraeger Subject: Re: [PATCH 0/3] KVM: do not use kvm->online_vcpus to check "has one VCPU been created?" Date: Mon, 13 Jun 2016 15:33:35 +0200 Message-ID: <575EB62F.4010107@de.ibm.com> References: <1465824332-10628-1-git-send-email-pbonzini@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Cc: Cornelia Huck , Christian Borntraeger To: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Return-path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34934 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423481AbcFMNdo (ORCPT ); Mon, 13 Jun 2016 09:33:44 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u5DDTvYG028544 for ; Mon, 13 Jun 2016 09:33:43 -0400 Received: from e37.co.us.ibm.com (e37.co.us.ibm.com [32.97.110.158]) by mx0a-001b2d01.pphosted.com with ESMTP id 23gdxt0wu6-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 13 Jun 2016 09:33:43 -0400 Received: from localhost by e37.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 13 Jun 2016 07:33:42 -0600 In-Reply-To: <1465824332-10628-1-git-send-email-pbonzini@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 06/13/2016 03:25 PM, Paolo Bonzini wrote: > kvm->online_vcpus is only updated at the very end of KVM_CREATE_VCPU. > Thus, it can be racy to use it as a check for "has any VCPU been created > already?". While x86 detects the race through kvm_vcpu_compatible, > it is kinda hackish and s390 does not do anything similar. Provide a > better fix for both. > > Paolo Bonzini (3): > KVM: introduce created_vcpus > KVM: remove kvm_vcpu_compatible > KVM: s390: use created_vcpus > > arch/s390/kvm/kvm-s390.c | 10 +++++----- > arch/x86/kvm/Kconfig | 1 - > arch/x86/kvm/x86.c | 11 +++-------- > include/linux/kvm_host.h | 14 ++++++++------ > virt/kvm/Kconfig | 3 --- > virt/kvm/kvm_main.c | 27 +++++++++++++++++---------- > 6 files changed, 33 insertions(+), 33 deletions(-) > >>From a quick look this looks "the right thing". Will do a proper review later this day or tomorrow.