]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: X86: Fix setup the virt_spin_lock_key before static key get initialized
authorWanpeng Li <wanpengli@tencent.com>
Sun, 25 Mar 2018 04:17:24 +0000 (21:17 -0700)
committerRadim Krčmář <rkrcmar@redhat.com>
Wed, 28 Mar 2018 20:47:06 +0000 (22:47 +0200)
commitf08224a67cfa6ae057b199d5b08e93924c10c0e8
tree7cfc7a30d9fb250150ec97697cfab186f8fb5f5e
parentbda55b5532d2170fac147d4a9a3ef37f64cb302d
KVM: X86: Fix setup the virt_spin_lock_key before static key get initialized

 static_key_disable_cpuslocked(): static key 'virt_spin_lock_key+0x0/0x20' used before call to jump_label_init()
 WARNING: CPU: 0 PID: 0 at kernel/jump_label.c:161 static_key_disable_cpuslocked+0x61/0x80
 RIP: 0010:static_key_disable_cpuslocked+0x61/0x80
 Call Trace:
  static_key_disable+0x16/0x20
  start_kernel+0x192/0x4b3
  secondary_startup_64+0xa5/0xb0

Qspinlock will be choosed when dedicated pCPUs are available, however, the
static virt_spin_lock_key is set in kvm_spinlock_init() before jump_label_init()
has been called, which will result in a WARN(). This patch fixes it by delaying
the virt_spin_lock_key setup to .smp_prepare_cpus().

Reported-by: Davidlohr Bueso <dbueso@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: Davidlohr Bueso <dbueso@suse.de>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
Fixes: b248f814a6ce ("KVM: X86: Choose qspinlock when dedicated physical CPUs are available")
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
arch/x86/kernel/kvm.c