From: Stefan Hajnoczi <stefanha@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
David Gibson <david@gibson.dropbear.id.au>,
qemu-devel@nongnu.org, qemulist@gmail.com
Subject: Re: [Qemu-devel] [PATCH 02/12] qemu-thread: add QemuEvent
Date: Thu, 16 May 2013 12:15:31 +0200 [thread overview]
Message-ID: <20130516101531.GD8853@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <1368632937-32272-3-git-send-email-pbonzini@redhat.com>
On Wed, May 15, 2013 at 05:48:47PM +0200, Paolo Bonzini wrote:
> This emulates Win32 manual-reset events using futexes or conditional
> variables. Typical ways to use them are with multi-producer,
> single-consumer data structures, to test for a complex condition whose
> elements come from different threads:
>
> for (;;) {
> qemu_event_reset(ev);
> ... test complex condition ...
> if (condition is true) {
> break;
> }
> qemu_event_wait(ev);
> }
>
> Alternatively:
>
> ... compute condition ...
> if (condition) {
> do {
> qemu_event_wait(ev);
> qemu_event_reset(ev);
> ... compute condition ...
> } while(condition);
> qemu_event_set(ev);
> }
>
> QemuEvent provides a very fast userspace path in the common case when
> no other thread is waiting, or the event is not changing state. It
> is used to report RCU quiescent states to the thread calling
> synchronize_rcu (the latter being the single consumer), and to report
> call_rcu invocations to the thread that receives them.
It would be nice to describe the need for the Linux futex code. pthread
mutex/condvars are implemented in terms of futexes already, so how much
benefit is there - I thought they stay in userspace in the non-contended
case too?
Stefan
next prev parent reply other threads:[~2013-05-16 10:15 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-15 15:48 [Qemu-devel] [RFC PATCH 00/12] RCU implementation for QEMU Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 01/12] add a header file for atomic operations Paolo Bonzini
2013-05-15 16:11 ` Peter Maydell
2013-05-15 15:48 ` [Qemu-devel] [PATCH 02/12] qemu-thread: add QemuEvent Paolo Bonzini
2013-05-16 10:15 ` Stefan Hajnoczi [this message]
2013-05-16 10:49 ` Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 03/12] rcu: add rcu library Paolo Bonzini
2013-05-16 11:46 ` Stefan Hajnoczi
2013-05-17 4:36 ` liu ping fan
2013-05-17 7:08 ` liu ping fan
2013-05-17 7:35 ` Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 04/12] qemu-thread: register threads with RCU Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 05/12] rcu: add call_rcu Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 06/12] rcu: add rcutorture Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 07/12] rcu: allow nested calls to rcu_thread_offline/rcu_thread_online Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 08/12] qemu-thread: report RCU quiescent states Paolo Bonzini
2013-05-16 8:33 ` liu ping fan
2013-05-16 8:43 ` Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 09/12] event loop: " Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 10/12] cpus: " Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 11/12] block: " Paolo Bonzini
2013-05-15 15:48 ` [Qemu-devel] [PATCH 12/12] migration: " Paolo Bonzini
2013-05-15 16:03 ` [Qemu-devel] [RFC PATCH 00/12] RCU implementation for QEMU Peter Maydell
2013-05-15 16:17 ` Paolo Bonzini
2013-05-15 16:16 ` Peter Maydell
2013-05-15 16:19 ` Paolo Bonzini
2013-05-15 19:28 ` Peter Maydell
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=20130516101531.GD8853@stefanha-thinkpad.redhat.com \
--to=stefanha@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=jan.kiszka@siemens.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemulist@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.