History | View | Annotate | Download (13.1 kB)
main-loop: do not include slirp/slirp.h, use libslirp.h instead
The header slirp/slirp.h is an internal header for slirp, andmain-loop.c does not use internals from there. Instead, it usespublic functions (slirp_update_timeout(), slirp_pollfds_fill()etc) which are declared in slirp/libslirp.h....
main-loop: narrow win32 pollfds_fill() event bitmasks
pollfds_fill() and pollfds_poll() translate GPollFD to rfds/wfds/xfdsfor sockets on win32. select(2) is the underlying system call which isused to monitor sockets for activity.
Currently file descriptors that monitor G_IO_ERR will be included in...
main-loop: partial revert of 5e3bc73
This patch reverts part of 5e3bc735d93dd23f074b5116fd11e1ad8cd4962f.
Paolo Bonzini wrote this patch and commented:
"WSAEventSelect is edge-triggered and the event will not be signaled ifthe socket handler does not consume all the data in the socket buffer."...
main-loop: drop the BQL if the I/O appears to be spinning
The char-flow refactoring introduced a busy-wait that depended onan action from the VCPU thread. However, the VCPU thread couldnever take that action because the busy-wait starved the VCPU thread...
main-loop: add qemu_get_aio_context()
It is very useful to get the main loop AioContext, which is a staticvariable in main-loop.c.
I'm not sure whether qemu_get_aio_context() will be necessary in thefuture once devices focus on using their own AioContext instead of the...
slirp: switch to GPollFD
Slirp uses rfds/wfds/xfds more extensively than other QEMU components.
The rarely-used out-of-band TCP data feature is used. That means weneed the full table of select(2) to g_poll(3) events:
rfds -> G_IO_IN | G_IO_HUP | G_IO_ERR...
iohandler: switch to GPollFD
Convert iohandler_select_fill() and iohandler_select_poll() to useGPollFD instead of rfds/wfds/xfds.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Reviewed-by: Laszlo Ersek <lersek@redhat.com>Message-id: 1361356113-11049-7-git-send-email-stefanha@redhat.com...
main-loop: drop rfds/wfds/xfds for good
Now that all *_fill() and *_poll() functions use GPollFD we no longerneed rfds/wfds/xfds or pollfds_from_select()/pollfds_to_select().
From now on everything uses GPollFD.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>...
main-loop: fix select_ret uninitialized variable warning
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Reviewed-by: Laszlo Ersek <lersek@redhat.com>Message-id: 1361356113-11049-2-git-send-email-stefanha@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
main-loop: switch to g_poll() on POSIX hosts
Use g_poll(3) instead of select(2). Well, this is kind of a cheat.It's true that we're now using g_poll(3) on POSIX hosts but the *_fill()and *_poll() functions are still using rfds/wfds/xfds.
We've set the scene to start converting *_fill() and *_poll() functions...
main-loop: switch POSIX glib integration to GPollFD
Convert glib file descriptor polling from rfds/wfds/xfds to GPollFD.
The Windows code still needs poll_fds[] and n_poll_fds but they can nowbecome local variables.
Check return values from g_poll and select
The current implementation of os_host_main_loop_wait() on Windows,returns 1 only when a g_poll() event occurs because the return value ofselect() is overridden. This is wrong as we may skip a socket event, asshown in this example:...
misc: move include files to include/qemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block: move include files to include/block/
aio: Get rid of qemu_aio_flush()
There are no remaining users, and new users should probably beusing bdrv_drain_all() in the first place.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
vl: delay thread initialization after daemonization
Commit ac4119c (chardev: Use timer instead of bottom-half to postponeopen event, 2012-10-12) moved the alarm timer initialization to an earlierpoint but failed to consider that it depends on qemu_init_main_loop....
vl: unify calls to init_timer_alarm
init_timer_alarm was being called twice. This is not needed.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
main-loop: use aio_notify for qemu_notify_event
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
aio: introduce AioContext, move bottom halves there
Start introducing AioContext, which will let us remove globals fromaio.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...
aio: add I/O handlers to the AioContext interface
With this patch, I/O handlers (including event notifier handlers) can beattached to a single AioContext.
aio: add non-blocking variant of aio_wait
This will be used when polling the GSource attached to an AioContext.
aio: add Win32 implementation
The Win32 implementation will only accept EventNotifiers, thus a fewdrivers are disabled under Windows. EventNotifiers are a good matchfor the GSource implementation, too, because the Win32 port of gliballows to place their HANDLEs in a GPollFD....
main-loop: use GSource to poll AIO file descriptors
This lets us remove the hooks for the main loop in async.c.
main-loop: unify qemu_init_main_loop between QEMU and tools
main-loop: Calculate poll timeout using timeout argument
The timeout argument was unused up to now,but it can be used to reduce the poll_timeout when it is infinite(negative value) or larger than timeout.
Signed-off-by: Stefan Weil <sw@weilnetz.de>Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>...
main-loop: Fix build for w32 and w64
This patch fixes a build regression with MinGW which was introduced bycommit 7c7db75576bd5a31508208f153c5aada64b2c8df.
The 3rd argument of g_main_context_query must point to a gint value.Using a pointer to an uint32_t value is wrong....
main_loop_wait: block indefinitely
- remove qemu_calculate_timeout;
- explicitly size timeout to uint32_t;
- introduce slirp_update_timeout;
- pass NULL as timeout argument to select in case timeout is the maximumvalue;
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>...
w64: Fix type cast in os_host_main_loop_wait
Casting a pointer to an integer must use (DWORD_PTR) instead of (DWORD).This also matches the definition of 'fd' (gint for w32, gint64 for w64).
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
main-loop: integrate glib sources for w32
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
main-loop: replace WaitForMultipleObjects with g_poll
On w32, glib implements g_poll using WaitForMultipleObjectsor MsgWaitForMultipleObjects. This means that we can simplifyour code by switching to g_poll, and at the same time prepare foradding back glib sources....
main-loop: interrupt wait when data arrives on a socket
Right now, the main loop is not interrupted when data arrives on asocket. To fix this, register each socket to interrupt the main loopwith WSAEventSelect. This does not replace select, it only communicates...
main loop: use msec-based timeout in glib_select_fill
The timeval-based timeout is not needed until we actually invoke select,so compute it only then. Also group the two calls that modify thetimeout, glib_select_fill and os_host_main_loop_wait.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
main-loop: disable fd_set-based glib integration under w32
Using select with glib pollfds is wrong under w32. Restrictthe code to the POSIX case.
main-loop: make qemu_event_handle static
Signed-off-by: Frediano Ziglio <freddy77@gmail.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
main-loop: Fix SetEvent() on uninitialized handle on win32
The attribute((constructor)) init_main_loop() automatically getcalled if qemu-tool.o is linked in. On win32, this leads toa qemu_notify_event() call which attempts to SetEvent() on a HANDLE that...
main-loop: For tools, initialize timers as part of qemu_init_main_loop()
In some cases initializing the alarm timers can lead to non-negligableoverhead from programs that link against qemu-tool.o. At least,setting a max-resolution WinMM alarm timer via mm_start_timer() (the...
cleanup, save a syscall
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
main-loop: Add missing include file
stdint.h defines the POSIX data types and is neededfor MinGW-w64 (and maybe other hosts).
v2: Instead of adding stdint.h directly, qemu-common.h is nowincluded and duplicate include statements were removed.
Signed-off-by: Stefan Weil <sw@weilnetz.de>...
main-loop: create main-loop.c