From: Paolo Bonzini <pbonzini@redhat.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 0/5] Spread the use of QEMU threading & locking API
Date: Thu, 05 Apr 2012 15:40:16 +0200 [thread overview]
Message-ID: <4F7DA0C0.1060209@redhat.com> (raw)
In-Reply-To: <4F7D977A.1020905@siemens.com>
Il 05/04/2012 15:00, Jan Kiszka ha scritto:
>> > But QemuEvent takes away the best name for a useful concept (a
>> > cross-platform implementation of Win32 events; you can see that in the
> The concept is not lost, it perfectly fit this incarnation. Just the
> special futex version for Linux is not feasible.
It's not just about the futex version. Can you implement a
userspace-only fast path? Perhaps with EFD_SEMAPHORE you can:
x = state of the event
bit 0 = set/reset
bit 1..31 = waiters
set
y = xchg(&x, 1)
if y > 1
write y >> 1 to eventfd
wait
do {
y = x
if (y & 1) return;
} while (fail to cmpxchg x from y to y + 2)
read from eventfd
reset
cmpxchg x from 1 to 0
but what if you are falling back to pipes?
2) It's much more heavyweight since (like Windows primitives) you need
to set aside OS resources for each QemuEvent. With mutexes and condvars
the kernel-side waitqueues come and go as they are used.
>> > RCU patches which were even posted on the list). We already have a
>> > perfectly good name for EventNotifiers, and there's no reason to break
>> > the history of event-notifier.c.
> Have you measured if the futex optimization is actually worth the
> effort, specifically compared to the fast path of mutex/cond loop?
A futex is 30% faster than the mutex/cond combination. It's called on
fast paths (call_rcu and, depending on how you implement RCU,
rcu_read_unlock) so it's important.
Paolo
next prev parent reply other threads:[~2012-04-05 13:40 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-04 15:08 [Qemu-devel] [PATCH 0/5] Spread the use of QEMU threading & locking API Jan Kiszka
2012-04-04 15:08 ` [Qemu-devel] [PATCH 1/5] Introduce qemu_cond_timedwait for POSIX Jan Kiszka
2012-04-04 15:08 ` [Qemu-devel] [PATCH 2/5] Switch POSIX compat AIO to QEMU abstractions Jan Kiszka
2012-04-04 15:08 ` [Qemu-devel] [PATCH 3/5] Use qemu_eventfd for POSIX AIO Jan Kiszka
2012-04-04 15:08 ` [Qemu-devel] [PATCH 4/5] Reorder POSIX compat AIO code Jan Kiszka
2012-04-04 15:08 ` [Qemu-devel] [PATCH 5/5] Switch compatfd to QEMU thread Jan Kiszka
2012-04-04 15:18 ` [Qemu-devel] [PATCH 0/5] Spread the use of QEMU threading & locking API Paolo Bonzini
2012-04-04 15:24 ` Jan Kiszka
2012-04-04 15:29 ` Paolo Bonzini
2012-04-04 15:38 ` Jan Kiszka
2012-04-04 15:43 ` Jan Kiszka
2012-04-04 16:05 ` Jan Kiszka
2012-04-04 16:39 ` Paolo Bonzini
2012-04-04 16:55 ` Jan Kiszka
2012-04-04 17:19 ` Jan Kiszka
2012-04-05 7:51 ` Paolo Bonzini
2012-04-05 10:55 ` Jan Kiszka
2012-04-05 11:07 ` Paolo Bonzini
2012-04-05 11:18 ` Jan Kiszka
2012-04-05 11:29 ` Paolo Bonzini
2012-04-05 12:04 ` Jan Kiszka
2012-04-05 12:48 ` Paolo Bonzini
[not found] ` <4F7D977A.1020905@siemens.com>
2012-04-05 13:40 ` Paolo Bonzini [this message]
2012-04-05 14:01 ` Jan Kiszka
2012-04-05 14:11 ` Paolo Bonzini
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=4F7DA0C0.1060209@redhat.com \
--to=pbonzini@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=jan.kiszka@siemens.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).