qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 09/12] cpus: introduce cpu_update_icount help


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 09/12] cpus: introduce cpu_update_icount helper
Date: Wed, 5 Apr 2017 16:08:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0


On 05/04/2017 15:25, Alex Bennée wrote:
> +{
> +    int64_t executed = cpu_get_icount_executed(cpu);
> +    cpu->icount_budget -= executed;
> +    atomic_add(&timers_state.qemu_icount, executed);
> +}

Since there's only one writer, it's also okay to do

        atomic_set(&timers_state.qemu_icount,
                   atomic_read(&timers_state.qemu_icount) + executed);

(also not just faster, but also simpler to turn into TCG code if we do
the update in gen_io_start).

Paolo



reply via email to

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