From: Paolo Bonzini <pbonzini@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel <qemu-devel@nongnu.org>,
Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [Qemu-devel] converting the block layer from coroutines to threads
Date: Tue, 28 Feb 2012 10:34:55 +0100 [thread overview]
Message-ID: <4F4C9FBF.3000902@redhat.com> (raw)
In-Reply-To: <4F47FA99.8050608@codemonkey.ws>
Il 24/02/2012 22:01, Anthony Liguori ha scritto:
>> Once you can issue I/O from two threads at the same-time (such as
>> streaming in the iothread and guest I/O in the virtqueue thread),
>> everything already needs to be thread-safe. It is a pretty short step
>> from there to thread pools for everything.
>
> If you start with a thread safe API for submitting block requests, that
> could be implemented as
>
> bapi_aiocb *bapi_submit_readv(bapi_driver *d, struct iovec *iov, int
> iovcnt,
> off_t offset)
> {
> bapi_request *req = make_bapi_request(BAPI_READ, iov, iovcnt, offset);
>
> return bapi_queue_add_req(req);
> }
>
> Which would schedule the I/O thread to actually implement the
> operation. You could then start incrementally refactoring specific
> drivers to be re-entrant (like linux-aio).
My proposal has exactly these two ingredients: a representations of
block layer requests, and a fast path for AIO.
But there are really two complementary parts to it. One is generalizing
thread-pool support to non-raw formats, the other is doing I/O from
multiple threads at the same time. The first is quite easy overall.
The second is hard, because it's not just about reentrancy. You need
various pieces of infrastructure that do not yet exist; for example you
need freeze/unfreeze, because drain/drain_all is not enough if other
threads can submit I/O concurrently.
> But anything that already needs to use a thread pool to do its I/O
> probably wouldn't benefit from threading virtio.
Linux AIO _is_ a thread-pool in the end. It is surprising how close the
latencies are between io_submit and cond_signal, for example.
Paolo
prev parent reply other threads:[~2012-02-28 9:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-24 19:02 [Qemu-devel] converting the block layer from coroutines to threads Paolo Bonzini
2012-02-24 19:22 ` Anthony Liguori
2012-02-24 20:43 ` Paolo Bonzini
2012-02-24 21:01 ` Anthony Liguori
2012-02-28 9:34 ` Paolo Bonzini [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=4F4C9FBF.3000902@redhat.com \
--to=pbonzini@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.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).