diff mbox series

[08/18] replay: Add replay_mutex_{lock, unlock}() stubs for qemu-user

Message ID 20240923162208.90745-9-iii@linux.ibm.com
State New
Headers show
Series Stop all qemu-cpu threads on a breakpoint | expand

Commit Message

Ilya Leoshkevich Sept. 23, 2024, 4:13 p.m. UTC
Sharing pause_all_vcpus() with qemu-user requires providing no-op
definitions of replay mutex functions. Make these functions available
via replay-core.h and move the existing stubs to a separate file.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 include/exec/replay-core.h | 13 +++++++++++++
 include/sysemu/replay.h    | 13 -------------
 replay/stubs-system.c      |  8 ++++++++
 stubs/meson.build          |  4 ++++
 stubs/replay-mutex.c       | 10 ++++++++++
 stubs/replay-tools.c       |  8 --------
 6 files changed, 35 insertions(+), 21 deletions(-)
 create mode 100644 stubs/replay-mutex.c
diff mbox series

Patch

diff --git a/include/exec/replay-core.h b/include/exec/replay-core.h
index 244c77acce5..74766bae90d 100644
--- a/include/exec/replay-core.h
+++ b/include/exec/replay-core.h
@@ -77,4 +77,17 @@  void replay_save_random(int ret, void *buf, size_t len);
 /* Loads the saved values for the random number generator */
 int replay_read_random(void *buf, size_t len);
 
+/* Replay locking
+ *
+ * The locks are needed to protect the shared structures and log file
+ * when doing record/replay. They also are the main sync-point between
+ * the main-loop thread and the vCPU thread. This was a role
+ * previously filled by the BQL which has been busy trying to reduce
+ * its impact across the code. This ensures blocks of events stay
+ * sequential and reproducible.
+ */
+
+void replay_mutex_lock(void);
+void replay_mutex_unlock(void);
+
 #endif
diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h
index 8102fa54f01..d6e0342b27c 100644
--- a/include/sysemu/replay.h
+++ b/include/sysemu/replay.h
@@ -51,19 +51,6 @@  typedef struct ReplayNetState ReplayNetState;
 /* Name of the initial VM snapshot */
 extern char *replay_snapshot;
 
-/* Replay locking
- *
- * The locks are needed to protect the shared structures and log file
- * when doing record/replay. They also are the main sync-point between
- * the main-loop thread and the vCPU thread. This was a role
- * previously filled by the BQL which has been busy trying to reduce
- * its impact across the code. This ensures blocks of events stay
- * sequential and reproducible.
- */
-
-void replay_mutex_lock(void);
-void replay_mutex_unlock(void);
-
 /* Processing the instructions */
 
 /*! Returns number of executed instructions. */
diff --git a/replay/stubs-system.c b/replay/stubs-system.c
index 50cefdb2d69..45984e3b098 100644
--- a/replay/stubs-system.c
+++ b/replay/stubs-system.c
@@ -94,3 +94,11 @@  void qmp_replay_seek(int64_t icount, Error **errp)
     error_set(errp, ERROR_CLASS_COMMAND_NOT_FOUND,
               "replay support not available");
 }
+
+void replay_mutex_lock(void)
+{
+}
+
+void replay_mutex_unlock(void)
+{
+}
diff --git a/stubs/meson.build b/stubs/meson.build
index 772a3e817df..ab4b98a0e18 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -46,6 +46,10 @@  if have_block or have_ga
   stub_ss.add(files('qmp-quit.c'))
 endif
 
+if have_block or have_ga or have_user
+  stub_ss.add(files('replay-mutex.c'))
+endif
+
 if have_block or have_user
   stub_ss.add(files('qtest.c'))
   stub_ss.add(files('vm-stop.c'))
diff --git a/stubs/replay-mutex.c b/stubs/replay-mutex.c
new file mode 100644
index 00000000000..08c69139bcb
--- /dev/null
+++ b/stubs/replay-mutex.c
@@ -0,0 +1,10 @@ 
+#include "qemu/osdep.h"
+#include "exec/replay-core.h"
+
+void replay_mutex_lock(void)
+{
+}
+
+void replay_mutex_unlock(void)
+{
+}
diff --git a/stubs/replay-tools.c b/stubs/replay-tools.c
index 3e8ca3212d9..2bca8ab6657 100644
--- a/stubs/replay-tools.c
+++ b/stubs/replay-tools.c
@@ -41,14 +41,6 @@  bool replay_checkpoint(ReplayCheckpoint checkpoint)
     return true;
 }
 
-void replay_mutex_lock(void)
-{
-}
-
-void replay_mutex_unlock(void)
-{
-}
-
 void replay_register_char_driver(struct Chardev *chr)
 {
 }