|
|
8b1478 |
From 95c9f56041b8d3b95644d790e2b3f59587805a01 Mon Sep 17 00:00:00 2001
|
|
|
8b1478 |
From: David Gibson <dgibson@redhat.com>
|
|
|
8b1478 |
Date: Tue, 17 Sep 2019 03:47:09 +0200
|
|
|
8b1478 |
Subject: [PATCH 3/4] migration: Do not re-read the clock on pre_save in case
|
|
|
8b1478 |
of paused guest
|
|
|
8b1478 |
|
|
|
8b1478 |
RH-Author: David Gibson <dgibson@redhat.com>
|
|
|
8b1478 |
Message-id: <20190917034709.20167-1-dgibson@redhat.com>
|
|
|
8b1478 |
Patchwork-id: 90473
|
|
|
8b1478 |
O-Subject: [RHEL-7.8 qemu-kvm-rhev PATCH] migration: Do not re-read the clock on pre_save in case of paused guest
|
|
|
8b1478 |
Bugzilla: 1743508
|
|
|
8b1478 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
8b1478 |
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
|
|
|
8b1478 |
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
8b1478 |
|
|
|
8b1478 |
From: "Maxiwell S. Garcia" <maxiwell@linux.ibm.com>
|
|
|
8b1478 |
|
|
|
8b1478 |
Re-read the timebase before migrate was ported from x86 commit:
|
|
|
8b1478 |
6053a86fe7bd: kvmclock: reduce kvmclock difference on migration
|
|
|
8b1478 |
|
|
|
8b1478 |
The clock move makes the guest knows about the paused time between
|
|
|
8b1478 |
the stop and migrate commands. This is an issue in an already-paused
|
|
|
8b1478 |
VM because some side effects, like process stalls, could happen
|
|
|
8b1478 |
after migration.
|
|
|
8b1478 |
|
|
|
8b1478 |
So, this patch checks the runstate of guest in the pre_save handler and
|
|
|
8b1478 |
do not re-reads the timebase in case of paused state (cold migration).
|
|
|
8b1478 |
|
|
|
8b1478 |
Signed-off-by: Maxiwell S. Garcia <maxiwell@linux.ibm.com>
|
|
|
8b1478 |
Message-Id: <20190711194702.26598-1-maxiwell@linux.ibm.com>
|
|
|
8b1478 |
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
|
|
8b1478 |
(cherry picked from commit d14f33976282a8744ca1bf1d64e73996c145aa3f)
|
|
|
8b1478 |
|
|
|
8b1478 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1743508
|
|
|
8b1478 |
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=23524287
|
|
|
8b1478 |
Testing: Booted a guest with the scratch qemu build
|
|
|
8b1478 |
|
|
|
8b1478 |
Signed-off-by: David Gibson <dgibson@redhat.com>
|
|
|
8b1478 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
8b1478 |
---
|
|
|
8b1478 |
hw/ppc/ppc.c | 13 +++++++++----
|
|
|
8b1478 |
target/ppc/cpu-qom.h | 1 +
|
|
|
8b1478 |
2 files changed, 10 insertions(+), 4 deletions(-)
|
|
|
8b1478 |
|
|
|
8b1478 |
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
|
|
|
8b1478 |
index ec4be25..fb90d19 100644
|
|
|
8b1478 |
--- a/hw/ppc/ppc.c
|
|
|
8b1478 |
+++ b/hw/ppc/ppc.c
|
|
|
8b1478 |
@@ -877,6 +877,8 @@ static void timebase_save(PPCTimebase *tb)
|
|
|
8b1478 |
* there is no need to update it from KVM here
|
|
|
8b1478 |
*/
|
|
|
8b1478 |
tb->guest_timebase = ticks + first_ppc_cpu->env.tb_env->tb_offset;
|
|
|
8b1478 |
+
|
|
|
8b1478 |
+ tb->runstate_paused = runstate_check(RUN_STATE_PAUSED);
|
|
|
8b1478 |
}
|
|
|
8b1478 |
|
|
|
8b1478 |
static void timebase_load(PPCTimebase *tb)
|
|
|
8b1478 |
@@ -923,9 +925,9 @@ void cpu_ppc_clock_vm_state_change(void *opaque, int running,
|
|
|
8b1478 |
}
|
|
|
8b1478 |
|
|
|
8b1478 |
/*
|
|
|
8b1478 |
- * When migrating, read the clock just before migration,
|
|
|
8b1478 |
- * so that the guest clock counts during the events
|
|
|
8b1478 |
- * between:
|
|
|
8b1478 |
+ * When migrating a running guest, read the clock just
|
|
|
8b1478 |
+ * before migration, so that the guest clock counts
|
|
|
8b1478 |
+ * during the events between:
|
|
|
8b1478 |
*
|
|
|
8b1478 |
* * vm_stop()
|
|
|
8b1478 |
* *
|
|
|
8b1478 |
@@ -940,7 +942,10 @@ static int timebase_pre_save(void *opaque)
|
|
|
8b1478 |
{
|
|
|
8b1478 |
PPCTimebase *tb = opaque;
|
|
|
8b1478 |
|
|
|
8b1478 |
- timebase_save(tb);
|
|
|
8b1478 |
+ /* guest_timebase won't be overridden in case of paused guest */
|
|
|
8b1478 |
+ if (!tb->runstate_paused) {
|
|
|
8b1478 |
+ timebase_save(tb);
|
|
|
8b1478 |
+ }
|
|
|
8b1478 |
|
|
|
8b1478 |
return 0;
|
|
|
8b1478 |
}
|
|
|
8b1478 |
diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h
|
|
|
8b1478 |
index deaa46a..b900277 100644
|
|
|
8b1478 |
--- a/target/ppc/cpu-qom.h
|
|
|
8b1478 |
+++ b/target/ppc/cpu-qom.h
|
|
|
8b1478 |
@@ -210,6 +210,7 @@ typedef struct PowerPCCPUClass {
|
|
|
8b1478 |
typedef struct PPCTimebase {
|
|
|
8b1478 |
uint64_t guest_timebase;
|
|
|
8b1478 |
int64_t time_of_the_day_ns;
|
|
|
8b1478 |
+ bool runstate_paused;
|
|
|
8b1478 |
} PPCTimebase;
|
|
|
8b1478 |
|
|
|
8b1478 |
extern const struct VMStateDescription vmstate_ppc_timebase;
|
|
|
8b1478 |
--
|
|
|
8b1478 |
1.8.3.1
|
|
|
8b1478 |
|