From: Zachary Amsden <zamsden@redhat.com>
To: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Cc: avi@redhat.com, mtosatti@redhat.com, kvm@vger.kernel.org,
takuya.yoshikawa@gmail.com
Subject: Re: [PATCH 1/2] KVM: take kvm_lock for hardware_disable() during cpu hotplug
Date: Wed, 17 Nov 2010 19:45:34 -1000 [thread overview]
Message-ID: <4CE4BD7E.3040406@redhat.com> (raw)
In-Reply-To: <4CE49264.8020103@oss.ntt.co.jp>
On 11/17/2010 04:41 PM, Takuya Yoshikawa wrote:
> (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<yoshikawa.takuya@oss.ntt.co.jp>
>>>>> ---
>>>>> 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?
Yes, quite easy. Some systems may not let cpu0 go offline, but you can
manually disable and re-enable the other processors:
[root@mysore ~]# echo "0" > /sys/devices/system/cpu/cpu1/online
[root@mysore ~]# echo "1" > /sys/devices/system/cpu/cpu1/online
Cheers,
Zach
next prev parent reply other threads:[~2010-11-18 5:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-16 8:32 [PATCH 0/2] KVM: fix and cleanup: kvm_lock and hardware_disable Takuya Yoshikawa
2010-11-16 8:35 ` [PATCH 1/2] KVM: take kvm_lock for hardware_disable() during cpu hotplug Takuya Yoshikawa
2010-11-18 1:59 ` Zachary Amsden
2010-11-18 2:04 ` Takuya Yoshikawa
2010-11-18 2:33 ` Zachary Amsden
2010-11-18 2:41 ` Takuya Yoshikawa
2010-11-18 5:45 ` Zachary Amsden [this message]
2010-11-18 8:33 ` Takuya Yoshikawa
2010-11-16 8:37 ` [PATCH 2/2] KVM: rename hardware_[dis|en]able() to *_nolock() and add locking wrappers Takuya Yoshikawa
2010-11-18 15:26 ` [PATCH 0/2] KVM: fix and cleanup: kvm_lock and hardware_disable Marcelo Tosatti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CE4BD7E.3040406@redhat.com \
--to=zamsden@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=takuya.yoshikawa@gmail.com \
--cc=yoshikawa.takuya@oss.ntt.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox