[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 22/23] docs/devel: Mention post_load hook restrictions where we do
From: |
Michael Tokarev |
Subject: |
[PULL 22/23] docs/devel: Mention post_load hook restrictions where we document the hook |
Date: |
Fri, 4 Oct 2024 19:03:30 +0300 |
From: Peter Maydell <peter.maydell@linaro.org>
Accessing another device in a post_load hook is a bad idea, because
the order of device save/restore is not fixed, and so this
cross-device access makes the save/restore non-deterministic.
We previously only flagged up this requirement in the
record-and-replay developer docs; repeat it in the main migration
documentation, where a developer trying to implement a post_load hook
is more likely to see it.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
docs/devel/migration/main.rst | 6 ++++++
docs/devel/replay.rst | 3 +++
2 files changed, 9 insertions(+)
diff --git a/docs/devel/migration/main.rst b/docs/devel/migration/main.rst
index 784c899dca..c2857fc244 100644
--- a/docs/devel/migration/main.rst
+++ b/docs/devel/migration/main.rst
@@ -465,6 +465,12 @@ Examples of such API functions are:
- portio_list_set_address()
- portio_list_set_enabled()
+Since the order of device save/restore is not defined, you must
+avoid accessing or changing any other device's state in one of these
+callbacks. (For instance, don't do anything that calls ``update_irq()``
+in a ``post_load`` hook.) Otherwise, restore will not be deterministic,
+and this will break execution record/replay.
+
Iterative device migration
--------------------------
diff --git a/docs/devel/replay.rst b/docs/devel/replay.rst
index effd856f0c..40f58d9d4f 100644
--- a/docs/devel/replay.rst
+++ b/docs/devel/replay.rst
@@ -202,6 +202,9 @@ into the log.
Saving/restoring the VM state
-----------------------------
+Record/replay relies on VM state save and restore being complete and
+deterministic.
+
All fields in the device state structure (including virtual timers)
should be restored by loadvm to the same values they had before savevm.
--
2.39.5
- [PULL 13/23] vhost: Remove unused vhost_dev_{load|save}_inflight, (continued)
- [PULL 13/23] vhost: Remove unused vhost_dev_{load|save}_inflight, Michael Tokarev, 2024/10/04
- [PULL 14/23] remote: Remove unused remote_iohub_finalize, Michael Tokarev, 2024/10/04
- [PULL 15/23] replay: Remove unused replay_disable_events, Michael Tokarev, 2024/10/04
- [PULL 16/23] hw/pci: Remove unused pcie_chassis_find_slot, Michael Tokarev, 2024/10/04
- [PULL 17/23] hw/net/rocker: Remove unused rocker_fp_ports, Michael Tokarev, 2024/10/04
- [PULL 18/23] block-backend: Remove deadcode, Michael Tokarev, 2024/10/04
- [PULL 19/23] tests/tcg/plugins: Remove remainder of the cris target, Michael Tokarev, 2024/10/04
- [PULL 20/23] hw/mips: Build fw_cfg.c once, Michael Tokarev, 2024/10/04
- [PULL 21/23] tests/functional: Fix hash validation, Michael Tokarev, 2024/10/04
- [PULL 23/23] MAINTAINERS: Add myself as maintainer of e500 machines, Michael Tokarev, 2024/10/04
- [PULL 22/23] docs/devel: Mention post_load hook restrictions where we document the hook,
Michael Tokarev <=
- Re: [PULL 00/23] Trivial patches for 2024-10-04, Peter Maydell, 2024/10/04