Re: [Qemu-devel] [PATCH v2 2/2] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe

2013-08-29 Thread Paolo Bonzini
Il 27/08/2013 10:23, Stefan Hajnoczi ha scritto: Introduce QEMUTimerList-active_timers_lock to protect the linked list of active timers. This allows qemu_timer_mod_ns() to be called from any thread. Note that vm_clock is not thread-safe and its use of qemu_clock_has_timers() works fine

Re: [Qemu-devel] [PATCH v2 2/2] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe

2013-08-29 Thread Stefan Hajnoczi
On Thu, Aug 29, 2013 at 12:00:12PM +0200, Paolo Bonzini wrote: Il 27/08/2013 10:23, Stefan Hajnoczi ha scritto: /* modify the current timer so that it will be fired when current_time = expire_time. The corresponding callback will be called. */ void timer_mod_ns(QEMUTimer *ts, int64_t

Re: [Qemu-devel] [PATCH v2 2/2] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe

2013-08-28 Thread Stefan Hajnoczi
On Tue, Aug 27, 2013 at 09:55:22AM +0100, Alex Bligh wrote: On 27 Aug 2013, at 09:23, Stefan Hajnoczi wrote: diff --git a/include/qemu/timer.h b/include/qemu/timer.h index e4934dd..b58903b 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -115,6 +115,10 @@ static inline

Re: [Qemu-devel] [PATCH v2 2/2] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe

2013-08-28 Thread Paolo Bonzini
Il 27/08/2013 10:55, Alex Bligh ha scritto: + * Note that this function should not be used when other threads also access + * the timer list. The return value may be outdated by the time it is acted + * upon. + * I'm in two minds as to whether there is a problem with the comment or the

[Qemu-devel] [PATCH v2 2/2] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe

2013-08-27 Thread Stefan Hajnoczi
Introduce QEMUTimerList-active_timers_lock to protect the linked list of active timers. This allows qemu_timer_mod_ns() to be called from any thread. Note that vm_clock is not thread-safe and its use of qemu_clock_has_timers() works fine today but is also not thread-safe. The purpose of this

Re: [Qemu-devel] [PATCH v2 2/2] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe

2013-08-27 Thread Alex Bligh
On 27 Aug 2013, at 09:23, Stefan Hajnoczi wrote: Introduce QEMUTimerList-active_timers_lock to protect the linked list of active timers. This allows qemu_timer_mod_ns() to be called from any thread. Note that vm_clock is not thread-safe and its use of qemu_clock_has_timers() works fine