]> git.proxmox.com Git - mirror_qemu.git/commit
accel/tcg: Consider cluster index in tb_lookup__cpu_state()
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 5 Feb 2019 15:18:10 +0000 (15:18 +0000)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 6 Feb 2019 03:39:24 +0000 (03:39 +0000)
commit9fd9b7de61b24c70a8a82d9627a20ed95433e1b5
tree3e8e78d3202d681c68d1e655245b3b4fd4336642
parent7400d6938c6d455c4eba2b80c06d60c8fa5c5ba3
accel/tcg: Consider cluster index in tb_lookup__cpu_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_lookup__cpu_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_lookup__cpu_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>
accel/tcg/cpu-exec.c
include/exec/tb-lookup.h