Skip to contentSkip to conversation

exec: QAPI housekeeping for user emulation

PATCH In review Philippe Mathieu-Daudé 3 participants 11 messages Dec 19, 2022 – Dec 21, 2022 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover exec: QAPI housekeeping for user emulation

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
Signature · 1 line
2.38.1
#1 lore raw

PATCH 1/5 exec: Remove unused 'qemu/timer.h' timer

---
 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(-)
accel/tcg/cpu-exec.c +0 -1
index 356fe348de..298149ed07 100644
@@ -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"
accel/tcg/translate-all.c +0 -1
index ed6656fb14..dea5ca81b5 100644
@@ -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"
include/exec/gen-icount.h +0 -1
index c57204ddad..166170b08e 100644
@@ -2,7 +2,6 @@
 #define GEN_ICOUNT_H
 
 #include "exec/exec-all.h"
-#include "qemu/timer.h"
 
 /* Helpers for instruction counting code generation.  */
 
include/sysemu/cpus.h +0 -1
index 1bace3379b..0535a4c68a 100644
@@ -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 */
tcg/tcg.c +0 -1
index 436fcf6ebd..1071fc00fe 100644
@@ -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"
 
Signature · 1 line
2.38.1
#3 lore raw

PATCH 2/5 tcg/tcg-op-gvec: Remove unused "qemu/main-loop.h" header

In reply to Philippe Mathieu-Daudé

---
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(-)
tcg/tcg-op-gvec.c +0 -1
index 079a761b04..aacedd3e15 100644
@@ -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
Signature · 1 line
2.38.1
Reviewed-by on v1 2/5
#4 lore raw

Re: [PATCH 2/5] tcg/tcg-op-gvec: Remove unused "qemu/main-loop.h" header

Quoted 11 lines · Philippe Mathieu-Daudé

---
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.

r~

Quoted 13 lines
tcg/tcg-op-gvec.c +0 -1
index 079a761b04..aacedd3e15 100644
@@ -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
#5 lore raw

PATCH 3/5 accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation

In reply to Philippe Mathieu-Daudé

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).

---
 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
accel/tcg/cpu-exec.c +2 -86
index 298149ed07..5a7825dce1 100644
@@ -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 */
accel/tcg/hmp.c deleted +0 -14
deleted file mode 100644
index bb67941420..0000000000
@@ -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);
accel/tcg/internal.h +3 -0
index 6edff16fb0..130d7fd564 100644
@@ -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 */
accel/tcg/meson.build +1 -1
index 75e1dffb4d..d645c38112 100644
@@ -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(
accel/tcg/monitor.c new file +105 -0

105 lines not on this page · raw message

Signature · 1 line
2.38.1
Reviewed-by on v1 3/5
#6 lore raw

Re: [PATCH 3/5] accel/tcg: Restrict 'qapi-commands-machine.h' to system emulation

Quoted 16 lines · Philippe Mathieu-Daudé

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).

---
  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(-)
Quoted 2 lines

delete mode 100644 accel/tcg/hmp.c
create mode 100644 accel/tcg/monitor.c

r~

#7 lore raw

PATCH 4/5 replay: Extract core API to 'exec/replay-core.h'

In reply to Philippe Mathieu-Daudé

From: Philippe Mathieu-Daude <[email protected]>

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.

---
 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
MAINTAINERS +1 -0
index 3bd433b65a..04aa77fd37 100644
@@ -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
accel/tcg/cpu-exec.c +1 -1
index 5a7825dce1..040de10440 100644
@@ -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"
accel/tcg/tcg-all.c +1 -1
index 30b503fb22..5dab1ae9dd 100644
@@ -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"
accel/tcg/translator.c +1 -1
index 061519691f..3a40f9eaca 100644
@@ -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
accel/tcg/user-exec-stub.c +1 -1
index 968cd3ca60..874e1f1a20 100644
@@ -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;
 
cpu.c +1 -1
index 4a7d865427..5503e2ff12 100644
@@ -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"
gdbstub/gdbstub.c +1 -1
index c3fbc31123..fb9c49e0fd 100644
@@ -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"
 
hw/core/ptimer.c +1 -1
index eb5ba1aff7..e03165febf 100644
@@ -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"
include/exec/replay-core.h new file +76 -0

76 lines not on this page · raw message

include/sysemu/replay.h +4 -63

104 lines not on this page · raw message

stubs/replay.c +1 -1
index 9d5b4be339..42c92e4acb 100644
@@ -1,5 +1,5 @@
 #include "qemu/osdep.h"
-#include "sysemu/replay.h"
+#include "exec/replay-core.h"
 
 ReplayMode replay_mode;
 
tests/unit/ptimer-test-stubs.c +1 -1
index f5e75a96b6..f2bfcede93 100644
@@ -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"
util/guest-random.c +1 -1
index 23643f86cc..a24d27624c 100644
@@ -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;
Signature · 1 line
2.38.1
Reviewed-by on v1 4/5
#8 lore raw

Re: [PATCH 4/5] replay: Extract core API to 'exec/replay-core.h'

Quoted 368 lines · Philippe Mathieu-Daudé

From: Philippe Mathieu-Daude <[email protected]>

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.

---
  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

MAINTAINERS +1 -0
index 3bd433b65a..04aa77fd37 100644
@@ -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
accel/tcg/cpu-exec.c +1 -1
index 5a7825dce1..040de10440 100644
@@ -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"
accel/tcg/tcg-all.c +1 -1
index 30b503fb22..5dab1ae9dd 100644
@@ -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"
accel/tcg/translator.c +1 -1
index 061519691f..3a40f9eaca 100644
@@ -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
accel/tcg/user-exec-stub.c +1 -1
index 968cd3ca60..874e1f1a20 100644
@@ -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;
 
cpu.c +1 -1
index 4a7d865427..5503e2ff12 100644
@@ -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"
gdbstub/gdbstub.c +1 -1
index c3fbc31123..fb9c49e0fd 100644
@@ -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"
 
hw/core/ptimer.c +1 -1
index eb5ba1aff7..e03165febf 100644
@@ -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"
include/exec/replay-core.h new file +76 -0
new file mode 100644
index 0000000000..9ec20cb124
@@ -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
include/sysemu/replay.h +4 -63
index 7ec0882b50..08aae5869f 100644
@@ -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. */
stubs/replay.c +1 -1
index 9d5b4be339..42c92e4acb 100644
@@ -1,5 +1,5 @@
  #include "qemu/osdep.h"
-#include "sysemu/replay.h"
+#include "exec/replay-core.h"
 
  ReplayMode replay_mode;
 
tests/unit/ptimer-test-stubs.c +1 -1
index f5e75a96b6..f2bfcede93 100644
@@ -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"
util/guest-random.c +1 -1
index 23643f86cc..a24d27624c 100644
@@ -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;
#9 lore raw

PATCH 5/5 tests/unit: Restrict machine-smp.c test to system emulation

In reply to Philippe Mathieu-Daudé

From: Philippe Mathieu-Daude <[email protected]>

---
 tests/unit/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/unit/meson.build +1 -1
index ffa444f432..51f453e6c4 100644
@@ -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]
   }
Signature · 1 line
2.38.1