Re: [Qemu-devel] [PATCH 2/8] timers: add timer_mod_anticipate and timer_mod_anticipate_ns

2013-10-08 Thread Alex Bligh
On 8 Oct 2013, at 10:25, Paolo Bonzini wrote: > Il 08/10/2013 11:15, Alex Bligh ha scritto: >> So "if we want to alter it" ... >> +if (ts->expire_time != -1) { +timer_del_locked(timer_list, ts); +} >> What's this bit for? Surely you've calculated whethe

Re: [Qemu-devel] [PATCH 2/8] timers: add timer_mod_anticipate and timer_mod_anticipate_ns

2013-10-08 Thread Paolo Bonzini
Il 08/10/2013 11:15, Alex Bligh ha scritto: > So "if we want to alter it" ... > >> > +if (ts->expire_time != -1) { >> > +timer_del_locked(timer_list, ts); >> > +} > What's this bit for? Surely you've calculated whether you are > shortening the expiry time (above), so al

Re: [Qemu-devel] [PATCH 2/8] timers: add timer_mod_anticipate and timer_mod_anticipate_ns

2013-10-08 Thread Alex Bligh
Paolo, On 8 Oct 2013, at 09:47, Paolo Bonzini wrote: > > --- a/qemu-timer.c > +++ b/qemu-timer.c > @@ -393,11 +393,40 @@ void timer_mod_ns(QEMUTimer *ts, int64_t expire_time) > } > } > > +/* modify the current timer so that it will be fired when current_time > + >= expire_time or the curre

[Qemu-devel] [PATCH 2/8] timers: add timer_mod_anticipate and timer_mod_anticipate_ns

2013-10-08 Thread Paolo Bonzini
These let a user anticipate the deadline of a timer, atomically with other sites that call the function. This helps avoiding complicated lock hierarchies. It is useful whenever the timer does work based on the current value of the clock (rather than doing something periodically on every tick). S