From: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
To: Waiman Long <Waiman.Long@hp.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
linux-arch@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org,
virtualization@lists.linux-foundation.org,
xen-devel@lists.xenproject.org, kvm@vger.kernel.org,
Paolo Bonzini <paolo.bonzini@gmail.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Rik van Riel <riel@redhat.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
David Vrabel <david.vrabel@citrix.com>,
Oleg Nesterov <oleg@redhat.com>, Gleb Natapov <gleb@redhat.com>,
Scott J Norton <scott.norton@hp.com>,
Chegu Vinod <chegu_vinod@hp.com>
Subject: Re: [PATCH v9 00/19] qspinlock: a 4-byte queue spinlock with PV support
Date: Sun, 27 Apr 2014 23:39:23 +0530 [thread overview]
Message-ID: <535D47D3.20202@linux.vnet.ibm.com> (raw)
In-Reply-To: <1397747051-15401-1-git-send-email-Waiman.Long@hp.com>
On 04/17/2014 08:33 PM, Waiman Long wrote:
> v8->v9:
> - Integrate PeterZ's version of the queue spinlock patch with some
> modification:
> http://lkml.kernel.org/r/20140310154236.038181843@infradead.org
> - Break the more complex patches into smaller ones to ease review effort.
> - Fix a racing condition in the PV qspinlock code.
>
> v7->v8:
> - Remove one unneeded atomic operation from the slowpath, thus
> improving performance.
> - Simplify some of the codes and add more comments.
> - Test for X86_FEATURE_HYPERVISOR CPU feature bit to enable/disable
> unfair lock.
> - Reduce unfair lock slowpath lock stealing frequency depending
> on its distance from the queue head.
> - Add performance data for IvyBridge-EX CPU.
>
> v6->v7:
> - Remove an atomic operation from the 2-task contending code
> - Shorten the names of some macros
> - Make the queue waiter to attempt to steal lock when unfair lock is
> enabled.
> - Remove lock holder kick from the PV code and fix a race condition
> - Run the unfair lock & PV code on overcommitted KVM guests to collect
> performance data.
>
> v5->v6:
> - Change the optimized 2-task contending code to make it fairer at the
> expense of a bit of performance.
> - Add a patch to support unfair queue spinlock for Xen.
> - Modify the PV qspinlock code to follow what was done in the PV
> ticketlock.
> - Add performance data for the unfair lock as well as the PV
> support code.
>
> v4->v5:
> - Move the optimized 2-task contending code to the generic file to
> enable more architectures to use it without code duplication.
> - Address some of the style-related comments by PeterZ.
> - Allow the use of unfair queue spinlock in a real para-virtualized
> execution environment.
> - Add para-virtualization support to the qspinlock code by ensuring
> that the lock holder and queue head stay alive as much as possible.
>
> v3->v4:
> - Remove debugging code and fix a configuration error
> - Simplify the qspinlock structure and streamline the code to make it
> perform a bit better
> - Add an x86 version of asm/qspinlock.h for holding x86 specific
> optimization.
> - Add an optimized x86 code path for 2 contending tasks to improve
> low contention performance.
>
> v2->v3:
> - Simplify the code by using numerous mode only without an unfair option.
> - Use the latest smp_load_acquire()/smp_store_release() barriers.
> - Move the queue spinlock code to kernel/locking.
> - Make the use of queue spinlock the default for x86-64 without user
> configuration.
> - Additional performance tuning.
>
> v1->v2:
> - Add some more comments to document what the code does.
> - Add a numerous CPU mode to support >= 16K CPUs
> - Add a configuration option to allow lock stealing which can further
> improve performance in many cases.
> - Enable wakeup of queue head CPU at unlock time for non-numerous
> CPU mode.
>
> This patch set has 3 different sections:
> 1) Patches 1-7: Introduces a queue-based spinlock implementation that
> can replace the default ticket spinlock without increasing the
> size of the spinlock data structure. As a result, critical kernel
> data structures that embed spinlock won't increase in size and
> break data alignments.
> 2) Patches 8-13: Enables the use of unfair queue spinlock in a
> virtual guest. This can resolve some of the locking related
> performance issues due to the fact that the next CPU to get the
> lock may have been scheduled out for a period of time.
> 3) Patches 14-19: Enable qspinlock para-virtualization support
> by halting the waiting CPUs after spinning for a certain amount of
> time. The unlock code will detect the a sleeping waiter and wake it
> up. This is essentially the same logic as the PV ticketlock code.
>
> The queue spinlock has slightly better performance than the ticket
> spinlock in uncontended case. Its performance can be much better
> with moderate to heavy contention. This patch has the potential of
> improving the performance of all the workloads that have moderate to
> heavy spinlock contention.
>
> The queue spinlock is especially suitable for NUMA machines with at
> least 2 sockets, though noticeable performance benefit probably won't
> show up in machines with less than 4 sockets.
>
> The purpose of this patch set is not to solve any particular spinlock
> contention problems. Those need to be solved by refactoring the code
> to make more efficient use of the lock or finer granularity ones. The
> main purpose is to make the lock contention problems more tolerable
> until someone can spend the time and effort to fix them.
For kvm part feel free to add:
Tested-by: Raghavendra K T <raghavendra.kt@linux.vnet.ibm.com>
V9 testing has shown no hangs.
I was able to do some performance testing. here are the results:
Overall we are seeing good improvement for pv-unfair version.
System : 32 cpu sandybridge with HT on. (4 node machine with 32 GB each)
Guest: 8GB with 16 vcpu/VM.
Average was taken over 8-10 data points.
Base = 3.15-rc2 with PRAVIRT_SPINLOCK = y
A = 3.15-rc2 + qspinlock v9 patch with QUEUE_SPINLOCK = y
PRAVIRT_SPINLOCK = y PARAVIRT_UNFAIR_LOCKS = y (unfair lock)
B = 3.15-rc2 + qspinlock v9 patch with QUEUE_SPINLOCK = y
PRAVIRT_SPINLOCK = n PARAVIRT_UNFAIR_LOCKS = n (queue spinlock without
paravirt)
C = 3.15-rc2 + qspinlock v9 patch with QUEUE_SPINLOCK = y
PRAVIRT_SPINLOCK = y PARAVIRT_UNFAIR_LOCKS = n (queue spinlock with
paravirt)
Ebizzy % improvements
========================
overcommit A B C
0.5x 4.4265 2.0611 1.5824
1.0x 0.9015 -7.7828 4.5443
1.5x 46.1162 -2.9845 -3.5046
2.0x 99.8150 -2.7116 4.7461
Dbench %improvements
overcommit A B C
0.5x 3.2617 3.5436 2.5676
1.0x 0.6302 2.2342 5.2201
1.5x 5.0027 4.8275 3.8375
2.0x 23.8242 4.5782 12.6067
Absolute values of base results: (overcommit, value, stdev)
Ebizzy ( records / sec with 120 sec run)
0.5x 20941.8750 (2%)
1.0x 17623.8750 (5%)
1.5x 5874.7778 (15%)
2.0x 3581.8750 (7%)
Dbench (throughput in MB/sec)
0.5x 10009.6610 (5%)
1.0x 6583.0538 (1%)
1.5x 3991.9622 (4%)
2.0x 2527.0613 (2.5%)
next prev parent reply other threads:[~2014-04-27 18:03 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-17 15:03 [PATCH v9 00/19] qspinlock: a 4-byte queue spinlock with PV support Waiman Long
2014-04-17 15:03 ` [PATCH v9 01/19] qspinlock: A simple generic 4-byte queue spinlock Waiman Long
2014-04-17 15:03 ` [PATCH v9 02/19] qspinlock, x86: Enable x86-64 to use " Waiman Long
2014-04-17 15:03 ` [PATCH v9 03/19] qspinlock: Add pending bit Waiman Long
2014-04-17 15:42 ` Peter Zijlstra
2014-04-17 21:20 ` Waiman Long
2014-04-18 8:13 ` Peter Zijlstra
2014-04-18 17:07 ` Waiman Long
2014-04-18 7:42 ` Ingo Molnar
2014-04-18 16:23 ` Waiman Long
2014-04-18 16:35 ` Konrad Rzeszutek Wilk
2014-04-18 18:12 ` Waiman Long
2014-04-17 15:03 ` [PATCH v9 04/19] qspinlock: Extract out the exchange of tail code word Waiman Long
2014-04-17 15:49 ` Peter Zijlstra
2014-04-17 21:28 ` Waiman Long
2014-04-18 8:15 ` Peter Zijlstra
2014-04-18 17:32 ` Waiman Long
2014-04-18 17:53 ` Peter Zijlstra
2014-04-18 18:13 ` Waiman Long
2014-04-17 15:03 ` [PATCH v9 05/19] qspinlock: Optimize for smaller NR_CPUS Waiman Long
2014-04-17 15:50 ` Peter Zijlstra
2014-04-17 21:29 ` Waiman Long
2014-04-17 15:51 ` Peter Zijlstra
2014-04-17 21:33 ` Waiman Long
2014-04-17 15:56 ` Peter Zijlstra
2014-04-17 21:46 ` Waiman Long
2014-04-18 8:27 ` Peter Zijlstra
2014-04-18 17:52 ` Waiman Long
2014-04-18 19:05 ` Peter Zijlstra
2014-04-18 21:40 ` Waiman Long
2014-04-23 14:23 ` Waiman Long
2014-04-23 14:56 ` Konrad Rzeszutek Wilk
2014-04-23 17:43 ` Waiman Long
2014-04-23 17:55 ` Konrad Rzeszutek Wilk
2014-04-23 22:24 ` Waiman Long
2014-04-23 23:48 ` Waiman Long
2014-04-17 15:58 ` Peter Zijlstra
2014-04-17 21:49 ` Waiman Long
2014-04-18 7:46 ` Ingo Molnar
2014-04-18 16:26 ` Waiman Long
2014-04-19 9:24 ` Ingo Molnar
2014-04-17 15:03 ` [PATCH v9 06/19] qspinlock: prolong the stay in the pending bit path Waiman Long
2014-04-17 16:36 ` Peter Zijlstra
2014-04-18 1:46 ` Waiman Long
2014-04-18 8:33 ` Peter Zijlstra
2014-04-18 18:07 ` Waiman Long
2014-04-17 15:03 ` [PATCH v9 07/19] qspinlock: Use a simple write to grab the lock, if applicable Waiman Long
2014-04-17 16:54 ` Peter Zijlstra
2014-04-17 15:04 ` [PATCH v9 08/19] qspinlock: Make a new qnode structure to support virtualization Waiman Long
2014-04-17 15:04 ` [PATCH v9 09/19] qspinlock: Prepare for unfair lock support Waiman Long
2014-04-17 15:04 ` [PATCH v9 10/19] qspinlock, x86: Allow unfair spinlock in a virtual guest Waiman Long
2014-04-17 15:04 ` [PATCH v9 11/19] qspinlock: Split the MCS queuing code into a separate slowerpath Waiman Long
2014-04-17 15:04 ` [PATCH v9 12/19] unfair qspinlock: Variable frequency lock stealing mechanism Waiman Long
2014-04-17 15:04 ` [PATCH v9 13/19] unfair qspinlock: Enable lock stealing in lock waiters Waiman Long
2014-04-17 15:04 ` [PATCH v9 14/19] pvqspinlock, x86: Rename paravirt_ticketlocks_enabled Waiman Long
2014-04-17 15:04 ` [PATCH v9 15/19] pvqspinlock, x86: Add PV data structure & methods Waiman Long
2014-04-17 15:04 ` [PATCH v9 16/19] pvqspinlock: Enable coexistence with the unfair lock Waiman Long
2014-04-17 15:04 ` [PATCH v9 17/19] pvqspinlock: Add qspinlock para-virtualization support Waiman Long
2014-04-17 15:04 ` [PATCH v9 18/19] pvqspinlock, x86: Enable PV qspinlock PV for KVM Waiman Long
2014-04-17 15:04 ` [PATCH v9 19/19] pvqspinlock, x86: Enable PV qspinlock for XEN Waiman Long
2014-04-17 17:23 ` [PATCH v9 00/19] qspinlock: a 4-byte queue spinlock with PV support Konrad Rzeszutek Wilk
2014-04-17 17:40 ` Raghavendra K T
2014-04-18 1:50 ` Waiman Long
2014-04-18 1:48 ` Waiman Long
2014-04-18 13:18 ` Konrad Rzeszutek Wilk
2014-04-18 17:05 ` Waiman Long
2014-04-27 18:09 ` Raghavendra K T [this message]
2014-05-07 15:00 ` Waiman Long
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=535D47D3.20202@linux.vnet.ibm.com \
--to=raghavendra.kt@linux.vnet.ibm.com \
--cc=Waiman.Long@hp.com \
--cc=chegu_vinod@hp.com \
--cc=david.vrabel@citrix.com \
--cc=gleb@redhat.com \
--cc=hpa@zytor.com \
--cc=konrad.wilk@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=paolo.bonzini@gmail.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=scott.norton@hp.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).