mirror of https://github.com/xemu-project/xemu.git
migration: Do not re-read the clock on pre_save in case of paused guest
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>
This commit is contained in:
parent
d15d4ad64f
commit
d14f339762
13
hw/ppc/ppc.c
13
hw/ppc/ppc.c
|
@ -1011,6 +1011,8 @@ static void timebase_save(PPCTimebase *tb)
|
||||||
* there is no need to update it from KVM here
|
* there is no need to update it from KVM here
|
||||||
*/
|
*/
|
||||||
tb->guest_timebase = ticks + first_ppc_cpu->env.tb_env->tb_offset;
|
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)
|
static void timebase_load(PPCTimebase *tb)
|
||||||
|
@ -1054,9 +1056,9 @@ void cpu_ppc_clock_vm_state_change(void *opaque, int running,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When migrating, read the clock just before migration,
|
* When migrating a running guest, read the clock just
|
||||||
* so that the guest clock counts during the events
|
* before migration, so that the guest clock counts
|
||||||
* between:
|
* during the events between:
|
||||||
*
|
*
|
||||||
* * vm_stop()
|
* * vm_stop()
|
||||||
* *
|
* *
|
||||||
|
@ -1071,7 +1073,10 @@ static int timebase_pre_save(void *opaque)
|
||||||
{
|
{
|
||||||
PPCTimebase *tb = 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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,6 +201,7 @@ typedef struct PowerPCCPUClass {
|
||||||
typedef struct PPCTimebase {
|
typedef struct PPCTimebase {
|
||||||
uint64_t guest_timebase;
|
uint64_t guest_timebase;
|
||||||
int64_t time_of_the_day_ns;
|
int64_t time_of_the_day_ns;
|
||||||
|
bool runstate_paused;
|
||||||
} PPCTimebase;
|
} PPCTimebase;
|
||||||
|
|
||||||
extern const VMStateDescription vmstate_ppc_timebase;
|
extern const VMStateDescription vmstate_ppc_timebase;
|
||||||
|
|
Loading…
Reference in New Issue