• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisão9fd9b7de61b24c70a8a82d9627a20ed95433e1b5 (tree)
Hora2019-02-06 12:39:24
AutorPeter Maydell <peter.maydell@lina...>
CommiterRichard Henderson

Mensagem de Log

accel/tcg: Consider cluster index in tb_lookupcpu_state()

In commit f7b78602fdc6c6e4be we added the CPU cluster number to the
cflags field of the TB hash; this included adding it to the value
kept in tb->cflags, since we pass that field directly into the hash
calculation in some places. Unfortunately we forgot to check whether
other parts of the code were doing comparisons against tb->cflags
that would need to be updated.

It turns out that there is exactly one such place: the
tb_lookupcpu_state() function checks whether the TB it has
found in the tb_jmp_cache has a tb->cflags matching the cf_mask
that is passed in. The tb->cflags has the cluster_index in it
but the cf_mask does not.

Hoist the "add cluster index to the cf_mask" code up from
tb_htable_lookup() to tb_lookupcpu_state() so it can be considered
in the "did this TB match in the jmp cache" condition, as well as
when we do the full hash lookup by physical PC, flags, etc.
(tb_htable_lookup() is only called from tb_lookup
cpu_state(),
so this change doesn't require any further knock-on changes.)

Fixes: f7b78602fdc6c6e4be ("accel/tcg: Add cluster number to TCG TB hash")
Tested-by: Cleber Rosa <crosa@redhat.com>
Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reported-by: Howard Spoelstra <hsp.cat7@gmail.com>
Reported-by: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20190205151810.571-1-peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Mudança Sumário

Diff

--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -325,9 +325,6 @@ TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc,
325325 struct tb_desc desc;
326326 uint32_t h;
327327
328- cf_mask &= ~CF_CLUSTER_MASK;
329- cf_mask |= cpu->cluster_index << CF_CLUSTER_SHIFT;
330-
331328 desc.env = (CPUArchState *)cpu->env_ptr;
332329 desc.cs_base = cs_base;
333330 desc.flags = flags;
--- a/include/exec/tb-lookup.h
+++ b/include/exec/tb-lookup.h
@@ -28,6 +28,10 @@ tb_lookup__cpu_state(CPUState *cpu, target_ulong *pc, target_ulong *cs_base,
2828 cpu_get_tb_cpu_state(env, pc, cs_base, flags);
2929 hash = tb_jmp_cache_hash_func(*pc);
3030 tb = atomic_rcu_read(&cpu->tb_jmp_cache[hash]);
31+
32+ cf_mask &= ~CF_CLUSTER_MASK;
33+ cf_mask |= cpu->cluster_index << CF_CLUSTER_SHIFT;
34+
3135 if (likely(tb &&
3236 tb->pc == *pc &&
3337 tb->cs_base == *cs_base &&