aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-10-30aio: add Win32 implementationPaolo Bonzini5-5/+218
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>
2012-10-30aio: prepare for introducing GSource-based dispatchPaolo Bonzini2-13/+87
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>
2012-10-30aio: add non-blocking variant of aio_waitPaolo Bonzini4-13/+32
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>
2012-10-30aio: test node->deleted before calling io_flushPaolo Bonzini1-1/+1
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>
2012-10-30aio: add I/O handlers to the AioContext interfacePaolo Bonzini4-48/+101
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>
2012-10-30aio: introduce AioContext, move bottom halves therePaolo Bonzini11-72/+119
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>
2012-10-30aio: provide platform-independent APIPaolo Bonzini3-3/+29
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>
2012-10-30aio: change qemu_aio_set_fd_handler to return voidPaolo Bonzini2-12/+10
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30vl: init main loop earlierPaolo Bonzini1-6/+6
Otherwise, chardevs will not be able to create a bottom half as soon as that will require an AioContext. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30event_notifier: enable it to use pipesPaolo Bonzini2-17/+71
This takes the eventfd emulation code from the main loop. When the EventNotifier is used for the main loop too, we need this compatibility code. Without CONFIG_EVENTFD, event_notifier_get_fd is only usable for the "read" side of the notifier, for example to set a select() handler. The return value of event_notifier_set changes to the cleaner 0/-errno. No caller is actually checking the return value. Reviewed-by: Anthony Liguori <anthony@codemonkey.ws> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30event_notifier: add Win32 implementationPaolo Bonzini5-4/+76
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30build: do not include main loop where it is not actually usedPaolo Bonzini3-10/+9
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30build: opts-visitor is not really part of QAPIPaolo Bonzini1-1/+3
It is only used by QEMU itself, do not build it into the tests. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30qemu-tool: do not depend on qemu-timer.cPaolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30main-loop: unify qemu_init_main_loop between QEMU and toolsPaolo Bonzini4-23/+4
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30qemu-timer: make initialization functions idempotentPaolo Bonzini1-3/+9
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30win32: add weak version of qemu_fd_registerPaolo Bonzini1-0/+5
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30iohandler: add weak alias in qemu-sockets.c, for qemu-gaPaolo Bonzini1-0/+11
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30fdsets: use weak aliases instead of qemu-tool.c/qemu-user.cPaolo Bonzini5-46/+30
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30sockets: use weak aliases instead of qemu-tool.cPaolo Bonzini2-6/+7
qemu-tool.c has its own (largeish) set of dependencies. Weak aliases can be placed directly where people use them, and do not contribute to increasing the dependencies of generic utility files. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30compiler: use weak aliases to provide default definitionsPaolo Bonzini3-9/+7
This is simpler and more portable. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30build: move cutils.o and qemu-timer-common.o to oslib-obj-yPaolo Bonzini2-5/+4
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-30janitor: move iovector functions out of cutils.cPaolo Bonzini5-107/+107
This removes the dependency of cutils.c on iov.c, and lets us remove iov.o from several builds. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-24win32: fix broken build due to missing QEMU_MADV_HUGEPAGELuiz Capitulino1-0/+2
Commit ad0b5321f1f797274603ebbe20108b0750baee94 forgot to add QEMU_MADV_HUGEPAGE macros for when CONFIG_MADVISE is not defined. This broke the build for Windows. Fix it. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-10-24Merge remote-tracking branch 'bonzini/nbd-next' into stagingAnthony Liguori28-420/+763
* bonzini/nbd-next: (30 commits) qmp: add NBD server commands block: add close notifiers block: prepare code for adding block notifiers qemu-sockets: add socket_listen, socket_connect, socket_parse tests: do not include tools-obj-y Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> qemu-sockets: return InetSocketAddress from inet_parse qapi: add socket address types build: add QAPI files to the tools vnc: drop QERR_VNC_SERVER_FAILED qemu-sockets: add error propagation to Unix socket functions qemu-sockets: add error propagation to inet_parse qemu-sockets: add error propagation to inet_dgram_opts qemu-sockets: add error propagation to inet_connect_addr qemu-sockets: include strerror or gai_strerror output in error messages vnc: add error propagation to vnc_display_open vnc: reorganize code for reverse mode vnc: introduce a single label for error returns vnc: avoid Yoda conditionals qemu-ga: ask and print error information from qemu-sockets nbd: ask and print error information from qemu-sockets ...
2012-10-23qmp: add NBD server commandsPaolo Bonzini4-1/+179
Adding an NBD server inside QEMU is trivial, since all the logic is in nbd.c and can be shared easily between qemu-nbd and QEMU itself. The main difference is that qemu-nbd serves a single unnamed export, while QEMU serves named exports. Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23block: add close notifiersPaolo Bonzini4-2/+14
The first user of close notifiers will be the embedded NBD server. It would be possible to use them to do some of the ad hoc processing (e.g. for block jobs and I/O limits) that is currently done by bdrv_close. Acked-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23block: prepare code for adding block notifiersPaolo Bonzini1-5/+5
There is no reason in principle to skip job cancellation and draining of pending I/O when there is no medium in the disk. Do these unconditionally, which also prepares the code for the next patch. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23qemu-sockets: add socket_listen, socket_connect, socket_parsePaolo Bonzini4-1/+111
These are QAPI-friendly versions of the qemu-sockets functions. They support IP sockets, Unix sockets, and named file descriptors, using a QAPI union to dispatch to the correct function. Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23tests: do not include tools-obj-yPaolo Bonzini1-5/+5
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23qemu-sockets: return InetSocketAddress from inet_parsePaolo Bonzini1-42/+79
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23qapi: add socket address typesPaolo Bonzini1-0/+53
Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23build: add QAPI files to the toolsPaolo Bonzini2-3/+3
We need them because qemu-sockets will soon be using SocketAddress. Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23Rename target_phys_addr_t to hwaddrAvi Kivity383-2240/+2240
target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are reserved) and its purpose doesn't match the name (most target_phys_addr_t addresses are not target specific). Replace it with a finger-friendly, standards conformant hwaddr. Outstanding patchsets can be fixed up with the command git rebase -i --exec 'find -name "*.[ch]" | xargs s/target_phys_addr_t/hwaddr/g' origin Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-10-23vnc: drop QERR_VNC_SERVER_FAILEDPaolo Bonzini2-6/+0
We now always return "nice" error messages in errp when we goto fail. Drop the default error message. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23qemu-sockets: add error propagation to Unix socket functionsPaolo Bonzini1-8/+8
Before: $ qemu-system-x86_64 -monitor unix:/vvv,server=off connect(unix:/vvv): No such file or directory chardev: opening backend "socket" failed After: $ x86_64-softmmu/qemu-system-x86_64 -monitor unix:/vvv,server=off qemu-system-x86_64: -monitor unix:/vvv,server=off: Failed to connect to socket: No such file or directory chardev: opening backend "socket" failed Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23qemu-sockets: add error propagation to inet_parsePaolo Bonzini1-20/+21
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23qemu-sockets: add error propagation to inet_dgram_optsPaolo Bonzini2-27/+8
Before: $ qemu-system-x86_64 -monitor udp:localhost:631@localhost:631 inet_dgram_opts: bind(ipv4,127.0.0.1,631): OK inet_dgram_opts failed chardev: opening backend "udp" failed After: $ x86_64-softmmu/qemu-system-x86_64 -monitor udp:localhost:631@localhost:631 qemu-system-x86_64: -monitor udp:localhost:631@localhost:631: Failed to bind socket: Address already in use chardev: opening backend "udp" failed Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23qemu-sockets: add error propagation to inet_connect_addrPaolo Bonzini1-9/+6
perror and fprintf can be removed because all clients can now consume Errors properly. However, we'll need to change the non-blocking connect handlers to take an Error, in order to improve error handling for migration with the TCP protocol. This is a minor degradation in error reporting for outgoing migration. However, until 1.2 this case just failed without even attempting to connect, so it is still an improvement as far as overall QoI is concerned. Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23qemu-sockets: include strerror or gai_strerror output in error messagesPaolo Bonzini1-21/+9
Among others, before: $ qemu-system-x86_64 -chardev socket,port=12345,id=char inet_connect: host and/or port not specified chardev: opening backend "socket" failed After: $ x86_64-softmmu/qemu-system-x86_64 -chardev socket,port=12345,id=char qemu-system-x86_64: -chardev socket,port=12345,id=char: host and/or port not specified chardev: opening backend "socket" failed perror and fprintf can be removed because all clients can now consume Errors properly. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23vnc: add error propagation to vnc_display_openPaolo Bonzini2-22/+29
Before: $ qemu-system-x86_64 -vnc foo.bar:12345 getaddrinfo(foo.bar,18245): Name or service not known Failed to start VNC server on `foo.bar:12345' $ qemu-system-x86_64 -vnc localhost:12345,reverse=on inet_connect_opts: connect(ipv4,yakj.usersys.redhat.com,127.0.0.1,12345): Connection refused Failed to start VNC server on `localhost:12345,reverse=on' After: $ x86_64-softmmu/qemu-system-x86_64 -vnc foo.bar:12345 Failed to start VNC server on `foo.bar:12345': address resolution failed for foo.bar:18245: Name or service not known $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:12345,reverse=on Failed to start VNC server on `localhost:12345,reverse=on': Failed to connect to socket: Connection refused Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23vnc: reorganize code for reverse modePaolo Bonzini3-16/+12
Avoid the dance between csock and vs->lsock. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23vnc: introduce a single label for error returnsPaolo Bonzini1-25/+17
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23vnc: avoid Yoda conditionalsPaolo Bonzini1-2/+2
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23qemu-ga: ask and print error information from qemu-socketsPaolo Bonzini1-3/+5
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23nbd: ask and print error information from qemu-socketsPaolo Bonzini1-8/+31
Before: $ qemu-system-x86_64 nbd:localhost:12345 inet_connect_opts: connect(ipv4,yakj.usersys.redhat.com,127.0.0.1,12345): Connection refused qemu-system-x86_64: could not open disk image nbd:localhost:12345: Connection refused After: $ x86_64-softmmu/qemu-system-x86_64 nbd:localhost:12345 qemu-system-x86_64: Failed to connect to socket: Connection refused qemu-system-x86_64: could not open disk image nbd:localhost:12345: Connection refused Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23qemu-char: ask and print error information from qemu-socketsPaolo Bonzini1-6/+17
Before: $ qemu-system-x86_64 -monitor tcp:localhost:6000 (starts despite error) $ qemu-system-x86_64 -monitor tcp:foo.bar:12345 getaddrinfo(foo.bar,12345): Name or service not known chardev: opening backend "socket" failed $ qemu-system-x86_64 -monitor tcp:localhost:443,server=on inet_listen_opts: bind(ipv4,127.0.0.1,443): Permission denied inet_listen_opts: FAILED chardev: opening backend "socket" failed After: $ x86_64-softmmu/qemu-system-x86_64 -monitor tcp:localhost:6000 x86_64-softmmu/qemu-system-x86_64: -monitor tcp:localhost:6000: Failed to connect to socket: Connection refused chardev: opening backend "socket" failed $ x86_64-softmmu/qemu-system-x86_64 -monitor tcp:foo.bar:12345 qemu-system-x86_64: -monitor tcp:foo.bar:12345: address resolution failed for foo.bar:12345: Name or service not known chardev: opening backend "socket" failed $ x86_64-softmmu/qemu-system-x86_64 -monitor tcp:localhost:443,server=on qemu-system-x86_64: -monitor tcp:localhost:443,server=on: Failed to bind socket: Permission denied chardev: opening backend "socket" failed Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23migration (incoming): add error propagation to fd and exec protocolsPaolo Bonzini7-42/+27
And remove the superfluous integer return value. Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23migration (outgoing): add error propagation for all protocolsPaolo Bonzini6-65/+22
Error propagation is already there for socket backends. Add it to other protocols, simplifying code that tests for errors that will never happen. With all protocols understanding Error, the code can be simplified further by removing the return value. Unfortunately, the quality of error messages varies depending on where the error is detected, because no Error is passed to the NonBlockingConnectHandler. Thus, the exact error message still cannot be sent to the user if the OS reports it asynchronously via SO_ERROR. If NonBlockingConnectHandler received an Error**, we could for example report the error class and/or message via a new field of the query-migration command even if it is reported asynchronously. Before: (qemu) migrate fd:ffff migrate: An undefined error has occurred (qemu) info migrate (qemu) After: (qemu) migrate fd:ffff migrate: File descriptor named 'ffff' has not been found (qemu) info migrate capabilities: xbzrle: off Migration status: failed total time: 0 milliseconds Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-23migration: use qemu-sockets to establish Unix socketsPaolo Bonzini3-81/+21
This makes migration-unix.c again a cut-and-paste job from migration-tcp.c, exactly as it was in the beginning. :) Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>