Skip to content

Commit 8c1c7fb

Browse files
npigginmpe
authored andcommitted
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>
1 parent 3d4fbff commit 8c1c7fb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/powerpc/kernel/idle_book3s.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,9 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_300)
551551
mr r3,r12
552552

553553
#ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
554+
lbz r0,HSTATE_HWTHREAD_STATE(r13)
555+
cmpwi r0,KVM_HWTHREAD_IN_KERNEL
556+
beq 1f
554557
li r0,KVM_HWTHREAD_IN_KERNEL
555558
stb r0,HSTATE_HWTHREAD_STATE(r13)
556559
/* Order setting hwthread_state vs. testing hwthread_req */

0 commit comments

Comments
 (0)