[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220823084003.GF2147148@ls.amr.corp.intel.com>
Date: Tue, 23 Aug 2022 01:40:03 -0700
From: Isaku Yamahata <isaku.yamahata@...il.com>
To: Chao Gao <chao.gao@...el.com>
Cc: isaku.yamahata@...el.com, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, isaku.yamahata@...il.com,
Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Kai Huang <kai.huang@...el.com>, Will Deacon <will@...nel.org>
Subject: Re: [RFC PATCH 03/18] KVM: Drop kvm_count_lock and instead protect
kvm_usage_count with kvm_lock
On Tue, Aug 23, 2022 at 10:26:09AM +0800,
Chao Gao <chao.gao@...el.com> wrote:
> On Fri, Aug 19, 2022 at 11:00:09PM -0700, isaku.yamahata@...el.com wrote:
> >From: Isaku Yamahata <isaku.yamahata@...el.com>
> >
> >Because kvm_count_lock unnecessarily complicates the KVM locking convention
> >Drop kvm_count_lock and instead protect kvm_usage_count with kvm_lock for
> >simplicity.
> >
> >Opportunistically add some comments on locking.
> >
> >Suggested-by: Sean Christopherson <seanjc@...gle.com>
> >Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
> >---
> > static cpumask_var_t cpus_hardware_enabled;
> >@@ -4999,6 +4998,8 @@ static void hardware_enable_nolock(void *junk)
> > int cpu = raw_smp_processor_id();
> > int r;
> >
> >+ WARN_ON_ONCE(preemptible());
> >+
> > if (cpumask_test_cpu(cpu, cpus_hardware_enabled))
> > return;
> >
> >@@ -5015,10 +5016,10 @@ static void hardware_enable_nolock(void *junk)
> >
> > static int kvm_starting_cpu(unsigned int cpu)
> > {
> >- raw_spin_lock(&kvm_count_lock);
> >+ mutex_lock(&kvm_lock);
>
> kvm_starting_cpu() is called with interrupt disabled. So we cannot use
> sleeping locks (e.g., mutex) here.
So your patch to move it to online section [1] is needed.
I thought I can pullin only some of your patches. But whole your patches are
needed.
[1] https://lore.kernel.org/lkml/20220317091539.GA7257@gao-cwp/T/#mcc0fd81e7a19601e7c3ce451582c516d38f977f6
--
Isaku Yamahata <isaku.yamahata@...il.com>
Powered by blists - more mailing lists