[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v6 3/7] trace: [tcg] Delay changes to dynamic st
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH v6 3/7] trace: [tcg] Delay changes to dynamic state when translating |
Date: |
Tue, 10 Jan 2017 17:31:37 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 |
On 09/01/2017 18:01, Stefan Hajnoczi wrote:
> Or use a simpler scheme:
>
> struct CPUState {
> ...
> uint32_t dstate_update_count;
> };
>
> In trace_event_set_vcpu_state_dynamic():
>
> if (state) {
> trace_events_enabled_count++;
> set_bit(vcpu_id, vcpu->trace_dstate_delayed);
> atomic_inc(&vcpu->dstate_update_count, 1);
> (*ev->dstate)++;
> } ...
>
> In cpu_exec() and friends:
>
> last_dstate_update_count = atomic_read(&vcpu->dstate_update_count);
>
> tb = tb_find(cpu, last_tb, tb_exit);
> cpu_loop_exec_tb(cpu, tb, &last_tb, &tb_exit, &sc);
>
> /* apply and disable delayed dstate changes */
> if (unlikely(atomic_read(&cpu->dstate_update_count) !=
> last_dstate_update_count)) {
> bitmap_copy(cpu->trace_dstate, cpu->trace_dstate_delayed,
> trace_get_vcpu_event_count());
> }
>
> (You'll need to adjust the details but the update counter approach
> should be workable.)
Would it work to use async_run_on_cpu?
Thanks,
Paolo
signature.asc
Description: OpenPGP digital signature