From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
alex@alex.org.uk, rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH 0/3] qemu-timer: make QEMUTimer functions thread-safe
Date: Thu, 18 Jul 2013 12:00:40 +0800 [thread overview]
Message-ID: <20130718040040.GC26596@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1373027986-17868-1-git-send-email-stefanha@redhat.com>
On Fri, Jul 05, 2013 at 02:39:43PM +0200, Stefan Hajnoczi wrote:
> This series makes the following functions thread-safe:
>
> qemu_mod_timer_ns()
> qemu_mod_timer()
> qemu_del_timer()
> qemu_timer_pending()
>
> The following were already thread-safe:
>
> qemu_free_timer()
> qemu_new_timer()
> qemu_timer_expired()
>
> Now it is possible to use QEMUTimer outside the QEMU global mutex. Timer
> callbacks are still invoked from the main loop. If a thread wishes to run
> timer callbacks it must use a thread-safe QEMUBH (which Ping Fan Liu is working
> on).
>
> Note that host_clock is not thread-safe because it keeps state and invokes
> reset notifiers. Device emulation threads mostly care about vm_clock, so this
> is not a problem.
>
> Stefan Hajnoczi (3):
> qemu-timer: drop outdated signal safety comments
> qemu-timer: add QEMUClock->active_timers list lock
> qemu-timer: add qemu_alarm_timer->timer_modified_lock
>
> qemu-timer.c | 129 +++++++++++++++++++++++++++++++++++++++++------------------
> 1 file changed, 90 insertions(+), 39 deletions(-)
I'm rethinking this patch series. If we go ahead and give every
AioContext a QEMUClock which also fires during aio_poll(), then
thread-safety is no longer an issue because:
1. Event loops like the dataplane thread will use the AioContext
QEMUClock since are based purely on aio_poll().
2. The AioContext timers are implemented using g_poll()/ppoll() timeout
in the same thread instead of global mechanisms (like signals). It's
not necessary to access timers from multiple threads.
Leaving this series for now unless someone needs thread-safe QEMUTimer,
in which case I can finish it off.
Stefan
prev parent reply other threads:[~2013-07-18 4:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-05 12:39 [Qemu-devel] [PATCH 0/3] qemu-timer: make QEMUTimer functions thread-safe Stefan Hajnoczi
2013-07-05 12:39 ` [Qemu-devel] [PATCH 1/3] qemu-timer: drop outdated signal safety comments Stefan Hajnoczi
2013-07-05 17:52 ` Jan Kiszka
2013-07-05 12:39 ` [Qemu-devel] [PATCH 2/3] qemu-timer: add QEMUClock->active_timers list lock Stefan Hajnoczi
2013-07-05 13:01 ` Paolo Bonzini
2013-07-05 12:39 ` [Qemu-devel] [PATCH 3/3] qemu-timer: add qemu_alarm_timer->timer_modified_lock Stefan Hajnoczi
2013-07-05 17:51 ` [Qemu-devel] [PATCH 0/3] qemu-timer: make QEMUTimer functions thread-safe Jan Kiszka
2013-07-15 12:45 ` Paolo Bonzini
2013-07-15 12:57 ` Jan Kiszka
2013-07-15 13:38 ` Paolo Bonzini
2013-07-18 4:00 ` Stefan Hajnoczi [this message]
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=20130718040040.GC26596@stefanha-thinkpad.redhat.com \
--to=stefanha@redhat.com \
--cc=alex@alex.org.uk \
--cc=aliguori@us.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).