qemu-kvm/kvm-migration-Do-not-re-read-the-clock-on-pre_save-in-ca.patch
Danilo C. L. de Paula 1523562e21 * Mon Sep 09 2019 Danilo Cesar Lemes de Paula <ddepaula@redhat.com> - 4.1.0-8.el8
- kvm-migration-Do-not-re-read-the-clock-on-pre_save-in-ca.patch [bz#1747836]
- kvm-ehci-fix-queue-dev-null-ptr-dereference.patch [bz#1746790]
- kvm-spapr-Use-SHUTDOWN_CAUSE_SUBSYSTEM_RESET-for-CAS-reb.patch [bz#1743477]
- kvm-file-posix-Handle-undetectable-alignment.patch [bz#1749134]
- kvm-block-posix-Always-allocate-the-first-block.patch [bz#1749134]
- kvm-iotests-Test-allocate_first_block-with-O_DIRECT.patch [bz#1749134]
- Resolves: bz#1743477
  (Since bd94bc06479a "spapr: change default interrupt mode to 'dual'", QEMU resets the machine to select the appropriate interrupt controller. And -no-reboot prevents that.)
- Resolves: bz#1746790
  (qemu core dump while migrate from RHEL7.6 to RHEL8.1)
- Resolves: bz#1747836
  (Call traces after guest migration due to incorrect handling of the timebase)
- Resolves: bz#1749134
  (I/O error when virtio-blk disk is backed by a raw image on 4k disk)
2019-09-09 19:17:47 +01:00

102 lines
3.4 KiB
Diff

From 8b0a69f11052d271ef49db0051d79e7f1a6102be Mon Sep 17 00:00:00 2001
From: David Gibson <dgibson@redhat.com>
Date: Mon, 2 Sep 2019 04:20:32 +0100
Subject: [PATCH 1/6] migration: Do not re-read the clock on pre_save in case
of paused guest
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
RH-Author: David Gibson <dgibson@redhat.com>
Message-id: <20190902042032.25987-1-dgibson@redhat.com>
Patchwork-id: 90226
O-Subject: [RHEL-AV-8.1.0 qemu-kvm PATCH] migration: Do not re-read the clock on pre_save in case of paused guest
Bugzilla: 1747836
RH-Acked-by: Thomas Huth <thuth@redhat.com>
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
From: "Maxiwell S. Garcia" <maxiwell@linux.ibm.com>
Re-read the timebase before migrate was ported from x86 commit:
6053a86fe7bd: kvmclock: reduce kvmclock difference on migration
The clock move makes the guest knows about the paused time between
the stop and migrate commands. This is an issue in an already-paused
VM because some side effects, like process stalls, could happen
after migration.
So, this patch checks the runstate of guest in the pre_save handler and
do not re-reads the timebase in case of paused state (cold migration).
Signed-off-by: Maxiwell S. Garcia <maxiwell@linux.ibm.com>
Message-Id: <20190711194702.26598-1-maxiwell@linux.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
(cherry picked from commit d14f33976282a8744ca1bf1d64e73996c145aa3f)
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1747836
Branch: rhel8/rhel-av-8.1.0/master-4.1.0
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=23282250
Testing: Booted guest with this qemu
Signed-off-by: David Gibson <dgibson@redhat.com>
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
---
hw/ppc/ppc.c | 13 +++++++++----
target/ppc/cpu-qom.h | 1 +
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index a9e508c..8572e45 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -1008,6 +1008,8 @@ static void timebase_save(PPCTimebase *tb)
* there is no need to update it from KVM here
*/
tb->guest_timebase = ticks + first_ppc_cpu->env.tb_env->tb_offset;
+
+ tb->runstate_paused = runstate_check(RUN_STATE_PAUSED);
}
static void timebase_load(PPCTimebase *tb)
@@ -1051,9 +1053,9 @@ void cpu_ppc_clock_vm_state_change(void *opaque, int running,
}
/*
- * When migrating, read the clock just before migration,
- * so that the guest clock counts during the events
- * between:
+ * When migrating a running guest, read the clock just
+ * before migration, so that the guest clock counts
+ * during the events between:
*
* * vm_stop()
* *
@@ -1068,7 +1070,10 @@ static int timebase_pre_save(void *opaque)
{
PPCTimebase *tb = opaque;
- timebase_save(tb);
+ /* guest_timebase won't be overridden in case of paused guest */
+ if (!tb->runstate_paused) {
+ timebase_save(tb);
+ }
return 0;
}
diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h
index be9b4c3..5fbcdee 100644
--- a/target/ppc/cpu-qom.h
+++ b/target/ppc/cpu-qom.h
@@ -201,6 +201,7 @@ typedef struct PowerPCCPUClass {
typedef struct PPCTimebase {
uint64_t guest_timebase;
int64_t time_of_the_day_ns;
+ bool runstate_paused;
} PPCTimebase;
extern const struct VMStateDescription vmstate_ppc_timebase;
--
1.8.3.1