qemu-devel
[Top][All Lists]
Advanced

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

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


From: Mike Day
Subject: Re: [Qemu-devel] [PATCH v4 2/3] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe
Date: Mon, 30 Sep 2013 09:18:01 -0400


On Mon, Sep 30, 2013 at 8:55 AM, Alex Bligh <address@hidden> 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 qemu_clock_notify(QEMUClockType type)
> > {
> >    QEMUTimerList *timer_list;
> >    QEMUClock *clock = qemu_clock_ptr(type);
> >    QLIST_FOREACH(timer_list, &clock->timerlists, list) {
> >        timerlist_notify(timer_list);
> >    }
> > }
> >
> > (line 228 of qemu-timer.c in my tree)
> > int64_t qemu_clock_deadline_ns_all(QEMUClockType type)
> > {
> >    int64_t deadline = -1;
> >    QEMUTimerList *timer_list;
> >    QEMUClock *clock = qemu_clock_ptr(type);
> >    QLIST_FOREACH(timer_list, &clock->timerlists, list) {
> >        deadline = qemu_soonest_timeout(deadline,
> >                                        timerlist_deadline_ns(timer_list));
> >    }
> >    return deadline;
> > }
> >
> > 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 by
> a clock.
>
> They do not iterate through the list of active timers in a timer
> list. I believe the latter is what active_timers_lock protects.
>
> The list of timers attached to a clock is only modified when timers
> are created and deleted which is (currently) under the BQL.
>


Sorry, and thanks for the correction re: active_timers_lock. I should have said that clock->timerlists may need its own mutex if and when we remove the BQL from the timer code.

Mike


reply via email to

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