tb hash improvements
Pull v2, with the fixed ppc cpu_relax, and the two %lu fixes. Not re-sending the rest of the patch set.
r~
The following changes since commit a93c1bdf0bd4689287094ddb2aae3dc907da3535:
Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20160610-1' into staging (2016-06-10 15:47:17 +0100)
are available in the git repository at:
git://github.com/rth7680/qemu.git tags/pull-tcg-20160611
for you to fetch changes up to 329844d4bc3d5a11f1e63938d66f74c9584c7abc:
translate-all: add tb hash bucket info to 'info jit' dump (2016-06-11 17:11:16 -0700)
----------------------------------------------------------------
TB hashing improvements
----------------------------------------------------------------
Emilio G. Cota (14):
compiler.h: add QEMU_ALIGNED() to enforce struct alignment
seqlock: remove optional mutex
seqlock: rename write_lock/unlock to write_begin/end include/processor.h: define cpu_relax()
exec: add tb_hash_func5, derived from xxhash
tb hash: hash phys_pc, pc, and flags with xxhash
qdist: add module to represent frequency distributions of data
qdist: add test program
qht: QEMU's fast, resizable and scalable Hash Table
qht: add test program
qht: add qht-bench, a performance benchmark
qht: add test-qht-par to invoke qht-bench from 'check' target tb hash: track translated blocks with qht
translate-all: add tb hash bucket info to 'info jit' dump
Guillaume Delbergue (1):
qemu-thread: add simple test-and-set spinlock
cpu-exec.c | 92 ++--- cpus.c | 30 +- include/exec/exec-all.h | 2 - include/exec/tb-context.h | 7 +- include/exec/tb-hash-xx.h | 94 ++++++ include/exec/tb-hash.h | 7 +- include/qemu/compiler.h | 2 + include/qemu/processor.h | 30 ++ include/qemu/qdist.h | 63 ++++ include/qemu/qht.h | 183 ++++++++++ include/qemu/seqlock.h | 14 +- include/qemu/thread.h | 35 ++ tests/.gitignore | 4 + tests/Makefile.include | 14 +- tests/qht-bench.c | 488 +++++++++++++++++++++++++++ tests/test-qdist.c | 384 +++++++++++++++++++++ tests/test-qht-par.c | 56 ++++ tests/test-qht.c | 159 +++++++++ translate-all.c | 131 +++++--- util/Makefile.objs | 2 + util/qdist.c | 395 ++++++++++++++++++++++ util/qht.c | 833 ++++++++++++++++++++++++++++++++++++++++++++++ 22 files changed, 2893 insertions(+), 132 deletions(-) create mode 100644 include/exec/tb-hash-xx.h create mode 100644 include/qemu/processor.h create mode 100644 include/qemu/qdist.h create mode 100644 include/qemu/qht.h create mode 100644 tests/qht-bench.c create mode 100644 tests/test-qdist.c create mode 100644 tests/test-qht-par.c create mode 100644 tests/test-qht.c create mode 100644 util/qdist.c create mode 100644 util/qht.c
[Qemu-devel] [PULL v2 04/15] include/processor.h: define cpu_relax()
From: "Emilio G. Cota" <[email protected]>
Taken from the linux kernel.
Message-Id: <[email protected]>
--- include/qemu/processor.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 include/qemu/processor.h
include/qemu/processor.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Copyright (C) 2016, Emilio G. Cota <[email protected]> +* +* License: GNU GPL, version 2. +* See the COPYING file in the top-level directory. +*/ +#ifndef QEMU_PROCESSOR_H +#define QEMU_PROCESSOR_H + +#include "qemu/atomic.h" + +#if defined(__i386__) || defined(__x86_64__) +# define cpu_relax () asm volatile("rep; nop" ::: "memory") + +#elif defined(__ia64__) +# define cpu_relax () asm volatile("hint @pause" ::: "memory") + +#elif defined(__aarch64__) +# define cpu_relax () asm volatile("yield" ::: "memory") + +#elif defined(__powerpc64__) +/* set Hardware Multi-Threading (HMT) priority to low; then back to medium */ +# define cpu_relax () asm volatile("or 1, 1, 1;" \ + "or 2, 2, 2;" ::: "memory") + +#else +# define cpu_relax () barrier() +#endif + +#endif /* QEMU_PROCESSOR_H */
Signature · 1 line
2.5.5
[Qemu-devel] [PULL v2 12/15] qht: add qht-bench, a performance benchmark
In reply to Richard HendersonFrom: "Emilio G. Cota" <[email protected]>
This serves as a performance benchmark as well as a stress test for QHT. We can tweak quite a number of things, including the number of resize threads and how frequently resizes are triggered.
A performance comparison of QHT vs CLHT[1] and ck_hs[2] using this same benchmark program can be found here:
http://imgur.com/a/0Bms4
The tests are run on a 64-core AMD Opteron 6376, pinning threads to cores favoring same-socket cores. For each run, qht-bench is invoked with:
$ tests/qht-bench -d $duration -n $n -u $u -g $range , where $duration is in seconds, $n is the number of threads, $u is the update rate (0.0 to 100.0), and $range is the number of keys.
Note that ck_hs's performance drops significantly as writes go up, since it requires an external lock (I used a ck_spinlock) around every write.
Also, note that CLHT instead of using a seqlock, relies on an allocator that does not ever return the same address during the same read-critical section. This gives it a slight performance advantage over QHT on read-heavy workloads, since the seqlock writes aren't there.
[1] CLHT: https://github.com/LPD-EPFL/CLHT
https://infoscience.epfl.ch/record/207109/files/ascy_asplos15.pdf
[2] ck_hs: http://concurrencykit.org/
http://backtrace.io/blog/blog/2015/03/13/workload-specialization/
A few of those plots are shown in text here, since that site might not be online forever. Throughput is on Mops/s on the Y axis.
200K keys, 0 % updates
450 ++--+------+------+-------+-------+-------+-------+------+-------+--++
| + + + + + + + + +N+ |
400 ++ ---+E+ ++
| +++---- |
350 ++ 9 ++------+------++ --+E+ -+H+ ++
| | +H+- | -+N+---- ---- +++ |
300 ++ 8 ++ +E+ ++ -----+E+ --+H+ ++
| | +++ | -+N+-----+H+-- |
250 ++ 7 ++------+------++ +++-----+E+---- ++
200 ++ 1 -+E+-----+H+ ++
| ---- qht +-E--+ |
150 ++ -+E+ clht +-H--+ ++
| ---- ck +-N--+ |
100 ++ +E+ ++
| ---- |
50 ++ -+E+ ++
| +E+E+ + + + + + + + + |
0 ++--E------+------+-------+-------+-------+-------+------+-------+--++
1 8 16 24 32 40 48 56 64
Number of threads
200K keys, 1 % updates350 ++--+------+------+-------+-------+-------+-------+------+-------+--++
| + + + + + + + + -+E+ |
300 ++ -----+H+ ++
| +E+-- |
| 9 ++------+------++ +++---- |
250 ++ | +E+ -- | -+E+ ++
| 8 ++ -- ++ ---- |
200 ++ | +++- | +++ ---+E+ ++
| 7 ++------N------++ -+E+-- qht +-E--+ |
| 1 +++---- clht +-H--+ |
150 ++ -+E+ ck +-N--+ ++
| ---- |
100 ++ +E+ ++
| ---- |
| -+E+ |
50 ++ +H+-+N+----+N+-----+N+------ ++
| +E+E+ + + + +N+-----+N+-----+N+----+N+-----+N+ |
0 ++--E------+------+-------+-------+-------+-------+------+-------+--++
1 8 16 24 32 40 48 56 64
Number of threads
200K keys, 20 % updates300 ++--+------+------+-------+-------+-------+-------+------+-------+--++
| + + + + + + + + + |
| -+H+ |
250 ++ ---- ++
| 9 ++------+------++ --+H+ ---+E+ |
| 8 ++ +H+-- ++ -+H+----+E+-- |
200 ++ | +E+ --| -----+E+-- +++ ++
| 7 ++ + ---- ++ ---+H+---- +++ qht +-E--+ |
150 ++ 6 ++------N------++ -+H+-----+E+ clht +-H--+ ++
| 1 -----+E+-- ck +-N--+ |
| -+H+---- |
100 ++ -----+E+ ++
| +E+-- |
| ----+++ |
50 ++ -+E+ ++
| +E+ +++ |
| +E+N+-+N+-----+ + + + + + + |
0 ++--E------+------N-------N-------N-------N-------N------N-------N--++
1 8 16 24 32 40 48 56 64
Number of threads
200K keys, 100 % updates qht +-E--+
clht +-H--+
160 ++--+------+------+-------+-------+-------+-------+---ck-+-N-----+--++
| + + + + + + + + ----H |
140 ++ +H+-- -+E+ ++
| +++---- ---- |
120 ++ 8 ++------+------++ -+H+ +E+ ++
| 7 ++ +H+---- ++ ---- +++---- |
100 ++ | +E+ | +++ ---+H+ -+E+ ++
| 6 ++ +++ ++ -+H+-- +++---- |
80 ++ 5 ++------N----------+E+-----+E+ ++
| 1 -+H+---- +++ |
| -----+E+ |
60 ++ +H+---- +++ ++
| ----+E+ |
40 ++ +H+---- ++
| --+E+ |
20 ++ +E+ ++
| +EE+ + + + + + + + + |
0 ++--+N-N---N------N-------N-------N-------N-------N------N-------N--++
1 8 16 24 32 40 48 56 64
Number of threadsMessage-Id: <[email protected]>
--- tests/.gitignore | 1 + tests/Makefile.include | 3 +- tests/qht-bench.c | 488 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 491 insertions(+), 1 deletion(-) create mode 100644 tests/qht-bench.c
tests/.gitignore +1 -0
@@ -7,6 +7,7 @@ check-qnull check-qstring check-qom-interface check-qom-proplist +qht-bench rcutorture test-aio test-base64
tests/Makefile.include +2 -1
@@ -400,7 +400,7 @@ test-obj-y = tests/check-qint.o tests/check-qstring.o tests/check-qdict.o \ tests/test-opts-visitor.o tests/test-qmp-event.o \ tests/rcutorture.o tests/test-rcu-list.o \ tests/test-qdist.o \ - tests/test-qht.o + tests/test-qht.o tests/qht-bench.o $(test-obj-y): QEMU_INCLUDES += -Itests QEMU_CFLAGS += -I$(SRC_PATH)/tests
@@ -441,6 +441,7 @@ tests/rcutorture$(EXESUF): tests/rcutorture.o $(test-util-obj-y) tests/test-rcu-list$(EXESUF): tests/test-rcu-list.o $(test-util-obj-y) tests/test-qdist$(EXESUF): tests/test-qdist.o $(test-util-obj-y) tests/test-qht$(EXESUF): tests/test-qht.o $(test-util-obj-y) +tests/qht-bench$(EXESUF): tests/qht-bench.o $(test-util-obj-y) tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \ hw/core/qdev.o hw/core/qdev-properties.o hw/core/hotplug.o\
tests/qht-bench.c new file +488 -0
488 lines not on this page · raw message
Signature · 1 line
2.5.5
Peter Maydell
AppliedQuoted 13 lines · Richard Henderson
Pull v2, with the fixed ppc
cpu_relax, and the two %lu fixes. Not re-sending the rest of the patch set.r~
The following changes since commit
a93c1bdf0bd4689287094ddb2aae3dc907da3535:Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20160610-1' into staging (2016-06-10 15:47:17 +0100)
are available in the git repository at:
Quoted 8 lines
git://github.com/rth7680/qemu.gittags/pull-tcg-20160611for you to fetch changes up to
329844d4bc3d5a11f1e63938d66f74c9584c7abc:translate-all: add tb hash bucket info to 'info jit' dump (2016-06-11 17:11:16 -0700)
----------------------------------------------------------------
TB hashing improvements
Applied, thanks.
-- PMM