qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH v5 07/31] icount: implement icount requestin


From: Pavel Dovgaluk
Subject: Re: [Qemu-devel] [RFC PATCH v5 07/31] icount: implement icount requesting
Date: Thu, 4 Dec 2014 14:02:12 +0300

> From: Paolo Bonzini [mailto:address@hidden On Behalf Of Paolo Bonzini
> On 26/11/2014 11:39, Pavel Dovgalyuk wrote:
> > +int64_t cpu_get_instructions_counter(void)
> > +{
> > +    /* This function calls are synchnonized to timer changes,
> > +       calling cpu_get_instructions_counter_locked without lock is safe */
> > +    int64_t icount = timers_state.qemu_icount;
> > +    CPUState *cpu = current_cpu;
> > +
> > +    if (cpu) {
> > +        icount -= (cpu->icount_decr.u16.low + cpu->icount_extra);
> > +    }
> > +    return icount;
> 
> Why do you need to do this if !cpu_can_do_io(cpu)?

We save number of executed instruction when saving interrupt or exception event.
It leads to the call of cpu_get_instructions_counter() from cpu_exec function
(through several replay functions). It is correct (because no block is executing
at that moment) but is different to prior usage of icount requests.

> Perhaps a better name for the functions is
> 
> - cpu_get_instructions_counter_locked -> cpu_get_icount_raw
> 
> - cpu_get_instructions_counter -> cpu_get_icount_raw_nocheck

Ok, I'll rename these functions.


Pavel Dovgalyuk




reply via email to

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