* [Qemu-devel] [PATCH 0/4] xxhash patches for 4.0 @ 2018-11-23 23:02 Emilio G. Cota 2018-11-23 23:02 ` [Qemu-devel] [PATCH 1/4] qht-bench: document -p flag Emilio G. Cota ` (4 more replies) 0 siblings, 5 replies; 8+ messages in thread From: Emilio G. Cota @ 2018-11-23 23:02 UTC (permalink / raw) To: qemu-devel; +Cc: Alex Bennée, Richard Henderson (Plus a qht-bench trivial patch.) Note that these apply on top of rth's tcg-next-for-4.0. Thanks, Emilio ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 1/4] qht-bench: document -p flag 2018-11-23 23:02 [Qemu-devel] [PATCH 0/4] xxhash patches for 4.0 Emilio G. Cota @ 2018-11-23 23:02 ` Emilio G. Cota 2018-11-28 14:57 ` Alex Bennée 2018-11-23 23:02 ` [Qemu-devel] [PATCH 2/4] exec: introduce qemu_xxhash{2,4,5,6,7} Emilio G. Cota ` (3 subsequent siblings) 4 siblings, 1 reply; 8+ messages in thread From: Emilio G. Cota @ 2018-11-23 23:02 UTC (permalink / raw) To: qemu-devel; +Cc: Alex Bennée, Richard Henderson Which we forgot to do in bd224fce60 ("qht-bench: add -p flag to precompute hash values", 2018-09-26). Signed-off-by: Emilio G. Cota <cota@braap.org> --- tests/qht-bench.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qht-bench.c b/tests/qht-bench.c index 2089e2bed1..636750d39f 100644 --- a/tests/qht-bench.c +++ b/tests/qht-bench.c @@ -72,6 +72,7 @@ static const char commands_string[] = " -n = number of threads\n" "\n" " -o = offset at which keys start\n" + " -p = precompute hashes\n" "\n" " -g = set -s,-k,-K,-l,-r to the same value\n" " -s = initial size hint\n" -- 2.17.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 1/4] qht-bench: document -p flag 2018-11-23 23:02 ` [Qemu-devel] [PATCH 1/4] qht-bench: document -p flag Emilio G. Cota @ 2018-11-28 14:57 ` Alex Bennée 0 siblings, 0 replies; 8+ messages in thread From: Alex Bennée @ 2018-11-28 14:57 UTC (permalink / raw) To: Emilio G. Cota; +Cc: qemu-devel, Richard Henderson Emilio G. Cota <cota@braap.org> writes: > Which we forgot to do in bd224fce60 ("qht-bench: add -p flag > to precompute hash values", 2018-09-26). > > Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> > --- > tests/qht-bench.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/tests/qht-bench.c b/tests/qht-bench.c > index 2089e2bed1..636750d39f 100644 > --- a/tests/qht-bench.c > +++ b/tests/qht-bench.c > @@ -72,6 +72,7 @@ static const char commands_string[] = > " -n = number of threads\n" > "\n" > " -o = offset at which keys start\n" > + " -p = precompute hashes\n" > "\n" > " -g = set -s,-k,-K,-l,-r to the same value\n" > " -s = initial size hint\n" -- Alex Bennée ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 2/4] exec: introduce qemu_xxhash{2,4,5,6,7} 2018-11-23 23:02 [Qemu-devel] [PATCH 0/4] xxhash patches for 4.0 Emilio G. Cota 2018-11-23 23:02 ` [Qemu-devel] [PATCH 1/4] qht-bench: document -p flag Emilio G. Cota @ 2018-11-23 23:02 ` Emilio G. Cota 2018-11-23 23:02 ` [Qemu-devel] [PATCH 3/4] include: move exec/tb-hash-xx.h to qemu/xxhash.h Emilio G. Cota ` (2 subsequent siblings) 4 siblings, 0 replies; 8+ messages in thread From: Emilio G. Cota @ 2018-11-23 23:02 UTC (permalink / raw) To: qemu-devel; +Cc: Alex Bennée, Richard Henderson Before moving them all to include/qemu/xxhash.h. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Emilio G. Cota <cota@braap.org> --- include/exec/tb-hash-xx.h | 41 +++++++++++++++++++++++++++++---------- include/exec/tb-hash.h | 2 +- tests/qht-bench.c | 2 +- util/qsp.c | 12 ++++++------ 4 files changed, 39 insertions(+), 18 deletions(-) diff --git a/include/exec/tb-hash-xx.h b/include/exec/tb-hash-xx.h index 747a9a612c..98ce4b628a 100644 --- a/include/exec/tb-hash-xx.h +++ b/include/exec/tb-hash-xx.h @@ -42,23 +42,23 @@ #define PRIME32_4 668265263U #define PRIME32_5 374761393U -#define TB_HASH_XX_SEED 1 +#define QEMU_XXHASH_SEED 1 /* * xxhash32, customized for input variables that are not guaranteed to be * contiguous in memory. */ static inline uint32_t -tb_hash_func7(uint64_t a0, uint64_t b0, uint32_t e, uint32_t f, uint32_t g) +qemu_xxhash7(uint64_t ab, uint64_t cd, uint32_t e, uint32_t f, uint32_t g) { - uint32_t v1 = TB_HASH_XX_SEED + PRIME32_1 + PRIME32_2; - uint32_t v2 = TB_HASH_XX_SEED + PRIME32_2; - uint32_t v3 = TB_HASH_XX_SEED + 0; - uint32_t v4 = TB_HASH_XX_SEED - PRIME32_1; - uint32_t a = a0 >> 32; - uint32_t b = a0; - uint32_t c = b0 >> 32; - uint32_t d = b0; + uint32_t v1 = QEMU_XXHASH_SEED + PRIME32_1 + PRIME32_2; + uint32_t v2 = QEMU_XXHASH_SEED + PRIME32_2; + uint32_t v3 = QEMU_XXHASH_SEED + 0; + uint32_t v4 = QEMU_XXHASH_SEED - PRIME32_1; + uint32_t a = ab >> 32; + uint32_t b = ab; + uint32_t c = cd >> 32; + uint32_t d = cd; uint32_t h32; v1 += a * PRIME32_2; @@ -98,4 +98,25 @@ tb_hash_func7(uint64_t a0, uint64_t b0, uint32_t e, uint32_t f, uint32_t g) return h32; } +static inline uint32_t qemu_xxhash2(uint64_t ab) +{ + return qemu_xxhash7(ab, 0, 0, 0, 0); +} + +static inline uint32_t qemu_xxhash4(uint64_t ab, uint64_t cd) +{ + return qemu_xxhash7(ab, cd, 0, 0, 0); +} + +static inline uint32_t qemu_xxhash5(uint64_t ab, uint64_t cd, uint32_t e) +{ + return qemu_xxhash7(ab, cd, e, 0, 0); +} + +static inline uint32_t qemu_xxhash6(uint64_t ab, uint64_t cd, uint32_t e, + uint32_t f) +{ + return qemu_xxhash7(ab, cd, e, f, 0); +} + #endif /* EXEC_TB_HASH_XX_H */ diff --git a/include/exec/tb-hash.h b/include/exec/tb-hash.h index 0526c4f678..731ba4c272 100644 --- a/include/exec/tb-hash.h +++ b/include/exec/tb-hash.h @@ -61,7 +61,7 @@ static inline uint32_t tb_hash_func(tb_page_addr_t phys_pc, target_ulong pc, uint32_t flags, uint32_t cf_mask, uint32_t trace_vcpu_dstate) { - return tb_hash_func7(phys_pc, pc, flags, cf_mask, trace_vcpu_dstate); + return qemu_xxhash7(phys_pc, pc, flags, cf_mask, trace_vcpu_dstate); } #endif diff --git a/tests/qht-bench.c b/tests/qht-bench.c index 636750d39f..0278f4da04 100644 --- a/tests/qht-bench.c +++ b/tests/qht-bench.c @@ -105,7 +105,7 @@ static bool is_equal(const void *ap, const void *bp) static uint32_t h(unsigned long v) { - return tb_hash_func7(v, 0, 0, 0, 0); + return qemu_xxhash2(v); } static uint32_t hval(unsigned long v) diff --git a/util/qsp.c b/util/qsp.c index a848b09c6d..dc29c41fde 100644 --- a/util/qsp.c +++ b/util/qsp.c @@ -135,13 +135,13 @@ QemuCondWaitFunc qemu_cond_wait_func = qemu_cond_wait_impl; * without it we still get a pretty unique hash. */ static inline -uint32_t do_qsp_callsite_hash(const QSPCallSite *callsite, uint64_t a) +uint32_t do_qsp_callsite_hash(const QSPCallSite *callsite, uint64_t ab) { - uint64_t b = (uint64_t)(uintptr_t)callsite->obj; + uint64_t cd = (uint64_t)(uintptr_t)callsite->obj; uint32_t e = callsite->line; uint32_t f = callsite->type; - return tb_hash_func7(a, b, e, f, 0); + return qemu_xxhash6(ab, cd, e, f); } static inline @@ -169,11 +169,11 @@ static uint32_t qsp_entry_no_thread_hash(const QSPEntry *entry) static uint32_t qsp_entry_no_thread_obj_hash(const QSPEntry *entry) { const QSPCallSite *callsite = entry->callsite; - uint64_t a = g_str_hash(callsite->file); - uint64_t b = callsite->line; + uint64_t ab = g_str_hash(callsite->file); + uint64_t cd = callsite->line; uint32_t e = callsite->type; - return tb_hash_func7(a, b, e, 0, 0); + return qemu_xxhash5(ab, cd, e); } static bool qsp_callsite_cmp(const void *ap, const void *bp) -- 2.17.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 3/4] include: move exec/tb-hash-xx.h to qemu/xxhash.h 2018-11-23 23:02 [Qemu-devel] [PATCH 0/4] xxhash patches for 4.0 Emilio G. Cota 2018-11-23 23:02 ` [Qemu-devel] [PATCH 1/4] qht-bench: document -p flag Emilio G. Cota 2018-11-23 23:02 ` [Qemu-devel] [PATCH 2/4] exec: introduce qemu_xxhash{2,4,5,6,7} Emilio G. Cota @ 2018-11-23 23:02 ` Emilio G. Cota 2018-11-23 23:02 ` [Qemu-devel] [PATCH 4/4] xxhash: match output against the original xxhash32 Emilio G. Cota 2018-12-14 0:45 ` [Qemu-devel] [PATCH 0/4] xxhash patches for 4.0 Richard Henderson 4 siblings, 0 replies; 8+ messages in thread From: Emilio G. Cota @ 2018-11-23 23:02 UTC (permalink / raw) To: qemu-devel; +Cc: Alex Bennée, Richard Henderson Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Emilio G. Cota <cota@braap.org> --- include/exec/tb-hash.h | 2 +- include/{exec/tb-hash-xx.h => qemu/xxhash.h} | 6 +++--- tests/qht-bench.c | 2 +- util/qsp.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) rename include/{exec/tb-hash-xx.h => qemu/xxhash.h} (97%) diff --git a/include/exec/tb-hash.h b/include/exec/tb-hash.h index 731ba4c272..4f3a37d927 100644 --- a/include/exec/tb-hash.h +++ b/include/exec/tb-hash.h @@ -20,7 +20,7 @@ #ifndef EXEC_TB_HASH_H #define EXEC_TB_HASH_H -#include "exec/tb-hash-xx.h" +#include "qemu/xxhash.h" #ifdef CONFIG_SOFTMMU diff --git a/include/exec/tb-hash-xx.h b/include/qemu/xxhash.h similarity index 97% rename from include/exec/tb-hash-xx.h rename to include/qemu/xxhash.h index 98ce4b628a..fe35dde328 100644 --- a/include/exec/tb-hash-xx.h +++ b/include/qemu/xxhash.h @@ -31,8 +31,8 @@ * - xxHash source repository : https://github.com/Cyan4973/xxHash */ -#ifndef EXEC_TB_HASH_XX_H -#define EXEC_TB_HASH_XX_H +#ifndef QEMU_XXHASH_H +#define QEMU_XXHASH_H #include "qemu/bitops.h" @@ -119,4 +119,4 @@ static inline uint32_t qemu_xxhash6(uint64_t ab, uint64_t cd, uint32_t e, return qemu_xxhash7(ab, cd, e, f, 0); } -#endif /* EXEC_TB_HASH_XX_H */ +#endif /* QEMU_XXHASH_H */ diff --git a/tests/qht-bench.c b/tests/qht-bench.c index 0278f4da04..ab4e708180 100644 --- a/tests/qht-bench.c +++ b/tests/qht-bench.c @@ -9,7 +9,7 @@ #include "qemu/atomic.h" #include "qemu/qht.h" #include "qemu/rcu.h" -#include "exec/tb-hash-xx.h" +#include "qemu/xxhash.h" struct thread_stats { size_t rd; diff --git a/util/qsp.c b/util/qsp.c index dc29c41fde..410f1ba004 100644 --- a/util/qsp.c +++ b/util/qsp.c @@ -61,7 +61,7 @@ #include "qemu/timer.h" #include "qemu/qht.h" #include "qemu/rcu.h" -#include "exec/tb-hash-xx.h" +#include "qemu/xxhash.h" enum QSPType { QSP_MUTEX, -- 2.17.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] [PATCH 4/4] xxhash: match output against the original xxhash32 2018-11-23 23:02 [Qemu-devel] [PATCH 0/4] xxhash patches for 4.0 Emilio G. Cota ` (2 preceding siblings ...) 2018-11-23 23:02 ` [Qemu-devel] [PATCH 3/4] include: move exec/tb-hash-xx.h to qemu/xxhash.h Emilio G. Cota @ 2018-11-23 23:02 ` Emilio G. Cota 2018-11-28 15:09 ` Alex Bennée 2018-12-14 0:45 ` [Qemu-devel] [PATCH 0/4] xxhash patches for 4.0 Richard Henderson 4 siblings, 1 reply; 8+ messages in thread From: Emilio G. Cota @ 2018-11-23 23:02 UTC (permalink / raw) To: qemu-devel; +Cc: Alex Bennée, Richard Henderson Change the order in which we extract a/b and c/d to match the output of the upstream xxhash32. Tested with: https://github.com/cota/xxhash/tree/qemu Signed-off-by: Emilio G. Cota <cota@braap.org> --- include/qemu/xxhash.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/qemu/xxhash.h b/include/qemu/xxhash.h index fe35dde328..076f1f6054 100644 --- a/include/qemu/xxhash.h +++ b/include/qemu/xxhash.h @@ -55,10 +55,10 @@ qemu_xxhash7(uint64_t ab, uint64_t cd, uint32_t e, uint32_t f, uint32_t g) uint32_t v2 = QEMU_XXHASH_SEED + PRIME32_2; uint32_t v3 = QEMU_XXHASH_SEED + 0; uint32_t v4 = QEMU_XXHASH_SEED - PRIME32_1; - uint32_t a = ab >> 32; - uint32_t b = ab; - uint32_t c = cd >> 32; - uint32_t d = cd; + uint32_t a = ab; + uint32_t b = ab >> 32; + uint32_t c = cd; + uint32_t d = cd >> 32; uint32_t h32; v1 += a * PRIME32_2; -- 2.17.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 4/4] xxhash: match output against the original xxhash32 2018-11-23 23:02 ` [Qemu-devel] [PATCH 4/4] xxhash: match output against the original xxhash32 Emilio G. Cota @ 2018-11-28 15:09 ` Alex Bennée 0 siblings, 0 replies; 8+ messages in thread From: Alex Bennée @ 2018-11-28 15:09 UTC (permalink / raw) To: Emilio G. Cota; +Cc: qemu-devel, Richard Henderson Emilio G. Cota <cota@braap.org> writes: > Change the order in which we extract a/b and c/d to > match the output of the upstream xxhash32. > > Tested with: > https://github.com/cota/xxhash/tree/qemu > > Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Alex Bennée <alex.bennee@linaro.org> > --- > include/qemu/xxhash.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/include/qemu/xxhash.h b/include/qemu/xxhash.h > index fe35dde328..076f1f6054 100644 > --- a/include/qemu/xxhash.h > +++ b/include/qemu/xxhash.h > @@ -55,10 +55,10 @@ qemu_xxhash7(uint64_t ab, uint64_t cd, uint32_t e, uint32_t f, uint32_t g) > uint32_t v2 = QEMU_XXHASH_SEED + PRIME32_2; > uint32_t v3 = QEMU_XXHASH_SEED + 0; > uint32_t v4 = QEMU_XXHASH_SEED - PRIME32_1; > - uint32_t a = ab >> 32; > - uint32_t b = ab; > - uint32_t c = cd >> 32; > - uint32_t d = cd; > + uint32_t a = ab; > + uint32_t b = ab >> 32; > + uint32_t c = cd; > + uint32_t d = cd >> 32; > uint32_t h32; > > v1 += a * PRIME32_2; -- Alex Bennée ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] [PATCH 0/4] xxhash patches for 4.0 2018-11-23 23:02 [Qemu-devel] [PATCH 0/4] xxhash patches for 4.0 Emilio G. Cota ` (3 preceding siblings ...) 2018-11-23 23:02 ` [Qemu-devel] [PATCH 4/4] xxhash: match output against the original xxhash32 Emilio G. Cota @ 2018-12-14 0:45 ` Richard Henderson 4 siblings, 0 replies; 8+ messages in thread From: Richard Henderson @ 2018-12-14 0:45 UTC (permalink / raw) To: Emilio G. Cota, qemu-devel; +Cc: Alex Bennée On 11/23/18 5:02 PM, Emilio G. Cota wrote: > (Plus a qht-bench trivial patch.) > > Note that these apply on top of rth's tcg-next-for-4.0. > > Thanks, Queued, thanks. r~ ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-12-14 0:45 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-11-23 23:02 [Qemu-devel] [PATCH 0/4] xxhash patches for 4.0 Emilio G. Cota 2018-11-23 23:02 ` [Qemu-devel] [PATCH 1/4] qht-bench: document -p flag Emilio G. Cota 2018-11-28 14:57 ` Alex Bennée 2018-11-23 23:02 ` [Qemu-devel] [PATCH 2/4] exec: introduce qemu_xxhash{2,4,5,6,7} Emilio G. Cota 2018-11-23 23:02 ` [Qemu-devel] [PATCH 3/4] include: move exec/tb-hash-xx.h to qemu/xxhash.h Emilio G. Cota 2018-11-23 23:02 ` [Qemu-devel] [PATCH 4/4] xxhash: match output against the original xxhash32 Emilio G. Cota 2018-11-28 15:09 ` Alex Bennée 2018-12-14 0:45 ` [Qemu-devel] [PATCH 0/4] xxhash patches for 4.0 Richard Henderson
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).