qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] aio-posix: Fix return value of aio_poll()


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] aio-posix: Fix return value of aio_poll()
Date: Wed, 23 Jan 2013 12:43:00 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

Il 23/01/2013 12:37, Dietmar Maurer ha scritto:
>>> I currently use qemu_aio_set_fd_handler() to implement async output to
>>> the backup stream. While that works, performance is much better
>>> (during backup) if I use a separate thread to write the data.
>>>
>>> Is that known behavior, or should aio give about the same performance
>>> as using a thread?
>>
>> It depends, but this is what we saw for migration too.  You may also have
>> less contention on the big QEMU lock if you use a thread.
> 
> But when I use a thread it triggers the bug in bdrv_drain_all(). So how can
> I fix  bdrv_drain_all() if I use a separate thread to write data?

The bug is, in all likelihood, in your own code.  Sorry. :)

> I currently use CoQueue to wait for the output thread.

The simplest way to synchronize the main event loop with another thread
is a bottom half.  There is no example yet, but I will post it soon for
migration.

In the other direction, use an EventNotifier (for which bottom halves
are just a nice wrapper).

> Maybe there is some example code somewhere?
>  
>>> Or would I get better performance if I use Linux native AIO support?
>>
>> That also depends, but in general it should be faster.
> 
> Is there an easy way to switch to native AIO? The code in block/linux-aio.c 
> is only
> usable inside block drivers? I simply need to write to a unix file descriptor.

First of all, AIO is only usable for files and block devices, not
character devices or sockets.  If you have one, you can use the block
device API rather than the file descriptor API to write it.  You'll get
native AIO support for free.

Support for running the block drivers in a separate thread is not there
yet, but I predict it will come later this year.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]