public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* RFC: Kernel lock elision for TSX
@ 2013-03-23  1:24 Andi Kleen
  2013-03-23  1:24 ` [PATCH 01/29] tsx: Add generic noop macros for RTM intrinsics Andi Kleen
                   ` (29 more replies)
  0 siblings, 30 replies; 50+ messages in thread
From: Andi Kleen @ 2013-03-23  1:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: torvalds, akpm, x86

This patchkit implements TSX lock elision for the kernel locks.
Lock elision uses hardware transactional memory to execute
locks in parallel.

This is just a RFC at this point, so that people can comment
on the code. Please send your feedback.
Code is against v3.9-rc3

Also available from:
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc.git
Branch: hle39/spinlock
The branch names may change as the tree is rebased.

For more details on the general elision concept please see:
http://halobates.de/adding-lock-elision-to-linux.pdf
http://lwn.net/Articles/533894/
Full TSX specification:
http://software.intel.com/file/41417 (chapter 8)

The patches provides the elision infrastructure and the changes
to the standard locks (rwsems, mutexes, spinlocks, rwspinlocks,
bit spinlocks) to elide.

The general strategy is to elide as many locks as possible, 
and use a combination of manual disabling and automatic
adaptation to handle lock regions that do not elide well.

Some additional kernel changes are also useful to fix common
transaction aborts. I have not included those in this patchkit,
but they will be submitted separately.  Many of these changes
improve general scalability, but improving cache line sharing
overhead.

Especially the adaptation algorithms have a lot of tunables.
The tuning is currently preliminary and will be revised later.

Some questions and answers:

- How much does it improve performance?
I cannot share any performance numbers at this point unfortunately.
Also please keep in mind that the tuning is very preliminary and
will be revised.

- How to test it:
You either need a system with Intel TSX. A qemu version with
TSX support is available from https://github.com/crjohns/qemu-tsx
and may also support the kernel (untested)

- The CONFIG_RTM_LOCKS option does not appear
Make sure CONFIG_PARAVIRT_GUEST and CONFIG_PARAVIRT_SPINLOCKS
is enabled. The spinlock code uses the paravirt locking infrastructure
to add elision.

- How does it interact with virtualization?
It cannot interoperate with Xen paravirtualized locks, but without 
them lock elision should work in virtualization. If the Xen
pvlocks are active spinlock elision will be disabled.
This may be fixed at some point.
There are some limitations in perf TSX PMU profiling with virtualization.

- How to tune it:
Use perf with the TSX extensions and the statistics exposed in
/sys/module/rtm_locks
You may need the latest hsw/pmu* branch from
git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-misc.git

- Why does this use RTM and not HLE
RTM is more flexible and we don't need HLE in this code.

Andi Kleen
ak@linux.intel.com
Speaking for myself only

^ permalink raw reply	[flat|nested] 50+ messages in thread

end of thread, other threads:[~2013-03-25  9:32 UTC | newest]

Thread overview: 50+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-23  1:24 RFC: Kernel lock elision for TSX Andi Kleen
2013-03-23  1:24 ` [PATCH 01/29] tsx: Add generic noop macros for RTM intrinsics Andi Kleen
2013-03-25  3:39   ` Michael Neuling
2013-03-25  8:19     ` Andi Kleen
2013-03-25  8:50       ` Michael Neuling
2013-03-23  1:24 ` [PATCH 02/29] x86, tsx: Add " Andi Kleen
2013-03-25  3:40   ` Michael Neuling
2013-03-25  8:15     ` Andi Kleen
2013-03-25  8:54       ` Michael Neuling
2013-03-25  9:32         ` Andi Kleen
2013-03-23  1:24 ` [PATCH 03/29] tsx: Add generic disable_txn macros Andi Kleen
2013-03-23  1:24 ` [PATCH 04/29] tsx: Add generic linux/elide.h macros Andi Kleen
2013-03-23  1:24 ` [PATCH 05/29] x86, tsx: Add a minimal RTM tester at bootup Andi Kleen
2013-03-23  1:25 ` [PATCH 06/29] checkpatch: Don't warn about if ((status = _xbegin()) == _XBEGIN_STARTED) Andi Kleen
2013-03-25  3:39   ` Michael Neuling
2013-03-23  1:25 ` [PATCH 07/29] x86, tsx: Don't abort immediately in __read/write_lock_failed Andi Kleen
2013-03-23  1:25 ` [PATCH 08/29] locking, tsx: Add support for arch_read/write_unlock_irq/flags Andi Kleen
2013-03-23  1:25 ` [PATCH 09/29] x86, xen: Support arch_spin_unlock_irq/flags Andi Kleen
2013-03-23  1:25 ` [PATCH 10/29] locking, tsx: Add support for arch_spin_unlock_irq/flags Andi Kleen
2013-03-23  1:25 ` [PATCH 11/29] x86, paravirt: Add support for arch_spin_unlock_flags/irq Andi Kleen
2013-03-23  1:25 ` [PATCH 12/29] x86, tsx: Add a per thread transaction disable count Andi Kleen
2013-03-23 11:51   ` Borislav Petkov
2013-03-23 13:51     ` Andi Kleen
2013-03-23 15:52       ` Borislav Petkov
2013-03-23 16:25         ` Borislav Petkov
2013-03-23 17:16         ` Linus Torvalds
2013-03-23 17:32           ` Borislav Petkov
2013-03-23 18:01           ` Andi Kleen
2013-03-23  1:25 ` [PATCH 13/29] params: Add a per cpu module param type Andi Kleen
2013-03-23  1:25 ` [PATCH 14/29] params: Add static key module param Andi Kleen
2013-03-23  1:25 ` [PATCH 15/29] x86, tsx: Add TSX lock elision infrastructure Andi Kleen
2013-03-23  1:25 ` [PATCH 16/29] locking, tsx: Allow architecture to control mutex fast path owner field Andi Kleen
2013-03-23  1:25 ` [PATCH 17/29] x86, tsx: Enable lock elision for mutexes Andi Kleen
2013-03-23  1:25 ` [PATCH 18/29] locking, tsx: Abort is mutex_is_locked() Andi Kleen
2013-03-23  1:25 ` [PATCH 19/29] x86, tsx: Add support for rwsem elision Andi Kleen
2013-03-23  1:25 ` [PATCH 20/29] x86, tsx: Enable elision for read write spinlocks Andi Kleen
2013-03-23  1:25 ` [PATCH 21/29] locking, tsx: Protect assert_spin_locked() with _xtest() Andi Kleen
2013-03-23  1:25 ` [PATCH 22/29] locking, tsx: Add a trace point for elision skipping Andi Kleen
2013-03-23  1:25 ` [PATCH 23/29] x86, tsx: Add generic per-lock adaptive lock elision support Andi Kleen
2013-03-23  1:25 ` [PATCH 24/29] x86, tsx: Use adaptive elision for mutexes Andi Kleen
2013-03-23  1:25 ` [PATCH 25/29] x86, tsx: Add adaption support for spinlocks Andi Kleen
2013-03-23  1:25 ` [PATCH 26/29] x86, tsx: Add adaptation support to rw spinlocks Andi Kleen
2013-03-23  1:25 ` [PATCH 27/29] locking, tsx: Add elision to bit spinlocks Andi Kleen
2013-03-23  1:25 ` [PATCH 28/29] x86, tsx: Add adaptive elision for rwsems Andi Kleen
2013-03-23  1:25 ` [PATCH 29/29] tsx: Add documentation for lock-elision Andi Kleen
2013-03-23 17:11 ` RFC: Kernel lock elision for TSX Linus Torvalds
2013-03-23 18:00   ` Andi Kleen
2013-03-23 18:02     ` Andi Kleen
2013-03-24 14:17     ` Benjamin Herrenschmidt
2013-03-25  0:59       ` Michael Neuling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox