diff mbox

[2/2] QEMU kvm: Add support to get/set vcpu unhalt msr to aid migration

Message ID 4F6C759E.8050004@linux.vnet.ibm.com
State New
Headers show

Commit Message

Raghavendra K T March 23, 2012, 1:07 p.m. UTC
On 03/23/2012 02:27 PM, Jan Kiszka wrote:
> On 2012-03-23 09:23, Raghavendra K T wrote:
>> From: Raghavendra K T<raghavendra.kt@linux.vnet.ibm.com>
>>
>> MSR_KVM_PV_UNHALT tells whether vcpu is unhalted, which needs to be
>> used during migration.
>
> Err, and where is it actually saved to/restored from the vmstate? You
> are lacking an extension of the CPU vmstate, preferably via a substate.
> See e.g. cpu/async_pf_msr.
>

Please let me know whether adding below patch make it complete. Or did
I miss something else ?

---
      CPUX86State *env = opaque;
@@ -462,6 +480,9 @@ static const VMStateDescription vmstate_cpu = {
          }, {
              .vmsd = &vmstate_msr_ia32_misc_enable,
              .needed = misc_enable_needed,
+        }, {
+            .vmsd = &vmstate_pv_unhalt_msr,
+            .needed = pv_unhalt_msr_needed,
          } , {
              /* empty */
          }
diff mbox

Patch

diff --git a/target-i386/machine.c b/target-i386/machine.c
index a8be058..c51d8d1 100644
--- a/target-i386/machine.c
+++ b/target-i386/machine.c
@@ -279,6 +279,13 @@  static bool async_pf_msr_needed(void *opaque)
      return cpu->async_pf_en_msr != 0;
  }

+static bool pv_unhalt_msr_needed(void *opaque)
+{
+    CPUX86State *cpu = opaque;
+
+    return cpu->pv_unhalt_msr != 0;
+}
+
  static const VMStateDescription vmstate_async_pf_msr = {
      .name = "cpu/async_pf_msr",
      .version_id = 1,
@@ -290,6 +297,17 @@  static const VMStateDescription 
vmstate_async_pf_msr = {
      }
  };

+static const VMStateDescription vmstate_pv_unhalt_msr = {
+    .name = "cpu/pv_unhalt_msr",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField []) {
+        VMSTATE_UINT64(pv_unhalt_msr, CPUX86State),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
  static bool fpop_ip_dp_needed(void *opaque)
  {