lkml.org 
[lkml]   [2022]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 03/18] KVM: Drop kvm_count_lock and instead protect kvm_usage_count with kvm_lock
On Fri, Aug 19, 2022 at 11:00:09PM -0700, isaku.yamahata@intel.com wrote:
>From: Isaku Yamahata <isaku.yamahata@intel.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@google.com>
>Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.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.

\
 
 \ /
  Last update: 2022-08-23 04:29    [W:0.388 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site