* [PATCH 0/5] exec: QAPI housekeeping for user emulation
@ 2022-12-19 17:08 Philippe Mathieu-Daudé
2022-12-19 17:08 ` [PATCH 1/5] exec: Remove unused 'qemu/timer.h' timer Philippe Mathieu-Daudé
` (4 more replies)
0 siblings, 5 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-19 17:08 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Alex Bennée, Richard Henderson,
Paolo Bonzini, Eduardo Habkost, Yanan Wang, Pavel Dovgalyuk,
Marcel Apfelbaum, Markus Armbruster, Riku Voipio
Since there is no monitor in user emulation builds, we
don't generate the QAPI headers for the QMP commands.
I'm not sure when the --disable-system --disable-tools
configuration started to bitrot; it might not be super
important, but I'm using it to better sort SYSEMU vs
USER code, so I need to get it building again.
I'm trying to split a big series in smaller ones to reduce
maintainers spam.
Philippe Mathieu-Daude (2):
replay: Extract core API to 'exec/replay-core.h'
tests/unit: Restrict machine-smp.c test to system emulation
Philippe Mathieu-Daudé (3):
exec: Remove unused 'qemu/timer.h' timer
tcg/tcg-op-gvec: Remove unused "qemu/main-loop.h" header
accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation
MAINTAINERS | 1 +
accel/tcg/cpu-exec.c | 91 +---------------------------
accel/tcg/hmp.c | 14 -----
accel/tcg/internal.h | 3 +
accel/tcg/meson.build | 2 +-
accel/tcg/monitor.c | 105 +++++++++++++++++++++++++++++++++
accel/tcg/tcg-all.c | 2 +-
accel/tcg/translate-all.c | 1 -
accel/tcg/translator.c | 2 +-
accel/tcg/user-exec-stub.c | 2 +-
cpu.c | 2 +-
gdbstub/gdbstub.c | 2 +-
hw/core/ptimer.c | 2 +-
include/exec/gen-icount.h | 1 -
include/exec/replay-core.h | 76 ++++++++++++++++++++++++
include/sysemu/cpus.h | 1 -
include/sysemu/replay.h | 67 ++-------------------
stubs/replay.c | 2 +-
tcg/tcg-op-gvec.c | 1 -
tcg/tcg.c | 1 -
tests/unit/meson.build | 2 +-
tests/unit/ptimer-test-stubs.c | 2 +-
util/guest-random.c | 2 +-
23 files changed, 203 insertions(+), 181 deletions(-)
delete mode 100644 accel/tcg/hmp.c
create mode 100644 accel/tcg/monitor.c
create mode 100644 include/exec/replay-core.h
--
2.38.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/5] exec: Remove unused 'qemu/timer.h' timer
2022-12-19 17:08 [PATCH 0/5] exec: QAPI housekeeping for user emulation Philippe Mathieu-Daudé
@ 2022-12-19 17:08 ` Philippe Mathieu-Daudé
2022-12-19 18:40 ` Richard Henderson
2022-12-19 17:08 ` [PATCH 2/5] tcg/tcg-op-gvec: Remove unused "qemu/main-loop.h" header Philippe Mathieu-Daudé
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-19 17:08 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Alex Bennée, Richard Henderson,
Paolo Bonzini, Eduardo Habkost, Yanan Wang, Pavel Dovgalyuk,
Marcel Apfelbaum, Markus Armbruster, Riku Voipio
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/tcg/cpu-exec.c | 1 -
accel/tcg/translate-all.c | 1 -
include/exec/gen-icount.h | 1 -
include/sysemu/cpus.h | 1 -
tcg/tcg.c | 1 -
5 files changed, 5 deletions(-)
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 356fe348de..298149ed07 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -29,7 +29,6 @@
#include "tcg/tcg.h"
#include "qemu/atomic.h"
#include "qemu/compiler.h"
-#include "qemu/timer.h"
#include "qemu/rcu.h"
#include "exec/log.h"
#include "qemu/main-loop.h"
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
index ed6656fb14..dea5ca81b5 100644
--- a/accel/tcg/translate-all.c
+++ b/accel/tcg/translate-all.c
@@ -49,7 +49,6 @@
#include "exec/translator.h"
#include "qemu/bitmap.h"
#include "qemu/qemu-print.h"
-#include "qemu/timer.h"
#include "qemu/main-loop.h"
#include "qemu/cacheinfo.h"
#include "exec/log.h"
diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h
index c57204ddad..166170b08e 100644
--- a/include/exec/gen-icount.h
+++ b/include/exec/gen-icount.h
@@ -2,7 +2,6 @@
#define GEN_ICOUNT_H
#include "exec/exec-all.h"
-#include "qemu/timer.h"
/* Helpers for instruction counting code generation. */
diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
index 1bace3379b..0535a4c68a 100644
--- a/include/sysemu/cpus.h
+++ b/include/sysemu/cpus.h
@@ -1,7 +1,6 @@
#ifndef QEMU_CPUS_H
#define QEMU_CPUS_H
-#include "qemu/timer.h"
#include "sysemu/accel-ops.h"
/* register accel-specific operations */
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 436fcf6ebd..1071fc00fe 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -34,7 +34,6 @@
#include "qemu/cutils.h"
#include "qemu/host-utils.h"
#include "qemu/qemu-print.h"
-#include "qemu/timer.h"
#include "qemu/cacheflush.h"
#include "qemu/cacheinfo.h"
--
2.38.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/5] tcg/tcg-op-gvec: Remove unused "qemu/main-loop.h" header
2022-12-19 17:08 [PATCH 0/5] exec: QAPI housekeeping for user emulation Philippe Mathieu-Daudé
2022-12-19 17:08 ` [PATCH 1/5] exec: Remove unused 'qemu/timer.h' timer Philippe Mathieu-Daudé
@ 2022-12-19 17:08 ` Philippe Mathieu-Daudé
2022-12-19 18:40 ` Richard Henderson
2022-12-19 17:08 ` [PATCH 3/5] accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation Philippe Mathieu-Daudé
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-19 17:08 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Alex Bennée, Richard Henderson,
Paolo Bonzini, Eduardo Habkost, Yanan Wang, Pavel Dovgalyuk,
Marcel Apfelbaum, Markus Armbruster, Riku Voipio
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
Added in db72581598 ("Include qemu/main-loop.h less") but now
I can't see what is requiring it.
I checked 'git diff db725815985..origin/master -- tcg/tcg-op-gvec.c'
to see if some code was removed without removing the header;
I haven't checked individual commits.
---
tcg/tcg-op-gvec.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c
index 079a761b04..aacedd3e15 100644
--- a/tcg/tcg-op-gvec.c
+++ b/tcg/tcg-op-gvec.c
@@ -21,7 +21,6 @@
#include "tcg/tcg.h"
#include "tcg/tcg-op.h"
#include "tcg/tcg-op-gvec.h"
-#include "qemu/main-loop.h"
#include "tcg/tcg-gvec-desc.h"
#define MAX_UNROLL 4
--
2.38.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/5] accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation
2022-12-19 17:08 [PATCH 0/5] exec: QAPI housekeeping for user emulation Philippe Mathieu-Daudé
2022-12-19 17:08 ` [PATCH 1/5] exec: Remove unused 'qemu/timer.h' timer Philippe Mathieu-Daudé
2022-12-19 17:08 ` [PATCH 2/5] tcg/tcg-op-gvec: Remove unused "qemu/main-loop.h" header Philippe Mathieu-Daudé
@ 2022-12-19 17:08 ` Philippe Mathieu-Daudé
2022-12-19 18:42 ` Richard Henderson
2022-12-19 17:08 ` [PATCH 4/5] replay: Extract core API to 'exec/replay-core.h' Philippe Mathieu-Daudé
2022-12-19 17:08 ` [PATCH 5/5] tests/unit: Restrict machine-smp.c test to system emulation Philippe Mathieu-Daudé
4 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-19 17:08 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Alex Bennée, Richard Henderson,
Paolo Bonzini, Eduardo Habkost, Yanan Wang, Pavel Dovgalyuk,
Marcel Apfelbaum, Markus Armbruster, Riku Voipio
Since commit a0e61807a3 ("qapi: Remove QMP events and commands from
user-mode builds") we don't generate the "qapi-commands-machine.h"
header in a user-emulation-only build.
Rename 'hmp.c' as 'monitor.c' and move the QMP functions from
cpu-exec.c (which is always compiled) to monitor.c (which is only
compiled when system-emulation is selected).
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/tcg/cpu-exec.c | 88 +----------------------------------
accel/tcg/hmp.c | 14 ------
accel/tcg/internal.h | 3 ++
accel/tcg/meson.build | 2 +-
accel/tcg/monitor.c | 105 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 111 insertions(+), 101 deletions(-)
delete mode 100644 accel/tcg/hmp.c
create mode 100644 accel/tcg/monitor.c
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 298149ed07..5a7825dce1 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -20,7 +20,6 @@
#include "qemu/osdep.h"
#include "qemu/qemu-print.h"
#include "qapi/error.h"
-#include "qapi/qapi-commands-machine.h"
#include "qapi/type-helpers.h"
#include "hw/core/tcg-cpu-ops.h"
#include "trace.h"
@@ -64,8 +63,8 @@ typedef struct SyncClocks {
#define MAX_DELAY_PRINT_RATE 2000000000LL
#define MAX_NB_PRINTS 100
-static int64_t max_delay;
-static int64_t max_advance;
+int64_t max_delay;
+int64_t max_advance;
static void align_clocks(SyncClocks *sc, CPUState *cpu)
{
@@ -1071,86 +1070,3 @@ void tcg_exec_unrealizefn(CPUState *cpu)
tlb_destroy(cpu);
g_free(cpu->tb_jmp_cache);
}
-
-#ifndef CONFIG_USER_ONLY
-
-static void dump_drift_info(GString *buf)
-{
- if (!icount_enabled()) {
- return;
- }
-
- g_string_append_printf(buf, "Host - Guest clock %"PRIi64" ms\n",
- (cpu_get_clock() - icount_get()) / SCALE_MS);
- if (icount_align_option) {
- g_string_append_printf(buf, "Max guest delay %"PRIi64" ms\n",
- -max_delay / SCALE_MS);
- g_string_append_printf(buf, "Max guest advance %"PRIi64" ms\n",
- max_advance / SCALE_MS);
- } else {
- g_string_append_printf(buf, "Max guest delay NA\n");
- g_string_append_printf(buf, "Max guest advance NA\n");
- }
-}
-
-HumanReadableText *qmp_x_query_jit(Error **errp)
-{
- g_autoptr(GString) buf = g_string_new("");
-
- if (!tcg_enabled()) {
- error_setg(errp, "JIT information is only available with accel=tcg");
- return NULL;
- }
-
- dump_exec_info(buf);
- dump_drift_info(buf);
-
- return human_readable_text_from_str(buf);
-}
-
-HumanReadableText *qmp_x_query_opcount(Error **errp)
-{
- g_autoptr(GString) buf = g_string_new("");
-
- if (!tcg_enabled()) {
- error_setg(errp, "Opcode count information is only available with accel=tcg");
- return NULL;
- }
-
- tcg_dump_op_count(buf);
-
- return human_readable_text_from_str(buf);
-}
-
-#ifdef CONFIG_PROFILER
-
-int64_t dev_time;
-
-HumanReadableText *qmp_x_query_profile(Error **errp)
-{
- g_autoptr(GString) buf = g_string_new("");
- static int64_t last_cpu_exec_time;
- int64_t cpu_exec_time;
- int64_t delta;
-
- cpu_exec_time = tcg_cpu_exec_time();
- delta = cpu_exec_time - last_cpu_exec_time;
-
- g_string_append_printf(buf, "async time %" PRId64 " (%0.3f)\n",
- dev_time, dev_time / (double)NANOSECONDS_PER_SECOND);
- g_string_append_printf(buf, "qemu time %" PRId64 " (%0.3f)\n",
- delta, delta / (double)NANOSECONDS_PER_SECOND);
- last_cpu_exec_time = cpu_exec_time;
- dev_time = 0;
-
- return human_readable_text_from_str(buf);
-}
-#else
-HumanReadableText *qmp_x_query_profile(Error **errp)
-{
- error_setg(errp, "Internal profiler not compiled");
- return NULL;
-}
-#endif
-
-#endif /* !CONFIG_USER_ONLY */
diff --git a/accel/tcg/hmp.c b/accel/tcg/hmp.c
deleted file mode 100644
index bb67941420..0000000000
--- a/accel/tcg/hmp.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu/error-report.h"
-#include "qapi/error.h"
-#include "qapi/qapi-commands-machine.h"
-#include "exec/exec-all.h"
-#include "monitor/monitor.h"
-
-static void hmp_tcg_register(void)
-{
- monitor_register_hmp_info_hrt("jit", qmp_x_query_jit);
- monitor_register_hmp_info_hrt("opcount", qmp_x_query_opcount);
-}
-
-type_init(hmp_tcg_register);
diff --git a/accel/tcg/internal.h b/accel/tcg/internal.h
index 6edff16fb0..130d7fd564 100644
--- a/accel/tcg/internal.h
+++ b/accel/tcg/internal.h
@@ -64,4 +64,7 @@ static inline target_ulong log_pc(CPUState *cpu, const TranslationBlock *tb)
#endif
}
+extern int64_t max_delay;
+extern int64_t max_advance;
+
#endif /* ACCEL_TCG_INTERNAL_H */
diff --git a/accel/tcg/meson.build b/accel/tcg/meson.build
index 75e1dffb4d..d645c38112 100644
--- a/accel/tcg/meson.build
+++ b/accel/tcg/meson.build
@@ -16,7 +16,7 @@ specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_ss)
specific_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_TCG'], if_true: files(
'cputlb.c',
- 'hmp.c',
+ 'monitor.c',
))
tcg_module_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_TCG'], if_true: files(
diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c
new file mode 100644
index 0000000000..4d01c0a825
--- /dev/null
+++ b/accel/tcg/monitor.c
@@ -0,0 +1,105 @@
+/*
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ *
+ * QEMU TCG monitor
+ *
+ * Copyright (c) 2003-2005 Fabrice Bellard
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qapi/type-helpers.h"
+#include "qapi/qapi-commands-machine.h"
+#include "monitor/monitor.h"
+#include "sysemu/cpus.h"
+#include "sysemu/cpu-timers.h"
+#include "sysemu/tcg.h"
+#include "internal.h"
+
+
+static void dump_drift_info(GString *buf)
+{
+ if (!icount_enabled()) {
+ return;
+ }
+
+ g_string_append_printf(buf, "Host - Guest clock %"PRIi64" ms\n",
+ (cpu_get_clock() - icount_get()) / SCALE_MS);
+ if (icount_align_option) {
+ g_string_append_printf(buf, "Max guest delay %"PRIi64" ms\n",
+ -max_delay / SCALE_MS);
+ g_string_append_printf(buf, "Max guest advance %"PRIi64" ms\n",
+ max_advance / SCALE_MS);
+ } else {
+ g_string_append_printf(buf, "Max guest delay NA\n");
+ g_string_append_printf(buf, "Max guest advance NA\n");
+ }
+}
+
+HumanReadableText *qmp_x_query_jit(Error **errp)
+{
+ g_autoptr(GString) buf = g_string_new("");
+
+ if (!tcg_enabled()) {
+ error_setg(errp, "JIT information is only available with accel=tcg");
+ return NULL;
+ }
+
+ dump_exec_info(buf);
+ dump_drift_info(buf);
+
+ return human_readable_text_from_str(buf);
+}
+
+HumanReadableText *qmp_x_query_opcount(Error **errp)
+{
+ g_autoptr(GString) buf = g_string_new("");
+
+ if (!tcg_enabled()) {
+ error_setg(errp, "Opcode count information is only available with accel=tcg");
+ return NULL;
+ }
+
+ tcg_dump_op_count(buf);
+
+ return human_readable_text_from_str(buf);
+}
+
+#ifdef CONFIG_PROFILER
+
+int64_t dev_time;
+
+HumanReadableText *qmp_x_query_profile(Error **errp)
+{
+ g_autoptr(GString) buf = g_string_new("");
+ static int64_t last_cpu_exec_time;
+ int64_t cpu_exec_time;
+ int64_t delta;
+
+ cpu_exec_time = tcg_cpu_exec_time();
+ delta = cpu_exec_time - last_cpu_exec_time;
+
+ g_string_append_printf(buf, "async time %" PRId64 " (%0.3f)\n",
+ dev_time, dev_time / (double)NANOSECONDS_PER_SECOND);
+ g_string_append_printf(buf, "qemu time %" PRId64 " (%0.3f)\n",
+ delta, delta / (double)NANOSECONDS_PER_SECOND);
+ last_cpu_exec_time = cpu_exec_time;
+ dev_time = 0;
+
+ return human_readable_text_from_str(buf);
+}
+#else
+HumanReadableText *qmp_x_query_profile(Error **errp)
+{
+ error_setg(errp, "Internal profiler not compiled");
+ return NULL;
+}
+#endif
+
+static void hmp_tcg_register(void)
+{
+ monitor_register_hmp_info_hrt("jit", qmp_x_query_jit);
+ monitor_register_hmp_info_hrt("opcount", qmp_x_query_opcount);
+}
+
+type_init(hmp_tcg_register);
--
2.38.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/5] replay: Extract core API to 'exec/replay-core.h'
2022-12-19 17:08 [PATCH 0/5] exec: QAPI housekeeping for user emulation Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2022-12-19 17:08 ` [PATCH 3/5] accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation Philippe Mathieu-Daudé
@ 2022-12-19 17:08 ` Philippe Mathieu-Daudé
2022-12-21 10:55 ` Pavel Dovgalyuk
2022-12-19 17:08 ` [PATCH 5/5] tests/unit: Restrict machine-smp.c test to system emulation Philippe Mathieu-Daudé
4 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-19 17:08 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Alex Bennée, Richard Henderson,
Paolo Bonzini, Eduardo Habkost, Yanan Wang, Pavel Dovgalyuk,
Marcel Apfelbaum, Markus Armbruster, Riku Voipio
From: Philippe Mathieu-Daude <philmd@linaro.org>
replay API is used deeply within TCG common code (common to user
and system emulation). Unfortunately "sysemu/replay.h" requires
some QAPI headers for few system-specific declarations, example:
void replay_input_event(QemuConsole *src, InputEvent *evt);
Since commit c2651c0eaa ("qapi/meson: Restrict UI module to system
emulation and tools") the QAPI header defining the InputEvent is
not generated anymore.
To keep it simple, extract the 'core' replay prototypes to a new
"exec/replay-core.h" header which we include in the TCG code that
doesn't need the rest of the replay API.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
MAINTAINERS | 1 +
accel/tcg/cpu-exec.c | 2 +-
accel/tcg/tcg-all.c | 2 +-
accel/tcg/translator.c | 2 +-
accel/tcg/user-exec-stub.c | 2 +-
cpu.c | 2 +-
gdbstub/gdbstub.c | 2 +-
hw/core/ptimer.c | 2 +-
include/exec/replay-core.h | 76 ++++++++++++++++++++++++++++++++++
include/sysemu/replay.h | 67 ++----------------------------
stubs/replay.c | 2 +-
tests/unit/ptimer-test-stubs.c | 2 +-
util/guest-random.c | 2 +-
13 files changed, 91 insertions(+), 73 deletions(-)
create mode 100644 include/exec/replay-core.h
diff --git a/MAINTAINERS b/MAINTAINERS
index 3bd433b65a..04aa77fd37 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3206,6 +3206,7 @@ S: Supported
F: replay/*
F: block/blkreplay.c
F: net/filter-replay.c
+F: include/exec/replay-core.h
F: include/sysemu/replay.h
F: docs/devel/replay.rst
F: docs/system/replay.rst
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 5a7825dce1..040de10440 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -37,7 +37,7 @@
#include "sysemu/cpus.h"
#include "exec/cpu-all.h"
#include "sysemu/cpu-timers.h"
-#include "sysemu/replay.h"
+#include "exec/replay-core.h"
#include "sysemu/tcg.h"
#include "exec/helper-proto.h"
#include "tb-jmp-cache.h"
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
index 30b503fb22..5dab1ae9dd 100644
--- a/accel/tcg/tcg-all.c
+++ b/accel/tcg/tcg-all.c
@@ -25,7 +25,7 @@
#include "qemu/osdep.h"
#include "sysemu/tcg.h"
-#include "sysemu/replay.h"
+#include "exec/replay-core.h"
#include "sysemu/cpu-timers.h"
#include "tcg/tcg.h"
#include "qapi/error.h"
diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c
index 061519691f..3a40f9eaca 100644
--- a/accel/tcg/translator.c
+++ b/accel/tcg/translator.c
@@ -16,7 +16,7 @@
#include "exec/log.h"
#include "exec/translator.h"
#include "exec/plugin-gen.h"
-#include "sysemu/replay.h"
+#include "exec/replay-core.h"
/* Pairs with tcg_clear_temp_count.
To be called by #TranslatorOps.{translate_insn,tb_stop} if
diff --git a/accel/tcg/user-exec-stub.c b/accel/tcg/user-exec-stub.c
index 968cd3ca60..874e1f1a20 100644
--- a/accel/tcg/user-exec-stub.c
+++ b/accel/tcg/user-exec-stub.c
@@ -1,6 +1,6 @@
#include "qemu/osdep.h"
#include "hw/core/cpu.h"
-#include "sysemu/replay.h"
+#include "exec/replay-core.h"
bool enable_cpu_pm = false;
diff --git a/cpu.c b/cpu.c
index 4a7d865427..5503e2ff12 100644
--- a/cpu.c
+++ b/cpu.c
@@ -33,7 +33,7 @@
#endif
#include "sysemu/tcg.h"
#include "sysemu/kvm.h"
-#include "sysemu/replay.h"
+#include "exec/replay-core.h"
#include "exec/cpu-common.h"
#include "exec/exec-all.h"
#include "exec/translate-all.h"
diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
index c3fbc31123..fb9c49e0fd 100644
--- a/gdbstub/gdbstub.c
+++ b/gdbstub/gdbstub.c
@@ -48,7 +48,7 @@
#include "sysemu/runstate.h"
#include "semihosting/semihost.h"
#include "exec/exec-all.h"
-#include "sysemu/replay.h"
+#include "exec/replay-core.h"
#include "internals.h"
diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
index eb5ba1aff7..e03165febf 100644
--- a/hw/core/ptimer.c
+++ b/hw/core/ptimer.c
@@ -10,7 +10,7 @@
#include "hw/ptimer.h"
#include "migration/vmstate.h"
#include "qemu/host-utils.h"
-#include "sysemu/replay.h"
+#include "exec/replay-core.h"
#include "sysemu/cpu-timers.h"
#include "sysemu/qtest.h"
#include "block/aio.h"
diff --git a/include/exec/replay-core.h b/include/exec/replay-core.h
new file mode 100644
index 0000000000..9ec20cb124
--- /dev/null
+++ b/include/exec/replay-core.h
@@ -0,0 +1,76 @@
+/*
+ * QEMU replay core API
+ *
+ * Copyright (c) 2010-2015 Institute for System Programming
+ * of the Russian Academy of Sciences.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef EXEC_REPLAY_H
+#define EXEC_REPLAY_H
+
+#include "qapi/qapi-types-replay.h"
+
+extern ReplayMode replay_mode;
+
+/* Replay process control functions */
+
+/*! Enables recording or saving event log with specified parameters */
+void replay_configure(struct QemuOpts *opts);
+/*! Initializes timers used for snapshotting and enables events recording */
+void replay_start(void);
+/*! Closes replay log file and frees other resources. */
+void replay_finish(void);
+/*! Adds replay blocker with the specified error description */
+void replay_add_blocker(Error *reason);
+/* Returns name of the replay log file */
+const char *replay_get_filename(void);
+
+/*
+ * Start making one step in backward direction.
+ * Used by gdbstub for backwards debugging.
+ * Returns true on success.
+ */
+bool replay_reverse_step(void);
+/*
+ * Start searching the last breakpoint/watchpoint.
+ * Used by gdbstub for backwards debugging.
+ * Returns true if the process successfully started.
+ */
+bool replay_reverse_continue(void);
+/*
+ * Returns true if replay module is processing
+ * reverse_continue or reverse_step request
+ */
+bool replay_running_debug(void);
+/* Called in reverse debugging mode to collect breakpoint information */
+void replay_breakpoint(void);
+/* Called when gdb is attached to gdbstub */
+void replay_gdb_attached(void);
+
+/* Interrupts and exceptions */
+
+/*! Called by exception handler to write or read
+ exception processing events. */
+bool replay_exception(void);
+/*! Used to determine that exception is pending.
+ Does not proceed to the next event in the log. */
+bool replay_has_exception(void);
+/*! Called by interrupt handlers to write or read
+ interrupt processing events.
+ \return true if interrupt should be processed */
+bool replay_interrupt(void);
+/*! Tries to read interrupt event from the file.
+ Returns true, when interrupt request is pending */
+bool replay_has_interrupt(void);
+
+/* Processing data from random generators */
+
+/* Saves the values from the random number generator */
+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);
+
+#endif
diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h
index 7ec0882b50..08aae5869f 100644
--- a/include/sysemu/replay.h
+++ b/include/sysemu/replay.h
@@ -1,8 +1,8 @@
-#ifndef REPLAY_H
-#define REPLAY_H
+#ifndef SYSEMU_REPLAY_H
+#define SYSEMU_REPLAY_H
/*
- * replay.h
+ * QEMU replay (system interface)
*
* Copyright (c) 2010-2015 Institute for System Programming
* of the Russian Academy of Sciences.
@@ -12,9 +12,9 @@
*
*/
+#include "exec/replay-core.h"
#include "qapi/qapi-types-misc.h"
#include "qapi/qapi-types-run-state.h"
-#include "qapi/qapi-types-replay.h"
#include "qapi/qapi-types-ui.h"
#include "block/aio.h"
@@ -45,8 +45,6 @@ typedef enum ReplayCheckpoint ReplayCheckpoint;
typedef struct ReplayNetState ReplayNetState;
-extern ReplayMode replay_mode;
-
/* Name of the initial VM snapshot */
extern char *replay_snapshot;
@@ -63,40 +61,6 @@ extern char *replay_snapshot;
void replay_mutex_lock(void);
void replay_mutex_unlock(void);
-/* Replay process control functions */
-
-/*! Enables recording or saving event log with specified parameters */
-void replay_configure(struct QemuOpts *opts);
-/*! Initializes timers used for snapshotting and enables events recording */
-void replay_start(void);
-/*! Closes replay log file and frees other resources. */
-void replay_finish(void);
-/*! Adds replay blocker with the specified error description */
-void replay_add_blocker(Error *reason);
-/* Returns name of the replay log file */
-const char *replay_get_filename(void);
-/*
- * Start making one step in backward direction.
- * Used by gdbstub for backwards debugging.
- * Returns true on success.
- */
-bool replay_reverse_step(void);
-/*
- * Start searching the last breakpoint/watchpoint.
- * Used by gdbstub for backwards debugging.
- * Returns true if the process successfully started.
- */
-bool replay_reverse_continue(void);
-/*
- * Returns true if replay module is processing
- * reverse_continue or reverse_step request
- */
-bool replay_running_debug(void);
-/* Called in reverse debugging mode to collect breakpoint information */
-void replay_breakpoint(void);
-/* Called when gdb is attached to gdbstub */
-void replay_gdb_attached(void);
-
/* Processing the instructions */
/*! Returns number of executed instructions. */
@@ -106,22 +70,6 @@ int replay_get_instructions(void);
/*! Updates instructions counter in replay mode. */
void replay_account_executed_instructions(void);
-/* Interrupts and exceptions */
-
-/*! Called by exception handler to write or read
- exception processing events. */
-bool replay_exception(void);
-/*! Used to determine that exception is pending.
- Does not proceed to the next event in the log. */
-bool replay_has_exception(void);
-/*! Called by interrupt handlers to write or read
- interrupt processing events.
- \return true if interrupt should be processed */
-bool replay_interrupt(void);
-/*! Tries to read interrupt event from the file.
- Returns true, when interrupt request is pending */
-bool replay_has_interrupt(void);
-
/* Processing clocks and other time sources */
/*! Save the specified clock */
@@ -143,13 +91,6 @@ int64_t replay_read_clock(ReplayClockKind kind, int64_t raw_icount);
? replay_save_clock((clock), (value), icount_get_raw_locked()) \
: (value))
-/* Processing data from random generators */
-
-/* Saves the values from the random number generator */
-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);
-
/* Events */
/*! Called when qemu shutdown is requested. */
diff --git a/stubs/replay.c b/stubs/replay.c
index 9d5b4be339..42c92e4acb 100644
--- a/stubs/replay.c
+++ b/stubs/replay.c
@@ -1,5 +1,5 @@
#include "qemu/osdep.h"
-#include "sysemu/replay.h"
+#include "exec/replay-core.h"
ReplayMode replay_mode;
diff --git a/tests/unit/ptimer-test-stubs.c b/tests/unit/ptimer-test-stubs.c
index f5e75a96b6..f2bfcede93 100644
--- a/tests/unit/ptimer-test-stubs.c
+++ b/tests/unit/ptimer-test-stubs.c
@@ -10,7 +10,7 @@
#include "qemu/osdep.h"
#include "qemu/main-loop.h"
-#include "sysemu/replay.h"
+#include "exec/replay-core.h"
#include "migration/vmstate.h"
#include "ptimer-test.h"
diff --git a/util/guest-random.c b/util/guest-random.c
index 23643f86cc..a24d27624c 100644
--- a/util/guest-random.c
+++ b/util/guest-random.c
@@ -14,7 +14,7 @@
#include "qapi/error.h"
#include "qemu/guest-random.h"
#include "crypto/random.h"
-#include "sysemu/replay.h"
+#include "exec/replay-core.h"
static __thread GRand *thread_rand;
--
2.38.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 5/5] tests/unit: Restrict machine-smp.c test to system emulation
2022-12-19 17:08 [PATCH 0/5] exec: QAPI housekeeping for user emulation Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2022-12-19 17:08 ` [PATCH 4/5] replay: Extract core API to 'exec/replay-core.h' Philippe Mathieu-Daudé
@ 2022-12-19 17:08 ` Philippe Mathieu-Daudé
2022-12-19 18:43 ` Richard Henderson
4 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-19 17:08 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Alex Bennée, Richard Henderson,
Paolo Bonzini, Eduardo Habkost, Yanan Wang, Pavel Dovgalyuk,
Marcel Apfelbaum, Markus Armbruster, Riku Voipio
From: Philippe Mathieu-Daude <philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
tests/unit/meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/unit/meson.build b/tests/unit/meson.build
index ffa444f432..51f453e6c4 100644
--- a/tests/unit/meson.build
+++ b/tests/unit/meson.build
@@ -46,7 +46,6 @@ tests = {
'test-uuid': [],
'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'],
'test-qapi-util': [],
- 'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'],
'test-interval-tree': [],
}
@@ -134,6 +133,7 @@ if have_system
'test-util-sockets': ['socket-helpers.c'],
'test-base64': [],
'test-bufferiszero': [],
+ 'test-smp-parse': [qom, meson.project_source_root() / 'hw/core/machine-smp.c'],
'test-vmstate': [migration, io],
'test-yank': ['socket-helpers.c', qom, io, chardev]
}
--
2.38.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/5] exec: Remove unused 'qemu/timer.h' timer
2022-12-19 17:08 ` [PATCH 1/5] exec: Remove unused 'qemu/timer.h' timer Philippe Mathieu-Daudé
@ 2022-12-19 18:40 ` Richard Henderson
0 siblings, 0 replies; 11+ messages in thread
From: Richard Henderson @ 2022-12-19 18:40 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Paolo Bonzini, Eduardo Habkost, Yanan Wang,
Pavel Dovgalyuk, Marcel Apfelbaum, Markus Armbruster, Riku Voipio
On 12/19/22 09:08, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> accel/tcg/cpu-exec.c | 1 -
> accel/tcg/translate-all.c | 1 -
> include/exec/gen-icount.h | 1 -
> include/sysemu/cpus.h | 1 -
> tcg/tcg.c | 1 -
> 5 files changed, 5 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/5] tcg/tcg-op-gvec: Remove unused "qemu/main-loop.h" header
2022-12-19 17:08 ` [PATCH 2/5] tcg/tcg-op-gvec: Remove unused "qemu/main-loop.h" header Philippe Mathieu-Daudé
@ 2022-12-19 18:40 ` Richard Henderson
0 siblings, 0 replies; 11+ messages in thread
From: Richard Henderson @ 2022-12-19 18:40 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Paolo Bonzini, Eduardo Habkost, Yanan Wang,
Pavel Dovgalyuk, Marcel Apfelbaum, Markus Armbruster, Riku Voipio
On 12/19/22 09:08, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> Added in db72581598 ("Include qemu/main-loop.h less") but now
> I can't see what is requiring it.
>
> I checked 'git diff db725815985..origin/master -- tcg/tcg-op-gvec.c'
> to see if some code was removed without removing the header;
> I haven't checked individual commits.
> ---
> tcg/tcg-op-gvec.c | 1 -
> 1 file changed, 1 deletion(-)
I can only imagine that it was cut-and-paste.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
>
> diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c
> index 079a761b04..aacedd3e15 100644
> --- a/tcg/tcg-op-gvec.c
> +++ b/tcg/tcg-op-gvec.c
> @@ -21,7 +21,6 @@
> #include "tcg/tcg.h"
> #include "tcg/tcg-op.h"
> #include "tcg/tcg-op-gvec.h"
> -#include "qemu/main-loop.h"
> #include "tcg/tcg-gvec-desc.h"
>
> #define MAX_UNROLL 4
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 3/5] accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation
2022-12-19 17:08 ` [PATCH 3/5] accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation Philippe Mathieu-Daudé
@ 2022-12-19 18:42 ` Richard Henderson
0 siblings, 0 replies; 11+ messages in thread
From: Richard Henderson @ 2022-12-19 18:42 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Paolo Bonzini, Eduardo Habkost, Yanan Wang,
Pavel Dovgalyuk, Marcel Apfelbaum, Markus Armbruster, Riku Voipio
On 12/19/22 09:08, Philippe Mathieu-Daudé wrote:
> Since commit a0e61807a3 ("qapi: Remove QMP events and commands from
> user-mode builds") we don't generate the "qapi-commands-machine.h"
> header in a user-emulation-only build.
>
> Rename 'hmp.c' as 'monitor.c' and move the QMP functions from
> cpu-exec.c (which is always compiled) to monitor.c (which is only
> compiled when system-emulation is selected).
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> accel/tcg/cpu-exec.c | 88 +----------------------------------
> accel/tcg/hmp.c | 14 ------
> accel/tcg/internal.h | 3 ++
> accel/tcg/meson.build | 2 +-
> accel/tcg/monitor.c | 105 ++++++++++++++++++++++++++++++++++++++++++
> 5 files changed, 111 insertions(+), 101 deletions(-)
> delete mode 100644 accel/tcg/hmp.c
> create mode 100644 accel/tcg/monitor.c
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 5/5] tests/unit: Restrict machine-smp.c test to system emulation
2022-12-19 17:08 ` [PATCH 5/5] tests/unit: Restrict machine-smp.c test to system emulation Philippe Mathieu-Daudé
@ 2022-12-19 18:43 ` Richard Henderson
0 siblings, 0 replies; 11+ messages in thread
From: Richard Henderson @ 2022-12-19 18:43 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Paolo Bonzini, Eduardo Habkost, Yanan Wang,
Pavel Dovgalyuk, Marcel Apfelbaum, Markus Armbruster, Riku Voipio
On 12/19/22 09:08, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daude<philmd@linaro.org>
>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> tests/unit/meson.build | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/5] replay: Extract core API to 'exec/replay-core.h'
2022-12-19 17:08 ` [PATCH 4/5] replay: Extract core API to 'exec/replay-core.h' Philippe Mathieu-Daudé
@ 2022-12-21 10:55 ` Pavel Dovgalyuk
0 siblings, 0 replies; 11+ messages in thread
From: Pavel Dovgalyuk @ 2022-12-21 10:55 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Alex Bennée, Richard Henderson, Paolo Bonzini,
Eduardo Habkost, Yanan Wang, Pavel Dovgalyuk, Marcel Apfelbaum,
Markus Armbruster, Riku Voipio
Reviewed-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
On 19.12.2022 20:08, Philippe Mathieu-Daudé wrote:
> From: Philippe Mathieu-Daude <philmd@linaro.org>
>
> replay API is used deeply within TCG common code (common to user
> and system emulation). Unfortunately "sysemu/replay.h" requires
> some QAPI headers for few system-specific declarations, example:
>
> void replay_input_event(QemuConsole *src, InputEvent *evt);
>
> Since commit c2651c0eaa ("qapi/meson: Restrict UI module to system
> emulation and tools") the QAPI header defining the InputEvent is
> not generated anymore.
> To keep it simple, extract the 'core' replay prototypes to a new
> "exec/replay-core.h" header which we include in the TCG code that
> doesn't need the rest of the replay API.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> MAINTAINERS | 1 +
> accel/tcg/cpu-exec.c | 2 +-
> accel/tcg/tcg-all.c | 2 +-
> accel/tcg/translator.c | 2 +-
> accel/tcg/user-exec-stub.c | 2 +-
> cpu.c | 2 +-
> gdbstub/gdbstub.c | 2 +-
> hw/core/ptimer.c | 2 +-
> include/exec/replay-core.h | 76 ++++++++++++++++++++++++++++++++++
> include/sysemu/replay.h | 67 ++----------------------------
> stubs/replay.c | 2 +-
> tests/unit/ptimer-test-stubs.c | 2 +-
> util/guest-random.c | 2 +-
> 13 files changed, 91 insertions(+), 73 deletions(-)
> create mode 100644 include/exec/replay-core.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3bd433b65a..04aa77fd37 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -3206,6 +3206,7 @@ S: Supported
> F: replay/*
> F: block/blkreplay.c
> F: net/filter-replay.c
> +F: include/exec/replay-core.h
> F: include/sysemu/replay.h
> F: docs/devel/replay.rst
> F: docs/system/replay.rst
> diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
> index 5a7825dce1..040de10440 100644
> --- a/accel/tcg/cpu-exec.c
> +++ b/accel/tcg/cpu-exec.c
> @@ -37,7 +37,7 @@
> #include "sysemu/cpus.h"
> #include "exec/cpu-all.h"
> #include "sysemu/cpu-timers.h"
> -#include "sysemu/replay.h"
> +#include "exec/replay-core.h"
> #include "sysemu/tcg.h"
> #include "exec/helper-proto.h"
> #include "tb-jmp-cache.h"
> diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
> index 30b503fb22..5dab1ae9dd 100644
> --- a/accel/tcg/tcg-all.c
> +++ b/accel/tcg/tcg-all.c
> @@ -25,7 +25,7 @@
>
> #include "qemu/osdep.h"
> #include "sysemu/tcg.h"
> -#include "sysemu/replay.h"
> +#include "exec/replay-core.h"
> #include "sysemu/cpu-timers.h"
> #include "tcg/tcg.h"
> #include "qapi/error.h"
> diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c
> index 061519691f..3a40f9eaca 100644
> --- a/accel/tcg/translator.c
> +++ b/accel/tcg/translator.c
> @@ -16,7 +16,7 @@
> #include "exec/log.h"
> #include "exec/translator.h"
> #include "exec/plugin-gen.h"
> -#include "sysemu/replay.h"
> +#include "exec/replay-core.h"
>
> /* Pairs with tcg_clear_temp_count.
> To be called by #TranslatorOps.{translate_insn,tb_stop} if
> diff --git a/accel/tcg/user-exec-stub.c b/accel/tcg/user-exec-stub.c
> index 968cd3ca60..874e1f1a20 100644
> --- a/accel/tcg/user-exec-stub.c
> +++ b/accel/tcg/user-exec-stub.c
> @@ -1,6 +1,6 @@
> #include "qemu/osdep.h"
> #include "hw/core/cpu.h"
> -#include "sysemu/replay.h"
> +#include "exec/replay-core.h"
>
> bool enable_cpu_pm = false;
>
> diff --git a/cpu.c b/cpu.c
> index 4a7d865427..5503e2ff12 100644
> --- a/cpu.c
> +++ b/cpu.c
> @@ -33,7 +33,7 @@
> #endif
> #include "sysemu/tcg.h"
> #include "sysemu/kvm.h"
> -#include "sysemu/replay.h"
> +#include "exec/replay-core.h"
> #include "exec/cpu-common.h"
> #include "exec/exec-all.h"
> #include "exec/translate-all.h"
> diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c
> index c3fbc31123..fb9c49e0fd 100644
> --- a/gdbstub/gdbstub.c
> +++ b/gdbstub/gdbstub.c
> @@ -48,7 +48,7 @@
> #include "sysemu/runstate.h"
> #include "semihosting/semihost.h"
> #include "exec/exec-all.h"
> -#include "sysemu/replay.h"
> +#include "exec/replay-core.h"
>
> #include "internals.h"
>
> diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c
> index eb5ba1aff7..e03165febf 100644
> --- a/hw/core/ptimer.c
> +++ b/hw/core/ptimer.c
> @@ -10,7 +10,7 @@
> #include "hw/ptimer.h"
> #include "migration/vmstate.h"
> #include "qemu/host-utils.h"
> -#include "sysemu/replay.h"
> +#include "exec/replay-core.h"
> #include "sysemu/cpu-timers.h"
> #include "sysemu/qtest.h"
> #include "block/aio.h"
> diff --git a/include/exec/replay-core.h b/include/exec/replay-core.h
> new file mode 100644
> index 0000000000..9ec20cb124
> --- /dev/null
> +++ b/include/exec/replay-core.h
> @@ -0,0 +1,76 @@
> +/*
> + * QEMU replay core API
> + *
> + * Copyright (c) 2010-2015 Institute for System Programming
> + * of the Russian Academy of Sciences.
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#ifndef EXEC_REPLAY_H
> +#define EXEC_REPLAY_H
> +
> +#include "qapi/qapi-types-replay.h"
> +
> +extern ReplayMode replay_mode;
> +
> +/* Replay process control functions */
> +
> +/*! Enables recording or saving event log with specified parameters */
> +void replay_configure(struct QemuOpts *opts);
> +/*! Initializes timers used for snapshotting and enables events recording */
> +void replay_start(void);
> +/*! Closes replay log file and frees other resources. */
> +void replay_finish(void);
> +/*! Adds replay blocker with the specified error description */
> +void replay_add_blocker(Error *reason);
> +/* Returns name of the replay log file */
> +const char *replay_get_filename(void);
> +
> +/*
> + * Start making one step in backward direction.
> + * Used by gdbstub for backwards debugging.
> + * Returns true on success.
> + */
> +bool replay_reverse_step(void);
> +/*
> + * Start searching the last breakpoint/watchpoint.
> + * Used by gdbstub for backwards debugging.
> + * Returns true if the process successfully started.
> + */
> +bool replay_reverse_continue(void);
> +/*
> + * Returns true if replay module is processing
> + * reverse_continue or reverse_step request
> + */
> +bool replay_running_debug(void);
> +/* Called in reverse debugging mode to collect breakpoint information */
> +void replay_breakpoint(void);
> +/* Called when gdb is attached to gdbstub */
> +void replay_gdb_attached(void);
> +
> +/* Interrupts and exceptions */
> +
> +/*! Called by exception handler to write or read
> + exception processing events. */
> +bool replay_exception(void);
> +/*! Used to determine that exception is pending.
> + Does not proceed to the next event in the log. */
> +bool replay_has_exception(void);
> +/*! Called by interrupt handlers to write or read
> + interrupt processing events.
> + \return true if interrupt should be processed */
> +bool replay_interrupt(void);
> +/*! Tries to read interrupt event from the file.
> + Returns true, when interrupt request is pending */
> +bool replay_has_interrupt(void);
> +
> +/* Processing data from random generators */
> +
> +/* Saves the values from the random number generator */
> +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);
> +
> +#endif
> diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h
> index 7ec0882b50..08aae5869f 100644
> --- a/include/sysemu/replay.h
> +++ b/include/sysemu/replay.h
> @@ -1,8 +1,8 @@
> -#ifndef REPLAY_H
> -#define REPLAY_H
> +#ifndef SYSEMU_REPLAY_H
> +#define SYSEMU_REPLAY_H
>
> /*
> - * replay.h
> + * QEMU replay (system interface)
> *
> * Copyright (c) 2010-2015 Institute for System Programming
> * of the Russian Academy of Sciences.
> @@ -12,9 +12,9 @@
> *
> */
>
> +#include "exec/replay-core.h"
> #include "qapi/qapi-types-misc.h"
> #include "qapi/qapi-types-run-state.h"
> -#include "qapi/qapi-types-replay.h"
> #include "qapi/qapi-types-ui.h"
> #include "block/aio.h"
>
> @@ -45,8 +45,6 @@ typedef enum ReplayCheckpoint ReplayCheckpoint;
>
> typedef struct ReplayNetState ReplayNetState;
>
> -extern ReplayMode replay_mode;
> -
> /* Name of the initial VM snapshot */
> extern char *replay_snapshot;
>
> @@ -63,40 +61,6 @@ extern char *replay_snapshot;
> void replay_mutex_lock(void);
> void replay_mutex_unlock(void);
>
> -/* Replay process control functions */
> -
> -/*! Enables recording or saving event log with specified parameters */
> -void replay_configure(struct QemuOpts *opts);
> -/*! Initializes timers used for snapshotting and enables events recording */
> -void replay_start(void);
> -/*! Closes replay log file and frees other resources. */
> -void replay_finish(void);
> -/*! Adds replay blocker with the specified error description */
> -void replay_add_blocker(Error *reason);
> -/* Returns name of the replay log file */
> -const char *replay_get_filename(void);
> -/*
> - * Start making one step in backward direction.
> - * Used by gdbstub for backwards debugging.
> - * Returns true on success.
> - */
> -bool replay_reverse_step(void);
> -/*
> - * Start searching the last breakpoint/watchpoint.
> - * Used by gdbstub for backwards debugging.
> - * Returns true if the process successfully started.
> - */
> -bool replay_reverse_continue(void);
> -/*
> - * Returns true if replay module is processing
> - * reverse_continue or reverse_step request
> - */
> -bool replay_running_debug(void);
> -/* Called in reverse debugging mode to collect breakpoint information */
> -void replay_breakpoint(void);
> -/* Called when gdb is attached to gdbstub */
> -void replay_gdb_attached(void);
> -
> /* Processing the instructions */
>
> /*! Returns number of executed instructions. */
> @@ -106,22 +70,6 @@ int replay_get_instructions(void);
> /*! Updates instructions counter in replay mode. */
> void replay_account_executed_instructions(void);
>
> -/* Interrupts and exceptions */
> -
> -/*! Called by exception handler to write or read
> - exception processing events. */
> -bool replay_exception(void);
> -/*! Used to determine that exception is pending.
> - Does not proceed to the next event in the log. */
> -bool replay_has_exception(void);
> -/*! Called by interrupt handlers to write or read
> - interrupt processing events.
> - \return true if interrupt should be processed */
> -bool replay_interrupt(void);
> -/*! Tries to read interrupt event from the file.
> - Returns true, when interrupt request is pending */
> -bool replay_has_interrupt(void);
> -
> /* Processing clocks and other time sources */
>
> /*! Save the specified clock */
> @@ -143,13 +91,6 @@ int64_t replay_read_clock(ReplayClockKind kind, int64_t raw_icount);
> ? replay_save_clock((clock), (value), icount_get_raw_locked()) \
> : (value))
>
> -/* Processing data from random generators */
> -
> -/* Saves the values from the random number generator */
> -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);
> -
> /* Events */
>
> /*! Called when qemu shutdown is requested. */
> diff --git a/stubs/replay.c b/stubs/replay.c
> index 9d5b4be339..42c92e4acb 100644
> --- a/stubs/replay.c
> +++ b/stubs/replay.c
> @@ -1,5 +1,5 @@
> #include "qemu/osdep.h"
> -#include "sysemu/replay.h"
> +#include "exec/replay-core.h"
>
> ReplayMode replay_mode;
>
> diff --git a/tests/unit/ptimer-test-stubs.c b/tests/unit/ptimer-test-stubs.c
> index f5e75a96b6..f2bfcede93 100644
> --- a/tests/unit/ptimer-test-stubs.c
> +++ b/tests/unit/ptimer-test-stubs.c
> @@ -10,7 +10,7 @@
>
> #include "qemu/osdep.h"
> #include "qemu/main-loop.h"
> -#include "sysemu/replay.h"
> +#include "exec/replay-core.h"
> #include "migration/vmstate.h"
>
> #include "ptimer-test.h"
> diff --git a/util/guest-random.c b/util/guest-random.c
> index 23643f86cc..a24d27624c 100644
> --- a/util/guest-random.c
> +++ b/util/guest-random.c
> @@ -14,7 +14,7 @@
> #include "qapi/error.h"
> #include "qemu/guest-random.h"
> #include "crypto/random.h"
> -#include "sysemu/replay.h"
> +#include "exec/replay-core.h"
>
>
> static __thread GRand *thread_rand;
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-12-21 10:56 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-19 17:08 [PATCH 0/5] exec: QAPI housekeeping for user emulation Philippe Mathieu-Daudé
2022-12-19 17:08 ` [PATCH 1/5] exec: Remove unused 'qemu/timer.h' timer Philippe Mathieu-Daudé
2022-12-19 18:40 ` Richard Henderson
2022-12-19 17:08 ` [PATCH 2/5] tcg/tcg-op-gvec: Remove unused "qemu/main-loop.h" header Philippe Mathieu-Daudé
2022-12-19 18:40 ` Richard Henderson
2022-12-19 17:08 ` [PATCH 3/5] accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation Philippe Mathieu-Daudé
2022-12-19 18:42 ` Richard Henderson
2022-12-19 17:08 ` [PATCH 4/5] replay: Extract core API to 'exec/replay-core.h' Philippe Mathieu-Daudé
2022-12-21 10:55 ` Pavel Dovgalyuk
2022-12-19 17:08 ` [PATCH 5/5] tests/unit: Restrict machine-smp.c test to system emulation Philippe Mathieu-Daudé
2022-12-19 18:43 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).