qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Emilio G. Cota" <cota@braap.org>
Cc: qemu-devel@nongnu.org,
	"Pavel Dovgalyuk" <Pavel.Dovgaluk@ispras.ru>,
	"Lluís Vilanova" <vilanova@ac.upc.edu>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Stefan Hajnoczi" <stefanha@gmail.com>
Subject: Re: [Qemu-devel] [RFC 04/48] exec: introduce qemu_xxhash{2, 4, 5, 6, 7}
Date: Wed, 14 Nov 2018 13:04:56 +0000	[thread overview]
Message-ID: <8736s3ernr.fsf@linaro.org> (raw)
In-Reply-To: <20181025172057.20414-5-cota@braap.org>


Emilio G. Cota <cota@braap.org> writes:

> Before moving them all to include/qemu/xxhash.h.
>
> Signed-off-by: Emilio G. Cota <cota@braap.org>

Reviewed-by: Alex Bennée <alex.bennee@linaro.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 2089e2bed1..2ea132fe57 100644
> --- a/tests/qht-bench.c
> +++ b/tests/qht-bench.c
> @@ -104,7 +104,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)


--
Alex Bennée

  reply	other threads:[~2018-11-14 13:05 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-25 17:20 [Qemu-devel] [RFC 00/48] Plugin support Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 01/48] cpu: introduce run_on_cpu_no_bql Emilio G. Cota
2018-11-14 11:30   ` Alex Bennée
2018-11-14 17:08     ` Emilio G. Cota
2018-11-14 18:23       ` Alex Bennée
2018-10-25 17:20 ` [Qemu-devel] [RFC 02/48] trace: expand mem_info:size_shift to 3 bits Emilio G. Cota
2018-11-14 13:03   ` Alex Bennée
2018-11-14 17:17     ` Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 03/48] tcg/README: fix typo s/afterwise/afterwards/ Emilio G. Cota
2018-11-14 13:03   ` Alex Bennée
2018-10-25 17:20 ` [Qemu-devel] [RFC 04/48] exec: introduce qemu_xxhash{2,4,5,6,7} Emilio G. Cota
2018-11-14 13:04   ` Alex Bennée [this message]
2018-10-25 17:20 ` [Qemu-devel] [RFC 05/48] include: move exec/tb-hash-xx.h to qemu/xxhash.h Emilio G. Cota
2018-11-14 13:05   ` Alex Bennée
2018-10-25 17:20 ` [Qemu-devel] [RFC 06/48] tcg: use QHT for helper_table Emilio G. Cota
2018-11-14 14:41   ` Alex Bennée
2018-11-14 17:50     ` Emilio G. Cota
2018-11-14 16:11   ` Alex Bennée
2018-11-14 17:52     ` Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 07/48] tcg: export TCGHelperInfo Emilio G. Cota
2018-11-14 16:12   ` Alex Bennée
2018-10-25 17:20 ` [Qemu-devel] [RFC 08/48] tcg: export tcg_gen_runtime_helper Emilio G. Cota
2018-11-14 16:44   ` Alex Bennée
2018-10-25 17:20 ` [Qemu-devel] [RFC 09/48] tcg: reset runtime helpers when flushing the code cache Emilio G. Cota
2018-11-14 17:01   ` Alex Bennée
2018-11-14 17:59     ` Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 10/48] exec: export do_tb_flush Emilio G. Cota
2018-11-22 17:09   ` Alex Bennée
2018-11-23 23:19     ` Emilio G. Cota
2018-11-26 11:11       ` Alex Bennée
2018-11-26 23:56         ` Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 11/48] atomic_template: fix indentation in GEN_ATOMIC_HELPER Emilio G. Cota
2018-11-22 17:09   ` Alex Bennée
2018-10-25 17:20 ` [Qemu-devel] [RFC 12/48] atomic_template: define pre/post macros Emilio G. Cota
2018-11-22 17:12   ` Alex Bennée
2018-11-24  0:09     ` Emilio G. Cota
2018-11-26 11:21       ` Alex Bennée
2018-11-27  1:16         ` Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 13/48] xxhash: add qemu_xxhash8 Emilio G. Cota
2018-11-22 17:15   ` Alex Bennée
2018-11-23 22:34     ` Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 14/48] plugin: preliminary user-facing API Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 15/48] plugin: add core code Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 16/48] tcg: add plugin_mask to TB hash Emilio G. Cota
2018-11-23 16:52   ` Alex Bennée
2018-11-24  0:02     ` Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 17/48] plugin-gen: add TCG code generation helpers Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 18/48] tcg: add memory callbacks for plugins (WIP) Emilio G. Cota
2018-11-23 16:55   ` Alex Bennée
2018-10-25 17:20 ` [Qemu-devel] [RFC 19/48] translate-all: notify plugin code of tb_flush Emilio G. Cota
2018-11-23 17:00   ` Alex Bennée
2018-11-23 23:15     ` Emilio G. Cota
2018-11-26 11:02       ` Alex Bennée
2018-11-26 21:53         ` Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 20/48] *-user: notify plugin of exit Emilio G. Cota
2018-11-23 17:01   ` Alex Bennée
2018-10-25 17:20 ` [Qemu-devel] [RFC 21/48] *-user: plugin syscalls Emilio G. Cota
2018-11-23 17:04   ` Alex Bennée
2018-11-24  0:03     ` Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 22/48] cpu: hook plugin vcpu events Emilio G. Cota
2018-11-23 17:10   ` Alex Bennée
2018-11-23 23:48     ` Emilio G. Cota
2018-11-26 11:17       ` Alex Bennée
2018-11-27  1:25         ` Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 23/48] translator: add plugin_insn argument to translate_insn Emilio G. Cota
2018-11-26 14:52   ` Alex Bennée
2018-11-26 18:27     ` Richard Henderson
2018-11-26 18:56       ` Alex Bennée
2018-11-26 19:19         ` Richard Henderson
2018-11-26 19:07       ` Emilio G. Cota
2018-11-26 19:30         ` Richard Henderson
2018-11-27  1:38           ` Emilio G. Cota
2018-11-28  0:54             ` Emilio G. Cota
2018-11-28  1:12               ` Emilio G. Cota
2018-11-28 12:40               ` Alex Bennée
2018-11-28 14:43                 ` Emilio G. Cota
2018-11-27 13:08         ` Pavel Dovgalyuk
2018-10-25 17:20 ` [Qemu-devel] [RFC 24/48] translator: add .ctx_base_offset and .ctx_size to TranslatorOps Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 25/48] target/arm: prepare for 2-pass translation Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 26/48] target/ppc: " Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 27/48] target/sh4: prepare for 2-pass translation (WIP) Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 28/48] target/i386: prepare for 2-pass translation Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 29/48] target/hppa: " Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 30/48] target/m68k: " Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 31/48] target/mips: prepare for 2-pass translation (WIP) Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 32/48] target/alpha: prepare for 2-pass translation Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 33/48] target/riscv: " Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 34/48] target/s390x: " Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 35/48] target/sparc: " Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 36/48] target/xtensa: " Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 37/48] target/openrisc: " Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 38/48] translator: implement " Emilio G. Cota
2018-11-26 15:16   ` Alex Bennée
2018-11-27  2:16     ` Emilio G. Cota
2018-11-27 14:48       ` Alex Bennée
2018-11-27 19:06         ` Emilio G. Cota
2018-11-28  2:30           ` Emilio G. Cota
2018-11-28 12:50             ` Alex Bennée
2018-11-28 15:03               ` Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 39/48] plugin: add API symbols to qemu-plugins.symbols Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 40/48] plugin: let plugins control the virtual clock Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 41/48] configure: add --enable-plugins Emilio G. Cota
2018-11-27 12:11   ` Alex Bennée
2018-11-27 17:08     ` Emilio G. Cota
2018-11-27 12:43   ` Roman Bolshakov
2018-11-27 23:13     ` Emilio G. Cota
2018-11-28 10:43       ` Roman Bolshakov
2018-11-28 17:23         ` Emilio G. Cota
2018-11-29  9:57           ` Roman Bolshakov
2018-11-29 17:00             ` Emilio G. Cota
2018-11-29 17:49               ` Emilio G. Cota
2018-11-29 19:34                 ` Roman Bolshakov
2018-10-25 17:20 ` [Qemu-devel] [RFC 42/48] vl: support -plugin option Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 43/48] linux-user: " Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 44/48] cpus: lockstep execution support Emilio G. Cota
2018-11-14 16:43   ` Alex Bennée
2018-11-14 18:33     ` Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 45/48] plugin: " Emilio G. Cota
2018-11-27 18:20   ` Alex Bennée
2018-11-27 19:19     ` Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 46/48] plugin: add plugin-chan PCI device Emilio G. Cota
2018-10-25 17:20 ` [Qemu-devel] [RFC 47/48] plugin: support guest hooks Emilio G. Cota
2018-11-27 18:28   ` Alex Bennée
2018-10-25 17:20 ` [Qemu-devel] [RFC 48/48] plugin: add a couple of very simple examples Emilio G. Cota
2018-10-29 10:59   ` Pavel Dovgalyuk
2018-10-29 16:38     ` Emilio G. Cota
2018-11-28 11:28   ` Alex Bennée
2018-11-28 14:48     ` Emilio G. Cota
2018-11-29 20:45   ` Roman Bolshakov
2018-12-08 23:32     ` Emilio G. Cota
2018-10-29  9:48 ` [Qemu-devel] [RFC 00/48] Plugin support Pavel Dovgalyuk
2018-10-29 16:45   ` Emilio G. Cota

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=8736s3ernr.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=Pavel.Dovgaluk@ispras.ru \
    --cc=cota@braap.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=vilanova@ac.upc.edu \
    /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).