- Aug 22, 2013
-
-
Stefan Hajnoczi authored
The AioHandler->opaque field does not exist in aio-win32.c. The code that uses it was incorrectly copied from aio-posix.c. For Windows we can use AioHandler->e to match against AioContext->notifier. This patch fixes the Windows build for aio-win32.o. Reviewed-by:
Stefan Weil <sw@weilnetz.de> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
Alex Bligh authored
Convert aio_poll to use deadline based on AioContext's timers. aio_poll has been changed to return accurately whether progress has occurred. Prior to this commit, aio_poll always returned true if g_poll was entered, whether or not any progress was made. This required a change to tests/test-aio.c where an assert was backwards. Signed-off-by:
Alex Bligh <alex@alex.org.uk> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
- Aug 19, 2013
-
-
Stefan Hajnoczi authored
The .io_flush() handler no longer exists and has no users. Drop the io_flush argument to aio_set_fd_handler() and related functions. The AioFlushEventNotifierHandler and AioFlushHandler typedefs are no longer used and are dropped too. Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
Stefan Hajnoczi authored
Now that aio_poll() users check their termination condition themselves, it is no longer necessary to call .io_flush() handlers. The behavior of aio_poll() changes as follows: 1. .io_flush() is no longer invoked and file descriptors are *always* monitored. Previously returning 0 from .io_flush() would skip this file descriptor. Due to this change it is essential to check that requests are pending before calling qemu_aio_wait(). Failure to do so means we block, for example, waiting for an idle iSCSI socket to become readable when there are no requests. Currently all qemu_aio_wait()/aio_poll() callers check before calling. 2. aio_poll() now returns true if progress was made (BH or fd handlers executed) and false otherwise. Previously it would return true whenever 'busy', which means that .io_flush() returned true. The 'busy' concept no longer exists so just progress is returned. Due to this change we need to update tests/test-aio.c which asserts aio_poll() return values. Note that QEMU doesn't actually rely on these return values so only tests/test-aio.c cares. Note that ctx->notifier, the EventNotifier fd used for aio_notify(), is now handled as a special case. This is a little ugly but maintains aio_poll() semantics, i.e. aio_notify() does not count as 'progress' and aio_poll() avoids blocking when the user has not set any fd handlers yet. Patches after this remove .io_flush() handler code until we can finally drop the io_flush arguments to aio_set_fd_handler() and friends. Reviewed-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
- Jan 17, 2013
-
-
Kevin Wolf authored
aio_poll() must return true if any work is still pending, even if it didn't make progress, so that bdrv_drain_all() doesn't stop waiting too early. The possibility of stopping early occasionally lead to a failed assertion in bdrv_drain_all(), when some in-flight request was missed and the function didn't really drain all requests. In order to make that change, the return value as specified in the function comment must change for blocking = false; fortunately, the return value of blocking = false callers is only used in test cases, so this change shouldn't cause any trouble. Cc: qemu-stable@nongnu.org Signed-off-by:
Kevin Wolf <kwolf@redhat.com> Signed-off-by:
Stefan Hajnoczi <stefanha@redhat.com>
-
- Dec 19, 2012
-
-
Paolo Bonzini authored
Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Nov 26, 2012
-
-
Paolo Bonzini authored
The repeated calls to WaitForMultipleObjects may cause a livelock in aio_poll, where no progress is made on bottom halves. This patch matches the behavior of the POSIX code. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
- Oct 30, 2012
-
-
Paolo Bonzini authored
In the current code, this is done by qemu_set_fd_handler2, which is called by qemu_aio_set_fd_handler. We need to keep the same behavior even after removing the call to qemu_set_fd_handler2. Reviewed-by:
Anthony Liguori <aliguori@us.ibm.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
This lets AioContexts be used (optionally) with a glib main loop. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
The Win32 implementation will only accept EventNotifiers, thus a few drivers are disabled under Windows. EventNotifiers are a good match for the GSource implementation, too, because the Win32 port of glib allows to place their HANDLEs in a GPollFD. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
This adds a GPollFD to each AioHandler. It will then be possible to attach these GPollFDs to a GSource, and from there to the main loop. aio_wait examines the GPollFDs and avoids calling select() if any is set (similar to what it does if bottom halves are available). Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
This will be used when polling the GSource attached to an AioContext. Reviewed-by:
Anthony Liguori <aliguori@us.ibm.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Otherwise, there could be a case where io_flush accesses freed memory because it should not have been called. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
With this patch, I/O handlers (including event notifier handlers) can be attached to a single AioContext. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Start introducing AioContext, which will let us remove globals from aio.c/async.c, and introduce multiple I/O threads. The bottom half functions now take an additional AioContext argument. A bottom half is created with a specific AioContext that remains the same throughout the lifetime. qemu_bh_new is just a wrapper that uses a global context. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
This adds to aio.c a platform-independent API based on EventNotifiers, that can be used by both POSIX and Win32. Reviewed-by:
Anthony Liguori <aliguori@us.ibm.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
Paolo Bonzini authored
Reviewed-by:
Anthony Liguori <aliguori@us.ibm.com> Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com>
-
- Sep 28, 2012
-
-
Paolo Bonzini authored
The AIO dispatch loop will call QLIST_REMOVE and g_free even if there are other pending calls to qemu_aio_wait outside the current one. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Bharata B Rao <bharata@linux.vnet.ibm.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
Paolo Bonzini authored
Fix qemu_aio_wait() to ensure that registered aio handlers don't get deleted when they are still active. This is ensured by maintaning the right count of walking_handlers. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Bharata B Rao <bharata@linux.vnet.ibm.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
- Apr 19, 2012
-
-
Paolo Bonzini authored
The do...while loop can never loop, because select will just not return 0 when invoked with infinite timeout. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
Paolo Bonzini authored
The definition of when qemu_aio_flush should loop is much simpler than it looks. It just has to call qemu_aio_wait until it makes no progress and all flush callbacks return false. qemu_aio_wait is the logical place to tell the caller about this. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
Paolo Bonzini authored
Both unused after the previous patch. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
- Jan 13, 2012
-
-
Paolo Bonzini authored
All files under GPLv2 will get GPLv2+ changes starting tomorrow. event_notifier.c and exec-obsolete.h were only ever touched by Red Hat employees and can be relicensed now. Signed-off-by:
Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
- Aug 21, 2011
-
-
Anthony Liguori authored
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
- May 21, 2010
-
-
Avi Kivity authored
Not all block format drivers expose an io_flush method (reasonable for read-only protocols), so calling io_flush there will immediately segfault. Fix by checking for the method's existence before calling it. Signed-off-by:
Avi Kivity <avi@redhat.com> Signed-off-by:
Kevin Wolf <kwolf@redhat.com>
-
- Oct 27, 2009
-
-
Kevin Wolf authored
We'll leave some AIO completions unhandled when we can't call the callback. qemu_aio_process_queue() is used later to run any callbacks that are left and can be run then. Signed-off-by:
Kevin Wolf <kwolf@redhat.com> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
- Sep 12, 2009
-
-
Blue Swirl authored
Problem: Our file sys-queue.h is a copy of the BSD file, but there are some additions and it's not entirely compatible. Because of that, there have been conflicts with system headers on BSD systems. Some hacks have been introduced in the commits 15cc9235, f40d7537, 96555a96 and 3990d09a but the fixes were fragile. Solution: Avoid the conflict entirely by renaming the functions and the file. Revert the previous hacks. Signed-off-by:
Blue Swirl <blauwirbel@gmail.com>
-
- Jul 22, 2009
-
-
Nolan authored
Without this, the call to qemu_aio_flush during migration doesn't actually flush all in-flight SCSI IOs. Signed-off-by: Nolan Leake <nolan <at> sigbus.net> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
- Jun 15, 2009
-
-
Andrea Arcangeli authored
qemu_aio_wait by invoking the bh or one of the aio completion callbacks, could end up submitting new pending aio, breaking the invariant that qemu_aio_flush returns only when no pending aio is outstanding (possibly a problem for migration as such). Signed-off-by:
Andrea Arcangeli <aarcange@redhat.com> Signed-off-by:
Christoph Hellwig <hch@lst.de> Acked-by:
Kevin Wolf <kwolf@redhat.com>
-
- May 08, 2009
-
-
Alexander Graf authored
When deleting an fd event there is a chance the object doesn't get deleted, but only ->deleted set positive and deleted somewhere later. Now, if we create a handler for the fd again before the actual deletion occurs, we end up writing data into an object that has ->deleted set, which is obviously wrong. I see two ways to fix this: 1. Don't return ->deleted objects in the search 2. Unset ->deleted in the search This patch implements 1. which feels safer to do. It fixes AIO issues I've seen with curl, as libcurl unsets fd event listeners pretty frequently. Signed-off-by:
Alexander Graf <alex@csgraf.de> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com>
-
- Feb 05, 2009
-
-
Anthony Liguori authored
Signed-off-by:
Avi Kivity <avi@redhat.com> Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6531 c046a42c-6fe2-441c-8c8c-71466251a162
-
- Oct 12, 2008
-
-
Anthony Liguori authored
This was spotted by valgrind. Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5470 c046a42c-6fe2-441c-8c8c-71466251a162
-
- Sep 22, 2008
-
-
Anthony Liguori authored
This patch refactors the AIO layer to allow multiple AIO implementations. It's only possible because of the recent signalfd() patch. Right now, the AIO infrastructure is pretty specific to the block raw backend. For other block devices to implement AIO, the qemu_aio_wait function must support registration. This patch introduces a new function, qemu_aio_set_fd_handler, which can be used to register a file descriptor to be called back. qemu_aio_wait() now polls a set of file descriptors registered with this function until one becomes readable or writable. This patch should allow the implementation of alternative AIO backends (via a thread pool or linux-aio) and AIO backends in non-traditional block devices (like NBD). Signed-off-by:
Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5297 c046a42c-6fe2-441c-8c8c-71466251a162
-