diff options
author | Longpeng(Mike) <longpeng2@huawei.com> | 2017-08-08 12:05:32 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2017-08-08 10:57:43 +0200 |
commit | 199b5763d329b43c88f6ad539db8a6c6b42f8edb (patch) | |
tree | 224f4ebeb9e58c43ea1916e63e813452f81dd45a /arch/powerpc/kvm | |
parent | 1b4d56b86a370a3785a33eba23e2e3009f5a03af (diff) | |
download | linux-stable-199b5763d329b43c88f6ad539db8a6c6b42f8edb.tar.gz linux-stable-199b5763d329b43c88f6ad539db8a6c6b42f8edb.tar.bz2 linux-stable-199b5763d329b43c88f6ad539db8a6c6b42f8edb.zip |
KVM: add spinlock optimization framework
If a vcpu exits due to request a user mode spinlock, then
the spinlock-holder may be preempted in user mode or kernel mode.
(Note that not all architectures trap spin loops in user mode,
only AMD x86 and ARM/ARM64 currently do).
But if a vcpu exits in kernel mode, then the holder must be
preempted in kernel mode, so we should choose a vcpu in kernel mode
as a more likely candidate for the lock holder.
This introduces kvm_arch_vcpu_in_kernel() to decide whether the
vcpu is in kernel-mode when it's preempted. kvm_vcpu_on_spin's
new argument says the same of the spinning VCPU.
Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r-- | arch/powerpc/kvm/powerpc.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index 1a75c0b5f4ca..3480faaf1ef8 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -58,6 +58,11 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) return !!(v->arch.pending_exceptions) || kvm_request_pending(v); } +bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu) +{ + return false; +} + int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu) { return 1; |