summaryrefslogtreecommitdiffstats
path: root/tcg/tcg-runtime.c
diff options
context:
space:
mode:
authorLluís Vilanova2017-07-04 10:42:32 +0200
committerStefan Hajnoczi2017-07-17 14:11:05 +0200
commit61a67f71dd7e437212a2730c4462dff9b3b7b3da (patch)
treef2f6baa00f0b9c9c6cd0c02fb5b184c0590e6bea /tcg/tcg-runtime.c
parenttrace: [tcg] Delay changes to dynamic state when translating (diff)
downloadqemu-61a67f71dd7e437212a2730c4462dff9b3b7b3da.tar.gz
qemu-61a67f71dd7e437212a2730c4462dff9b3b7b3da.tar.xz
qemu-61a67f71dd7e437212a2730c4462dff9b3b7b3da.zip
exec: [tcg] Use different TBs according to the vCPU's dynamic tracing state
Every vCPU now uses a separate set of TBs for each set of dynamic tracing event state values. Each set of TBs can be used by any number of vCPUs to maximize TB reuse when vCPUs have the same tracing state. This feature is later used by tracetool to optimize tracing of guest code events. The maximum number of TB sets is defined as 2^E, where E is the number of events that have the 'vcpu' property (their state is stored in CPUState->trace_dstate). For this to work, a change on the dynamic tracing state of a vCPU will force it to flush its virtual TB cache (which is only indexed by address), and fall back to the physical TB cache (which now contains the vCPU's dynamic tracing state as part of the hashing function). Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu> Reviewed-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Emilio G. Cota <cota@braap.org> Signed-off-by: Emilio G. Cota <cota@braap.org> Message-id: 149915775266.6295.10060144081246467690.stgit@frigg.lan Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'tcg/tcg-runtime.c')
-rw-r--r--tcg/tcg-runtime.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tcg/tcg-runtime.c b/tcg/tcg-runtime.c
index ec3a34e461..3e23649dd7 100644
--- a/tcg/tcg-runtime.c
+++ b/tcg/tcg-runtime.c
@@ -158,7 +158,8 @@ void *HELPER(lookup_tb_ptr)(CPUArchState *env, target_ulong addr)
if (unlikely(!(tb
&& tb->pc == addr
&& tb->cs_base == cs_base
- && tb->flags == flags))) {
+ && tb->flags == flags
+ && tb->trace_vcpu_dstate == *cpu->trace_dstate))) {
tb = tb_htable_lookup(cpu, addr, cs_base, flags);
if (!tb) {
return tcg_ctx.code_gen_epilogue;