diff mbox

[RFC,v3,02/13] migration: migrate icount fields.

Message ID 1400252448-13347-3-git-send-email-fred.konrad@greensocs.com
State New
Headers show

Commit Message

fred.konrad@greensocs.com May 16, 2014, 3 p.m. UTC
From: KONRAD Frederic <fred.konrad@greensocs.com>

This fixes a bug where qemu_icount and qemu_icount_bias are not migrated.
It adds a subsection "timer/icount" to vmstate_timers so icount is migrated only
when needed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
---
 cpus.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Amit Shah June 10, 2014, 6:20 a.m. UTC | #1
On (Fri) 16 May 2014 [17:00:37], fred.konrad@greensocs.com wrote:
> From: KONRAD Frederic <fred.konrad@greensocs.com>
> 
> This fixes a bug where qemu_icount and qemu_icount_bias are not migrated.
> It adds a subsection "timer/icount" to vmstate_timers so icount is migrated only
> when needed.
> 
> Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>

Reviewed-by: Amit Shah <amit.shah@redhat.com>

> +static bool icount_state_needed(void *opaque)
> +{
> +    return (use_icount != 0);
> +}

You can just say 'return use_icount;' here instead.

		Amit
fred.konrad@greensocs.com June 10, 2014, 12:12 p.m. UTC | #2
On 10/06/2014 08:20, Amit Shah wrote:
> On (Fri) 16 May 2014 [17:00:37], fred.konrad@greensocs.com wrote:
>> From: KONRAD Frederic <fred.konrad@greensocs.com>
>>
>> This fixes a bug where qemu_icount and qemu_icount_bias are not migrated.
>> It adds a subsection "timer/icount" to vmstate_timers so icount is migrated only
>> when needed.
>>
>> Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
> Reviewed-by: Amit Shah <amit.shah@redhat.com>
>
>> +static bool icount_state_needed(void *opaque)
>> +{
>> +    return (use_icount != 0);
>> +}
> You can just say 'return use_icount;' here instead.
>
> 		Amit
>
Hi,

Thanks for the review, I'll make this change.

Fred
diff mbox

Patch

diff --git a/cpus.c b/cpus.c
index 687717f..89f4b26 100644
--- a/cpus.c
+++ b/cpus.c
@@ -427,6 +427,26 @@  void qemu_clock_warp(QEMUClockType type)
     }
 }
 
+static bool icount_state_needed(void *opaque)
+{
+    return (use_icount != 0);
+}
+
+/*
+ * This is a subsection for icount migration.
+ */
+static const VMStateDescription icount_vmstate_timers = {
+    .name = "timer/icount",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField[]) {
+        VMSTATE_INT64(qemu_icount_bias, TimersState),
+        VMSTATE_INT64(qemu_icount, TimersState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static const VMStateDescription vmstate_timers = {
     .name = "timer",
     .version_id = 2,
@@ -437,6 +457,14 @@  static const VMStateDescription vmstate_timers = {
         VMSTATE_INT64(dummy, TimersState),
         VMSTATE_INT64_V(cpu_clock_offset, TimersState, 2),
         VMSTATE_END_OF_LIST()
+    },
+    .subsections = (VMStateSubsection[]) {
+        {
+            .vmsd = &icount_vmstate_timers,
+            .needed = icount_state_needed,
+        }, {
+            /* empty */
+        }
     }
 };