[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 3/4] exec: [tcg] Switch physical TB cache based
From: |
Lluís Vilanova |
Subject: |
Re: [Qemu-devel] [PATCH 3/4] exec: [tcg] Switch physical TB cache based on vCPU tracing state |
Date: |
Thu, 15 Sep 2016 14:57:06 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Lluís Vilanova writes:
> Uses the per-vCPU event state in CPUState->trace_dstate (a bitmap) as an
> index to a physical TB cache that will contain code specific to the set
> of dynamically enabled events.
> Two vCPUs tracing different events will execute code from different
> physical TB caches. Two vCPUs tracing the same events will execute code
> from the same physical TB cache.
> This is used on the next patch to optimize TCG code related to event
> tracing.
> Signed-off-by: Lluís Vilanova <address@hidden>
> ---
> cpu-exec.c | 6 ++++++
> trace/control-target.c | 2 ++
> trace/control.h | 3 +++
> translate-all.c | 23 +++++++++++++++++++++++
> translate-all.h | 26 ++++++++++++++++++++++++++
> 5 files changed, 60 insertions(+)
[...]
> diff --git a/translate-all.c b/translate-all.c
> index c864eee..c306cf4 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -1166,6 +1166,29 @@ static void tb_link_page(TranslationBlock *tb,
> tb_page_addr_t phys_pc,
> #endif
> }
> +void cpu_tb_cache_set_request(CPUState *cpu)
> +{
> + /*
> + * Request is taken from cpu->trace_dstate and lazily applied into
> + * cpu->tb_cache_idx at cpu_tb_cache_set_apply().
> + */
> + /* NOTE: Checked by all TBs in gen_tb_start(). */
> + cpu->tcg_exit_req = true;
> +}
> +
> +bool cpu_tb_cache_set_requested(CPUState *cpu)
> +{
> + return !bitmap_equal(cpu->trace_dstate, cpu->tb_cache_idx,
> + TRACE_VCPU_EVENT_COUNT);
> +}
> +
> +void cpu_tb_cache_set_apply(CPUState *cpu)
> +{
> + bitmap_copy(cpu->tb_cache_idx, cpu->tb_cache_idx,
> + TRACE_VCPU_EVENT_COUNT);
I forgot to update the patch before sending. This one should be:
bitmap_copy(cpu->tb_cache_idx, cpu->trace_dstate,
TRACE_VCPU_EVENT_COUNT);
I'll wait for other reviews before sending v2 with this fixed.
> + tb_flush_jmp_cache_all(cpu);
> +}
> +
> /* Called with mmap_lock held for user mode emulation. */
> TranslationBlock *tb_gen_code(CPUState *cpu,
> target_ulong pc, target_ulong cs_base,
[...]
Cheers,
Lluis