Skip to content

Commit

Permalink
target/ppc: Fix timebase reset with record-replay
Browse files Browse the repository at this point in the history
Timebase save uses a random number for a legacy vmstate field, which
makes rr snapshot loading unbalanced. The easiest way to deal with this
is just to skip the rng if record-replay is active.

Reviewed-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
  • Loading branch information
npiggin authored and legoater committed Sep 6, 2023
1 parent cdab53d commit 9db680f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions hw/ppc/ppc.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "qemu/main-loop.h"
#include "qemu/error-report.h"
#include "sysemu/kvm.h"
#include "sysemu/replay.h"
#include "sysemu/runstate.h"
#include "kvm_ppc.h"
#include "migration/vmstate.h"
Expand Down Expand Up @@ -974,8 +975,14 @@ static void timebase_save(PPCTimebase *tb)
return;
}

/* not used anymore, we keep it for compatibility */
tb->time_of_the_day_ns = qemu_clock_get_ns(QEMU_CLOCK_HOST);
if (replay_mode == REPLAY_MODE_NONE) {
/* not used anymore, we keep it for compatibility */
tb->time_of_the_day_ns = qemu_clock_get_ns(QEMU_CLOCK_HOST);
} else {
/* simpler for record-replay to avoid this event, compat not needed */
tb->time_of_the_day_ns = 0;
}

/*
* tb_offset is only expected to be changed by QEMU so
* there is no need to update it from KVM here
Expand Down

0 comments on commit 9db680f

Please sign in to comment.