All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Herongguang (Stephen)" <herongguang.he@huawei.com>
To: qemu-devel@nongnu.org, pbonzini@redhat.com, quintela@redhat.com,
	amit.shah@redhat.com
Cc: arei.gonglei@huawei.com, "Huangweidong (C)" <weidong.huang@huawei.com>
Subject: [Qemu-devel] [RFC/PATCH] migration: SMRAM dirty bitmap not fetched from kvm-kmod and not send to destination
Date: Wed, 14 Sep 2016 15:55:53 +0800	[thread overview]
Message-ID: <57D90289.6020003@huawei.com> (raw)

Hi,
We found a problem that when a redhat 6 VM reboots (in grub countdown UI), migrating this VM will result in VM’s memory difference between source and destination side. The difference always resides in GPA 0xA0000~0xC0000, i.e. SMRAM area.

Occasionally this result in VM instruction emulation error in destination side.

After some digging, I think this is because in migration code, in migration_bitmap_sync(), only memory slots in address space address_space_memory’s dirty bitmap  fetched from kvm-kmod, while SMRAM memory slot, in address space smram_address_space’s dirty bitmap not fetched from kvm-kmod, thus modifications in SMRAM in source side are not sent to destination side.

I tried following patch, and this phenomenon does not happen anymore. Do you think this patch is OK or do you have better idea? Thanks.

diff --git a/migration/ram.c b/migration/ram.c
index a3d70c4..1cc4360 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -607,6 +607,8 @@ static void migration_bitmap_sync_init(void)
      iterations_prev = 0;
  }

+extern AddressSpace smram_address_space;
+
  static void migration_bitmap_sync(void)
  {
      RAMBlock *block;
@@ -627,6 +629,7 @@ static void migration_bitmap_sync(void)

      trace_migration_bitmap_sync_start();
      address_space_sync_dirty_bitmap(&address_space_memory);
+    address_space_sync_dirty_bitmap(&smram_address_space);

      qemu_mutex_lock(&migration_bitmap_mutex);
      rcu_read_lock();
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index d1a25c5..b98fe22 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1111,7 +1111,7 @@ static int kvm_get_supported_msrs(KVMState *s)

  static Notifier smram_machine_done;
  static KVMMemoryListener smram_listener;
-static AddressSpace smram_address_space;
+AddressSpace smram_address_space;
  static MemoryRegion smram_as_root;
  static MemoryRegion smram_as_mem;

             reply	other threads:[~2016-09-14  7:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-14  7:55 Herongguang (Stephen) [this message]
2016-09-14  9:05 ` [Qemu-devel] [RFC/PATCH] migration: SMRAM dirty bitmap not fetched from kvm-kmod and not send to destination Paolo Bonzini
2016-09-22 13:16   ` Herongguang (Stephen)
2016-09-23  1:11     ` Herongguang (Stephen)
2016-09-23  7:17     ` Paolo Bonzini
2016-09-23  8:51       ` Herongguang (Stephen)
2016-09-23  8:59         ` Paolo Bonzini
2016-09-23  9:14           ` Herongguang (Stephen)
2016-09-25 11:33       ` Herongguang (Stephen)
2016-09-26  7:15         ` Paolo Bonzini
2016-09-22  7:51 ` [RFC/PATCH 2] kvm: x86: handle KVM_SET_VCPU_EVENTS/KVM_VCPUEVENT_VALID_SMM properly Herongguang (Stephen)
2016-09-22  7:51   ` [Qemu-devel] " Herongguang (Stephen)
2016-09-22  9:29   ` Paolo Bonzini
2016-09-22  9:29     ` [Qemu-devel] " Paolo Bonzini
2016-09-22 13:19     ` Herongguang (Stephen)
2016-09-22 13:19       ` [Qemu-devel] " Herongguang (Stephen)
2016-09-22  7:56 ` [Qemu-devel] [RFC/PATCH 3] kvm: fix events.flags (KVM_VCPUEVENT_VALID_SMM) overwritten by 0 Herongguang (Stephen)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57D90289.6020003@huawei.com \
    --to=herongguang.he@huawei.com \
    --cc=amit.shah@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    --cc=weidong.huang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.