|
| From: | Paolo Bonzini |
| Subject: | Re: [Qemu-devel] [RFC PATCH v5 07/31] icount: implement icount requesting |
| Date: | Wed, 03 Dec 2014 11:17:49 +0100 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
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)?
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
This makes it clear that cpu_get_instructions_counter should raise
questions to a reviewer.
Paolo
| [Prev in Thread] | Current Thread | [Next in Thread] |