Next commit will register tcg_dump_stats() as AccelClass::get_stats
handler. Since we want this handler to be called with the correct
accelerator state, propagate it along.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/tcg/internal-common.h | 2 +-
accel/tcg/monitor.c | 3 ++-
accel/tcg/tcg-stats.c | 7 +++----
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h
index 77a3a0684a5..847ae3914f5 100644
--- a/accel/tcg/internal-common.h
+++ b/accel/tcg/internal-common.h
@@ -139,6 +139,6 @@ G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);
void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
void tb_set_jmp_target(TranslationBlock *tb, int n, uintptr_t addr);
-void tcg_dump_stats(GString *buf);
+void tcg_dump_stats(AccelState *accel, GString *buf);
#endif
diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c
index adb9de5a1c6..97626da2f1f 100644
--- a/accel/tcg/monitor.c
+++ b/accel/tcg/monitor.c
@@ -7,6 +7,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/accel.h"
#include "qapi/error.h"
#include "qapi/type-helpers.h"
#include "qapi/qapi-commands-machine.h"
@@ -23,7 +24,7 @@ HumanReadableText *qmp_x_query_jit(Error **errp)
return NULL;
}
- tcg_dump_stats(buf);
+ tcg_dump_stats(current_accel(), buf);
return human_readable_text_from_str(buf);
}
diff --git a/accel/tcg/tcg-stats.c b/accel/tcg/tcg-stats.c
index eb6e20ae985..02795570b5c 100644
--- a/accel/tcg/tcg-stats.c
+++ b/accel/tcg/tcg-stats.c
@@ -37,9 +37,8 @@ static void dump_drift_info(GString *buf)
}
}
-static void dump_accel_info(GString *buf)
+static void dump_accel_info(AccelState *accel, GString *buf)
{
- AccelState *accel = current_accel();
bool one_insn_per_tb = object_property_get_bool(OBJECT(accel),
"one-insn-per-tb",
&error_fatal);
@@ -207,9 +206,9 @@ static void dump_exec_info(GString *buf)
tcg_dump_flush_info(buf);
}
-void tcg_dump_stats(GString *buf)
+void tcg_dump_stats(AccelState *accel, GString *buf)
{
- dump_accel_info(buf);
+ dump_accel_info(accel, buf);
dump_exec_info(buf);
dump_drift_info(buf);
}
--
2.49.0
On 7/15/25 04:40, Philippe Mathieu-Daudé wrote: > Next commit will register tcg_dump_stats() asAccelClass::get_stats > handler. Since we want this handler to be called with the correct > accelerator state, propagate it along. > > Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org> > --- > accel/tcg/internal-common.h | 2 +- > accel/tcg/monitor.c | 3 ++- > accel/tcg/tcg-stats.c | 7 +++---- > 3 files changed, 6 insertions(+), 6 deletions(-) I suppose you could at the same time rename to tcg_get_stats to match the accel hook. But either way, Reviewed-by: Richard Henderson <richard.henderson@linaro.org> r~
On Tue, Jul 15, 2025 at 1:40 PM Philippe Mathieu-Daudé
<philmd@linaro.org> wrote:
>
> Next commit will register tcg_dump_stats() as AccelClass::get_stats
> handler. Since we want this handler to be called with the correct
> accelerator state, propagate it along.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> accel/tcg/internal-common.h | 2 +-
> accel/tcg/monitor.c | 3 ++-
> accel/tcg/tcg-stats.c | 7 +++----
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h
> index 77a3a0684a5..847ae3914f5 100644
> --- a/accel/tcg/internal-common.h
> +++ b/accel/tcg/internal-common.h
> @@ -139,6 +139,6 @@ G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr);
> void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
> void tb_set_jmp_target(TranslationBlock *tb, int n, uintptr_t addr);
>
> -void tcg_dump_stats(GString *buf);
> +void tcg_dump_stats(AccelState *accel, GString *buf);
>
> #endif
> diff --git a/accel/tcg/monitor.c b/accel/tcg/monitor.c
> index adb9de5a1c6..97626da2f1f 100644
> --- a/accel/tcg/monitor.c
> +++ b/accel/tcg/monitor.c
> @@ -7,6 +7,7 @@
> */
>
> #include "qemu/osdep.h"
> +#include "qemu/accel.h"
> #include "qapi/error.h"
> #include "qapi/type-helpers.h"
> #include "qapi/qapi-commands-machine.h"
> @@ -23,7 +24,7 @@ HumanReadableText *qmp_x_query_jit(Error **errp)
> return NULL;
> }
>
> - tcg_dump_stats(buf);
> + tcg_dump_stats(current_accel(), buf);
>
> return human_readable_text_from_str(buf);
> }
> diff --git a/accel/tcg/tcg-stats.c b/accel/tcg/tcg-stats.c
> index eb6e20ae985..02795570b5c 100644
> --- a/accel/tcg/tcg-stats.c
> +++ b/accel/tcg/tcg-stats.c
> @@ -37,9 +37,8 @@ static void dump_drift_info(GString *buf)
> }
> }
>
> -static void dump_accel_info(GString *buf)
> +static void dump_accel_info(AccelState *accel, GString *buf)
> {
> - AccelState *accel = current_accel();
> bool one_insn_per_tb = object_property_get_bool(OBJECT(accel),
> "one-insn-per-tb",
> &error_fatal);
> @@ -207,9 +206,9 @@ static void dump_exec_info(GString *buf)
> tcg_dump_flush_info(buf);
> }
>
> -void tcg_dump_stats(GString *buf)
> +void tcg_dump_stats(AccelState *accel, GString *buf)
> {
> - dump_accel_info(buf);
> + dump_accel_info(accel, buf);
> dump_exec_info(buf);
> dump_drift_info(buf);
> }
> --
> 2.49.0
>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
© 2016 - 2025 Red Hat, Inc.