qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* trace_FOO_tcg bit-rotted?
@ 2021-04-06 16:00 Alex Bennée
  2021-04-06 17:24 ` no-reply
  2021-04-07  9:08 ` Laurent Vivier
  0 siblings, 2 replies; 11+ messages in thread
From: Alex Bennée @ 2021-04-06 16:00 UTC (permalink / raw)
  To: Stefan Hajnoczi, Lluís Vilanova; +Cc: matheus.ferst, qemu-devel

Hi,

It's been awhile since I last played with this but I think we are
suffering from not having some test cases for tracing code
generation/execution in the tree. I tried adding a simple trace point to
see if I could track ERET calls:

--8<---------------cut here---------------start------------->8---
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 0b42e53500..0d643f78fe 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -36,6 +36,7 @@
 #include "exec/log.h"
 
 #include "trace-tcg.h"
+#include "trace.h"
 #include "translate-a64.h"
 #include "qemu/atomic128.h"
 
@@ -2302,6 +2303,9 @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn)
         default:
             goto do_unallocated;
         }
+
+        trace_eret_tcg(s->current_el, dst);
+
         if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) {
             gen_io_start();
         }
diff --git a/target/arm/trace-events b/target/arm/trace-events
index 41c63d7570..2d4fca16a1 100644
--- a/target/arm/trace-events
+++ b/target/arm/trace-events
@@ -1,5 +1,10 @@
 # See docs/devel/tracing.txt for syntax documentation.
 
+# translate-a64.c
+# Mode: softmmu
+# Targets: TCG(aarch64-softmmu)
+tcg eret(int current_el, TCGv target_el) "trans_eret: from EL%d", "exec_eret: EL%d to EL%"PRId64
+
 # helper.c
 arm_gt_recalc(int timer, int irqstate, uint64_t nexttick) "gt recalc: timer %d irqstate %d next tick 0x%" PRIx64
 arm_gt_recalc_disabled(int timer) "gt recalc: timer %d irqstate 0 timer disabled"
--8<---------------cut here---------------end--------------->8---

According to the tracing docs I the:

  trace_eret_tcg(s->current_el, dst);

Should:

  Instead of using these two events, you should instead use the function
  "trace_<eventname>_tcg" during translation (TCG code generation). This function
  will automatically call "trace_<eventname>_trans", and will generate the
  necessary TCG code to call "trace_<eventname>_exec" during guest code execution.

But it falls down with the following:

  ../../target/arm/translate-a64.c: In function ‘disas_uncond_b_reg’:
  ../../target/arm/translate-a64.c:2307:9: error: implicit declaration of function ‘trace_eret_tcg’; did you mean ‘trace_eret_exec’? [-Werror=implicit-function-declaration]
           trace_eret_tcg(s->current_el, dst);
           ^~~~~~~~~~~~~~
           trace_eret_exec
  ../../target/arm/translate-a64.c:2307:9: error: nested extern declaration of ‘trace_eret_tcg’ [-Werror=nested-externs]
  cc1: all warnings being treated as errors
  ninja: build stopped: subcommand failed.

So I'm wondering what needs to be done to fix this? Given the one other
tracepoint is in the general tcg-op.c is this just some build stuff to
do with how the tracepoint segments are generated?

-- 
Alex Bennée


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-04-27 13:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 16:00 trace_FOO_tcg bit-rotted? Alex Bennée
2021-04-06 17:24 ` no-reply
2021-04-07  9:08 ` Laurent Vivier
2021-04-09 16:29   ` Alex Bennée
2021-04-12 15:00     ` Stefan Hajnoczi
2021-04-12 19:06       ` Alex Bennée
2021-04-13  8:33         ` Stefan Hajnoczi
2021-04-13  9:25           ` Alex Bennée
2021-04-23 10:58             ` Vilanova, Lluis
2021-04-23 15:14               ` Alex Bennée
2021-04-27 13:00                 ` Vilanova, Lluis

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