qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mike Day <ncmike@ncultra.org>
To: Alex Bligh <alex@alex.org.uk>
Cc: Anthony Liguori <anthony@codemonkey.ws>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Ping Fan Liu <pingfank@linux.vnet.ibm.com>,
	qemu-devel@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>
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	[thread overview]
Message-ID: <CAGaKXu3fxe9-+8x16y3FkUG68OCc0s1qGUW4L=xWGFxYLFKgHQ@mail.gmail.com> (raw)
In-Reply-To: <4C38C504-350E-4492-89A9-AFF84BAE9836@alex.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1711 bytes --]

>
>
> On Mon, Sep 30, 2013 at 8:55 AM, Alex Bligh <alex@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 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

[-- Attachment #2: Type: text/html, Size: 2358 bytes --]

  reply	other threads:[~2013-09-30 13:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12  9:02 [Qemu-devel] [PATCH v4 0/3] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe Stefan Hajnoczi
2013-09-12  9:02 ` [Qemu-devel] [PATCH v4 1/3] qemu-timer: drop outdated signal safety comments Stefan Hajnoczi
2013-09-12  9:02 ` [Qemu-devel] [PATCH v4 2/3] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe Stefan Hajnoczi
2013-09-30 12:45   ` Mike Day
2013-09-30 12:55     ` Alex Bligh
2013-09-30 13:18       ` Mike Day [this message]
2013-09-30 13:34         ` Alex Bligh
2013-09-30 14:31           ` Mike Day
2013-10-07 12:20           ` Paolo Bonzini
2013-10-07 16:14             ` Mike Day
2013-09-12  9:02 ` [Qemu-devel] [PATCH v4 3/3] qemu-timer: do not take the lock in timer_pending Stefan Hajnoczi
2013-09-18 13:51 ` [Qemu-devel] [PATCH v4 0/3] qemu-timer: make qemu_timer_mod_ns() and qemu_timer_del() thread-safe Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGaKXu3fxe9-+8x16y3FkUG68OCc0s1qGUW4L=xWGFxYLFKgHQ@mail.gmail.com' \
    --to=ncmike@ncultra.org \
    --cc=alex@alex.org.uk \
    --cc=anthony@codemonkey.ws \
    --cc=pbonzini@redhat.com \
    --cc=pingfank@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).