summaryrefslogtreecommitdiffstats
path: root/vl.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix warnings caused by timer_t, it is 32 bits on Sparc64blueswir12008-11-161-3/+3
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5725 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix no_frame unused warning when SDL is disabledblueswir12008-11-161-0/+2
| | | | | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5724 c046a42c-6fe2-441c-8c8c-71466251a162
* Split savevm code into savevm.caliguori2008-11-111-1156/+0
| | | | | | | | | | | This is pure code motion. The savevm code is all common code so we can build it once and share the object with all executables. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5700 c046a42c-6fe2-441c-8c8c-71466251a162
* Reintroduce migrate-to-exec: support (Charles Duffy)aliguori2008-11-111-0/+64
| | | | | | | | | | | | | | | | | | | KVM's live migration support included support for exec: URLs, allowing system state to be written or received via an arbitrary popen()ed subprocess. This provides a convenient way to pipe state through a compression algorithm or an arbitrary network transport on its way to its destination, and a convenient way to write state to disk; libvirt's qemu driver currently uses migration to exec: targets for this latter purpose. This version of the patch refactors now-common code from migrate-tcp.c into migrate.c. Signed-off-by: Charles Duffy <Charles_Duffy@messageone.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5694 c046a42c-6fe2-441c-8c8c-71466251a162
* Revert commits 5685 to 5688 committed by mistakeaurel322008-11-111-1/+1
| | | | | | Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5691 c046a42c-6fe2-441c-8c8c-71466251a162
* qemu: generate signals on tap I/Oaurel322008-11-111-1/+1
| | | | | | | | | | | | Currently tap does not generate signals on I/O; this causes network latency to be dependent on the timer tick (1ms without dyntick, guest dependent with dyntick). By generating a signal on I/O, we can inform the guest immediately that a packet has arrived. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5688 c046a42c-6fe2-441c-8c8c-71466251a162
* Add the -bt switch for setting up bluetooth stuff.balrog2008-11-091-2/+172
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5652 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix some build issues for BSD.blueswir12008-11-071-7/+12
| | | | | | | Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5646 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix windows build after init_host_timer changes.aliguori2008-11-051-30/+41
| | | | | | | | | | | | | host_alarm_timer fires in a separate thread. The windows build current uses SetEvent() and WaitEvent() to then notify the main thread. This is functionally equivalent to what we're doing in Unix with pipe(). So let's just #ifdef the pipe() code on Windows since it doesn't build there anyway. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5637 c046a42c-6fe2-441c-8c8c-71466251a162
* Run timers from host alarm timer callbackaliguori2008-11-051-10/+9
| | | | | | | | | | | This further cleans up the main loop getting it a lot closer to what a main loop should be. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5636 c046a42c-6fe2-441c-8c8c-71466251a162
* Use qemu_set_fd_handler2() to determine when alarm timer fires.aliguori2008-11-051-13/+22
| | | | | | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5635 c046a42c-6fe2-441c-8c8c-71466251a162
* Improve error reporting in init_timer_alarmaliguori2008-11-051-16/+42
| | | | | | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5634 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix alarm_timer race with select - v3 (Jan Kiszka)aliguori2008-11-051-2/+26
| | | | | | | | | | | | | | | | | | | | | Changing the default IO timeout to 5 s (#5578) made a race visible between the alarm_timer and select() in main_loop_wait(): If the timer fired before select was able to block, the full select() timeout could have been applied instead of returning immediately. Since #5578, this causes heavy problems to the Musicpal board emulation with stalls up to 5 s, but also with some older Linux guest kernels. The following patch introduces a pipe that is written to by host_alarm_handler and select()'ed in main_loop_wait(). This avoids prevents that select() blocks though a timer has fired and waits for processing. Signed-off-by: Jan Kiszka <jan.kiszka@web.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5633 c046a42c-6fe2-441c-8c8c-71466251a162
* Add KVM support to QEMUaliguori2008-11-051-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds very basic KVM support. KVM is a kernel module for Linux that allows userspace programs to make use of hardware virtualization support. It current supports x86 hardware virtualization using Intel VT-x or AMD-V. It also supports IA64 VT-i, PPC 440, and S390. This patch only implements the bare minimum support to get a guest booting. It has very little impact the rest of QEMU and attempts to integrate nicely with the rest of QEMU. Even though this implementation is basic, it is significantly faster than TCG. Booting and shutting down a Linux guest: w/TCG: 1:32.36 elapsed 84% CPU w/KVM: 0:31.14 elapsed 59% CPU Right now, KVM is disabled by default and must be explicitly enabled with -enable-kvm. We can enable it by default later when we have had better testing. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5627 c046a42c-6fe2-441c-8c8c-71466251a162
* Remove dumb_refreshaliguori2008-10-311-9/+2
| | | | | | | | | | | It is safe not to set dpy_refresh and that's used to indicate that the display doesn't need updates. This saves us two wakeups per second. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5583 c046a42c-6fe2-441c-8c8c-71466251a162
* Move network redirection code out of vl.c and into net.caliguori2008-10-311-1462/+10
| | | | | | | | | | Mostly code motion. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5581 c046a42c-6fe2-441c-8c8c-71466251a162
* Move CharDriverState code out of vl.caliguori2008-10-311-2113/+1
| | | | | | | | | | | | The motivating goal behind this is to allow other tools to use the CharDriver code. This patch is pure code motion except for the Makefile changes and the copyright/header in qemu-char.c. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5580 c046a42c-6fe2-441c-8c8c-71466251a162
* Move some declarations around in the QEMU CharDriver codealiguori2008-10-311-17/+8
| | | | | | | | | | | | The goal of this series is to move the CharDriverState code out of vl.c and into its own file, qemu-char.c. This patch moves around some declarations so the next patch can be pure code motion. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5579 c046a42c-6fe2-441c-8c8c-71466251a162
* Increase default IO timeout from 10ms to 5saliguori2008-10-311-2/+2
| | | | | | | | | | | | | | | | | With the recent changes to the main loop, we no longer have unconditional polling. This means we can now sleep in select() for much longer than we previously did. This patch increases our select() sleep time from 10ms to 5s which is effectively unlimited since we're going to wake up sooner than that in almost all circumstances. With this patch, I see the number of wake-ups with an idle dynamic ticks guest drop from 80 per second to about 15 times per second. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5578 c046a42c-6fe2-441c-8c8c-71466251a162
* Main loop fixes/cleanupaliguori2008-10-311-17/+47
| | | | | | | | | Tidy up win32 main loop bits, allow timeout >= 1s, and force timeout to 0 if there is a pending bottom half. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5577 c046a42c-6fe2-441c-8c8c-71466251a162
* Implement "info chardev" command. (Gerd Hoffmann)aliguori2008-10-311-33/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes qemu keep track of the character devices in use and implements a "info chardev" monitor command to print a list. qemu_chr_open() sticks the devices into a linked list now. It got a new argument (label), so there is a name for each device. It also assigns a filename to each character device. By default it just copyes the filename passed in. Individual drivers can fill in something else though. qemu_chr_open_pty() sets the filename to name of the pseudo tty allocated. Output looks like this: (qemu) info chardev monitor: filename=unix:/tmp/run.sh-26827/monitor,server,nowait serial0: filename=unix:/tmp/run.sh-26827/console,server serial1: filename=pty:/dev/pts/5 parallel0: filename=vc:640x480 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5575 c046a42c-6fe2-441c-8c8c-71466251a162
* Make DMA bottom-half driven (v2)aliguori2008-10-311-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current DMA routines are driven by a call in main_loop_wait() after every select. This patch converts the DMA code to be driven by a constantly rescheduled bottom half. The advantage of using a scheduled bottom half is that we can stop scheduling the bottom half when there no DMA channels are runnable. This means we can potentially detect this case and sleep longer in the main loop. The only two architectures implementing DMA_run() are cris and i386. For cris, I converted it to a simple repeating bottom half. I've only compile tested this as cris does not seem to work on a 64-bit host. It should be functionally identical to the previous implementation so I expect it to work. For x86, I've made sure to only fire the DMA bottom half if there is a DMA channel that is runnable. The effect of this is that unless you're using sb16 or a floppy disk, the DMA bottom half never fires. You probably should test this malc. My own benchmarks actually show slight improvement by it's possible the change in timing could affect your demos. Since v1, I've changed the code to use a BH instead of a timer. cris at least seems to depend on faster than 10ms polling. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5573 c046a42c-6fe2-441c-8c8c-71466251a162
* Make bottom halves more robustaliguori2008-10-311-23/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | Bottom halves are supposed to not complete until the next iteration of the main loop. This is very important to ensure that guests can not cause stack overflows in the block driver code. Right now, if you attempt to schedule a bottom half within a bottom half callback, you will enter an infinite loop. This patch uses the same logic that we use for the IOHandler loop to make the bottom half processing robust in list manipulation while in a callback. This patch also introduces idle scheduling for bottom halves. qemu_bh_poll() returns an indication of whether any bottom halves were successfully executed. qemu_aio_wait() uses this to immediately return if a bottom half was executed instead of waiting for a completion notification. qemu_bh_schedule_idle() works around this by not reporting the callback has run in the qemu_bh_poll loop. qemu_aio_wait() probably needs some refactoring but that would require a larger code audit. idle scheduling seems like a good compromise. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5572 c046a42c-6fe2-441c-8c8c-71466251a162
* Set default max_cpus to one.balrog2008-10-281-0/+1
| | | | | | | Clean-up machine definitions. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5566 c046a42c-6fe2-441c-8c8c-71466251a162
* Suppress a GCC warning about unused functionblueswir12008-10-251-0/+2
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5534 c046a42c-6fe2-441c-8c8c-71466251a162
* Replace uses of strncpy (a GNU extension) with Qemu pstrcpyblueswir12008-10-251-2/+2
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5531 c046a42c-6fe2-441c-8c8c-71466251a162
* Live migration for Win32 (Hervé Poussineau)aliguori2008-10-241-12/+12
| | | | | | | | | | | | | This patch fixes migration so that it works on Win32. This requires using socket specific calls since sockets cannot be treated like file descriptors on win32. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5525 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix windows build after migration changesaliguori2008-10-241-3/+2
| | | | | | | | | | | | | The live migration code broke the windows build. As part of this change, I've switched the BIOS path to C:\Program Files\Qemu instead of /c/Program Files/Qemu. The later is only valid when launching from MSYS but the former is always valid. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5524 c046a42c-6fe2-441c-8c8c-71466251a162
* Expand cache= option and use write-through caching by defaultaliguori2008-10-141-6/+12
| | | | | | | | | | | | | | | | | | This patch changes the cache= option to accept none, writeback, or writethough to control the host page cache behavior. By default, writethrough caching is now used which internally is implemented by using O_DSYNC to open the disk images. When using -snapshot, writeback is used by default since data integrity it not at all an issue. cache=none has the same behavior as cache=off previously. The later syntax is still supported by now deprecated. I also cleaned up the O_DIRECT implementation to avoid many of the #ifdefs. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5485 c046a42c-6fe2-441c-8c8c-71466251a162
* FreeBSD also has clock_gettimeaurel322008-10-131-2/+2
| | | | | | | Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5481 c046a42c-6fe2-441c-8c8c-71466251a162
* Introduce ethernet announcement function.aliguori2008-10-131-0/+39
| | | | | | | | | | | This patch adds an ethernet announce function that will minimize downtime when doing a live migration. This code originates from KVM. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5477 c046a42c-6fe2-441c-8c8c-71466251a162
* Introduce UI for live migrationaliguori2008-10-131-1/+14
| | | | | | | | | | | | This patch introduces a command line parameter and monitor command for starting a live migration. The next patch will provide an example of how to use these parameters. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5476 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix some issues with QEMUFilealiguori2008-10-131-43/+79
| | | | | | | | | | | | | | | | This patch allows QEMUFile's read and write operations to return negative error codes. This is necessary to detect things like closed streams during live migration. It also removes unused code for QEMUFileFD write path. Finally, it makes sure to avoid attempting to flush an output buffer if the file is only being used for input. This was spotted by Uri Lublin. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5474 c046a42c-6fe2-441c-8c8c-71466251a162
* Get rid of sys/poll.haurel322008-10-121-1/+0
| | | | | | (C.W. Betts) git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5463 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix IO performance regression in sparcaliguori2008-10-081-0/+13
| | | | | | | | | | | | | | | | | | Replace signalfd with signal handler/pipe. There is no way to interrupt the CPU execution loop when a file descriptor becomes readable. This results in a large performance regression in sparc emulation during bootup. This patch switches us to signal handler/pipe which was originally suggested by Ian Jackson. The signal handler lets us interrupt the CPU emulation loop while the write to a pipe lets us avoid the select/signal race condition. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5451 c046a42c-6fe2-441c-8c8c-71466251a162
* machine struct - specify max_cpus at the per machine level (Jes Sorensen)aliguori2008-10-071-8/+8
| | | | | | | | | | | | | | | Introduce a max_cpus per-machine variable, allowing individual boards to limit it's number of CPUs. Check requested number of CPUs in setup code and exit if it exceeds the supported number for the machine. This also renders the static MAX_CPUS check obsolete, so remove this from vl.c. Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5443 c046a42c-6fe2-441c-8c8c-71466251a162
* Switch the memory savevm handler to be "live"aliguori2008-10-061-141/+152
| | | | | | | | | | | | | | | | | | | | This patch replaces the static memory savevm/loadvm handler with a "live" one. This handler is used even if performing a non-live migration. The key difference between this handler and the previous is that each page is prefixed with the address of the page. The QEMUFile rate limiting code, in combination with the live migration dirty tracking bits, is used to determine which pages should be sent and how many should be sent. The live save code "converges" when the number of dirty pages reaches a fixed amount. Currently, this is 10 pages. This is something that should eventually be derived from whatever the bandwidth limitation is. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5437 c046a42c-6fe2-441c-8c8c-71466251a162
* Introduce v3 of savevm protocolaliguori2008-10-061-45/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current savevm/loadvm protocol has some draw backs. It does not support the ability to do progressive saving which means it cannot be used for live checkpointing or migration. The sections sizes are 32-bit integers which means that it will not function when using more than 4GB of memory for a guest. It attempts to seek within the output file which means it cannot be streamed. The current protocol also is pretty lax about how it supports forward compatibility. If a saved section version is greater than what the restore code support, the restore code generally treats the saved data as being in whatever version it supports. This means that restoring a saved VM on an older version of QEMU will likely result in silent guest failure. This patch introduces a new version of the savevm protocol. It has the following features: * Support for progressive save of sections (for live checkpoint/migration) * An asynchronous API for doing save * Support for interleaving multiple progressive save sections (for future support of memory hot-add/storage migration) * Fully streaming format * Strong section version checking Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5434 c046a42c-6fe2-441c-8c8c-71466251a162
* Variable autostart is not used outside main()blueswir12008-10-051-2/+3
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5419 c046a42c-6fe2-441c-8c8c-71466251a162
* Make network packet debug functions more accessibleblueswir12008-10-041-4/+7
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5416 c046a42c-6fe2-441c-8c8c-71466251a162
* Add some missing static qualifiersblueswir12008-10-041-1/+1
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5415 c046a42c-6fe2-441c-8c8c-71466251a162
* Make CPULogItem tables constblueswir12008-10-021-1/+1
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5397 c046a42c-6fe2-441c-8c8c-71466251a162
* Make some variables staticblueswir12008-10-011-14/+14
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5377 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix warning about incompatible typesblueswir12008-10-011-4/+2
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5373 c046a42c-6fe2-441c-8c8c-71466251a162
* Remove unused variableblueswir12008-10-011-1/+0
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5371 c046a42c-6fe2-441c-8c8c-71466251a162
* Add some missing static qualifiersblueswir12008-09-301-2/+2
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5363 c046a42c-6fe2-441c-8c8c-71466251a162
* Silence some warnings about uninitialized variablesblueswir12008-09-301-1/+3
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5362 c046a42c-6fe2-441c-8c8c-71466251a162
* Few compile time warnings removed (Stefano Stabellini)blueswir12008-09-301-3/+4
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5361 c046a42c-6fe2-441c-8c8c-71466251a162
* Refactor QEMUFile for live migrationaliguori2008-09-291-55/+203
| | | | | | | | | | | | | | To support live migration, we override QEMUFile so that instead of writing to disk, the save/restore state happens over a network connection. This patch makes QEMUFile read/write operations function pointers so that we can override them for live migration. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5352 c046a42c-6fe2-441c-8c8c-71466251a162
* Add a "null" bluetooth HCI and a header file for bluetooth.balrog2008-09-281-0/+56
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5342 c046a42c-6fe2-441c-8c8c-71466251a162
OpenPOWER on IntegriCloud