[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 25/26] accel/tcg: Add cluster number to TCG TB hash
From: |
Peter Maydell |
Subject: |
[Qemu-devel] [PULL 25/26] accel/tcg: Add cluster number to TCG TB hash |
Date: |
Mon, 28 Jan 2019 18:10:46 +0000 |
Include the cluster number in the hash we use to look
up TBs. This is important because a TB that is valid
for one cluster at a given physical address and set
of CPU flags is not necessarily valid for another:
the two clusters may have different views of physical
memory, or may have different CPU features (eg FPU
present or absent).
We put the cluster number in the high 8 bits of the
TB cflags. This gives us up to 256 clusters, which should
be enough for anybody. If we ever need more, or need
more bits in cflags for other purposes, we could make
tb_hash_func() take more data (and expand qemu_xxhash7()
to qemu_xxhash8()).
Signed-off-by: Peter Maydell <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Reviewed-by: Alistair Francis <address@hidden>
Reviewed-by: Edgar E. Iglesias <address@hidden>
Message-id: address@hidden
---
include/exec/exec-all.h | 4 +++-
accel/tcg/cpu-exec.c | 3 +++
accel/tcg/translate-all.c | 3 +++
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
index 815e5b1e838..aa7b81aaf01 100644
--- a/include/exec/exec-all.h
+++ b/include/exec/exec-all.h
@@ -351,9 +351,11 @@ struct TranslationBlock {
#define CF_USE_ICOUNT 0x00020000
#define CF_INVALID 0x00040000 /* TB is stale. Set with @jmp_lock held */
#define CF_PARALLEL 0x00080000 /* Generate code for a parallel context */
+#define CF_CLUSTER_MASK 0xff000000 /* Top 8 bits are cluster ID */
+#define CF_CLUSTER_SHIFT 24
/* cflags' mask for hashing/comparison */
#define CF_HASH_MASK \
- (CF_COUNT_MASK | CF_LAST_IO | CF_USE_ICOUNT | CF_PARALLEL)
+ (CF_COUNT_MASK | CF_LAST_IO | CF_USE_ICOUNT | CF_PARALLEL |
CF_CLUSTER_MASK)
/* Per-vCPU dynamic tracing state used to generate this TB */
uint32_t trace_vcpu_dstate;
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 870027d4359..6c4a33262f5 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -325,6 +325,9 @@ TranslationBlock *tb_htable_lookup(CPUState *cpu,
target_ulong pc,
struct tb_desc desc;
uint32_t h;
+ cf_mask &= ~CF_CLUSTER_MASK;
+ cf_mask |= cpu->cluster_index << CF_CLUSTER_SHIFT;
+
desc.env = (CPUArchState *)cpu->env_ptr;
desc.cs_base = cs_base;
desc.flags = flags;
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index 8cb8c8870e6..7364e8a071f 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -1688,6 +1688,9 @@ TranslationBlock *tb_gen_code(CPUState *cpu,
cflags |= CF_NOCACHE | 1;
}
+ cflags &= ~CF_CLUSTER_MASK;
+ cflags |= cpu->cluster_index << CF_CLUSTER_SHIFT;
+
buffer_overflow:
tb = tb_alloc(pc);
if (unlikely(!tb)) {
--
2.20.1
- [Qemu-devel] [PULL 15/26] tests/microbit-test: Check nRF51 UART functionality, (continued)
- [Qemu-devel] [PULL 15/26] tests/microbit-test: Check nRF51 UART functionality, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 17/26] xlnx-zynqmp: Don't create rpu-cluster if there are no RPUs, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 13/26] tests/libqtest: Introduce qtest_init_with_serial(), Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 18/26] aspeed/smc: fix default read value, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 21/26] aspeed/smc: snoop SPI transfers to fake dummy cycles, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 20/26] aspeed/smc: Add dummy data register, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 19/26] aspeed/smc: define registers for all possible CS, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 16/26] checkpatch: Don't emit spurious warnings about block comments, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 14/26] tests/microbit-test: Make test independent of global_qtest, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 26/26] gdbstub: Simplify gdb_get_cpu_pid() to use cpu->cluster_index, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 25/26] accel/tcg: Add cluster number to TCG TB hash,
Peter Maydell <=
- [Qemu-devel] [PULL 22/26] tests/microbit-test: Add tests for nRF51 NVMC, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 23/26] hw/arm/xlnx-zynqmp: Realize cluster after putting RPUs in it, Peter Maydell, 2019/01/28
- [Qemu-devel] [PULL 24/26] qom/cpu: Add cluster_index to CPUState, Peter Maydell, 2019/01/28