From nobody Thu Sep 24 20:03:13 2026 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC7DE36B92E; Mon, 21 Sep 2026 10:15:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789985750; cv=none; b=g6+ZY5VpCRiUCIDQbct+YSOEUE03dkC1KqX9dywXcKo9aGkrytdHHGVwHjjTpL/qm5anbjgf0q5sTpi1cxNtnBzX5kLfY+FrRCUOGGNf7K6jUj1k+uT3vaSLgIqN+6uto3DpHyagJZ4cA/Mxh6tEIh+6SasluYRvMuU4e1K7htI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789985750; c=relaxed/simple; bh=zZrDW3SHHmLudM5KCemxSzMyjiOJhBFvYJ3SWRiP5d4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CWqROrNzFI3UUuJCI7gXkG7NAeKnHd8OJQCNRpM93MR1QLg4GAuq1zq0+0ntg4UL7WqDm0LGCUMb7nGcWNKVIAJHvqYLfh3Agl8VIrLTuUyAVtkdeClPl2iVXcOCcSi0Zf8mTrMkVOGdLoiUXYXg+uVKsH7v/cieaXgjT+sEnhM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=permerror header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=ZMh+bOFq; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=permerror header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="ZMh+bOFq" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=A8GueV0q9qDzWaxCC5p2cjn5HRkzxejPacA4CAQ/AA4=; t=1789985748; x=1791195348; b=ZMh+bOFqqO8vUUCfg3Sl4Y9NMqNiEfIVG2AqqoarBII710u DVkATePu+HaKMraDGXlyBqwcv86PkIrKfpdA8WPu16BSnXXBbErKx/1r89abA/cYDVJSEijrvYBfp 8B4fN/PYEThWckrdbXRocz3YeNJjkU99lAALEaldprUzsLtazcuyUPoHFiDwMVED+AS3L9vg4vaIa JWFC+5kl8NOGmfP4Wu/A1kjoxm+b8yRINIJE0jnfao4TMWxTIeV1ZtNufFEq67k2mh7LF5DKIJ+pD lnGEnNR7SNMug9Tz7O6IX/pn9y8EiHDIKl4wf7UljaHtL9FQktQGbmrGyz3OkmKg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__ECDSA_SECP256R1_SHA256__AES_256_GCM:256) (Exim 4.98.2) (envelope-from ) id 1x8b3m-00000005jvH-2m4F; Mon, 21 Sep 2026 12:15:42 +0200 From: Johannes Berg To: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Johannes Berg Subject: [PATCH v6 1/4] tracing: add __print_sym() to replace __print_symbolic() Date: Mon, 21 Sep 2026 12:06:32 +0200 Message-ID: <20260921101538.97286-7-johannes@sipsolutions.net> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260921101538.97286-6-johannes@sipsolutions.net> References: <20260921101538.97286-6-johannes@sipsolutions.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Johannes Berg The way __print_symbolic() works is limited and inefficient in multiple ways: - you can only use it with a static list of symbols, but e.g. the SKB dropreasons are now a dynamic list - it builds the list in memory _three_ times, so it takes a lot of memory: - The print_fmt contains the list (since it's passed to the macro there). This actually contains the names _twice_, which is fixed up at runtime. - TRACE_DEFINE_ENUM() puts a 24-byte struct trace_eval_map for every entry, plus the string pointed to by it, which cannot be deduplicated with the strings in the print_fmt - The in-kernel symbolic printing creates yet another list of struct trace_print_flags for trace_print_symbols_seq() - it also requires runtime fixup during init, which is a lot of string parsing due to the print_fmt fixup Introduce __print_sym() to - over time - replace the old one. We can easily extend this also to __print_flags later, but I cared only about the SKB dropreasons for now, which has only __print_symbolic(). This new __print_sym() requires only a single list of items, created by TRACE_DEFINE_SYM_LIST(), or can even use another already existing list by using TRACE_DEFINE_SYM_FNS() with lookup and show methods. Then, instead of doing an init-time fixup, just do this at the time when userspace reads the print_fmt. This way, dynamically updated lists are possible. For userspace, nothing actually changes, because the print_fmt is shown exactly the same way the old __print_symbolic() was. This adds about 4k .text in my test builds, but that'll be more than paid for by the actual conversions. Signed-off-by: Johannes Berg --- v6: don't place data needed at runtime in .init sections, fixing the crash Steven reported with v1: https://lore.kernel.org/r/20240819182340.3bd23d67@gandalf.local.home/ (yes, it's been over 2 years ... my bad) --- include/asm-generic/vmlinux.lds.h | 3 + include/linux/module.h | 2 + include/linux/trace_events.h | 7 ++ include/linux/tracepoint.h | 20 +++++ include/trace/stages/init.h | 55 ++++++++++++ include/trace/stages/stage2_data_offsets.h | 6 ++ include/trace/stages/stage3_trace_output.h | 9 ++ include/trace/stages/stage7_class_define.h | 3 + kernel/module/main.c | 3 + kernel/trace/trace_events.c | 99 +++++++++++++++++++++- kernel/trace/trace_output.c | 45 ++++++++++ 11 files changed, 250 insertions(+), 2 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinu= x.lds.h index b2988aa12f66..e48327fafdfe 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -276,8 +276,10 @@ . =3D ALIGN(8); \ BOUNDED_SECTION(_ftrace_events) \ BOUNDED_SECTION_BY(_ftrace_eval_map, _ftrace_eval_maps) +#define FTRACE_SYM_DEFS() BOUNDED_SECTION(_ftrace_sym_defs) #else #define FTRACE_EVENTS() +#define FTRACE_SYM_DEFS() #endif =20 #ifdef CONFIG_TRACING @@ -391,6 +393,7 @@ TRACE_PRINTKS() \ BPF_RAW_TP() \ TRACEPOINT_STR() \ + FTRACE_SYM_DEFS() \ KUNIT_TABLE() =20 /* diff --git a/include/linux/module.h b/include/linux/module.h index 96cc98568eea..a02833ac421b 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -516,6 +516,8 @@ struct module { unsigned int num_trace_events; struct trace_eval_map **trace_evals; unsigned int num_trace_evals; + struct trace_sym_def **trace_sym_defs; + unsigned int num_trace_sym_defs; #endif #ifdef CONFIG_DYNAMIC_FTRACE unsigned int num_ftrace_callsites; diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index 5cbd09c8be8d..80c34ef89feb 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -29,6 +29,13 @@ const char *trace_print_symbols_seq(struct trace_seq *p,= unsigned long val, const struct trace_print_flags *symbol_array, size_t symbol_array_size); =20 +const char *trace_print_sym_seq(struct trace_seq *p, unsigned long long va= l, + const char *(*lookup)(unsigned long long val)); +const char *trace_sym_lookup(const struct trace_sym_entry *list, + size_t len, unsigned long long value); +void trace_sym_show(struct seq_file *m, + const struct trace_sym_entry *list, size_t len); + #if BITS_PER_LONG =3D=3D 32 const char *trace_print_flags_seq_u64(struct trace_seq *p, const char *del= im, unsigned long long flags, diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index e0d838c9ce93..05c45a72756c 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -32,6 +32,24 @@ struct trace_eval_map { unsigned long eval_value; }; =20 +struct trace_sym_def { + const char *system; + const char *symbol_id; + /* may return NULL, called under rcu_read_lock() */ + const char * (*lookup)(unsigned long long); + /* + * Must print the list: ', { val, "name"}, ...' + * with no trailing comma, but with the leading ', ' + * to simplify things: + */ + void (*show)(struct seq_file *); +}; + +struct trace_sym_entry { + unsigned long long value; + const char *name; +}; + #define TRACEPOINT_DEFAULT_PRIO 10 =20 extern int @@ -163,6 +181,8 @@ extern void syscall_unregfunc(void); =20 #define TRACE_DEFINE_ENUM(x) #define TRACE_DEFINE_SIZEOF(x) +#define TRACE_DEFINE_SYM_FNS(...) +#define TRACE_DEFINE_SYM_LIST(...) =20 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) diff --git a/include/trace/stages/init.h b/include/trace/stages/init.h index 000bcfc8dd2e..6285a03a52b2 100644 --- a/include/trace/stages/init.h +++ b/include/trace/stages/init.h @@ -23,6 +23,61 @@ TRACE_MAKE_SYSTEM_STR(); __section("_ftrace_eval_map") \ *TRACE_SYSTEM##_##a =3D &__##TRACE_SYSTEM##_##a =20 +/* + * Define a symbol for __print_sym by giving lookup and + * show functions. See &struct trace_sym_def. + */ +#undef TRACE_DEFINE_SYM_FNS +#define TRACE_DEFINE_SYM_FNS(_symbol_id, _lookup, _show) \ + _TRACE_DEFINE_SYM_FNS(TRACE_SYSTEM, _symbol_id, _lookup, _show) +#define _TRACE_DEFINE_SYM_FNS(_system, _symbol_id, _lookup, _show) \ + __TRACE_DEFINE_SYM_FNS(_system, _symbol_id, _lookup, _show) +#define __TRACE_DEFINE_SYM_FNS(_system, _symbol_id, _lookup, _show) \ + ___TRACE_DEFINE_SYM_FNS(_system ## _ ## _symbol_id, _symbol_id, \ + _lookup, _show) +#define ___TRACE_DEFINE_SYM_FNS(_name, _symbol_id, _lookup, _show) \ + static struct trace_sym_def \ + __trace_sym_def_ ## _name =3D { \ + .system =3D TRACE_SYSTEM_STRING, \ + .symbol_id =3D #_symbol_id, \ + .lookup =3D _lookup, \ + .show =3D _show, \ + }; \ + static struct trace_sym_def __used \ + __section("_ftrace_sym_defs") \ + *__trace_sym_def_p_ ## _name =3D &__trace_sym_def_ ## _name + +/* + * Define a symbol for __print_sym by giving lookup and + * show functions. See &struct trace_sym_def. + */ +#undef TRACE_DEFINE_SYM_LIST +#define TRACE_DEFINE_SYM_LIST(_symbol_id, ...) \ + _TRACE_DEFINE_SYM_LIST(TRACE_SYSTEM, _symbol_id, __VA_ARGS__) +#define _TRACE_DEFINE_SYM_LIST(_system, _symbol_id, ...) \ + __TRACE_DEFINE_SYM_LIST(_system, _symbol_id, __VA_ARGS__) +#define __TRACE_DEFINE_SYM_LIST(_system, _symbol_id, ...) \ + ___TRACE_DEFINE_SYM_LIST(_system ## _ ## _symbol_id, _symbol_id,\ + __VA_ARGS__) +#define ___TRACE_DEFINE_SYM_LIST(_name, _symbol_id, ...) \ + static struct trace_sym_entry \ + __trace_sym_list_ ## _name[] =3D { __VA_ARGS__ }; \ + static const char * \ + __trace_sym_lookup_ ## _name(unsigned long long value) \ + { \ + return trace_sym_lookup(__trace_sym_list_ ## _name, \ + ARRAY_SIZE(__trace_sym_list_ ## _name), value); \ + } \ + static void \ + __trace_sym_show_ ## _name(struct seq_file *m) \ + { \ + trace_sym_show(m, __trace_sym_list_ ## _name, \ + ARRAY_SIZE(__trace_sym_list_ ## _name)); \ + } \ + ___TRACE_DEFINE_SYM_FNS(_name, _symbol_id, \ + __trace_sym_lookup_ ## _name, \ + __trace_sym_show_ ## _name) + #undef TRACE_DEFINE_SIZEOF #define TRACE_DEFINE_SIZEOF(a) \ static struct trace_eval_map __used __initdata \ diff --git a/include/trace/stages/stage2_data_offsets.h b/include/trace/sta= ges/stage2_data_offsets.h index 8b0cff06d346..5afd9de7deb3 100644 --- a/include/trace/stages/stage2_data_offsets.h +++ b/include/trace/stages/stage2_data_offsets.h @@ -5,6 +5,12 @@ #undef TRACE_DEFINE_ENUM #define TRACE_DEFINE_ENUM(a) =20 +#undef TRACE_DEFINE_SYM_FNS +#define TRACE_DEFINE_SYM_FNS(_symbol_id, _lookup, _show) + +#undef TRACE_DEFINE_SYM_LIST +#define TRACE_DEFINE_SYM_LIST(_symbol_id, ...) + #undef TRACE_DEFINE_SIZEOF #define TRACE_DEFINE_SIZEOF(a) =20 diff --git a/include/trace/stages/stage3_trace_output.h b/include/trace/sta= ges/stage3_trace_output.h index 181b81335781..09304259a8c1 100644 --- a/include/trace/stages/stage3_trace_output.h +++ b/include/trace/stages/stage3_trace_output.h @@ -79,6 +79,15 @@ trace_print_symbols_seq(p, value, symbols, ARRAY_SIZE(symbols)); \ }) =20 +#undef __print_sym +#define __print_sym(value, symbol_id) \ + ___print_sym(TRACE_SYSTEM, value, symbol_id) +#define ___print_sym(sys, value, symbol_id) \ + ____print_sym(sys, value, symbol_id) +#define ____print_sym(sys, value, symbol_id) \ + trace_print_sym_seq(p, value, \ + __trace_sym_def_p_ ## sys ## _ ## symbol_id->lookup) + #undef __print_flags_u64 #undef __print_symbolic_u64 #if BITS_PER_LONG =3D=3D 32 diff --git a/include/trace/stages/stage7_class_define.h b/include/trace/sta= ges/stage7_class_define.h index 47008897a795..936b9fa08cea 100644 --- a/include/trace/stages/stage7_class_define.h +++ b/include/trace/stages/stage7_class_define.h @@ -45,6 +45,9 @@ #define __event_in_softirq() (REC->common_flags & 0x10) #define __event_in_irq() (REC->common_flags & 0x18) =20 +#undef __print_sym +#define __print_sym(value, symbol_id) __print_sym(value:symbol_id) + /* * The below is not executed in the kernel. It is only what is * displayed in the print format for userspace to parse. diff --git a/kernel/module/main.c b/kernel/module/main.c index d0e1e0bd2ad0..8ab386a37376 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -2735,6 +2735,9 @@ static int find_module_sections(struct module *mod, s= truct load_info *info) mod->trace_evals =3D section_objs(info, "_ftrace_eval_map", sizeof(*mod->trace_evals), &mod->num_trace_evals); + mod->trace_sym_defs =3D section_objs(info, "_ftrace_sym_defs", + sizeof(*mod->trace_sym_defs), + &mod->num_trace_sym_defs); #endif #ifdef CONFIG_TRACING mod->trace_bprintk_fmt_start =3D section_objs(info, "__trace_printk_fmt", diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 1d39eaf6a0f7..abf38e3095c9 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -2109,6 +2109,102 @@ static void *f_next(struct seq_file *m, void *v, lo= ff_t *pos) return node; } =20 +extern struct trace_sym_def *__start_ftrace_sym_defs[]; +extern struct trace_sym_def *__stop_ftrace_sym_defs[]; + +/* note: @name is not NUL-terminated */ +static void show_sym_list(struct seq_file *m, struct trace_event_call *cal= l, + const char *name, unsigned int name_len) +{ + struct trace_sym_def **sym_defs; + unsigned int n_sym_defs, i; + + if ((call->flags & TRACE_EVENT_FL_DYNAMIC) || !call->module) { + sym_defs =3D __start_ftrace_sym_defs; + n_sym_defs =3D __stop_ftrace_sym_defs - __start_ftrace_sym_defs; + } else { +#ifdef CONFIG_MODULES + struct module *mod =3D call->module; + + sym_defs =3D mod->trace_sym_defs; + n_sym_defs =3D mod->num_trace_sym_defs; +#else + return; +#endif /* CONFIG_MODULES */ + } + + for (i =3D 0; i < n_sym_defs; i++) { + unsigned int sym_len; + + if (!sym_defs[i]) + continue; + if (sym_defs[i]->system !=3D call->class->system) + continue; + sym_len =3D strlen(sym_defs[i]->symbol_id); + if (name_len !=3D sym_len) + continue; + if (strncmp(sym_defs[i]->symbol_id, name, sym_len)) + continue; + if (sym_defs[i]->show) + sym_defs[i]->show(m); + break; + } +} + +static void show_print_fmt(struct seq_file *m, struct trace_event_call *ca= ll) +{ + char *ptr =3D call->print_fmt; + bool in_print_sym =3D false; + int quote =3D 0; + + seq_puts(m, "\nprint fmt: "); + while (*ptr) { + if (*ptr =3D=3D '\\') { + seq_putc(m, *ptr); + ptr++; + /* paranoid */ + if (!*ptr) + break; + goto next; + } + if (*ptr =3D=3D '"') { + quote ^=3D 1; + goto next; + } + if (quote) + goto next; + + if (in_print_sym && *ptr !=3D ':') + goto next; + + if (in_print_sym && *ptr =3D=3D ':') { + const char *name; + + ptr++; + name =3D ptr; + /* skip the name */ + while (*ptr && *ptr !=3D ')') + ptr++; + /* and show the actual list inline now */ + show_sym_list(m, call, name, ptr - name); + in_print_sym =3D false; + continue; + } + + if (strncmp(ptr, "__print_sym(", 12) =3D=3D 0) { + ptr +=3D 12; + seq_puts(m, "__print_symbolic("); + in_print_sym =3D true; + continue; + } +next: + seq_putc(m, *ptr); + ptr++; + } + + seq_putc(m, '\n'); +} + static int f_show(struct seq_file *m, void *v) { struct trace_event_file *file =3D event_file_data(m->private); @@ -2128,8 +2224,7 @@ static int f_show(struct seq_file *m, void *v) return 0; =20 case FORMAT_PRINTFMT: - seq_printf(m, "\nprint fmt: %s\n", - call->print_fmt); + show_print_fmt(m, call); return 0; } =20 diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index a5ad76175d10..0850b3ad5707 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -131,6 +131,51 @@ trace_print_symbols_seq(struct trace_seq *p, unsigned = long val, } EXPORT_SYMBOL(trace_print_symbols_seq); =20 +const char *trace_sym_lookup(const struct trace_sym_entry *list, + size_t len, unsigned long long value) +{ + size_t i; + + for (i =3D 0; i < len; i++) { + if (list[i].value =3D=3D value) + return list[i].name; + } + return NULL; +} +EXPORT_SYMBOL(trace_sym_lookup); + +void trace_sym_show(struct seq_file *m, + const struct trace_sym_entry *list, size_t len) +{ + size_t i; + + for (i =3D 0; i < len; i++) + seq_printf(m, ", { %lld, \"%s\" }", + list[i].value, list[i].name); +} +EXPORT_SYMBOL(trace_sym_show); + +const char * +trace_print_sym_seq(struct trace_seq *p, unsigned long long val, + const char *(*lookup)(unsigned long long val)) +{ + const char *ret =3D trace_seq_buffer_ptr(p); + const char *name; + + rcu_read_lock(); + name =3D lookup(val); + if (name) + trace_seq_puts(p, name); + else + trace_seq_printf(p, "0x%llx", val); + rcu_read_unlock(); + + trace_seq_putc(p, 0); + + return ret; +} +EXPORT_SYMBOL(trace_print_sym_seq); + #if BITS_PER_LONG =3D=3D 32 const char * trace_print_flags_seq_u64(struct trace_seq *p, const char *delim, --=20 2.55.0 From nobody Thu Sep 24 20:03:13 2026 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 860BA3DC4B8; Mon, 21 Sep 2026 10:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789985751; cv=none; b=BgPhcF28OMPOz/8yfPK6Mho1TTLaoQfke09Vt4VB89E1BULAKnMt9X0Vg9q+BkcU9ciYmuBk1gKmSlUUciRGTbxNnjjbBufiYDYtMzx77a2lPPCawRGDeDcImrQluRGvBK9EhEAf8jW1CqzDNSsK3OJnF//ODZwTKnGEH3X74ic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789985751; c=relaxed/simple; bh=yeRGN+0wWYWZ65R9hKxmT90VoewUaS+Ba/MM3Z9frHA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EuQDk+ujqEUMEGmaLcx5G8/M4ZKWlWxeX+AZj/XHszqX0796EZF0bVKyGwZHrMD9EfL9zrEHW8fl3VJ/ssVu8pylljsSl+n2TFgf/2WrbZ/XAuAnnvTDOXFQPaia9RjDpt4azYdHvhyj0aaejGKD+TOmO8zIiH20AGAc1BYbBoE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=permerror header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=yGZKC71J; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=permerror header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="yGZKC71J" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=tETmZyietn5/+Tj0nR7lM4MbsVT0JGLtyF0nww7h+gY=; t=1789985749; x=1791195349; b=yGZKC71JzWwS38jFQHJ3Yoq6a2F+2rx1lcsdYkwIfaYuB72 EBWca0bfwXBSI+arHtLJNOCj6O7yYrMsb6xv8WJg/antEUBDhdnA6FKx2c3gTitfZXeZ9JqxDBICZ FjG1qq6nE3XE7x9JyZFtwNG9+kLIkWmmdvp1JmoUwsIjapCM4yZX90w7hrHq554i5uKJ74DAIlnbR F5yBP2HmrMaK/smpLVTE0LzPhTyr1AOP6PC1rs6bpCvWc3B+WN9Dyo9+YXAF6KXTWPpIPDrFPb4wb /SpEV+NubEg4LG20VQp4St5suyRnq51eQ+Bu8oEgHe2INW8Q67NSWF6hXF0mlf3A==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__ECDSA_SECP256R1_SHA256__AES_256_GCM:256) (Exim 4.98.2) (envelope-from ) id 1x8b3n-00000005jvH-3VqX; Mon, 21 Sep 2026 12:15:44 +0200 From: Johannes Berg To: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Johannes Berg Subject: [PATCH v6 2/4] tracing/timer: use __print_sym() Date: Mon, 21 Sep 2026 12:06:33 +0200 Message-ID: <20260921101538.97286-8-johannes@sipsolutions.net> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260921101538.97286-6-johannes@sipsolutions.net> References: <20260921101538.97286-6-johannes@sipsolutions.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Johannes Berg Use the new __print_sym() in the timer tracing, just to show how to convert something. This adds ~80 bytes of .text for a saving of ~1.5K of data in my builds. Note the format changes from print fmt: "success=3D%d dependency=3D%s", REC->success, __print_symbolic(R= EC->dependency, { 0, "NONE" }, { (1 << 0), "POSIX_TIMER" }, { (1 << 1), "PE= RF_EVENTS" }, { (1 << 2), "SCHED" }, { (1 << 3), "CLOCK_UNSTABLE" }, { (1 <= < 4), "RCU" }, { (1 << 5), "RCU_EXP" }) to print fmt: "success=3D%d dependency=3D%s", REC->success, __print_symbolic(R= EC->dependency, { 0, "NONE" }, { 1, "POSIX_TIMER" }, { 2, "PERF_EVENTS" }, = { 4, "SCHED" }, { 8, "CLOCK_UNSTABLE" }, { 16, "RCU" }, { 32, "RCU_EXP" }) since the values are now just printed in the show function as pure decimal values. Signed-off-by: Johannes Berg --- include/trace/events/timer.h | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/include/trace/events/timer.h b/include/trace/events/timer.h index ca82fd62dc30..9a43f4fedaf6 100644 --- a/include/trace/events/timer.h +++ b/include/trace/events/timer.h @@ -441,26 +441,18 @@ TRACE_EVENT(itimer_expire, #undef tick_dep_mask_name #undef tick_dep_name_end =20 -/* The MASK will convert to their bits and they need to be processed too */ -#define tick_dep_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \ - TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep); -#define tick_dep_name_end(sdep) TRACE_DEFINE_ENUM(TICK_DEP_BIT_##sdep); \ - TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep); -/* NONE only has a mask defined for it */ -#define tick_dep_mask_name(sdep) TRACE_DEFINE_ENUM(TICK_DEP_MASK_##sdep); +#define tick_dep_name(sdep) { TICK_DEP_MASK_##sdep, #sdep }, +#define tick_dep_mask_name(sdep) { TICK_DEP_MASK_##sdep, #sdep }, +#define tick_dep_name_end(sdep) { TICK_DEP_MASK_##sdep, #sdep } =20 -TICK_DEP_NAMES +TRACE_DEFINE_SYM_LIST(tick_dep_names, TICK_DEP_NAMES); =20 #undef tick_dep_name #undef tick_dep_mask_name #undef tick_dep_name_end =20 -#define tick_dep_name(sdep) { TICK_DEP_MASK_##sdep, #sdep }, -#define tick_dep_mask_name(sdep) { TICK_DEP_MASK_##sdep, #sdep }, -#define tick_dep_name_end(sdep) { TICK_DEP_MASK_##sdep, #sdep } - #define show_tick_dep_name(val) \ - __print_symbolic(val, TICK_DEP_NAMES) + __print_sym(val, tick_dep_names) =20 TRACE_EVENT(tick_stop, =20 --=20 2.55.0 From nobody Thu Sep 24 20:03:13 2026 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0F4E3C3F5E; Mon, 21 Sep 2026 10:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789985751; cv=none; b=NI5dNi1fioH9FGGarNUg7STtMutJGQLh5a1W/mKmpHYbBpqrUioeye6ZHyZSWDBZH/Nc7WXoluw1C9OQFH1fgD4V7zXq8KPWLK/HnxZtwjdYAZi3PGXibQ+rs/BGfXkwekajLj/5LO7qoValQQ6s5WKU2HEkhWYxfw6SyOIsVsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789985751; c=relaxed/simple; bh=TU93HLpvR1dP02TFve8ZQG/QDNfXb4wFD5OT8DFmE3w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jmYyBMehKJi/tfsKIU/MNOMNRFetRPSDlsDm1lZDw7m4L+ojj2yb8HqT6aLrZ5Piogr6w2sejIjr0SOxmWO5AkZXGbngMRl0rxn1KVTsSbx6gLS7YXnVseYCXg/L64o812Weyk2Iv72bzd8OW07kpxtPT4cCf6LgbRRLrLt6S8Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=permerror header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=NRuY5dBg; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=permerror header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="NRuY5dBg" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=R58cUpihFiNJhRhiocI1VcD6CHdtizckpbaSpUo+PVg=; t=1789985749; x=1791195349; b=NRuY5dBgAkwmMRkDfQYLn55QMSSmUYlS0eo/+5h2ownqiqL zCSNffgOBUIPwabILCLSA5qWxWwbekSUKzdAJ3DNkaxeTrawwciP8+xoKG2cojICKr4QSDDx1m7iN j9UP6ch+7aJ524N8/UgI/ZF0S571TQ9Eo/l1a8OyOvf7w1KfKOmuFA9TN3Sc523RIPt6Y3qrY+6BP ieVQjAM+eWB87AwaEuYTm6zvf1dk+YBon5q3ENJGX29Re05y4Osszhtn529haJ4A4BTtliY7XI3FI H6laQk1RpG+u2FKhEENpoXDLCuE0ISGcmXCsP345FoLExGp1VrVY8fKhj4xh1mtg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__ECDSA_SECP256R1_SHA256__AES_256_GCM:256) (Exim 4.98.2) (envelope-from ) id 1x8b3o-00000005jvH-2LH3; Mon, 21 Sep 2026 12:15:44 +0200 From: Johannes Berg To: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Johannes Berg Subject: [PATCH v6 3/4] net: dropreason: use new __print_sym() in tracing Date: Mon, 21 Sep 2026 12:06:34 +0200 Message-ID: <20260921101538.97286-9-johannes@sipsolutions.net> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260921101538.97286-6-johannes@sipsolutions.net> References: <20260921101538.97286-6-johannes@sipsolutions.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Johannes Berg The __print_symbolic() could only ever print the core drop reasons, since that's the way the infrastructure works. Now that we have __print_sym() with all the advantages mentioned in that commit, convert to that and get all the drop reasons from all subsystems. As we already have a list of them, that's really easy. This is a little bit of .text (~100 bytes in my build) and saves a lot of .data (~17k). Signed-off-by: Johannes Berg --- include/net/dropreason.h | 5 +++++ include/trace/events/skb.h | 13 +++--------- net/core/skbuff.c | 43 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 10 deletions(-) diff --git a/include/net/dropreason.h b/include/net/dropreason.h index 1df60645fb27..dc4a60130c09 100644 --- a/include/net/dropreason.h +++ b/include/net/dropreason.h @@ -42,6 +42,11 @@ struct drop_reason_list { extern const struct drop_reason_list __rcu * drop_reasons_by_subsys[SKB_DROP_REASON_SUBSYS_NUM]; =20 +#ifdef CONFIG_TRACEPOINTS +const char *drop_reason_lookup(unsigned long long value); +void drop_reason_show(struct seq_file *m); +#endif + void drop_reasons_register_subsys(enum skb_drop_reason_subsys subsys, const struct drop_reason_list *list); void drop_reasons_unregister_subsys(enum skb_drop_reason_subsys subsys); diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h index 2945aa7fe9a7..991bf172a6ea 100644 --- a/include/trace/events/skb.h +++ b/include/trace/events/skb.h @@ -8,15 +8,9 @@ #include #include #include +#include =20 -#undef FN -#define FN(reason) TRACE_DEFINE_ENUM(SKB_DROP_REASON_##reason); -DEFINE_DROP_REASON(FN, FN) - -#undef FN -#undef FNe -#define FN(reason) { SKB_DROP_REASON_##reason, #reason }, -#define FNe(reason) { SKB_DROP_REASON_##reason, #reason } +TRACE_DEFINE_SYM_FNS(drop_reason, drop_reason_lookup, drop_reason_show); =20 /* * Tracepoint for free an sk_buff: @@ -47,8 +41,7 @@ TRACE_EVENT(kfree_skb, TP_printk("skbaddr=3D%p rx_sk=3D%p protocol=3D%u location=3D%pS reason: %= s", __entry->skbaddr, __entry->rx_sk, __entry->protocol, __entry->location, - __print_symbolic(__entry->reason, - DEFINE_DROP_REASON(FN, FNe))) + __print_sym(__entry->reason, drop_reason)) ); =20 #undef FN diff --git a/net/core/skbuff.c b/net/core/skbuff.c index ab195b99c853..0c2d43797587 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -154,6 +154,49 @@ drop_reasons_by_subsys[SKB_DROP_REASON_SUBSYS_NUM] =3D= { }; EXPORT_SYMBOL(drop_reasons_by_subsys); =20 +#ifdef CONFIG_TRACEPOINTS +const char *drop_reason_lookup(unsigned long long value) +{ + unsigned long long subsys_id =3D value >> SKB_DROP_REASON_SUBSYS_SHIFT; + u32 reason =3D value & ~SKB_DROP_REASON_SUBSYS_MASK; + const struct drop_reason_list *subsys; + + if (subsys_id >=3D SKB_DROP_REASON_SUBSYS_NUM) + return NULL; + + subsys =3D rcu_dereference(drop_reasons_by_subsys[subsys_id]); + if (!subsys) + return NULL; + if (reason >=3D subsys->n_reasons) + return NULL; + return subsys->reasons[reason]; +} + +void drop_reason_show(struct seq_file *m) +{ + u32 subsys_id; + + rcu_read_lock(); + for (subsys_id =3D 0; subsys_id < SKB_DROP_REASON_SUBSYS_NUM; subsys_id++= ) { + const struct drop_reason_list *subsys; + u32 i; + + subsys =3D rcu_dereference(drop_reasons_by_subsys[subsys_id]); + if (!subsys) + continue; + + for (i =3D 0; i < subsys->n_reasons; i++) { + if (!subsys->reasons[i]) + continue; + seq_printf(m, ", { %u, \"%s\" }", + (subsys_id << SKB_DROP_REASON_SUBSYS_SHIFT) | i, + subsys->reasons[i]); + } + } + rcu_read_unlock(); +} +#endif + /** * drop_reasons_register_subsys - register another drop reason subsystem * @subsys: the subsystem to register, must not be the core --=20 2.55.0 From nobody Thu Sep 24 20:03:13 2026 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8614D3E0C4C; Mon, 21 Sep 2026 10:15:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789985752; cv=none; b=Zq3Jaj82s3f8SFu8osYQ/QojKPFE34JIgSTi9WsWEYd7DKA1QDcKsCS1KAwoBQz0nSIX1eEOf1ckKUJ9Y+NiiQyLI9Ur2gDp2JtDuZ3HtdteDblAM08GvI9xN15q3nrGq90Cv6nvOxQg2558KuP6323YWGs70UJgxkRpk1sd4Ds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789985752; c=relaxed/simple; bh=qRbo3nIagDmOVXamtI/Wqt7gq1MvSeelgCrdL3Y69hg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UPmB7FZX+wju1DUESU4cQR7Je9+upVKWCyIIBwBW5wlhCv31AX3E28rPkGevZAbYaJc4WYi+qJflDKEsbN7kgrGB5nMfG6l1U1rl/Jc6XnuQ9nissOXy57JOpZT9Q+a2xCM7wJC4JqTBOCBk6DOhtShjRlrA7jpesHkSJxrbMOQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=permerror header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=AHlhXWB9; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=permerror header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="AHlhXWB9" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=EDn54jabC0To4na0WfUtOppzSuDggojBsbVFmCKJPl8=; t=1789985749; x=1791195349; b=AHlhXWB9zIZ28q7r9fz6fEEUj4I3ckc1lszH9zxppcILuZP vvYdq0FfBCdCk3Cu7DGvhUDOE5Ct4qlR1+iaGO+5IEyQFdKfoIbqgw16/VS9+5VtWJqFFDSYpW+8S zq+ZFK0gLHLWwyiHt9YvfztAfTA3eHTGjqsutnp7YRvRym9q5pNmtoFDIXBrX/aIE5sLYAEHjoYxm toaibPkntMlm5h2wPlp8zfO8Wy3C27EWS2JW/pvCY55iu40BSi07jgK1zWiasBMblZpGceEliw0tn 1xqdrjlXiAbB40GMslWMXPnLOcJUEEjrFnZg7N4kI/T82ZfEtiVwqSzBmoH6pilg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__ECDSA_SECP256R1_SHA256__AES_256_GCM:256) (Exim 4.98.2) (envelope-from ) id 1x8b3p-00000005jvH-1jqe; Mon, 21 Sep 2026 12:15:45 +0200 From: Johannes Berg To: linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Johannes Berg Subject: [PATCH v6 4/4] net: drop_monitor: use drop_reason_lookup() Date: Mon, 21 Sep 2026 12:06:35 +0200 Message-ID: <20260921101538.97286-10-johannes@sipsolutions.net> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260921101538.97286-6-johannes@sipsolutions.net> References: <20260921101538.97286-6-johannes@sipsolutions.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Johannes Berg Now that we have drop_reason_lookup(), we can just use it for drop_monitor as well, rather than exporting the list itself. Signed-off-by: Johannes Berg --- include/net/dropreason.h | 4 ---- net/core/drop_monitor.c | 20 +++++--------------- net/core/skbuff.c | 6 +++--- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/include/net/dropreason.h b/include/net/dropreason.h index dc4a60130c09..4680da5964ef 100644 --- a/include/net/dropreason.h +++ b/include/net/dropreason.h @@ -38,10 +38,6 @@ struct drop_reason_list { size_t n_reasons; }; =20 -/* Note: due to dynamic registrations, access must be under RCU */ -extern const struct drop_reason_list __rcu * -drop_reasons_by_subsys[SKB_DROP_REASON_SUBSYS_NUM]; - #ifdef CONFIG_TRACEPOINTS const char *drop_reason_lookup(unsigned long long value); void drop_reason_show(struct seq_file *m); diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index abaf108ac4db..5b685f918cc2 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c @@ -612,9 +612,8 @@ static int net_dm_packet_report_fill(struct sk_buff *ms= g, struct sk_buff *skb, size_t payload_len) { struct net_dm_skb_cb *cb =3D NET_DM_SKB_CB(skb); - const struct drop_reason_list *list =3D NULL; - unsigned int subsys, subsys_reason; char buf[NET_DM_MAX_SYMBOL_LEN]; + const char *reason_str; struct nlattr *attr; void *hdr; int rc; @@ -632,19 +631,10 @@ static int net_dm_packet_report_fill(struct sk_buff *= msg, struct sk_buff *skb, goto nla_put_failure; =20 rcu_read_lock(); - subsys =3D u32_get_bits(cb->reason, SKB_DROP_REASON_SUBSYS_MASK); - if (subsys < SKB_DROP_REASON_SUBSYS_NUM) - list =3D rcu_dereference(drop_reasons_by_subsys[subsys]); - subsys_reason =3D cb->reason & ~SKB_DROP_REASON_SUBSYS_MASK; - if (!list || - subsys_reason >=3D list->n_reasons || - !list->reasons[subsys_reason] || - strlen(list->reasons[subsys_reason]) > NET_DM_MAX_REASON_LEN) { - list =3D rcu_dereference(drop_reasons_by_subsys[SKB_DROP_REASON_SUBSYS_C= ORE]); - subsys_reason =3D SKB_DROP_REASON_NOT_SPECIFIED; - } - if (nla_put_string(msg, NET_DM_ATTR_REASON, - list->reasons[subsys_reason])) { + reason_str =3D drop_reason_lookup(cb->reason); + if (unlikely(!reason_str)) + reason_str =3D drop_reason_lookup(SKB_DROP_REASON_NOT_SPECIFIED); + if (nla_put_string(msg, NET_DM_ATTR_REASON, reason_str)) { rcu_read_unlock(); goto nla_put_failure; } diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 0c2d43797587..d74022457893 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -148,13 +148,11 @@ static const struct drop_reason_list drop_reasons_cor= e =3D { .n_reasons =3D ARRAY_SIZE(drop_reasons), }; =20 -const struct drop_reason_list __rcu * +static const struct drop_reason_list __rcu * drop_reasons_by_subsys[SKB_DROP_REASON_SUBSYS_NUM] =3D { [SKB_DROP_REASON_SUBSYS_CORE] =3D RCU_INITIALIZER(&drop_reasons_core), }; -EXPORT_SYMBOL(drop_reasons_by_subsys); =20 -#ifdef CONFIG_TRACEPOINTS const char *drop_reason_lookup(unsigned long long value) { unsigned long long subsys_id =3D value >> SKB_DROP_REASON_SUBSYS_SHIFT; @@ -171,7 +169,9 @@ const char *drop_reason_lookup(unsigned long long value) return NULL; return subsys->reasons[reason]; } +EXPORT_SYMBOL(drop_reason_lookup); =20 +#ifdef CONFIG_TRACEPOINTS void drop_reason_show(struct seq_file *m) { u32 subsys_id; --=20 2.55.0