1 From 417bb00022c813c6dc11bfa652d74f3687df7626 Mon Sep 17 00:00:00 2001
2 From: Bruce Ashfield <bruce.ashfield@gmail.com>
3 Date: Wed, 3 Aug 2022 14:55:56 -0400
4 Subject: [PATCH] compaction: make tracepoints condtional on CONFIG_COMPACTION
6 When building against a v5.19 mips kernel, the following errors
9 | lttng-modules-2.13.4/src/probes/../../include/instrumentation/events/compaction.h:105:42: note: expected 'struct compact_control *' but argument is of type 'struct compact_control *'
10 | 105 | TP_PROTO(struct compact_control *cc,
11 | | ~~~~~~~~~~~~~~~~~~~~~~~~^~
12 | lttng-modules-2.13.4/src/probes/../../include/lttng/tracepoint-event-impl.h:779:68: note: in definition of macro 'LTTNG_TRACEPOINT_EVENT_CLASS_CODE'
13 | 779 | static inline size_t __event_get_align__##_name(void *__tp_locvar, _proto) \
15 | lttng-modules-2.13.4/src/probes/../../include/lttng/tracepoint-event-impl.h:106:50: note: in expansion of macro 'PARAMS'
16 | 106 | LTTNG_TRACEPOINT_EVENT_CLASS_CODE(_name, PARAMS(_proto), PARAMS(_args), , , \
18 | lttng-modules-2.13.4/src/probes/../../include/lttng/tracepoint-event-impl.h:41:9: note: in expansion of macro 'LTTNG_TRACEPOINT_EVENT_CLASS'
19 | 41 | LTTNG_TRACEPOINT_EVENT_CLASS(map, \
20 | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 | lttng-modules-2.13.4/src/probes/../../include/lttng/tracepoint-event-impl.h:42:30: note: in expansion of macro 'PARAMS'
22 | 42 | PARAMS(proto), \
24 | lttng-modules-2.13.4/src/probes/../../include/instrumentation/events/compaction.h:101:1: note: in expansion of macro 'LTTNG_TRACEPOINT_EVENT_MAP'
25 | 101 | LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
26 | | ^~~~~~~~~~~~~~~~~~~~~~~~~~
27 | lttng-modules-2.13.4/src/probes/../../include/instrumentation/events/compaction.h:105:9: note: in expansion of macro 'TP_PROTO'
28 | 105 | TP_PROTO(struct compact_control *cc,
30 | lttng-modules-2.13.4/src/probes/../../include/instrumentation/events/compaction.h:112:57: error: invalid use of undefined type 'struct compact_control'
34 | lttng-modules-2.13.4/src/probes/../../include/instrumentation/events/compaction.h:108:25: warning: 'struct compact_control' declared inside parameter list will not be visible outside of this definition or declaration
35 | 108 | TP_PROTO(struct compact_control *cc,
37 | lttng-modules-2.13.4/src/probes/../../include/lttng/tracepoint-event-impl.h:159:43: note: in definition of macro 'LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP'
38 | 159 | void __event_template_proto___##_template(_proto);
40 | lttng-modules-2.13.4/src/probes/../../include/lttng/tracepoint-event-impl.h:45:61: note: in expansion of macro 'PARAMS'
41 | 45 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(map, name, map, PARAMS(proto), PARAMS(args))
43 | lttng-modules-2.13.4/src/probes/../../include/instrumentation/events/compaction.h:104:1: note: in expansion of macro 'LTTNG_TRACEPOINT_EVENT_MAP'
44 | 104 | LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
45 | | ^~~~~~~~~~~~~~~~~~~~~~~~~~
46 | lttng-modules-2.13.4/src/probes/../../include/instrumentation/events/compaction.h:108:9: note: in expansion of macro 'TP_PROTO'
47 | 108 | TP_PROTO(struct compact_control *cc,
49 | lttng-modules-2.13.4/src/probes/../../include/lttng/tracepoint-event-impl.h:159:6: error: conflicting types for '__event_template_proto___compaction_migratepages'; have 'void(struct compact_control *, unsigned int)'
50 | 159 | void __event_template_proto___##_template(_proto);
51 | | ^~~~~~~~~~~~~~~~~~~~~~~~~
52 | lttng-modules-2.13.4/src/probes/../../include/lttng/tracepoint-event-impl.h:45:9: note: in expansion of macro 'LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP'
53 | 45 | LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(map, name, map, PARAMS(proto), PARAMS(args))
54 | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
56 The root cause appears to be that this particular mips kernel does not
57 have CONFIG_COMPACTION avaiable, and hence we end up with the struct
58 declaration within this tracepoint, and then conflicting types.
60 While putting the conditional around only compaction_migratepages seemed
61 sufficient to get the build working, it doesn't look like any of the
62 tracepoints should be valid, so we extend it to all definitions.
64 Upstream-Status: Submitted [https://lists.lttng.org/pipermail/lttng-dev/2022-August/030246.html]
66 Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
68 include/instrumentation/events/compaction.h | 5 +++++
69 1 file changed, 5 insertions(+)
71 diff --git a/include/instrumentation/events/compaction.h b/include/instrumentation/events/compaction.h
72 index ecae39a..155804a 100644
73 --- a/include/instrumentation/events/compaction.h
74 +++ b/include/instrumentation/events/compaction.h
76 #include <linux/types.h>
77 #include <lttng/kernel-version.h>
79 +#ifdef CONFIG_COMPACTION
81 #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0)
83 LTTNG_TRACEPOINT_EVENT_CLASS(compaction_isolate_template,
84 @@ -97,6 +99,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_MAP(compaction_isolate_template,
86 #endif /* #else #if LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,0,0) */
89 #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,18,0))
90 LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
92 @@ -182,6 +185,8 @@ LTTNG_TRACEPOINT_EVENT_MAP(mm_compaction_migratepages,
94 #endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(3,16,0)) */
96 +#endif /* CONFIG_COMPACTION */
98 #endif /* LTTNG_TRACE_COMPACTION_H */
100 /* This part must be outside protection */