Skip to content

Commit 92a22ce

Browse files
committed
perf/tracing: Use stage6 of tracing to not duplicate macros
The perf events are created by the same macro magic as tracefs trace events are. But to hook into perf, it has its own code. It duplicates many of the same macros as the tracefs macros and this is an issue because it misses bug fixes as well as any new enhancements that come with the other trace macros. As the trace macros have been put into their own staging files, have perf take advantage of this and use the tracefs stage 6 macros that the "fast assign" portion of the trace event macro uses. Link: https://lkml.kernel.org/r/20230124202515.716458410@goodmis.org Link: https://lore.kernel.org/lkml/1671181385-5719-1-git-send-email-quic_linyyuan@quicinc.com/ Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reported-by: Linyu Yuan <quic_linyyuan@quicinc.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent b81a3a1 commit 92a22ce

2 files changed

Lines changed: 4 additions & 45 deletions

File tree

include/trace/perf.h

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,7 @@
44

55
#ifdef CONFIG_PERF_EVENTS
66

7-
#undef __entry
8-
#define __entry entry
9-
10-
#undef __get_dynamic_array
11-
#define __get_dynamic_array(field) \
12-
((void *)__entry + (__entry->__data_loc_##field & 0xffff))
13-
14-
#undef __get_dynamic_array_len
15-
#define __get_dynamic_array_len(field) \
16-
((__entry->__data_loc_##field >> 16) & 0xffff)
17-
18-
#undef __get_str
19-
#define __get_str(field) ((char *)__get_dynamic_array(field))
20-
21-
#undef __get_bitmask
22-
#define __get_bitmask(field) (char *)__get_dynamic_array(field)
23-
24-
#undef __get_cpumask
25-
#define __get_cpumask(field) (char *)__get_dynamic_array(field)
26-
27-
#undef __get_sockaddr
28-
#define __get_sockaddr(field) ((struct sockaddr *)__get_dynamic_array(field))
29-
30-
#undef __get_rel_dynamic_array
31-
#define __get_rel_dynamic_array(field) \
32-
((void *)__entry + \
33-
offsetof(typeof(*__entry), __rel_loc_##field) + \
34-
sizeof(__entry->__rel_loc_##field) + \
35-
(__entry->__rel_loc_##field & 0xffff))
36-
37-
#undef __get_rel_dynamic_array_len
38-
#define __get_rel_dynamic_array_len(field) \
39-
((__entry->__rel_loc_##field >> 16) & 0xffff)
40-
41-
#undef __get_rel_str
42-
#define __get_rel_str(field) ((char *)__get_rel_dynamic_array(field))
43-
44-
#undef __get_rel_bitmask
45-
#define __get_rel_bitmask(field) (char *)__get_rel_dynamic_array(field)
46-
47-
#undef __get_rel_cpumask
48-
#define __get_rel_cpumask(field) (char *)__get_rel_dynamic_array(field)
49-
50-
#undef __get_rel_sockaddr
51-
#define __get_rel_sockaddr(field) ((struct sockaddr *)__get_rel_dynamic_array(field))
7+
#include "stages/stage6_event_callback.h"
528

539
#undef __perf_count
5410
#define __perf_count(c) (__count = (c))

include/trace/stages/stage6_event_callback.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
/* Stage 6 definitions for creating trace events */
44

5+
/* Reuse some of the stage 3 macros */
6+
#include "stage3_trace_output.h"
7+
58
#undef __entry
69
#define __entry entry
710

0 commit comments

Comments
 (0)