qemu-devel
[Top][All Lists]
Advanced

[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: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v6 3/7] trace: [tcg] Delay changes to dynamic state when translating
Date: Wed, 11 Jan 2017 16:16:40 +0000
User-agent: Mutt/1.7.1 (2016-10-04)

On Tue, Jan 10, 2017 at 05:31:37PM +0100, Paolo Bonzini wrote:
> 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?

I think so.

Stefan

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]