|
Davidlohr Bueso |
42325b |
From 89340d0935c9296c7b8222b6eab30e67cb57ab82 Mon Sep 17 00:00:00 2001
|
|
Davidlohr Bueso |
42325b |
From: Wanpeng Li <wanpengli@tencent.com>
|
|
Davidlohr Bueso |
42325b |
Date: Mon, 9 Sep 2019 09:40:28 +0800
|
|
Davidlohr Bueso |
42325b |
Subject: [PATCH] Revert "locking/pvqspinlock: Don't wait if vCPU is preempted"
|
|
Davidlohr Bueso |
42325b |
Git-commit: 89340d0935c9296c7b8222b6eab30e67cb57ab82
|
|
Davidlohr Bueso |
42325b |
Patch-mainline: v5.4-rc1
|
|
Davidlohr Bueso |
42325b |
References: bsc#1050549
|
|
Davidlohr Bueso |
42325b |
|
|
Davidlohr Bueso |
42325b |
This patch reverts commit 75437bb304b20 (locking/pvqspinlock: Don't
|
|
Davidlohr Bueso |
42325b |
wait if vCPU is preempted). A large performance regression was caused
|
|
Davidlohr Bueso |
42325b |
by this commit. on over-subscription scenarios.
|
|
Davidlohr Bueso |
42325b |
|
|
Davidlohr Bueso |
42325b |
The test was run on a Xeon Skylake box, 2 sockets, 40 cores, 80 threads,
|
|
Davidlohr Bueso |
42325b |
with three VMs of 80 vCPUs each. The score of ebizzy -M is reduced from
|
|
Davidlohr Bueso |
42325b |
13000-14000 records/s to 1700-1800 records/s:
|
|
Davidlohr Bueso |
42325b |
|
|
Davidlohr Bueso |
42325b |
Host Guest score
|
|
Davidlohr Bueso |
42325b |
|
|
Davidlohr Bueso |
42325b |
vanilla w/o kvm optimizations upstream 1700-1800 records/s
|
|
Davidlohr Bueso |
42325b |
vanilla w/o kvm optimizations revert 13000-14000 records/s
|
|
Davidlohr Bueso |
42325b |
vanilla w/ kvm optimizations upstream 4500-5000 records/s
|
|
Davidlohr Bueso |
42325b |
vanilla w/ kvm optimizations revert 14000-15500 records/s
|
|
Davidlohr Bueso |
42325b |
|
|
Davidlohr Bueso |
42325b |
Exit from aggressive wait-early mechanism can result in premature yield
|
|
Davidlohr Bueso |
42325b |
and extra scheduling latency.
|
|
Davidlohr Bueso |
42325b |
|
|
Davidlohr Bueso |
42325b |
Actually, only 6% of wait_early events are caused by vcpu_is_preempted()
|
|
Davidlohr Bueso |
42325b |
being true. However, when one vCPU voluntarily releases its vCPU, all
|
|
Davidlohr Bueso |
42325b |
the subsequently waiters in the queue will do the same and the cascading
|
|
Davidlohr Bueso |
42325b |
effect leads to bad performance.
|
|
Davidlohr Bueso |
42325b |
|
|
Davidlohr Bueso |
42325b |
kvm optimizations:
|
|
Davidlohr Bueso |
42325b |
[1] commit d73eb57b80b (KVM: Boost vCPUs that are delivering interrupts)
|
|
Davidlohr Bueso |
42325b |
[2] commit 266e85a5ec9 (KVM: X86: Boost queue head vCPU to mitigate lock waiter preemption)
|
|
Davidlohr Bueso |
42325b |
|
|
Davidlohr Bueso |
42325b |
Tested-by: loobinliu@tencent.com
|
|
Davidlohr Bueso |
42325b |
Cc: Peter Zijlstra <peterz@infradead.org>
|
|
Davidlohr Bueso |
42325b |
Cc: Thomas Gleixner <tglx@linutronix.de>
|
|
Davidlohr Bueso |
42325b |
Cc: Ingo Molnar <mingo@kernel.org>
|
|
Davidlohr Bueso |
42325b |
Cc: Waiman Long <longman@redhat.com>
|
|
Davidlohr Bueso |
42325b |
Cc: Paolo Bonzini <pbonzini@redhat.com>
|
|
Davidlohr Bueso |
42325b |
Cc: Radim Krčmář <rkrcmar@redhat.com>
|
|
Davidlohr Bueso |
42325b |
Cc: loobinliu@tencent.com
|
|
Davidlohr Bueso |
42325b |
Cc: stable@vger.kernel.org
|
|
Davidlohr Bueso |
42325b |
Fixes: 75437bb304b20 (locking/pvqspinlock: Don't wait if vCPU is preempted)
|
|
Davidlohr Bueso |
42325b |
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
|
|
Davidlohr Bueso |
42325b |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
Davidlohr Bueso |
42325b |
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
|
|
Davidlohr Bueso |
42325b |
|
|
Davidlohr Bueso |
42325b |
---
|
|
Davidlohr Bueso |
42325b |
kernel/locking/qspinlock_paravirt.h | 2 +-
|
|
Davidlohr Bueso |
42325b |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
Davidlohr Bueso |
42325b |
|
|
Davidlohr Bueso |
42325b |
diff --git a/kernel/locking/qspinlock_paravirt.h b/kernel/locking/qspinlock_paravirt.h
|
|
Davidlohr Bueso |
42325b |
index 89bab079e7a4..e84d21aa0722 100644
|
|
Davidlohr Bueso |
42325b |
--- a/kernel/locking/qspinlock_paravirt.h
|
|
Davidlohr Bueso |
42325b |
+++ b/kernel/locking/qspinlock_paravirt.h
|
|
Davidlohr Bueso |
42325b |
@@ -269,7 +269,7 @@ pv_wait_early(struct pv_node *prev, int loop)
|
|
Davidlohr Bueso |
42325b |
if ((loop & PV_PREV_CHECK_MASK) != 0)
|
|
Davidlohr Bueso |
42325b |
return false;
|
|
Davidlohr Bueso |
42325b |
|
|
Davidlohr Bueso |
42325b |
- return READ_ONCE(prev->state) != vcpu_running || vcpu_is_preempted(prev->cpu);
|
|
Davidlohr Bueso |
42325b |
+ return READ_ONCE(prev->state) != vcpu_running;
|
|
Davidlohr Bueso |
42325b |
}
|
|
Davidlohr Bueso |
42325b |
|
|
Davidlohr Bueso |
42325b |
/*
|
|
Davidlohr Bueso |
42325b |
--
|
|
Davidlohr Bueso |
42325b |
2.16.4
|
|
Davidlohr Bueso |
42325b |
|