summaryrefslogtreecommitdiffstats
path: root/arch_init.c
Commit message (Collapse)AuthorAgeFilesLines
* Protect migration_bitmap_sync() with the ramlist lockPaolo Bonzini2013-01-171-2/+1
| | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Reviewed-by: Eric Blake <eblake@redhat.com>
* Unlock ramlist lock also in error casePaolo Bonzini2013-01-171-1/+2
| | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Reviewed-by: Eric Blake <eblake@redhat.com>
* ram: refactor ram_save_block() return valueJuan Quintela2012-12-201-10/+15
| | | | | | | | | | | | | | It could only return 0 if we only found dirty xbzrle pages that hadn't changed (i.e. they were written with the same content). We don't care about that case, it is the same than nothing dirty. So now the return of the function is how much have it written, nothing else. Adjust callers. And we also made ram_save_iterate() return the number of transferred bytes, not the number of transferred pages. Signed-off-by: Juan Quintela <quintela@redhat.com>
* ram: account the amount of transferred ram betterJuan Quintela2012-12-201-14/+20
| | | | Signed-off-by: Juan Quintela <quintela@redhat.com>
* ram: optimize migration bitmap walkingJuan Quintela2012-12-201-19/+26
| | | | | | | | Instead of testing each page individually, we search what is the next dirty page with a bitmap operation. We have to reorganize the code to move from a "for" loop, to a while(dirty) loop. Signed-off-by: Juan Quintela <quintela@redhat.com>
* ram: Use memory_region_test_and_clear_dirtyJuan Quintela2012-12-201-4/+3
| | | | | | | This avoids having to do two walks over the dirty bitmap, once reading the dirty bits, and anthoer cleaning them. Signed-off-by: Juan Quintela <quintela@redhat.com>
* ram: Add last_sent_blockJuan Quintela2012-12-201-1/+5
| | | | | | | This is the last block from where we have sent data. Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* ram: rename last_block to last_seen_blockJuan Quintela2012-12-201-6/+10
| | | | Signed-off-by: Juan Quintela <quintela@redhat.com>
* savevm: New save live migration method: pendingJuan Quintela2012-12-201-30/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code just now does (simplified for clarity) if (qemu_savevm_state_iterate(s->file) == 1) { vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); qemu_savevm_state_complete(s->file); } Problem here is that qemu_savevm_state_iterate() returns 1 when it knows that remaining memory to sent takes less than max downtime. But this means that we could end spending 2x max_downtime, one downtime in qemu_savevm_iterate, and the other in qemu_savevm_state_complete. Changed code to: pending_size = qemu_savevm_state_pending(s->file, max_size); DPRINTF("pending size %lu max %lu\n", pending_size, max_size); if (pending_size >= max_size) { ret = qemu_savevm_state_iterate(s->file); } else { vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); qemu_savevm_state_complete(s->file); } So what we do is: at current network speed, we calculate the maximum number of bytes we can sent: max_size. Then we ask every save_live section how much they have pending. If they are less than max_size, we move to complete phase, otherwise we do an iterate one. This makes things much simpler, because now individual sections don't have to caluclate the bandwidth (it was implossible to do right from there). Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* protect the ramlist with a separate mutexUmesh Deshpande2012-12-201-1/+8
| | | | | | | | | | | | Add the new mutex that protects shared state between ram_save_live and the iothread. If the iothread mutex has to be taken together with the ramlist mutex, the iothread shall always be _outside_. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Umesh Deshpande <udeshpan@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
* add a version number to ram_listUmesh Deshpande2012-12-201-1/+6
| | | | | | | | | | | This will be used to detect if last_block might have become invalid across different calls to ram_save_live. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Umesh Deshpande <udeshpan@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
* exec: sort the memory from biggest to smallestPaolo Bonzini2012-12-201-30/+0
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* exec: change RAM list to a TAILQPaolo Bonzini2012-12-201-12/+12
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* exec: change ramlist from MRU order to a 1-item cachePaolo Bonzini2012-12-201-0/+1
| | | | | | | | | Most of the time, only 2 items will be active (from/to for a string operation, or code/data). But TCG guests likely won't have gigabytes of memory, so this actually goes down to 1 item. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: fix migration_bitmap leakPaolo Bonzini2012-12-201-6/+7
| | | | | | Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* softmmu: move include files to include/sysemu/Paolo Bonzini2012-12-191-3/+3
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* misc: move include files to include/qemu/Paolo Bonzini2012-12-191-3/+3
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* migration: move include files to include/migration/Paolo Bonzini2012-12-191-2/+2
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* monitor: move include files to include/monitor/Paolo Bonzini2012-12-191-1/+1
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* exec: move include files to include/exec/Paolo Bonzini2012-12-191-2/+2
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* net: do not include net.h everywherePaolo Bonzini2012-12-191-1/+0
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* janitor: do not rely on indirect inclusions of or from qemu-char.hPaolo Bonzini2012-12-191-0/+1
| | | | | | | | | Various header files rely on qemu-char.h including qemu-config.h or main-loop.h, but they really do not need qemu-char.h at all (particularly interesting is the case of the block layer!). Clean this up, and also add missing inclusions of qemu-char.h itself. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* Merge commit '1dd3a74d2ee2d873cde0b390b536e45420b3fe05' into HEADPaolo Bonzini2012-12-171-1/+1
|\ | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| * pci: update all users to look in pci/Michael S. Tsirkin2012-12-171-1/+1
| | | | | | | | | | | | update all users so we can remove the makefile hack. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | migration: Fix madvise breakage if host and guest have different page sizesDavid Gibson2012-12-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | madvise(DONTNEED) will throw away the contents of the whole page at the given address, even if the given length is less than the page size. One can argue about whether that's the correct behaviour, but that's what it's done for a long time in Linux at least. That means that the madvise() in ram_load(), on a setup where TARGET_PAGE_SIZE is smaller than the host page size, can throw away data in guest pages adjacent to the one it's actually processing right now, leading to guest memory corruption on an incoming migration. This patch therefore, disables the madvise() if the host page size is larger than TARGET_PAGE_SIZE. This means we don't get the benefits of that madvise() in this case, but a more complete fix is more difficult to accomplish. This at least fixes the guest memory corruption. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* | Fix off-by-1 error in RAM migration codeDavid Gibson2012-12-121-1/+1
|/ | | | | | | | | | | The code for migrating (or savevm-ing) memory pages starts off by creating a dirty bitmap and filling it with 1s. Except, actually, because bit addresses are 0-based it fills every bit except bit 0 with 1s and puts an extra 1 beyond the end of the bitmap, potentially corrupting unrelated memory. Oops. This patch fixes it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* migration: Add dirty_pages_rate to query migrate outputJuan Quintela2012-10-171-0/+18
| | | | | | It indicates how many pages were dirtied during the last second. Signed-off-by: Juan Quintela <quintela@redhat.com>
* Separate migration bitmapJuan Quintela2012-10-171-20/+43
| | | | | | | | | | | | | | | | This patch creates a migration bitmap, which is periodically kept in sync with the qemu bitmap. A separate copy of the dirty bitmap for the migration limits the amount of concurrent access to the qemu bitmap from iothread and migration thread (which requires taking the big lock). We use the qemu bitmap type. We have to "undo" the dirty_pages counting optimization on the general dirty bitmap and do the counting optimization with the migration local bitmap. Signed-off-by: Umesh Deshpande <udeshpan@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* ram: create trace event for migration sync bitmapJuan Quintela2012-10-171-0/+6
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* ram: introduce migration_bitmap_sync()Juan Quintela2012-10-171-2/+8
| | | | | | | | | Helper that we use each time that we need to syncronize the migration bitmap with the other dirty bitmaps. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* ram: Introduce migration_bitmap_test_and_reset_dirty()Juan Quintela2012-10-171-5/+14
| | | | | | | | | It just test if the dirty bit is set, and clears it. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
* ram: introduce migration_bitmap_set_dirty()Juan Quintela2012-10-171-7/+13
| | | | | | | | | It just marks a region of memory as dirty. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
* savevm: Factorize ram globals reset in its own functionJuan Quintela2012-10-171-3/+9
| | | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
* migration: print expected downtime in info migrateJuan Quintela2012-10-171-0/+2
| | | | Signed-off-by: Juan Quintela <quintela@redhat.com>
* migration: rename expected_time to expected_downtimeJuan Quintela2012-10-171-10/+10
| | | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
* fix migration syncJuan Quintela2012-10-171-0/+1
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
* Eliminate cpus-x86_64.conf fileEduardo Habkost2012-09-211-1/+0
| | | | | | | | | This file is not needed anymore, as QEMU won't ship any config-based cpudefs out of the box, relying only on the builtin CPU models. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
* arch_init.c: Improve '-soundhw help' for non-HAS_AUDIO_CHOICE archsPeter Maydell2012-09-191-0/+5
| | | | | | | | | For architectures which don't set HAS_AUDIO_CHOICE, improve the '-soundhw help' message so that it doesn't simply print an empty list, implying no sound support at all. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: malc <av1474@comtv.ru>
* arch_init.c: add missing '%' symbols before PRIu64 in debug printfsIgor Mitsyanko2012-09-141-4/+4
| | | | | | | | '%' symbols were missing in front of PRIu64 macros in DPRINTF() messages in arch_init.c, this caused compilation warnings when compiled with DEBUG_ARCH_INIT defined. Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
* qapi: add 'query-target' command to return target archDaniel P. Berrange2012-08-221-0/+11
| | | | | | | | | | | | | Add a 'query-target' QAPI command to allow management applications to determine what target architecture a QEMU binary is emulating without having to parse the binary name or -help output $ qmp-shell -p /tmp/qemu (QEMU) query-target { u'return': { u'arch': u'x86_64' }} Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'quintela/migration-next-20120808' into stagingAnthony Liguori2012-08-131-5/+241
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * quintela/migration-next-20120808: Restart optimization on stage3 update version Add XBZRLE statistics Add migration accounting for normal and duplicate pages Change total_time to total-time in MigrationStats Add migrate_set_cache_size command Add XBZRLE to ram_save_block and ram_save_live Add xbzrle_encode_buffer and xbzrle_decode_buffer functions Add uleb encoding/decoding functions Add cache handling functions Add XBZRLE documentation Add migrate-set-capabilities Add migration capabilities
| * Restart optimization on stage3 update versionJuan Quintela2012-08-081-9/+15
| | | | | | | | | | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
| * Add XBZRLE statisticsOrit Wasserman2012-08-081-0/+28
| | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com> Signed-off-by: Petter Svard <petters@cs.umu.se> Signed-off-by: Aidan Shribman <aidan.shribman@sap.com> Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
| * Add migration accounting for normal and duplicate pagesOrit Wasserman2012-08-081-0/+38
| | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com> Signed-off-by: Petter Svard <petters@cs.umu.se> Signed-off-by: Aidan Shribman <aidan.shribman@sap.com> Signed-off-by: Orit Wasserman <owasserm@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
| * Add migrate_set_cache_size commandOrit Wasserman2012-08-081-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change XBZRLE cache size in bytes (the size should be a power of 2, it will be rounded down to the nearest power of 2). If XBZRLE cache size is too small there will be many cache miss. New query-migrate-cache-size QMP command and 'info migrate_cache_size' HMP command to query cache value. Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com> Signed-off-by: Petter Svard <petters@cs.umu.se> Signed-off-by: Aidan Shribman <aidan.shribman@sap.com> Signed-off-by: Orit Wasserman <owasserm@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
| * Add XBZRLE to ram_save_block and ram_save_liveOrit Wasserman2012-08-081-2/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the outgoing migration check to see if the page is cached and changed, then send compressed page by using save_xbrle_page function. In the incoming migration check to see if RAM_SAVE_FLAG_XBZRLE is set and decompress the page (by using load_xbrle function). Signed-off-by: Benoit Hudzia <benoit.hudzia@sap.com> Signed-off-by: Petter Svard <petters@cs.umu.se> Signed-off-by: Aidan Shribman <aidan.shribman@sap.com> Signed-off-by: Orit Wasserman <owasserm@redhat.com> Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
* | unicore32-softmmu: Add unicore32-softmmu build supportGuan Xuetao2012-08-111-0/+2
|/ | | | | | | | | | | This patch adds unicore32-softmmu build support, include configure, makefile, arch_init, and all missing functions needed by softmmu. Although all missing functions are empty, unicore32-softmmu could be build successfully. By 20120804: change QEMU_ARCH_UNICORE32 to 0x4000 Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Support 'help' as a synonym for '?' in command line optionsPeter Maydell2012-08-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | For command line options which permit '?' meaning 'please list the permitted values', add support for 'help' as a synonym, by abstracting the check out into a helper function. This change means that in some cases where we were being lazy in our string parsing, "?junk" will now be rejected as an invalid option rather than being (undocumentedly) treated the same way as "?". Update the documentation to use 'help' rather than '?', since '?' is a shell metacharacter and thus prone to fail confusingly if there is a single character filename in the current working directory and the '?' has not been escaped. It's therefore better to steer users towards 'help', though '?' is retained for backwards compatibility. We do not, however, update the output of the system emulator's -help (or any documentation autogenerated from the qemu-options.hx which is the source of the -help text) because libvirt parses our -help output and will break. At a later date when QEMU provides a better interface so libvirt can avoid having to do this, we can update the -help text too. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge commit 'quintela/migration-next-v5' into stagingAnthony Liguori2012-07-301-50/+87
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '6c779f22a93cc6e4565b940ef616e3efc5b50ba5': Change ram_save_block to return -1 if there are no more changes ram: save_live_setup() we don't need to synchronize the dirty bitmap. ram: iterate phase ram: save_live_complete() only do one loop ram: save_live_setup() don't need to sent pages savevm: split save_live into stage2 and stage3 savevm: split save_live_setup from save_live_state savevm: introduce is_active method savevm: Refactor cancel operation in its own operation savevm: remove SaveLiveStateHandler savevm: remove SaveSetParamsHandler savevm: Live migration handlers register the struct directly savevm: Use a struct to pass all handlers
| * Change ram_save_block to return -1 if there are no more changesOrit Wasserman2012-07-231-6/+20
| | | | | | | | | | | | It will return 0 if the page is unmodifed. Signed-off-by: Orit Wasserman <owasserm@redhat.com>
OpenPOWER on IntegriCloud