Commit Graph

97 Commits

Author SHA1 Message Date
Paolo Bonzini 1de7afc984 misc: move include files to include/qemu/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19 08:32:39 +01:00
Paolo Bonzini caf71f86a3 migration: move include files to include/migration/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19 08:31:32 +01:00
Paolo Bonzini 83c9089e73 monitor: move include files to include/monitor/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19 08:31:32 +01:00
Paolo Bonzini 022c62cbbc exec: move include files to include/exec/
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19 08:31:31 +01:00
Paolo Bonzini 7fa22f2bf7 net: do not include net.h everywhere
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-19 08:29:59 +01:00
Paolo Bonzini 077805fa92 janitor: do not rely on indirect inclusions of or from qemu-char.h
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>
2012-12-19 08:29:52 +01:00
Paolo Bonzini 6f991980a5 Merge commit '1dd3a74d2ee2d873cde0b390b536e45420b3fe05' into HEAD
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-12-17 18:56:22 +01:00
Michael S. Tsirkin a2cb15b0dd pci: update all users to look in pci/
update all users so we can remove the makefile hack.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-12-17 13:02:26 +02:00
David Gibson 45e6cee42b migration: Fix madvise breakage if host and guest have different page sizes
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>
2012-12-12 15:03:31 -06:00
David Gibson 7ec81e56ed Fix off-by-1 error in RAM migration code
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>
2012-12-12 15:03:31 -06:00
Juan Quintela 8d017193e2 migration: Add dirty_pages_rate to query migrate output
It indicates how many pages were dirtied during the last second.

Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-10-17 18:34:58 +02:00
Juan Quintela c6bf8e0e0c Separate migration bitmap
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>
2012-10-17 18:34:58 +02:00
Juan Quintela 3c12193d99 ram: create trace event for migration sync bitmap
Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-17 18:34:58 +02:00
Juan Quintela dd2df737ef ram: introduce migration_bitmap_sync()
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>
2012-10-17 18:34:58 +02:00
Juan Quintela 69268cde14 ram: Introduce migration_bitmap_test_and_reset_dirty()
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>
2012-10-17 18:34:58 +02:00
Juan Quintela e44d26c8f3 ram: introduce migration_bitmap_set_dirty()
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>
2012-10-17 18:34:58 +02:00
Juan Quintela 5a17077529 savevm: Factorize ram globals reset in its own function
Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
2012-10-17 18:34:58 +02:00
Juan Quintela 2c52ddf1cb migration: print expected downtime in info migrate
Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-10-17 18:34:58 +02:00
Juan Quintela c00012f68b migration: rename expected_time to expected_downtime
Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Orit Wasserman <owasserm@redhat.com>
2012-10-17 18:34:58 +02:00
Juan Quintela 79536f4f16 fix migration sync
Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-17 18:34:58 +02:00
Eduardo Habkost ba6212d8a8 Eliminate cpus-x86_64.conf file
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>
2012-09-21 15:12:58 +02:00
Peter Maydell 55d4fd3c24 arch_init.c: Improve '-soundhw help' for non-HAS_AUDIO_CHOICE archs
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>
2012-09-19 17:55:08 +04:00
Igor Mitsyanko ef37a699a0 arch_init.c: add missing '%' symbols before PRIu64 in debug printfs
'%' 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>
2012-09-14 08:21:29 +01:00
Daniel P. Berrange 99afc91d6c qapi: add 'query-target' command to return target arch
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>
2012-08-22 10:47:17 -05:00
Anthony Liguori ac839ccd8c Merge remote-tracking branch 'quintela/migration-next-20120808' into staging
* 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
2012-08-13 16:02:11 -05:00
Guan Xuetao 4f23a1e645 unicore32-softmmu: Add unicore32-softmmu build support
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>
2012-08-11 09:36:55 +00:00
Juan Quintela dd051c7217 Restart optimization on stage3 update version
Signed-off-by: Juan Quintela <quintela@redhat.com>

Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2012-08-08 13:51:12 +02:00
Orit Wasserman f36d55af74 Add XBZRLE statistics
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>
2012-08-08 13:51:12 +02:00
Orit Wasserman 004d4c10ae Add migration accounting for normal and duplicate pages
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>
2012-08-08 13:51:12 +02:00
Orit Wasserman 9e1ba4cc4e Add migrate_set_cache_size command
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>
2012-08-08 13:51:12 +02:00
Orit Wasserman 17ad9b358b Add XBZRLE to ram_save_block and ram_save_live
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>
2012-08-08 13:51:12 +02:00
Peter Maydell c8057f951d Support 'help' as a synonym for '?' in command line options
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>
2012-08-02 13:16:42 -05:00
Anthony Liguori e6a7671998 Merge commit 'quintela/migration-next-v5' into staging
* 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
2012-07-30 09:58:48 -05:00
Jia Liu e67db06e9f target-or32: Add target stubs and QOM cpu
Add OpenRISC target stubs, QOM cpu and basic machine.

Signed-off-by: Jia Liu <proljc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-07-27 21:12:55 +00:00
Orit Wasserman 6c779f22a9 Change ram_save_block to return -1 if there are no more changes
It will return 0 if the page is unmodifed.

Signed-off-by: Orit Wasserman <owasserm@redhat.com>
2012-07-23 14:02:28 +02:00
Juan Quintela 6d2fe810ed ram: save_live_setup() we don't need to synchronize the dirty bitmap.
1st: we were synchonizing the dirty bitmap before calling
      memory_global_dirty_log_start().

2nd: We are marking all pages as dirty anywhere, no reason to go
     through all the bitmap to "mark" dirty same pages twice.

So, call removed.

Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-07-20 08:19:27 +02:00
Juan Quintela 00d94f3f76 ram: iterate phase
We only need to synchronize the bitmap when the number of dirty pages is low.
Not every time that we call the function.

Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-07-20 08:19:27 +02:00
Juan Quintela b81e712d25 ram: save_live_complete() only do one loop
We were doing the same loop that stage2, and a new one for stage3.  We
only need the one for stage3.

Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-07-20 08:19:27 +02:00
Juan Quintela 5910d1e6cb ram: save_live_setup() don't need to sent pages
We should send pages on interate phase, not in setup one.  This was a
"bug".  Just removing the loop does what we want.  Tested that it
works with current ram_load().

Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-07-20 08:19:27 +02:00
Juan Quintela 16310a3cca savevm: split save_live into stage2 and stage3
We split it into 2 functions, foo_live_iterate, and foo_live_complete.
At this point, we only remove the bits that are for the other stage,
functionally this is equivalent to previous code.

Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-07-20 08:19:27 +02:00
Juan Quintela d1315aac6e savevm: split save_live_setup from save_live_state
This patch splits stage 1 to its own function for both save_live
users, ram and block.  It is just a copy of the function, removing the
parts of the other stages.  Optimizations would came later.

Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-07-20 08:19:27 +02:00
Juan Quintela 9b5bfab05f savevm: Refactor cancel operation in its own operation
Intead of abusing stage with value -1.

Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-07-20 08:19:27 +02:00
Juan Quintela 7908c78d3e savevm: Live migration handlers register the struct directly
Notice that the live migration users never unregister, so no problem
about freeing the ops structure.

Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-07-20 08:19:27 +02:00
Juan Quintela 45f33f01f3 Maintain the number of dirty pages
Calculate the number of dirty pages takes a lot on hosts with lots
of memory.  Just maintain how many pages are dirty.

Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-06-29 13:31:07 +02:00
Juan Quintela 4508bd9ed8 Exit loop if we have been there too long
Checking each 64 pages is a random magic number as good as any other.
We don't want to test too many times, but on the other hand,
qemu_get_clock_ns() is not so expensive either.  We want to be sure
that we spent less than 50ms (half of buffered_file timer), if we
spent more than 100ms, all the accounting got wrong.

Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-06-29 13:31:04 +02:00
Juan Quintela 5b3c963887 Only calculate expected_time for stage 2
ram_save_remaining() is an expensive operation when there is a lot of memory.
So we only call the function when we need it.

Signed-off-by: Juan Quintela <quintela@redhat.com>
2012-06-29 13:28:09 +02:00
Orit Wasserman 8e21cd3200 Add migration_end function
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
2012-06-29 13:27:28 +02:00
Orit Wasserman 3a697f697b Add debugging infrastructure
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
2012-06-29 13:27:14 +02:00
Orit Wasserman 0c51f43d7a Add save_block_hdr 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>
2012-06-29 13:18:28 +02:00
Orit Wasserman 0ff1f9f585 Add missing check for host_from_stream_offset return value for RAM_SAVE_FLAG_PAGE
Signed-off-by: Orit Wasserman <owasserm@redhat.com>
2012-06-29 10:38:28 +02:00