Re: [PATCH v4 13/26] KVM: Add arch hook when VM is added/deleted

From: Isaku Yamahata
Date: Sat Sep 10 2022 - 22:51:03 EST


On Fri, Sep 09, 2022 at 02:08:04PM +0800,
Chao Gao <chao.gao@xxxxxxxxx> wrote:

> >+static void kvm_del_vm(void)
> >+{
> >+ cpus_read_lock();
> >+ mutex_lock(&kvm_lock);
> >+ kvm_arch_del_vm(kvm_usage_count);
> >+ mutex_unlock(&kvm_lock);
> >+ cpus_read_unlock();
>
> kvm_arch_del_vm() is an empty function now. I don't understand why
> cpus_read_lock() is needed. Maybe add the lock when you fill up
> kvm_arch_del_vm().

The next patch populates it with on_each_cpu(hardware_disable_nolock, NULL, 1);
I will move adding lock to the next one. Or revise how adding arch hooks and
populating part.
--
Isaku Yamahata <isaku.yamahata@xxxxxxxxx>