From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takuya Yoshikawa Subject: Re: [PATCH 1/2] KVM: take kvm_lock for hardware_disable() during cpu hotplug Date: Thu, 18 Nov 2010 11:41:40 +0900 Message-ID: <4CE49264.8020103@oss.ntt.co.jp> References: <20101116173244.c5d2e812.yoshikawa.takuya@oss.ntt.co.jp> <20101116173502.96ff13f3.yoshikawa.takuya@oss.ntt.co.jp> <4CE4889A.7010808@redhat.com> <4CE489A6.4010100@oss.ntt.co.jp> <4CE4908F.3050209@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org, takuya.yoshikawa@gmail.com To: Zachary Amsden Return-path: Received: from serv2.oss.ntt.co.jp ([222.151.198.100]:49404 "EHLO serv2.oss.ntt.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751244Ab0KRCje (ORCPT ); Wed, 17 Nov 2010 21:39:34 -0500 In-Reply-To: <4CE4908F.3050209@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: (2010/11/18 11:33), Zachary Amsden wrote: > On 11/17/2010 04:04 PM, Takuya Yoshikawa wrote: >> (2010/11/18 10:59), Zachary Amsden wrote: >>> On 11/15/2010 10:35 PM, Takuya Yoshikawa wrote: >>>> In kvm_cpu_hotplug(), only CPU_STARTING case is protected by kvm_lock. >>>> This patch adds missing protection for CPU_DYING case. >>>> >>>> Signed-off-by: Takuya Yoshikawa >>>> --- >>>> virt/kvm/kvm_main.c | 2 ++ >>>> 1 files changed, 2 insertions(+), 0 deletions(-) >>>> >>>> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c >>>> index 339dd43..0fdd911 100644 >>>> --- a/virt/kvm/kvm_main.c >>>> +++ b/virt/kvm/kvm_main.c >>>> @@ -2148,7 +2148,9 @@ static int kvm_cpu_hotplug(struct notifier_block *notifier, unsigned long val, >>>> case CPU_DYING: >>>> printk(KERN_INFO "kvm: disabling virtualization on CPU%d\n", >>>> cpu); >>>> + spin_lock(&kvm_lock); >>>> hardware_disable(NULL); >>>> + spin_unlock(&kvm_lock); >>>> break; >>>> case CPU_STARTING: >>>> printk(KERN_INFO "kvm: enabling virtualization on CPU%d\n", >>> >>> I believe this is correct. >> >> You mean lock is not necessary? > > No, I believe your patch is correct and the lock should be there. Did you test with spinlock debugging just to be sure? > Sorry but no. I have no experience with cpu hotplug. So I thought it would take too much time to do real test by myself and reported like this this time. Any easy way to test? Takuya