summaryrefslogtreecommitdiff
path: root/arch/powerpc/kernel/idle_book3s.S
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2017-11-17 17:08:06 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2018-03-31 16:47:47 +0300
commit8c1c7fb0b5ec95c392e9b585a6cf8cde254308d3 (patch)
tree59df28bcb598514ca3c236f77e506e40a6d067ef /arch/powerpc/kernel/idle_book3s.S
parent3d4fbffdd703d2b968db443911f2147c732a4a48 (diff)
downloadlinux-8c1c7fb0b5ec95c392e9b585a6cf8cde254308d3.tar.xz
powerpc/64s/idle: avoid sync for KVM state when waking from idle
When waking from a CPU idle instruction (e.g., nap or stop), the sync for ordering the KVM secondary thread state can be avoided if there wakeup is coming from a kernel context rather than KVM context. This improves performance for ping-pong benchmark with the stop0 idle state by 0.46% for 2 threads in the same core, and 1.02% for different cores. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel/idle_book3s.S')
-rw-r--r--arch/powerpc/kernel/idle_book3s.S3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
index 2896ccf3138d..903ec2a5c76c 100644
--- a/arch/powerpc/kernel/idle_book3s.S
+++ b/arch/powerpc/kernel/idle_book3s.S
@@ -551,6 +551,9 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_300)
mr r3,r12
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
+ lbz r0,HSTATE_HWTHREAD_STATE(r13)
+ cmpwi r0,KVM_HWTHREAD_IN_KERNEL
+ beq 1f
li r0,KVM_HWTHREAD_IN_KERNEL
stb r0,HSTATE_HWTHREAD_STATE(r13)
/* Order setting hwthread_state vs. testing hwthread_req */