[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230908154417.5172e343@gandalf.local.home>
Date: Fri, 8 Sep 2023 15:44:17 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Sven Schnelle <svens@...ux.ibm.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/3] tracing/synthetic: use union instead of casts
On Thu, 10 Aug 2023 08:05:36 +0200
Sven Schnelle <svens@...ux.ibm.com> wrote:
> --- a/include/linux/trace_events.h
> +++ b/include/linux/trace_events.h
> @@ -59,6 +59,17 @@ int trace_raw_output_prep(struct trace_iterator *iter,
> extern __printf(2, 3)
> void trace_event_printf(struct trace_iterator *iter, const char *fmt, ...);
>
> +/* Used to find the offset and length of dynamic fields in trace events */
> +struct trace_dynamic_info {
> +#ifdef CONFIG_CPU_BIG_ENDIAN
> + u16 offset;
> + u16 len;
> +#else
> + u16 len;
> + u16 offset;
> +#endif
> +};
> +
So this patch broke synthetic events. I found that it works with:
diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h
index 12f875e9e69a..4a98e23b0e77 100644
--- a/include/linux/trace_events.h
+++ b/include/linux/trace_events.h
@@ -65,10 +65,10 @@ struct trace_dynamic_info {
u16 offset;
u16 len;
#else
- u16 len;
u16 offset;
+ u16 len;
#endif
-};
+} __packed;
/*
* The trace entry - the most basic unit of tracing. This is what
That is, I had to swap the order of len vs offset, and to also be safe, I
added "__packed".
I'm guessing that the BIG ENDIAN is broken too? So I'm going to swap that
as well.
It causes the following test to fail:
./ftracetest test.d/trigger/inter-event/trigger-synthetic-event-dynstring.tc
Which I didn't notice because I found that test to be broken, and needs this patch:
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-dynstring.tc b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-dynstring.tc
index 213d890ed188..174376ddbc6c 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-dynstring.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-synthetic-event-dynstring.tc
@@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: event trigger - test inter-event histogram trigger trace action with dynamic string param
-# requires: set_event synthetic_events events/sched/sched_process_exec/hist "char name[]' >> synthetic_events":README ping:program
+# requires: set_event synthetic_events events/sched/sched_process_exec/hist "' >> synthetic_events":README ping:program
fail() { #msg
echo $1
-- Steve
Powered by blists - more mailing lists