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

2013-10-07 Thread Paolo Bonzini
Il 30/09/2013 15:34, Alex Bligh ha scritto: I think the most likely change here is that the walkers might move outside the BQL. Given modification of this list is so rare, the lock would be very very read heavy, so RCU is probably a sensible option. I agree. Keeping the write side on the

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

2013-10-07 Thread Mike Day
Paolo Bonzini pbonz...@redhat.com writes: Il 30/09/2013 15:34, Alex Bligh ha scritto: I think the most likely change here is that the walkers might move outside the BQL. Given modification of this list is so rare, the lock would be very very read heavy, so RCU is probably a sensible

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

2013-09-30 Thread Mike Day
Stefan Hajnoczi stefa...@redhat.com writes: 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

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

2013-09-30 Thread Alex Bligh
On 30 Sep 2013, at 13:45, Mike Day wrote: I've applied this set to Paolo's rcu tree - I see a couple of routines that appear to need the active_timers_lock: (line 137 of qemu-timer.c in my tree) void qemu_clock_notify(QEMUClockType type) { QEMUTimerList *timer_list; QEMUClock

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

2013-09-30 Thread Mike Day
On Mon, Sep 30, 2013 at 8:55 AM, Alex Bligh a...@alex.org.uk wrote: On 30 Sep 2013, at 13:45, Mike Day wrote: I've applied this set to Paolo's rcu tree - I see a couple of routines that appear to need the active_timers_lock: (line 137 of qemu-timer.c in my tree) void

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

2013-09-30 Thread Alex Bligh
Mike, void qemu_clock_notify(QEMUClockType type) ... int64_t qemu_clock_deadline_ns_all(QEMUClockType type) ... I think these functions are always called now with the BQL held, so I wonder if they are good candidates for RCU? These routines iterate through the list of timerlists held

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

2013-09-30 Thread Mike Day
On Mon, Sep 30, 2013 at 9:34 AM, Alex Bligh a...@alex.org.uk wrote: void qemu_clock_notify(QEMUClockType type) ... int64_t qemu_clock_deadline_ns_all(QEMUClockType type) ... I think these functions are always called now with the BQL held, so I wonder if they are good candidates for

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

2013-09-12 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