diff mbox series

[v2,16/18] stubs: split record/replay stubs further

Message ID 20240408155330.522792-17-pbonzini@redhat.com
State New
Headers show
Series buildsys: Start shrinking qemu-user build process | expand

Commit Message

Paolo Bonzini April 8, 2024, 3:53 p.m. UTC
replay.c symbols are only needed by user mode emulation, with the
exception of replay_mode that is needed by both user mode emulation
(by way of qemu_guest_getrandom) and block layer tools (by way of
util/qemu-timer.c).

Since it is needed by libqemuutil rather than specific files that
are part of the tools and emulators, split the replay_mode stub
into its own file.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 stubs/replay-mode.c | 4 ++++
 stubs/replay.c      | 2 --
 stubs/meson.build   | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)
 create mode 100644 stubs/replay-mode.c

Comments

Richard Henderson April 8, 2024, 4:59 p.m. UTC | #1
On 4/8/24 05:53, Paolo Bonzini wrote:
> replay.c symbols are only needed by user mode emulation, with the
> exception of replay_mode that is needed by both user mode emulation
> (by way of qemu_guest_getrandom) and block layer tools (by way of
> util/qemu-timer.c).
> 
> Since it is needed by libqemuutil rather than specific files that
> are part of the tools and emulators, split the replay_mode stub
> into its own file.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   stubs/replay-mode.c | 4 ++++
>   stubs/replay.c      | 2 --
>   stubs/meson.build   | 1 +
>   3 files changed, 5 insertions(+), 2 deletions(-)
>   create mode 100644 stubs/replay-mode.c

I don't see how this helps.

With qemu_guest_getrandom you still pull in replay_read_random and replay_save_random. 
With timerlist_run_timers you still pull in replay_checkpoint.

So both stubs files are still used in the same cases.


r~
Paolo Bonzini April 8, 2024, 5:14 p.m. UTC | #2
On Mon, Apr 8, 2024 at 6:59 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> On 4/8/24 05:53, Paolo Bonzini wrote:
> > replay.c symbols are only needed by user mode emulation, with the
> > exception of replay_mode that is needed by both user mode emulation
> > (by way of qemu_guest_getrandom) and block layer tools (by way of
> > util/qemu-timer.c).
> >
> > Since it is needed by libqemuutil rather than specific files that
> > are part of the tools and emulators, split the replay_mode stub
> > into its own file.
>
> I don't see how this helps.
>
> With qemu_guest_getrandom you still pull in replay_read_random and replay_save_random.
> With timerlist_run_timers you still pull in replay_checkpoint.
>
> So both stubs files are still used in the same cases.

But user-mode emulation does not use timerlist_run_timers, and block
layer tools do not use qemu_guest_getrandom. In fact the next patch
wouldn't compile if that wasn't the case.

Paolo
diff mbox series

Patch

diff --git a/stubs/replay-mode.c b/stubs/replay-mode.c
new file mode 100644
index 00000000000..264be9d96c9
--- /dev/null
+++ b/stubs/replay-mode.c
@@ -0,0 +1,4 @@ 
+#include "qemu/osdep.h"
+#include "sysemu/replay.h"
+
+ReplayMode replay_mode;
diff --git a/stubs/replay.c b/stubs/replay.c
index 42c92e4acb8..b4dd6a566e8 100644
--- a/stubs/replay.c
+++ b/stubs/replay.c
@@ -1,8 +1,6 @@ 
 #include "qemu/osdep.h"
 #include "exec/replay-core.h"
 
-ReplayMode replay_mode;
-
 void replay_finish(void)
 {
 }
diff --git a/stubs/meson.build b/stubs/meson.build
index a252bffad00..4a524f5816b 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -36,6 +36,7 @@  stub_ss.add(files('qmp-quit.c'))
 stub_ss.add(files('qtest.c'))
 stub_ss.add(files('ram-block.c'))
 stub_ss.add(files('replay.c'))
+stub_ss.add(files('replay-mode.c'))
 stub_ss.add(files('runstate-check.c'))
 stub_ss.add(files('sysbus.c'))
 stub_ss.add(files('target-get-monitor-def.c'))