[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/35] spapr: Fix record-replay machine reset consuming too many e
From: |
Cédric Le Goater |
Subject: |
[PULL 24/35] spapr: Fix record-replay machine reset consuming too many events |
Date: |
Mon, 4 Sep 2023 11:06:19 +0200 |
From: Nicholas Piggin <npiggin@gmail.com>
spapr_machine_reset gets a random number to populate the device-tree
rng seed with. When loading a snapshot for record-replay, the machine
is reset again, and that tries to consume the random event record
again, crashing due to inconsistent record
Fix this by saving the seed to populate the device tree with, and
skipping the rng on snapshot load.
Acked-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>
---
include/hw/ppc/spapr.h | 1 +
hw/ppc/spapr.c | 12 +++++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index f47e8419a575..f4bd204d8633 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -204,6 +204,7 @@ struct SpaprMachineState {
uint32_t fdt_size;
uint32_t fdt_initial_size;
void *fdt_blob;
+ uint8_t fdt_rng_seed[32];
long kernel_size;
bool kernel_le;
uint64_t kernel_addr;
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index c0b0ada121f9..f7cc6a890f45 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1022,7 +1022,6 @@ static void spapr_dt_chosen(SpaprMachineState *spapr,
void *fdt, bool reset)
{
MachineState *machine = MACHINE(spapr);
SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
- uint8_t rng_seed[32];
int chosen;
_FDT(chosen = fdt_add_subnode(fdt, 0, "chosen"));
@@ -1100,8 +1099,7 @@ static void spapr_dt_chosen(SpaprMachineState *spapr,
void *fdt, bool reset)
spapr_dt_ov5_platform_support(spapr, fdt, chosen);
}
- qemu_guest_getrandom_nofail(rng_seed, sizeof(rng_seed));
- _FDT(fdt_setprop(fdt, chosen, "rng-seed", rng_seed, sizeof(rng_seed)));
+ _FDT(fdt_setprop(fdt, chosen, "rng-seed", spapr->fdt_rng_seed, 32));
_FDT(spapr_dt_ovec(fdt, chosen, spapr->ov5_cas, "ibm,architecture-vec-5"));
}
@@ -1654,6 +1652,14 @@ static void spapr_machine_reset(MachineState *machine,
ShutdownCause reason)
void *fdt;
int rc;
+ if (reason != SHUTDOWN_CAUSE_SNAPSHOT_LOAD) {
+ /*
+ * Record-replay snapshot load must not consume random, this was
+ * already replayed from initial machine reset.
+ */
+ qemu_guest_getrandom_nofail(spapr->fdt_rng_seed, 32);
+ }
+
pef_kvm_reset(machine->cgs, &error_fatal);
spapr_caps_apply(spapr);
--
2.41.0
- [PULL 14/35] hw/ppc: Round up the decrementer interval when converting to ns, (continued)
- [PULL 14/35] hw/ppc: Round up the decrementer interval when converting to ns, Cédric Le Goater, 2023/09/04
- [PULL 15/35] hw/ppc: Avoid decrementer rounding errors, Cédric Le Goater, 2023/09/04
- [PULL 16/35] target/ppc: Sign-extend large decrementer to 64-bits, Cédric Le Goater, 2023/09/04
- [PULL 17/35] hw/ppc: Always store the decrementer value, Cédric Le Goater, 2023/09/04
- [PULL 18/35] target/ppc: Migrate DECR SPR, Cédric Le Goater, 2023/09/04
- [PULL 19/35] hw/ppc: Reset timebase facilities on machine reset, Cédric Le Goater, 2023/09/04
- [PULL 20/35] hw/ppc: Read time only once to perform decrementer write, Cédric Le Goater, 2023/09/04
- [PULL 21/35] target/ppc: Fix CPU reservation migration for record-replay, Cédric Le Goater, 2023/09/04
- [PULL 23/35] spapr: Fix machine reset deadlock from replay-record, Cédric Le Goater, 2023/09/04
- [PULL 25/35] tests/avocado: boot ppc64 pseries replay-record test to Linux VFS mount, Cédric Le Goater, 2023/09/04
- [PULL 24/35] spapr: Fix record-replay machine reset consuming too many events,
Cédric Le Goater <=
- [PULL 22/35] target/ppc: Fix timebase reset with record-replay, Cédric Le Goater, 2023/09/04
- [PULL 27/35] tests/avocado: ppc64 reverse debugging tests for pseries and powernv, Cédric Le Goater, 2023/09/04
- [PULL 26/35] tests/avocado: reverse-debugging cope with re-executing breakpoints, Cédric Le Goater, 2023/09/04
- [PULL 28/35] target/ppc: Fix LQ, STQ register-pair order for big-endian, Cédric Le Goater, 2023/09/04
- [PULL 29/35] target/ppc: Flush inputs to zero with NJ in ppc_store_vscr, Cédric Le Goater, 2023/09/04
- [PULL 30/35] hw/ppc/e500: fix broken snapshot replay, Cédric Le Goater, 2023/09/04
- [PULL 32/35] ppc/xive: Use address_space routines to access the machine RAM, Cédric Le Goater, 2023/09/04
- [PULL 31/35] target/ppc: Fix the order of kvm_enable judgment about kvmppc_set_interrupt(), Cédric Le Goater, 2023/09/04
- [PULL 33/35] ppc/xive: Introduce a new XiveRouter end_notify() handler, Cédric Le Goater, 2023/09/04
- [PULL 35/35] ppc/xive: Add support for the PC MMIOs, Cédric Le Goater, 2023/09/04