From: "Blue Swirl" <blauwirbel@gmail.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>, kvm-devel <kvm@vger.kernel.org>
Subject: Re: [Qemu-devel] [RFC] Replace posix-aio with custom thread pool
Date: Sat, 6 Dec 2008 11:03:30 +0200 [thread overview]
Message-ID: <f43fc5580812060103o32c2aec9x5d6bcdc344d0ed8f@mail.gmail.com> (raw)
In-Reply-To: <1228512061-25398-1-git-send-email-aliguori@us.ibm.com>
On 12/5/08, Anthony Liguori <aliguori@us.ibm.com> wrote:
> glibc implements posix-aio as a thread pool and imposes a number of limitations.
>
> 1) it limits one request per-file descriptor. we hack around this by dup()'ing
> file descriptors which is hideously ugly
>
> 2) it's impossible to add new interfaces and we need a vectored read/write
> operation to properly support a zero-copy API.
>
> What has been suggested to me by glibc folks, is to implement whatever new
> interfaces we want and then it can eventually be proposed for standardization.
> This requires that we implement our own posix-aio implementation though.
>
> This patch implements posix-aio using pthreads. It immediately eliminates the
> need for fd pooling.
>
> It performs at least as well as the current posix-aio code (in some
> circumstances, even better).
>
> My only concern here is non-Linux Unices like FreeBSD. They have kernel support
> for posix-aio. Since we cannot extend those interfaces though, I think that
> even on those platforms we should still use a thread pool.
>
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
> @@ -895,6 +824,7 @@ BlockDriver bdrv_raw = {
> .bdrv_aio_cancel = raw_aio_cancel,
> .aiocb_size = sizeof(RawAIOCB),
> #endif
> +
> @@ -1252,6 +1178,7 @@ BlockDriver bdrv_host_device = {
> .bdrv_aio_cancel = raw_aio_cancel,
> .aiocb_size = sizeof(RawAIOCB),
> #endif
> +
Some cleanup needed here?
> +int _compat_aio_init(struct aioinit *aioinit)
> +static int _compat_aio_submit(struct aiocb *aiocb, int is_write)
> +int _compat_aio_read(struct aiocb *aiocb)
> +int _compat_aio_write(struct aiocb *aiocb)
> +ssize_t _compat_aio_return(struct aiocb *aiocb)
> +int _compat_aio_error(struct aiocb *aiocb)
> +int _compat_aio_cancel(int fd, struct aiocb *aiocb)
The names should not begin with an underscore.
> +struct aiocb
> +{
> + int aio_fildes;
> + void *aio_buf;
> + size_t aio_nbytes;
> + struct sigevent aio_sigevent;
> + off_t aio_offset;
> +
> + /* private */
> + TAILQ_ENTRY(aiocb) node;
> + int is_write;
> + ssize_t ret;
> + int active;
> +};
> +
> +struct aioinit
> +{
> + int aio_threads;
> + int aio_num;
> + int aio_idle_time;
> +};
These structs should probably be named qemu_aiocb and qemu_aioinit to
avoid conflict with system types.
I like to use unsigned types whenever possible, IIRC compilers may
generate better code with those.
next prev parent reply other threads:[~2008-12-06 9:03 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-05 21:21 [Qemu-devel] [RFC] Replace posix-aio with custom thread pool Anthony Liguori
2008-12-06 9:03 ` Blue Swirl [this message]
2008-12-06 18:26 ` Jamie Lokier
2008-12-08 18:23 ` Anthony Liguori
2008-12-09 15:51 ` Gerd Hoffmann
2008-12-09 16:01 ` Anthony Liguori
2008-12-10 16:44 ` Andrea Arcangeli
2008-12-10 17:21 ` Anthony Liguori
2008-12-10 17:29 ` Gerd Hoffmann
2008-12-10 18:50 ` Anthony Liguori
2008-12-10 19:08 ` Andrea Arcangeli
2008-12-11 13:12 ` Andrea Arcangeli
2008-12-11 15:24 ` Gerd Hoffmann
2008-12-11 15:53 ` Andrea Arcangeli
2008-12-11 16:11 ` Gerd Hoffmann
2008-12-11 16:49 ` Andrea Arcangeli
2008-12-11 17:20 ` Gerd Hoffmann
2008-12-11 18:11 ` Andrea Arcangeli
2008-12-11 20:38 ` Gerd Hoffmann
2008-12-11 20:40 ` Anthony Liguori
2008-12-12 8:23 ` Jens Axboe
2008-12-12 11:51 ` Andrea Arcangeli
2008-12-12 11:54 ` Jens Axboe
2008-12-12 14:13 ` Andrea Arcangeli
2008-12-12 14:24 ` Anthony Liguori
2008-12-12 16:33 ` Chris Wright
2008-12-12 16:51 ` Anthony Liguori
2008-12-12 16:52 ` Chris Wright
2008-12-11 21:32 ` Christoph Hellwig
2008-12-12 0:27 ` Andrea Arcangeli
2008-12-11 21:30 ` Christoph Hellwig
2008-12-11 16:41 ` Anthony Liguori
2008-12-12 14:24 ` Andrea Arcangeli
2008-12-12 14:35 ` Anthony Liguori
2008-12-12 15:44 ` Andrea Arcangeli
2008-12-12 16:49 ` Anthony Liguori
2008-12-12 17:09 ` Andrea Arcangeli
2008-12-12 17:25 ` Anthony Liguori
2008-12-12 17:52 ` Andrea Arcangeli
2008-12-12 18:17 ` Anthony Liguori
2008-12-12 18:26 ` Andrea Arcangeli
2008-12-12 20:12 ` Gerd Hoffmann
2008-12-12 20:17 ` Anthony Liguori
2008-12-12 20:35 ` Gerd Hoffmann
2008-12-09 17:16 ` Avi Kivity
2008-12-17 14:44 ` Ian Jackson
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=f43fc5580812060103o32c2aec9x5d6bcdc344d0ed8f@mail.gmail.com \
--to=blauwirbel@gmail.com \
--cc=aliguori@us.ibm.com \
--cc=kvm@vger.kernel.org \
--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).