From: Stefan Hajnoczi <stefanha@gmail.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Kevin Wolf <kwolf@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>, Avi Kivity <avi@redhat.com>,
qemu-devel@nongnu.org, Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [Qemu-devel] [PATCH] event_notifier: move to top-level directory
Date: Wed, 28 Sep 2011 10:12:38 +0100 [thread overview]
Message-ID: <CAJSP0QWEBXpCAS-Z+DX35yjd9JHrRTjZOXthLFNbk_Qnz2Y1Zg@mail.gmail.com> (raw)
In-Reply-To: <4E823EEE.3030807@codemonkey.ws>
On Tue, Sep 27, 2011 at 10:23 PM, Anthony Liguori <anthony@codemonkey.ws> wrote:
> On 09/27/2011 11:39 AM, Paolo Bonzini wrote:
>>
>> On 09/27/2011 06:05 PM, Anthony Liguori wrote:
>>>
>>> Actually, for posix-aio, we can just switch to using g_idle_add().
>>> g_idle_add() uses g_source_attach which is thread safe. g_idle_add()
>>> gives you a thread safe mechanism to defer a piece of work to the
>>> main loop which is really what we want here.
>>
>> For that, a bottom half would also do (apart that I am not sure it is
>> async-safe with TCG). In fact, that would make sense since all of
>> posix_aio_process_queue could become a bottom half.
>
> Bottom halves are signal safe, not thread safe.
>
> To make bottom halves thread safe, you would (in the very least) have to add
> some barriers when reading/writing the scheduling flag. I think it's much
> better to just use GIdle sources though.
>
>>> This can actually be made to work with sync I/O emulation too by
>>> having another GMainLoop in the sync I/O loop although I thought I
>>> recalled a patch series to remove that stuff.
>>
>> ... which stuff? :)
>
> The sync I/O emulation. Since sync I/O is done in block drivers, they can
> just use coroutine I/O instead of sync I/O.
Yes, I think we should covert sync I/O code to use coroutines, which
is quite natural. The users of sync I/O today are:
1. Hardware emulation - lesser-used or not performance-critical code
paths still use bdrv_read/write() in places, e.g. sd, nand, fdc, ide
pio.
2. Block drivers. Some image formats are synchronous, but converting
to coroutines is pretty easy.
3. qemu-tools including qemu-img and qemu-io.
With Paolo's work to make the event loop available in qemu-tools it
should be possible to convert and eliminate synchronous I/O
interfaces.
Stefan
next prev parent reply other threads:[~2011-09-28 9:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-27 14:26 [Qemu-devel] [PATCH] event_notifier: move to top-level directory Avi Kivity
2011-09-27 15:17 ` Stefan Hajnoczi
2011-09-27 15:28 ` Jan Kiszka
2011-09-27 16:05 ` Anthony Liguori
2011-09-27 16:39 ` Paolo Bonzini
2011-09-27 21:23 ` Anthony Liguori
2011-09-28 6:27 ` Paolo Bonzini
2011-09-28 7:52 ` Jan Kiszka
2011-09-28 8:00 ` Paolo Bonzini
2011-09-28 9:12 ` Stefan Hajnoczi [this message]
2011-11-01 22:18 ` Anthony Liguori
2011-11-02 18:10 ` Alexander Graf
2011-11-02 17:12 ` Avi Kivity
2011-11-02 17:13 ` Avi Kivity
2011-11-02 18:23 ` Alexander Graf
2011-11-02 17:22 ` Avi Kivity
2011-11-02 17:27 ` Alexander Graf
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=CAJSP0QWEBXpCAS-Z+DX35yjd9JHrRTjZOXthLFNbk_Qnz2Y1Zg@mail.gmail.com \
--to=stefanha@gmail.com \
--cc=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@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).