Skip to contentSkip to conversation

tracing: Add an option to show symbols in _text+offset for function profiler

PATCH Superseded Masami Hiramatsu (Google) 2 participants 6 messages Sep 22, 2025 – Sep 23, 2025

Subsystems (3)

v2 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Masami Hiramatsu (Google)

author maintainer
#0 lore raw

v2 cover tracing: Add an option to show symbols in _text+offset for function profiler

Hi,

This series implements an option to show symbols in _text+OFFSET format instead of symbol name in the function profiler. This is the 2nd version, the 1st one is here;

https://lore.kernel.org/all/175826135058.101165.7219957344129610147.stgit@devnote2/

This version adds a patch to expand the trace_iterator_flag flag bits to 64 bits [1/2] because there is already 32 flags and no space to add a new flag. Also, add a dummy TRACE_ITER_PROF_TEXT_OFFSET to fix a compliation error if CONFIG_FUNCTION_PROFILER=n.

Thank you,

---

Masami Hiramatsu (Google) (2):
tracing: Allow tracer to add more than 32 options
tracing: Add an option to show symbols in _text+offset for function profiler

 kernel/trace/ftrace.c             |   26 ++++++++++
 kernel/trace/trace.c              |   24 +++++-----
 kernel/trace/trace.h              |   92 +++++++++++++++++++++----------------
 kernel/trace/trace_irqsoff.c      |    2 -
 kernel/trace/trace_sched_wakeup.c |    2 -
 5 files changed, 91 insertions(+), 55 deletions(-)

--
Masami Hiramatsu (Google) <[email protected]>

author maintainer
#1 lore raw

PATCH v2 1/2 tracing: Allow tracer to add more than 32 options

From: Masami Hiramatsu (Google) <[email protected]>

Since enum trace_iterator_flags is 32bit, the max number of the option flags is limited to 32 and it is fully used now. To add a new option, we need to expand it.

This replaces trace_iterator_flags with just a list of static const u64 so that we can add another 32 new options. Now all option masks are u64 instead of u32 or unsigned int.

---
 kernel/trace/trace.c              |   19 +++++----
 kernel/trace/trace.h              |   81 +++++++++++++++++++------------------
 kernel/trace/trace_irqsoff.c      |    2 -
 kernel/trace/trace_sched_wakeup.c |    2 -
 4 files changed, 53 insertions(+), 51 deletions(-)
kernel/trace/trace.c +10 -9
index 4283ed4e8f59..114098f7b06f 100644
@@ -1736,7 +1736,7 @@ unsigned long nsecs_to_usecs(unsigned long nsecs)
  * of strings in the order that the evals (enum) were defined.
  */
 #undef C
-#define C(a, b) b
+#define C(a, b) b,
 
 /* These must match the bit positions in trace_iterator_flags */
 static const char *trace_options[] = {
@@ -5144,7 +5144,7 @@ static int tracing_trace_options_show(struct seq_file *m, void *v)
 	trace_opts = tr->current_trace->flags->opts;
 
 	for (i = 0; trace_options[i]; i++) {
-		if (tr->trace_flags & (1 << i))
+		if (tr->trace_flags & (1ULL << i))
 			seq_printf(m, "%s\n", trace_options[i]);
 		else
 			seq_printf(m, "no%s\n", trace_options[i]);
@@ -5197,7 +5197,7 @@ static int set_tracer_option(struct trace_array *tr, char *cmp, int neg)
 }
 
 /* Some tracers require overwrite to stay enabled */
-int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set)
+int trace_keep_overwrite(struct tracer *tracer, u64 mask, int set)
 {
 	if (tracer->enabled && (mask & TRACE_ITER_OVERWRITE) && !set)
 		return -1;
@@ -5205,7 +5205,7 @@ int trace_keep_overwrite(struct tracer *tracer, u32 mask, int set)
 	return 0;
 }
 
-int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled)
+int set_tracer_flag(struct trace_array *tr, u64 mask, int enabled)
 {
 	if ((mask == TRACE_ITER_RECORD_TGID) ||
 	    (mask == TRACE_ITER_RECORD_CMD) ||
@@ -5307,7 +5307,7 @@ int trace_set_options(struct trace_array *tr, char *option)
 	if (ret < 0)
 		ret = set_tracer_option(tr, cmp, neg);
 	else
-		ret = set_tracer_flag(tr, 1 << ret, !neg);
+		ret = set_tracer_flag(tr, 1ULL << ret, !neg);
 
 	mutex_unlock(&trace_types_lock);
 	mutex_unlock(&event_mutex);
@@ -9119,7 +9119,7 @@ trace_options_core_read(struct file *filp, char __user *ubuf, size_t cnt,
 
 	get_tr_index(tr_index, &tr, &index);
 
-	if (tr->trace_flags & (1 << index))
+	if (tr->trace_flags & (1ULL << index))
 		buf = "1\n";
 	else
 		buf = "0\n";
@@ -9148,7 +9148,7 @@ trace_options_core_write(struct file *filp, const char __user *ubuf, size_t cnt,
 
 	mutex_lock(&event_mutex);
 	mutex_lock(&trace_types_lock);
-	ret = set_tracer_flag(tr, 1 << index, val);
+	ret = set_tracer_flag(tr, 1ULL << index, val);
 	mutex_unlock(&trace_types_lock);
 	mutex_unlock(&event_mutex);
 
@@ -9312,8 +9312,9 @@ static void create_trace_options_dir(struct trace_array *tr)
 
 	for (i = 0; trace_options[i]; i++) {
 		if (top_level ||
-		    !((1 << i) & TOP_LEVEL_TRACE_FLAGS))
+		    !((1ULL << i) & TOP_LEVEL_TRACE_FLAGS)) {
 			create_trace_option_core_file(tr, trace_options[i], i);
+		}
 	}
 }
 
@@ -9997,7 +9998,7 @@ static int __remove_instance(struct trace_array *tr)
 	/* Disable all the flags that were enabled coming in */
 	for (i = 0; i < TRACE_FLAGS_MAX_SIZE; i++) {
 		if ((1 << i) & ZEROED_TRACE_FLAGS)
-			set_tracer_flag(tr, 1 << i, 0);
+			set_tracer_flag(tr, 1ULL << i, 0);
 	}
 
 	if (printk_trace == tr)
kernel/trace/trace.h +41 -40

148 lines not on this page · raw message

kernel/trace/trace_irqsoff.c +1 -1
index 5496758b6c76..1a65f9f1075c 100644
@@ -539,7 +539,7 @@ static inline int irqsoff_function_set(struct trace_array *tr, u32 mask, int set
 }
 #endif /* CONFIG_FUNCTION_TRACER */
 
-static int irqsoff_flag_changed(struct trace_array *tr, u32 mask, int set)
+static int irqsoff_flag_changed(struct trace_array *tr, u64 mask, int set)
 {
 	struct tracer *tracer = tr->current_trace;
 
kernel/trace/trace_sched_wakeup.c +1 -1
index bf1cb80742ae..45865b4f753f 100644
@@ -328,7 +328,7 @@ __trace_function(struct trace_array *tr,
 		trace_function(tr, ip, parent_ip, trace_ctx, NULL);
 }
 
-static int wakeup_flag_changed(struct trace_array *tr, u32 mask, int set)
+static int wakeup_flag_changed(struct trace_array *tr, u64 mask, int set)
 {
 	struct tracer *tracer = tr->current_trace;
 
#2 lore raw

Re: [PATCH v2 1/2] tracing: Allow tracer to add more than 32 options

kernel test robot noticed the following build warnings:

Hi Masami,

kernel test robot noticed the following build warnings:

[auto build test WARNING on trace/for-next]
[also build test WARNING on linus/master v6.17-rc7 next-20250922] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Masami-Hiramatsu-Google/tracing-Allow-tracer-to-add-more-than-32-options/20250922-204945
base:   https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next
patch link:    https://lore.kernel.org/r/175854517136.353182.4018685864707176851.stgit%40devnote2
patch subject: [PATCH v2 1/2] tracing: Allow tracer to add more than 32 options
config: sh-randconfig-001-20250923 (https://download.01.org/0day-ci/archive/20250923/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250923/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from kernel/trace/fgraph.c:20:
kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_STACKTRACE' defined but not used [-Wunused-const-variable=]

    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1351:17: note: in expansion of macro 'C'
    1351 |                 C(STACKTRACE,           "stacktrace")
         |                 ^
   kernel/trace/trace.h:1393:17: note: in expansion of macro 'STACK_FLAGS'
    1393 |                 STACK_FLAGS                                     \
         |                 ^~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
>> kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_DISPLAY_GRAPH' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1326:17: note: in expansion of macro 'C'
    1326 |                 C(DISPLAY_GRAPH,        "display-graph")
         |                 ^
   kernel/trace/trace.h:1392:17: note: in expansion of macro 'FGRAPH_FLAGS'
    1392 |                 FGRAPH_FLAGS                                    \
         |                 ^~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_FUNC_FORK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1341:17: note: in expansion of macro 'C'
    1341 |                 C(FUNC_FORK,            "function-fork")
         |                 ^
   kernel/trace/trace.h:1391:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1391 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_FUNCTION' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1340:17: note: in expansion of macro 'C'
    1340 |                 C(FUNCTION,             "function-trace")       \
         |                 ^
   kernel/trace/trace.h:1391:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1391 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_HASH_PTR' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1390:17: note: in expansion of macro 'C'
    1390 |                 C(HASH_PTR,             "hash-ptr")     /* Print hashed pointer */ \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_PAUSE_ON_TRACE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1389:17: note: in expansion of macro 'C'
    1389 |                 C(PAUSE_ON_TRACE,       "pause-on-trace")       \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_COPY_MARKER' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1388:17: note: in expansion of macro 'C'
    1388 |                 C(COPY_MARKER,          "copy_trace_marker")\
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_TRACE_PRINTK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1387:17: note: in expansion of macro 'C'
    1387 |                 C(TRACE_PRINTK,         "trace_printk_dest")    \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_EVENT_FORK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1386:17: note: in expansion of macro 'C'
    1386 |                 C(EVENT_FORK,           "event-fork")           \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_MARKERS' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1385:17: note: in expansion of macro 'C'
    1385 |                 C(MARKERS,              "markers")              \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_IRQ_INFO' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1384:17: note: in expansion of macro 'C'
    1384 |                 C(IRQ_INFO,             "irq-info")             \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_STOP_ON_FREE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
--
   In file included from kernel/trace/trace.c:58:
>> kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_DISPLAY_GRAPH' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1326:17: note: in expansion of macro 'C'
    1326 |                 C(DISPLAY_GRAPH,        "display-graph")
         |                 ^
   kernel/trace/trace.h:1392:17: note: in expansion of macro 'FGRAPH_FLAGS'
    1392 |                 FGRAPH_FLAGS                                    \
         |                 ^~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_USERSTACKTRACE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1375:17: note: in expansion of macro 'C'
    1375 |                 C(USERSTACKTRACE,       "userstacktrace")       \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~

{standard input}: Assembler messages:
{standard input}:6792: Error: offset to unaligned destination
{standard input}:24045: Error: offset to unaligned destination
{standard input}:24422: Error: offset to unaligned destination
{standard input}:32500: Error: offset to unaligned destination
--
In file included from kernel/trace/trace_output.h:6,
from kernel/trace/trace_events.c:31:
kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_STACKTRACE' defined but not used [-Wunused-const-variable=]

    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1351:17: note: in expansion of macro 'C'
    1351 |                 C(STACKTRACE,           "stacktrace")
         |                 ^
   kernel/trace/trace.h:1393:17: note: in expansion of macro 'STACK_FLAGS'
    1393 |                 STACK_FLAGS                                     \
         |                 ^~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
>> kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_DISPLAY_GRAPH' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1326:17: note: in expansion of macro 'C'
    1326 |                 C(DISPLAY_GRAPH,        "display-graph")
         |                 ^
   kernel/trace/trace.h:1392:17: note: in expansion of macro 'FGRAPH_FLAGS'
    1392 |                 FGRAPH_FLAGS                                    \
         |                 ^~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_FUNC_FORK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1341:17: note: in expansion of macro 'C'
    1341 |                 C(FUNC_FORK,            "function-fork")
         |                 ^
   kernel/trace/trace.h:1391:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1391 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_FUNCTION' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1340:17: note: in expansion of macro 'C'
    1340 |                 C(FUNCTION,             "function-trace")       \
         |                 ^
   kernel/trace/trace.h:1391:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1391 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_HASH_PTR' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1390:17: note: in expansion of macro 'C'
    1390 |                 C(HASH_PTR,             "hash-ptr")     /* Print hashed pointer */ \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_PAUSE_ON_TRACE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1389:17: note: in expansion of macro 'C'
    1389 |                 C(PAUSE_ON_TRACE,       "pause-on-trace")       \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_COPY_MARKER' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1388:17: note: in expansion of macro 'C'
    1388 |                 C(COPY_MARKER,          "copy_trace_marker")\
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_TRACE_PRINTK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1387:17: note: in expansion of macro 'C'
    1387 |                 C(TRACE_PRINTK,         "trace_printk_dest")    \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_EVENT_FORK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1386:17: note: in expansion of macro 'C'
    1386 |                 C(EVENT_FORK,           "event-fork")           \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_MARKERS' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1385:17: note: in expansion of macro 'C'
    1385 |                 C(MARKERS,              "markers")              \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_IRQ_INFO' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1384:17: note: in expansion of macro 'C'
    1384 |                 C(IRQ_INFO,             "irq-info")             \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_STOP_ON_FREE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
--
   In file included from kernel/trace/ring_buffer.c:36:
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_STACKTRACE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1351:17: note: in expansion of macro 'C'
    1351 |                 C(STACKTRACE,           "stacktrace")
         |                 ^
   kernel/trace/trace.h:1393:17: note: in expansion of macro 'STACK_FLAGS'
    1393 |                 STACK_FLAGS                                     \
         |                 ^~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
>> kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_DISPLAY_GRAPH' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1326:17: note: in expansion of macro 'C'
    1326 |                 C(DISPLAY_GRAPH,        "display-graph")
         |                 ^
   kernel/trace/trace.h:1392:17: note: in expansion of macro 'FGRAPH_FLAGS'
    1392 |                 FGRAPH_FLAGS                                    \
         |                 ^~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_FUNC_FORK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1341:17: note: in expansion of macro 'C'
    1341 |                 C(FUNC_FORK,            "function-fork")
         |                 ^
   kernel/trace/trace.h:1391:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1391 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_FUNCTION' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1340:17: note: in expansion of macro 'C'
    1340 |                 C(FUNCTION,             "function-trace")       \
         |                 ^
   kernel/trace/trace.h:1391:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1391 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_HASH_PTR' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1390:17: note: in expansion of macro 'C'
    1390 |                 C(HASH_PTR,             "hash-ptr")     /* Print hashed pointer */ \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_PAUSE_ON_TRACE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1389:17: note: in expansion of macro 'C'
    1389 |                 C(PAUSE_ON_TRACE,       "pause-on-trace")       \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_COPY_MARKER' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1388:17: note: in expansion of macro 'C'
    1388 |                 C(COPY_MARKER,          "copy_trace_marker")\
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_TRACE_PRINTK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1387:17: note: in expansion of macro 'C'
    1387 |                 C(TRACE_PRINTK,         "trace_printk_dest")    \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_EVENT_FORK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1386:17: note: in expansion of macro 'C'
    1386 |                 C(EVENT_FORK,           "event-fork")           \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_MARKERS' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1385:17: note: in expansion of macro 'C'
    1385 |                 C(MARKERS,              "markers")              \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_IRQ_INFO' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1384:17: note: in expansion of macro 'C'
    1384 |                 C(IRQ_INFO,             "irq-info")             \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_STOP_ON_FREE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);

..

vim +/TRACE_ITER_DISPLAY_GRAPH +1414 kernel/trace/trace.h

1348
1349 #ifdef CONFIG_STACKTRACE
1350 # define STACK_FLAGS \

> 1351			C(STACKTRACE,		"stacktrace")
  1352	#else
  1353	# define STACK_FLAGS
  1354	#endif
  1355	
  1356	/*
  1357	 * trace_iterator_flags is an enumeration that defines bit
  1358	 * positions into trace_flags that controls the output.
  1359	 *
  1360	 * NOTE: These bits must match the trace_options array in
  1361	 *       trace.c (this macro guarantees it).
  1362	 */
  1363	#define TRACE_FLAGS						\
  1364			C(PRINT_PARENT,		"print-parent")		\
  1365			C(SYM_OFFSET,		"sym-offset")		\
  1366			C(SYM_ADDR,		"sym-addr")		\
  1367			C(VERBOSE,		"verbose")		\
  1368			C(RAW,			"raw")			\
  1369			C(HEX,			"hex")			\
  1370			C(BIN,			"bin")			\
  1371			C(BLOCK,		"block")		\
  1372			C(FIELDS,		"fields")		\
  1373			C(PRINTK,		"trace_printk")	\
  1374			C(ANNOTATE,		"annotate")		\
  1375			C(USERSTACKTRACE,	"userstacktrace")	\
  1376			C(SYM_USEROBJ,		"sym-userobj")		\
  1377			C(PRINTK_MSGONLY,	"printk-msg-only")	\
  1378			C(CONTEXT_INFO,		"context-info")   /* Print pid/cpu/time */ \
  1379			C(LATENCY_FMT,		"latency-format")	\
  1380			C(RECORD_CMD,		"record-cmd")		\
  1381			C(RECORD_TGID,		"record-tgid")		\
  1382			C(OVERWRITE,		"overwrite")		\
  1383			C(STOP_ON_FREE,		"disable_on_free")	\
  1384			C(IRQ_INFO,		"irq-info")		\
  1385			C(MARKERS,		"markers")		\
  1386			C(EVENT_FORK,		"event-fork")		\
  1387			C(TRACE_PRINTK,		"trace_printk_dest")	\
  1388			C(COPY_MARKER,		"copy_trace_marker")\
  1389			C(PAUSE_ON_TRACE,	"pause-on-trace")	\
  1390			C(HASH_PTR,		"hash-ptr")	/* Print hashed pointer */ \
  1391			FUNCTION_FLAGS					\
  1392			FGRAPH_FLAGS					\
  1393			STACK_FLAGS					\
  1394			BRANCH_FLAGS
  1395	
  1396	/*
  1397	 * By defining C, we can make TRACE_FLAGS a list of bit names
  1398	 * that will define the bits for the flag masks.
  1399	 */
  1400	#undef C
  1401	#define C(a, b) TRACE_ITER_##a##_BIT,
  1402	
  1403	enum trace_iterator_bits {
  1404		TRACE_FLAGS
  1405		/* Make sure we don't go more than we have bits for */
  1406		TRACE_ITER_LAST_BIT
  1407	};
  1408	
  1409	/*
  1410	 * By redefining C, we can make TRACE_FLAGS a list of masks that
  1411	 * use the bits as defined above.
  1412	 */
  1413	#undef C
> 1414	#define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);

1415

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author maintainer
#3 lore raw

Re: [PATCH v2 1/2] tracing: Allow tracer to add more than 32 options

Quoted 18 lines · On Tue, 23 Sep 2025 09:47:13 +0800 kernel test robot <[email protected]> wrote:

Hi Masami,

kernel test robot noticed the following build warnings:

[auto build test WARNING on trace/for-next]
[also build test WARNING on linus/master v6.17-rc7 next-20250922] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Masami-Hiramatsu-Google/tracing-Allow-tracer-to-add-more-than-32-options/20250922-204945
base:   https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next
patch link:    https://lore.kernel.org/r/175854517136.353182.4018685864707176851.stgit%40devnote2
patch subject: [PATCH v2 1/2] tracing: Allow tracer to add more than 32 options
config: sh-randconfig-001-20250923 (https://download.01.org/0day-ci/archive/20250923/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250923/[email protected]/reproduce)
Quoted 5 lines

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

Hmm, even if it is 'static const', if it is not used, we will get warning.

Maybe

#undef C(a, b)
#define C(a, b) TRACE_ITER_##a |
static const u64 trace_flags_defined =

	TRACE_FLAGS 0;

And use this mask in the set_tracer_flag() to check given bit mask is correct.

Thank you,

Quoted 452 lines

All warnings (new ones prefixed by >>):

In file included from kernel/trace/fgraph.c:20:

   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_STACKTRACE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1351:17: note: in expansion of macro 'C'
    1351 |                 C(STACKTRACE,           "stacktrace")
         |                 ^
   kernel/trace/trace.h:1393:17: note: in expansion of macro 'STACK_FLAGS'
    1393 |                 STACK_FLAGS                                     \
         |                 ^~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_DISPLAY_GRAPH' defined but not used [-Wunused-const-variable=]

    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1326:17: note: in expansion of macro 'C'
    1326 |                 C(DISPLAY_GRAPH,        "display-graph")
         |                 ^
   kernel/trace/trace.h:1392:17: note: in expansion of macro 'FGRAPH_FLAGS'
    1392 |                 FGRAPH_FLAGS                                    \
         |                 ^~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_FUNC_FORK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1341:17: note: in expansion of macro 'C'
    1341 |                 C(FUNC_FORK,            "function-fork")
         |                 ^
   kernel/trace/trace.h:1391:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1391 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_FUNCTION' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1340:17: note: in expansion of macro 'C'
    1340 |                 C(FUNCTION,             "function-trace")       \
         |                 ^
   kernel/trace/trace.h:1391:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1391 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_HASH_PTR' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1390:17: note: in expansion of macro 'C'
    1390 |                 C(HASH_PTR,             "hash-ptr")     /* Print hashed pointer */ \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_PAUSE_ON_TRACE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1389:17: note: in expansion of macro 'C'
    1389 |                 C(PAUSE_ON_TRACE,       "pause-on-trace")       \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_COPY_MARKER' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1388:17: note: in expansion of macro 'C'
    1388 |                 C(COPY_MARKER,          "copy_trace_marker")\
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_TRACE_PRINTK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1387:17: note: in expansion of macro 'C'
    1387 |                 C(TRACE_PRINTK,         "trace_printk_dest")    \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_EVENT_FORK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1386:17: note: in expansion of macro 'C'
    1386 |                 C(EVENT_FORK,           "event-fork")           \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_MARKERS' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1385:17: note: in expansion of macro 'C'
    1385 |                 C(MARKERS,              "markers")              \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_IRQ_INFO' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1384:17: note: in expansion of macro 'C'
    1384 |                 C(IRQ_INFO,             "irq-info")             \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_STOP_ON_FREE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);

--
In file included from kernel/trace/trace.c:58:

Quoted 1 line
Quoted 1 line

kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_DISPLAY_GRAPH' defined but not used [-Wunused-const-variable=]

    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1326:17: note: in expansion of macro 'C'
    1326 |                 C(DISPLAY_GRAPH,        "display-graph")
         |                 ^
   kernel/trace/trace.h:1392:17: note: in expansion of macro 'FGRAPH_FLAGS'
    1392 |                 FGRAPH_FLAGS                                    \
         |                 ^~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_USERSTACKTRACE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1375:17: note: in expansion of macro 'C'
    1375 |                 C(USERSTACKTRACE,       "userstacktrace")       \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~

{standard input}: Assembler messages:
{standard input}:6792: Error: offset to unaligned destination {standard input}:24045: Error: offset to unaligned destination {standard input}:24422: Error: offset to unaligned destination {standard input}:32500: Error: offset to unaligned destination
--
In file included from kernel/trace/trace_output.h:6,
from kernel/trace/trace_events.c:31:

   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_STACKTRACE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1351:17: note: in expansion of macro 'C'
    1351 |                 C(STACKTRACE,           "stacktrace")
         |                 ^
   kernel/trace/trace.h:1393:17: note: in expansion of macro 'STACK_FLAGS'
    1393 |                 STACK_FLAGS                                     \
         |                 ^~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_DISPLAY_GRAPH' defined but not used [-Wunused-const-variable=]

    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1326:17: note: in expansion of macro 'C'
    1326 |                 C(DISPLAY_GRAPH,        "display-graph")
         |                 ^
   kernel/trace/trace.h:1392:17: note: in expansion of macro 'FGRAPH_FLAGS'
    1392 |                 FGRAPH_FLAGS                                    \
         |                 ^~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_FUNC_FORK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1341:17: note: in expansion of macro 'C'
    1341 |                 C(FUNC_FORK,            "function-fork")
         |                 ^
   kernel/trace/trace.h:1391:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1391 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_FUNCTION' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1340:17: note: in expansion of macro 'C'
    1340 |                 C(FUNCTION,             "function-trace")       \
         |                 ^
   kernel/trace/trace.h:1391:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1391 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_HASH_PTR' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1390:17: note: in expansion of macro 'C'
    1390 |                 C(HASH_PTR,             "hash-ptr")     /* Print hashed pointer */ \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_PAUSE_ON_TRACE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1389:17: note: in expansion of macro 'C'
    1389 |                 C(PAUSE_ON_TRACE,       "pause-on-trace")       \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_COPY_MARKER' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1388:17: note: in expansion of macro 'C'
    1388 |                 C(COPY_MARKER,          "copy_trace_marker")\
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_TRACE_PRINTK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1387:17: note: in expansion of macro 'C'
    1387 |                 C(TRACE_PRINTK,         "trace_printk_dest")    \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_EVENT_FORK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1386:17: note: in expansion of macro 'C'
    1386 |                 C(EVENT_FORK,           "event-fork")           \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_MARKERS' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1385:17: note: in expansion of macro 'C'
    1385 |                 C(MARKERS,              "markers")              \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_IRQ_INFO' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1384:17: note: in expansion of macro 'C'
    1384 |                 C(IRQ_INFO,             "irq-info")             \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_STOP_ON_FREE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
--
   In file included from kernel/trace/ring_buffer.c:36:
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_STACKTRACE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1351:17: note: in expansion of macro 'C'
    1351 |                 C(STACKTRACE,           "stacktrace")
         |                 ^
   kernel/trace/trace.h:1393:17: note: in expansion of macro 'STACK_FLAGS'
    1393 |                 STACK_FLAGS                                     \
         |                 ^~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
Quoted 1 line
Quoted 1 line

kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_DISPLAY_GRAPH' defined but not used [-Wunused-const-variable=]

    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1326:17: note: in expansion of macro 'C'
    1326 |                 C(DISPLAY_GRAPH,        "display-graph")
         |                 ^
   kernel/trace/trace.h:1392:17: note: in expansion of macro 'FGRAPH_FLAGS'
    1392 |                 FGRAPH_FLAGS                                    \
         |                 ^~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_FUNC_FORK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1341:17: note: in expansion of macro 'C'
    1341 |                 C(FUNC_FORK,            "function-fork")
         |                 ^
   kernel/trace/trace.h:1391:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1391 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_FUNCTION' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1340:17: note: in expansion of macro 'C'
    1340 |                 C(FUNCTION,             "function-trace")       \
         |                 ^
   kernel/trace/trace.h:1391:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1391 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_HASH_PTR' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1390:17: note: in expansion of macro 'C'
    1390 |                 C(HASH_PTR,             "hash-ptr")     /* Print hashed pointer */ \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_PAUSE_ON_TRACE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1389:17: note: in expansion of macro 'C'
    1389 |                 C(PAUSE_ON_TRACE,       "pause-on-trace")       \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_COPY_MARKER' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1388:17: note: in expansion of macro 'C'
    1388 |                 C(COPY_MARKER,          "copy_trace_marker")\
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_TRACE_PRINTK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1387:17: note: in expansion of macro 'C'
    1387 |                 C(TRACE_PRINTK,         "trace_printk_dest")    \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_EVENT_FORK' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1386:17: note: in expansion of macro 'C'
    1386 |                 C(EVENT_FORK,           "event-fork")           \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_MARKERS' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1385:17: note: in expansion of macro 'C'
    1385 |                 C(MARKERS,              "markers")              \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_IRQ_INFO' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1384:17: note: in expansion of macro 'C'
    1384 |                 C(IRQ_INFO,             "irq-info")             \
         |                 ^
   kernel/trace/trace.h:1416:1: note: in expansion of macro 'TRACE_FLAGS'
    1416 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1414:34: warning: 'TRACE_ITER_STOP_ON_FREE' defined but not used [-Wunused-const-variable=]
    1414 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);

..

vim +/TRACE_ITER_DISPLAY_GRAPH +1414 kernel/trace/trace.h

1348
1349 #ifdef CONFIG_STACKTRACE
1350 # define STACK_FLAGS \

Quoted 1 line

1351 C(STACKTRACE, "stacktrace")

1352 #else
1353 # define STACK_FLAGS
1354 #endif
1355
1356 /*
1357 * trace_iterator_flags is an enumeration that defines bit
1358 * positions into trace_flags that controls the output.
1359 *
1360 * NOTE: These bits must match the trace_options array in
1361 * trace.c (this macro guarantees it).
1362 */
1363 #define TRACE_FLAGS \
1364 C(PRINT_PARENT, "print-parent") \
1365 C(SYM_OFFSET, "sym-offset") \
1366 C(SYM_ADDR, "sym-addr") \
1367 C(VERBOSE, "verbose") \
1368 C(RAW, "raw") \
1369 C(HEX, "hex") \
1370 C(BIN, "bin") \
1371 C(BLOCK, "block") \
1372 C(FIELDS, "fields") \
1373 C(PRINTK, "trace_printk") \
1374 C(ANNOTATE, "annotate") \
1375 C(USERSTACKTRACE, "userstacktrace") \
1376 C(SYM_USEROBJ, "sym-userobj") \
1377 C(PRINTK_MSGONLY, "printk-msg-only") \
1378 C(CONTEXT_INFO, "context-info") /* Print pid/cpu/time */ \
1379 C(LATENCY_FMT, "latency-format") \
1380 C(RECORD_CMD, "record-cmd") \
1381 C(RECORD_TGID, "record-tgid") \
1382 C(OVERWRITE, "overwrite") \
1383 C(STOP_ON_FREE, "disable_on_free") \
1384 C(IRQ_INFO, "irq-info") \
1385 C(MARKERS, "markers") \
1386 C(EVENT_FORK, "event-fork") \
1387 C(TRACE_PRINTK, "trace_printk_dest") \
1388 C(COPY_MARKER, "copy_trace_marker")\
1389 C(PAUSE_ON_TRACE, "pause-on-trace") \
1390 C(HASH_PTR, "hash-ptr") /* Print hashed pointer */ \
1391 FUNCTION_FLAGS \
1392 FGRAPH_FLAGS \
1393 STACK_FLAGS \
1394 BRANCH_FLAGS
1395
1396 /*
1397 * By defining C, we can make TRACE_FLAGS a list of bit names
1398 * that will define the bits for the flag masks.
1399 */
1400 #undef C
1401 #define C(a, b) TRACE_ITER_##a##_BIT,
1402
1403 enum trace_iterator_bits {
1404 TRACE_FLAGS
1405 /* Make sure we don't go more than we have bits for */
1406 TRACE_ITER_LAST_BIT
1407 };
1408
1409 /*
1410 * By redefining C, we can make TRACE_FLAGS a list of masks that
1411 * use the bits as defined above.
1412 */
1413 #undef C

Quoted 1 line

1414 #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);

1415

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
author maintainer
#4 lore raw

PATCH v2 2/2 tracing: Add an option to show symbols in _text+offset for function profiler

In reply to Masami Hiramatsu (Google)

From: Masami Hiramatsu (Google) <[email protected]>

Function profiler shows the hit count of each function using its symbol name. However, there are some same-name local symbols, which we can not distinguish.
To solve this issue, this introduces an option to show the symbols in "_text+OFFSET" format. This can avoid exposing the random shift of KASLR. The functions in modules are shown as "MODNAME+OFFSET" where the offset is from ".text".

E.g. for the kernel text symbols, specify vmlinux and the output to
addr2line, you can find the actual function and source info;

  $ addr2line -fie vmlinux _text+3078208
  __balance_callbacks
  kernel/sched/core.c:5064

for modules, specify the module file and .text+OFFSET;

  $ addr2line -fie samples/trace_events/trace-events-sample.ko .text+8224
  do_simple_thread_func
  samples/trace_events/trace-events-sample.c:23

---
Changes in v2:
- Define a dummy TRACE_ITER_PROF_TEXT_OFFSET if CONFIG_FUNCTION_PROFILER=n.

---
 kernel/trace/ftrace.c |   26 +++++++++++++++++++++++++-
 kernel/trace/trace.c  |    5 +++--
 kernel/trace/trace.h  |   11 ++++++++++-
 3 files changed, 38 insertions(+), 4 deletions(-)
kernel/trace/ftrace.c +25 -1
index 00b76d450a89..d4802bb93793 100644
@@ -534,7 +534,9 @@ static int function_stat_headers(struct seq_file *m)
 
 static int function_stat_show(struct seq_file *m, void *v)
 {
+	struct trace_array *tr = trace_get_global_array();
 	struct ftrace_profile *rec = v;
+	const char *refsymbol = NULL;
 	char str[KSYM_SYMBOL_LEN];
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
 	static struct trace_seq s;
@@ -554,7 +556,29 @@ static int function_stat_show(struct seq_file *m, void *v)
 		return 0;
 #endif
 
-	kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
+	if (tr->trace_flags & TRACE_ITER_PROF_TEXT_OFFSET) {
+		long offset;
+
+		if (core_kernel_text(rec->ip)) {
+			refsymbol = "_text";
+			offset = rec->ip - (unsigned long)_text;
+		} else {
+			struct module *mod;
+
+			guard(rcu)();
+			mod = __module_text_address(rec->ip);
+			if (mod) {
+				refsymbol = mod->name;
+				/* Calculate offset from module's text entry address. */
+				offset = rec->ip - (unsigned long)mod->mem[MOD_TEXT].base;
+			}
+		}
+		if (refsymbol)
+			snprintf(str, sizeof(str), "  %s%+ld", refsymbol, offset);
+	}
+	if (!refsymbol)
+		kallsyms_lookup(rec->ip, NULL, NULL, NULL, str);
+
 	seq_printf(m, "  %-30.30s  %10lu", str, rec->counter);
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
kernel/trace/trace.c +3 -2
index 114098f7b06f..cbe1c5aa12e1 100644
@@ -522,7 +522,8 @@ EXPORT_SYMBOL_GPL(unregister_ftrace_export);
 
 /* trace_options that are only supported by global_trace */
 #define TOP_LEVEL_TRACE_FLAGS (TRACE_ITER_PRINTK |			\
-	       TRACE_ITER_PRINTK_MSGONLY | TRACE_ITER_RECORD_CMD)
+	       TRACE_ITER_PRINTK_MSGONLY | TRACE_ITER_RECORD_CMD |	\
+	       TRACE_ITER_PROF_TEXT_OFFSET)
 
 /* trace_flags that are default zero for instances */
 #define ZEROED_TRACE_FLAGS \
@@ -11106,7 +11107,7 @@ __init static int tracer_alloc_buffers(void)
 
 #ifdef CONFIG_FUNCTION_TRACER
 /* Used to set module cached ftrace filtering at boot up */
-__init struct trace_array *trace_get_global_array(void)
+struct trace_array *trace_get_global_array(void)
 {
 	return &global_trace;
 }
kernel/trace/trace.h +10 -1
index c2a41c2cafe5..f57d0900f427 100644
@@ -1353,6 +1353,14 @@ extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
 # define STACK_FLAGS
 #endif
 
+#ifdef CONFIG_FUNCTION_PROFILER
+# define PROFILER_FLAGS					\
+		C(PROF_TEXT_OFFSET,	"prof-text-offset")
+#else
+# define PROFILER_FLAGS
+# define TRACE_ITER_PROF_TEXT_OFFSET	0UL
+#endif
+
 /*
  * trace_iterator_flags is an enumeration that defines bit
  * positions into trace_flags that controls the output.
@@ -1391,7 +1399,8 @@ extern int trace_get_user(struct trace_parser *parser, const char __user *ubuf,
 		FUNCTION_FLAGS					\
 		FGRAPH_FLAGS					\
 		STACK_FLAGS					\
-		BRANCH_FLAGS
+		BRANCH_FLAGS					\
+		PROFILER_FLAGS
 
 /*
  * By defining C, we can make TRACE_FLAGS a list of bit names
#5 lore raw
kernel test robot noticed the following build warnings:

Hi Masami,

kernel test robot noticed the following build warnings:

[auto build test WARNING on trace/for-next]
[also build test WARNING on linus/master v6.17-rc7 next-20250922] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Masami-Hiramatsu-Google/tracing-Allow-tracer-to-add-more-than-32-options/20250922-204945
base:   https://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace for-next
patch link:    https://lore.kernel.org/r/175854518099.353182.11090224112128363620.stgit%40devnote2
patch subject: [PATCH v2 2/2] tracing: Add an option to show symbols in _text+offset for function profiler
config: i386-randconfig-014-20250923 (https://download.01.org/0day-ci/archive/20250923/[email protected]/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250923/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from kernel/trace/trace_output.h:6,
from kernel/trace/trace_export.c:15:

>> kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_PROF_TEXT_OFFSET' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1358:17: note: in expansion of macro 'C'
    1358 |                 C(PROF_TEXT_OFFSET,     "prof-text-offset")
         |                 ^
   kernel/trace/trace.h:1403:17: note: in expansion of macro 'PROFILER_FLAGS'
    1403 |                 PROFILER_FLAGS
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_STACKTRACE' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1351:17: note: in expansion of macro 'C'
    1351 |                 C(STACKTRACE,           "stacktrace")
         |                 ^
   kernel/trace/trace.h:1401:17: note: in expansion of macro 'STACK_FLAGS'
    1401 |                 STACK_FLAGS                                     \
         |                 ^~~~~~~~~~~
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_FUNC_FORK' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1341:17: note: in expansion of macro 'C'
    1341 |                 C(FUNC_FORK,            "function-fork")
         |                 ^
   kernel/trace/trace.h:1399:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1399 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_FUNCTION' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1340:17: note: in expansion of macro 'C'
    1340 |                 C(FUNCTION,             "function-trace")       \
         |                 ^
   kernel/trace/trace.h:1399:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1399 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_HASH_PTR' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1398:17: note: in expansion of macro 'C'
    1398 |                 C(HASH_PTR,             "hash-ptr")     /* Print hashed pointer */ \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_PAUSE_ON_TRACE' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1397:17: note: in expansion of macro 'C'
    1397 |                 C(PAUSE_ON_TRACE,       "pause-on-trace")       \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_COPY_MARKER' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1396:17: note: in expansion of macro 'C'
    1396 |                 C(COPY_MARKER,          "copy_trace_marker")\
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_TRACE_PRINTK' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1395:17: note: in expansion of macro 'C'
    1395 |                 C(TRACE_PRINTK,         "trace_printk_dest")    \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_EVENT_FORK' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1394:17: note: in expansion of macro 'C'
    1394 |                 C(EVENT_FORK,           "event-fork")           \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_MARKERS' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1393:17: note: in expansion of macro 'C'
    1393 |                 C(MARKERS,              "markers")              \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
--
   In file included from kernel/trace/trace_output.h:6,
                    from kernel/trace/trace_events.c:31:
>> kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_PROF_TEXT_OFFSET' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1358:17: note: in expansion of macro 'C'
    1358 |                 C(PROF_TEXT_OFFSET,     "prof-text-offset")
         |                 ^
   kernel/trace/trace.h:1403:17: note: in expansion of macro 'PROFILER_FLAGS'
    1403 |                 PROFILER_FLAGS
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_STACKTRACE' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1351:17: note: in expansion of macro 'C'
    1351 |                 C(STACKTRACE,           "stacktrace")
         |                 ^
   kernel/trace/trace.h:1401:17: note: in expansion of macro 'STACK_FLAGS'
    1401 |                 STACK_FLAGS                                     \
         |                 ^~~~~~~~~~~
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_FUNC_FORK' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1341:17: note: in expansion of macro 'C'
    1341 |                 C(FUNC_FORK,            "function-fork")
         |                 ^
   kernel/trace/trace.h:1399:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1399 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_FUNCTION' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1340:17: note: in expansion of macro 'C'
    1340 |                 C(FUNCTION,             "function-trace")       \
         |                 ^
   kernel/trace/trace.h:1399:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1399 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_HASH_PTR' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1398:17: note: in expansion of macro 'C'
    1398 |                 C(HASH_PTR,             "hash-ptr")     /* Print hashed pointer */ \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_PAUSE_ON_TRACE' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1397:17: note: in expansion of macro 'C'
    1397 |                 C(PAUSE_ON_TRACE,       "pause-on-trace")       \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_COPY_MARKER' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1396:17: note: in expansion of macro 'C'
    1396 |                 C(COPY_MARKER,          "copy_trace_marker")\
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_TRACE_PRINTK' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1395:17: note: in expansion of macro 'C'
    1395 |                 C(TRACE_PRINTK,         "trace_printk_dest")    \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_EVENT_FORK' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1394:17: note: in expansion of macro 'C'
    1394 |                 C(EVENT_FORK,           "event-fork")           \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_MARKERS' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1393:17: note: in expansion of macro 'C'
    1393 |                 C(MARKERS,              "markers")              \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
--
   kernel/trace/bpf_trace.c: In function '____bpf_trace_printk':
   kernel/trace/bpf_trace.c:378:9: warning: function '____bpf_trace_printk' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
     378 |         ret = bstr_printf(data.buf, MAX_BPRINTF_BUF, fmt, data.bin_args);
         |         ^~~
   kernel/trace/bpf_trace.c: In function '____bpf_trace_vprintk':
   kernel/trace/bpf_trace.c:434:9: warning: function '____bpf_trace_vprintk' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
     434 |         ret = bstr_printf(data.buf, MAX_BPRINTF_BUF, fmt, data.bin_args);
         |         ^~~
   kernel/trace/bpf_trace.c: In function '____bpf_seq_printf':
   kernel/trace/bpf_trace.c:476:9: warning: function '____bpf_seq_printf' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
     476 |         seq_bprintf(m, fmt, data.bin_args);
         |         ^~~~~~~~~~~
   In file included from kernel/trace/trace_probe.h:31,
                    from kernel/trace/bpf_trace.c:35:
   kernel/trace/trace.h: At top level:
>> kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_PROF_TEXT_OFFSET' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1358:17: note: in expansion of macro 'C'
    1358 |                 C(PROF_TEXT_OFFSET,     "prof-text-offset")
         |                 ^
   kernel/trace/trace.h:1403:17: note: in expansion of macro 'PROFILER_FLAGS'
    1403 |                 PROFILER_FLAGS
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_STACKTRACE' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1351:17: note: in expansion of macro 'C'
    1351 |                 C(STACKTRACE,           "stacktrace")
         |                 ^
   kernel/trace/trace.h:1401:17: note: in expansion of macro 'STACK_FLAGS'
    1401 |                 STACK_FLAGS                                     \
         |                 ^~~~~~~~~~~
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_FUNC_FORK' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1341:17: note: in expansion of macro 'C'
    1341 |                 C(FUNC_FORK,            "function-fork")
         |                 ^
   kernel/trace/trace.h:1399:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1399 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_FUNCTION' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1340:17: note: in expansion of macro 'C'
    1340 |                 C(FUNCTION,             "function-trace")       \
         |                 ^
   kernel/trace/trace.h:1399:17: note: in expansion of macro 'FUNCTION_FLAGS'
    1399 |                 FUNCTION_FLAGS                                  \
         |                 ^~~~~~~~~~~~~~
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_HASH_PTR' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1398:17: note: in expansion of macro 'C'
    1398 |                 C(HASH_PTR,             "hash-ptr")     /* Print hashed pointer */ \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_PAUSE_ON_TRACE' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1397:17: note: in expansion of macro 'C'
    1397 |                 C(PAUSE_ON_TRACE,       "pause-on-trace")       \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_COPY_MARKER' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1396:17: note: in expansion of macro 'C'
    1396 |                 C(COPY_MARKER,          "copy_trace_marker")\
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_TRACE_PRINTK' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1395:17: note: in expansion of macro 'C'
    1395 |                 C(TRACE_PRINTK,         "trace_printk_dest")    \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_EVENT_FORK' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1394:17: note: in expansion of macro 'C'
    1394 |                 C(EVENT_FORK,           "event-fork")           \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS
         | ^~~~~~~~~~~
   kernel/trace/trace.h:1423:34: warning: 'TRACE_ITER_MARKERS' defined but not used [-Wunused-const-variable=]
    1423 | #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
         |                                  ^~~~~~~~~~~
   kernel/trace/trace.h:1393:17: note: in expansion of macro 'C'
    1393 |                 C(MARKERS,              "markers")              \
         |                 ^
   kernel/trace/trace.h:1425:1: note: in expansion of macro 'TRACE_FLAGS'
    1425 | TRACE_FLAGS

..

vim +/TRACE_ITER_PROF_TEXT_OFFSET +1423 kernel/trace/trace.h

a3418a364ec3c8 Steven Rostedt (Red Hat   2015-09-29  1417) 
a3418a364ec3c8 Steven Rostedt (Red Hat   2015-09-29  1418) /*
a3418a364ec3c8 Steven Rostedt (Red Hat   2015-09-29  1419)  * By redefining C, we can make TRACE_FLAGS a list of masks that
a3418a364ec3c8 Steven Rostedt (Red Hat   2015-09-29  1420)  * use the bits as defined above.
a3418a364ec3c8 Steven Rostedt (Red Hat   2015-09-29  1421)  */
a3418a364ec3c8 Steven Rostedt (Red Hat   2015-09-29  1422) #undef C
7e017e0772184c Masami Hiramatsu (Google  2025-09-22 @1423) #define C(a, b) static const u64 TRACE_ITER_##a = (1ULL << TRACE_ITER_##a##_BIT);
a3418a364ec3c8 Steven Rostedt (Red Hat   2015-09-29  1424) 
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki