[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 04/13] tcg: keep TCGContext's read-mostly fields
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [PATCH v2 04/13] tcg: keep TCGContext's read-mostly fields in a separate cache line |
Date: |
Tue, 25 Apr 2017 03:53:50 -0400 |
Upcoming changes will require reading from TCGContext from a
parallel fast path. Prepare for this by keeping the struct's
read-mostly fields in a separate cache line, thereby preventing
false cache line sharing.
Signed-off-by: Emilio G. Cota <address@hidden>
---
tcg/tcg.h | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/tcg/tcg.h b/tcg/tcg.h
index 5fdbfe3..b26f0ef 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -642,6 +642,20 @@ QEMU_BUILD_BUG_ON(OPPARAM_BUF_SIZE > (1 << 14));
QEMU_BUILD_BUG_ON(sizeof(TCGOp) > 8);
struct TCGContext {
+ /* Read-mostly fields go here to prevent false sharing */
+ struct {
+ GHashTable *helpers;
+
+ void *code_gen_prologue;
+ void *code_gen_buffer;
+ size_t code_gen_buffer_size;
+
+ /* Threshold to flush the translated code buffer. */
+ void *code_gen_highwater;
+
+ int code_gen_max_blocks;
+ } QEMU_ALIGNED(64);
+
uint8_t *pool_cur, *pool_end;
TCGPool *pool_first, *pool_current, *pool_first_large;
int nb_labels;
@@ -663,8 +677,6 @@ struct TCGContext {
tcg_insn_unit *code_ptr;
- GHashTable *helpers;
-
#ifdef CONFIG_PROFILER
/* profiling info */
int64_t tb_count1;
@@ -697,15 +709,8 @@ struct TCGContext {
here, because there's too much arithmetic throughout that relies
on addition and subtraction working on bytes. Rely on the GCC
extension that allows arithmetic on void*. */
- int code_gen_max_blocks;
- void *code_gen_prologue;
- void *code_gen_buffer;
- size_t code_gen_buffer_size;
void *code_gen_ptr;
- /* Threshold to flush the translated code buffer. */
- void *code_gen_highwater;
-
TBContext tb_ctx;
/* Track which vCPU triggers events */
--
2.7.4
- [Qemu-devel] [PATCH v2 11/13] target/i386: optimize cross-page direct jumps in softmmu, (continued)
- [Qemu-devel] [PATCH v2 11/13] target/i386: optimize cross-page direct jumps in softmmu, Emilio G. Cota, 2017/04/25
- [Qemu-devel] [PATCH v2 05/13] tcg-runtime: add lookup_tb_ptr helper, Emilio G. Cota, 2017/04/25
- [Qemu-devel] [PATCH v2 10/13] target/i386: introduce gen_jr() helper to jump to register, Emilio G. Cota, 2017/04/25
- [Qemu-devel] [PATCH v2 12/13] target/i386: optimize indirect branches, Emilio G. Cota, 2017/04/25
- [Qemu-devel] [PATCH v2 06/13] tcg: add goto_ptr opcode, Emilio G. Cota, 2017/04/25
- [Qemu-devel] [PATCH v2 09/13] target/arm: optimize indirect branches with TCG's goto_ptr, Emilio G. Cota, 2017/04/25
- [Qemu-devel] [PATCH v2 04/13] tcg: keep TCGContext's read-mostly fields in a separate cache line,
Emilio G. Cota <=
- [Qemu-devel] [PATCH v2 13/13] tb-hash: improve tb_jmp_cache hash function in user mode, Emilio G. Cota, 2017/04/25