From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423630AbcFMNdq (ORCPT ); Mon, 13 Jun 2016 09:33:46 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:20787 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1423357AbcFMNdo (ORCPT ); Mon, 13 Jun 2016 09:33:44 -0400 X-IBM-Helo: d03dlp01.boulder.ibm.com X-IBM-MailFrom: borntraeger@de.ibm.com X-IBM-RcptTo: pbonzini@redhat.com;kvm@vger.kernel.org;linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/3] KVM: do not use kvm->online_vcpus to check "has one VCPU been created?" To: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <1465824332-10628-1-git-send-email-pbonzini@redhat.com> Cc: Cornelia Huck , Christian Borntraeger From: Christian Borntraeger Date: Mon, 13 Jun 2016 15:33:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <1465824332-10628-1-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16061313-0024-0000-0000-000013DEA9C9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16061313-0025-0000-0000-000041C14EBF Message-Id: <575EB62F.4010107@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-06-13_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606130153 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.