From nobody Tue Apr 7 16:17:35 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 9E8403C7DEA; Thu, 12 Mar 2026 11:25:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773314744; cv=none; b=B7wGFYTnrkBadf/NGCuDIdYnFI9tI9OZzm/fabdu+kIWbNRom2FTCyoESUX2pa4U8/nyK5JDWfAagNo5LaRttoeZxyCxhIyAPS71bnOb9Z2uiVtwciyvroLmGvk3n8PYBcAb63dtS2urZe0gHDOE5ss3pj+aizrmUgJHXb0e+q4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773314744; c=relaxed/simple; bh=Al50iXhFt6bSTB2FCp+jqdthkkgbTTN+Et2dvXMBWoY=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=fv0RPhBr1BbL4f6fk89k1c5zO3fCvChz+B6PQJYmLEj5A88AS3gz4z+ImP3l+nX0dznM31SF+iZuinP6mi1es/x2i2IZJvEwP+3YKpU7fVH4DwZxfak8CR2g8J9xL7yBK2g+p0Kemnlk/hcaNv0pDvzRGuLCmZ2UfwsQB8XZBgs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=evQZ7SGA; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=1ghlZpY3; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="evQZ7SGA"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="1ghlZpY3" Date: Thu, 12 Mar 2026 11:25:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1773314741; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jmHsjs9y50DzJQis6VAlZmFQoYG/NEt6k8/+IC91P/A=; b=evQZ7SGACIE5fJmN0kM+U28sZFaNRU8bOGMG2iK1GVct3HKbpnhOzTgRzbhNxq6nZ9qsCQ l6qjWSYiV8LRkdLTM+Yy8S1QC2fE8R9/+6w4pEVr4xY+DDjumtgujHuJF9vphBEDq8hmiD CBxMyhY4F5S+9MFk/itJ8UiG7ugd9BM0oMrvRDrWq8x0DjD1pEvLrmK7MKZ26ly+KUVtGb fwsfZb7G7Gao3goVb7XmY+fVFto4F+mqUmIy6T5Lvo8h8xQNTFpOCsH7ar3SlZZky8qYPc H3Q6NMJdnFgO1IPz8STYXNQyKharCcNlV4tSC6fNEcWsEt4xEc2gvjgKcdI4+A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1773314741; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jmHsjs9y50DzJQis6VAlZmFQoYG/NEt6k8/+IC91P/A=; b=1ghlZpY3S6dRch/iv6819XwYZBNoaIk6GBpHNQr2TASua+SBBtBxKBX72EeMFyEXyL7iJ2 Mhs94phsaTH0lzAw== From: tip-bot2 for Thomas =?utf-8?q?Wei=C3=9Fschuh_=28Schneider_Electric=29?= Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: timers/core] tracing: Use explicit array size instead of sentinel elements in symbol printing Cc: thomas.weissschuh@linutronix.de, Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260311-hrtimer-cleanups-v1-2-095357392669@linutronix.de> References: <20260311-hrtimer-cleanups-v1-2-095357392669@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177331474001.1647592.117044075737626231.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the timers/core branch of tip: Commit-ID: 754e38d2d1aeeadddac5220f34e07cf263502a46 Gitweb: https://git.kernel.org/tip/754e38d2d1aeeadddac5220f34e07cf26= 3502a46 Author: Thomas Wei=C3=9Fschuh (Schneider Electric) AuthorDate: Wed, 11 Mar 2026 11:15:11 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 12 Mar 2026 12:15:53 +01:00 tracing: Use explicit array size instead of sentinel elements in symbol pri= nting The sentinel value added by the wrapper macros __print_symbolic() et al prevents the callers from adding their own trailing comma. This makes constructing symbol list dynamically based on kconfig values tedious. Drop the sentinel elements, so callers can either specify the trailing comma or not, just like in regular array initializers. Signed-off-by: Thomas Wei=C3=9Fschuh (Schneider Electric) Signed-off-by: Thomas Gleixner Link: https://patch.msgid.link/20260311-hrtimer-cleanups-v1-2-095357392669@= linutronix.de --- include/linux/trace_events.h | 13 ++++--- include/trace/stages/stage3_trace_output.h | 40 ++++++++++----------- kernel/trace/trace_events_synth.c | 4 +- kernel/trace/trace_output.c | 20 ++++++----- kernel/trace/trace_syscalls.c | 3 +-- 5 files changed, 43 insertions(+), 37 deletions(-) diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index 37eb2f0..40a43a4 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -22,20 +22,23 @@ union bpf_attr; =20 const char *trace_print_flags_seq(struct trace_seq *p, const char *delim, unsigned long flags, - const struct trace_print_flags *flag_array); + const struct trace_print_flags *flag_array, + size_t flag_array_size); =20 const char *trace_print_symbols_seq(struct trace_seq *p, unsigned long val, - const struct trace_print_flags *symbol_array); + const struct trace_print_flags *symbol_array, + size_t symbol_array_size); =20 #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, - const struct trace_print_flags_u64 *flag_array); + const struct trace_print_flags_u64 *flag_array, + size_t flag_array_size); =20 const char *trace_print_symbols_seq_u64(struct trace_seq *p, unsigned long long val, - const struct trace_print_flags_u64 - *symbol_array); + const struct trace_print_flags_u64 *symbol_array, + size_t symbol_array_size); #endif =20 struct trace_iterator; diff --git a/include/trace/stages/stage3_trace_output.h b/include/trace/sta= ges/stage3_trace_output.h index fce85ea..b7d8ef4 100644 --- a/include/trace/stages/stage3_trace_output.h +++ b/include/trace/stages/stage3_trace_output.h @@ -64,36 +64,36 @@ #define __get_rel_sockaddr(field) ((struct sockaddr *)__get_rel_dynamic_ar= ray(field)) =20 #undef __print_flags -#define __print_flags(flag, delim, flag_array...) \ - ({ \ - static const struct trace_print_flags __flags[] =3D \ - { flag_array, { -1, NULL }}; \ - trace_print_flags_seq(p, delim, flag, __flags); \ +#define __print_flags(flag, delim, flag_array...) \ + ({ \ + static const struct trace_print_flags __flags[] =3D \ + { flag_array }; \ + trace_print_flags_seq(p, delim, flag, __flags, ARRAY_SIZE(__flags)); \ }) =20 #undef __print_symbolic -#define __print_symbolic(value, symbol_array...) \ - ({ \ - static const struct trace_print_flags symbols[] =3D \ - { symbol_array, { -1, NULL }}; \ - trace_print_symbols_seq(p, value, symbols); \ +#define __print_symbolic(value, symbol_array...) \ + ({ \ + static const struct trace_print_flags symbols[] =3D \ + { symbol_array }; \ + trace_print_symbols_seq(p, value, symbols, ARRAY_SIZE(symbols)); \ }) =20 #undef __print_flags_u64 #undef __print_symbolic_u64 #if BITS_PER_LONG =3D=3D 32 -#define __print_flags_u64(flag, delim, flag_array...) \ - ({ \ - static const struct trace_print_flags_u64 __flags[] =3D \ - { flag_array, { -1, NULL } }; \ - trace_print_flags_seq_u64(p, delim, flag, __flags); \ +#define __print_flags_u64(flag, delim, flag_array...) \ + ({ \ + static const struct trace_print_flags_u64 __flags[] =3D \ + { flag_array }; \ + trace_print_flags_seq_u64(p, delim, flag, __flags, ARRAY_SIZE(__flags));= \ }) =20 -#define __print_symbolic_u64(value, symbol_array...) \ - ({ \ - static const struct trace_print_flags_u64 symbols[] =3D \ - { symbol_array, { -1, NULL } }; \ - trace_print_symbols_seq_u64(p, value, symbols); \ +#define __print_symbolic_u64(value, symbol_array...) \ + ({ \ + static const struct trace_print_flags_u64 symbols[] =3D \ + { symbol_array }; \ + trace_print_symbols_seq_u64(p, value, symbols, ARRAY_SIZE(symbols)); \ }) #else #define __print_flags_u64(flag, delim, flag_array...) \ diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_= synth.c index 8bb95b2..39ac4eb 100644 --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -395,7 +395,7 @@ static enum print_line_t print_synth_event(struct trace= _iterator *iter, n_u64++; } else { struct trace_print_flags __flags[] =3D { - __def_gfpflag_names, {-1, NULL} }; + __def_gfpflag_names }; char *space =3D (i =3D=3D se->n_fields - 1 ? "" : " "); =20 print_synth_event_num_val(s, print_fmt, @@ -408,7 +408,7 @@ static enum print_line_t print_synth_event(struct trace= _iterator *iter, trace_seq_puts(s, " ("); trace_print_flags_seq(s, "|", entry->fields[n_u64].as_u64, - __flags); + __flags, ARRAY_SIZE(__flags)); trace_seq_putc(s, ')'); } n_u64++; diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 1996d7a..96e2d22 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -69,14 +69,15 @@ enum print_line_t trace_print_printk_msg_only(struct tr= ace_iterator *iter) const char * trace_print_flags_seq(struct trace_seq *p, const char *delim, unsigned long flags, - const struct trace_print_flags *flag_array) + const struct trace_print_flags *flag_array, + size_t flag_array_size) { unsigned long mask; const char *str; const char *ret =3D trace_seq_buffer_ptr(p); int i, first =3D 1; =20 - for (i =3D 0; flag_array[i].name && flags; i++) { + for (i =3D 0; i < flag_array_size && flags; i++) { =20 mask =3D flag_array[i].mask; if ((flags & mask) !=3D mask) @@ -106,12 +107,13 @@ EXPORT_SYMBOL(trace_print_flags_seq); =20 const char * trace_print_symbols_seq(struct trace_seq *p, unsigned long val, - const struct trace_print_flags *symbol_array) + const struct trace_print_flags *symbol_array, + size_t symbol_array_size) { int i; const char *ret =3D trace_seq_buffer_ptr(p); =20 - for (i =3D 0; symbol_array[i].name; i++) { + for (i =3D 0; i < symbol_array_size; i++) { =20 if (val !=3D symbol_array[i].mask) continue; @@ -133,14 +135,15 @@ EXPORT_SYMBOL(trace_print_symbols_seq); const char * trace_print_flags_seq_u64(struct trace_seq *p, const char *delim, unsigned long long flags, - const struct trace_print_flags_u64 *flag_array) + const struct trace_print_flags_u64 *flag_array, + size_t flag_array_size) { unsigned long long mask; const char *str; const char *ret =3D trace_seq_buffer_ptr(p); int i, first =3D 1; =20 - for (i =3D 0; flag_array[i].name && flags; i++) { + for (i =3D 0; i < flag_array_size && flags; i++) { =20 mask =3D flag_array[i].mask; if ((flags & mask) !=3D mask) @@ -170,12 +173,13 @@ EXPORT_SYMBOL(trace_print_flags_seq_u64); =20 const char * trace_print_symbols_seq_u64(struct trace_seq *p, unsigned long long val, - const struct trace_print_flags_u64 *symbol_array) + const struct trace_print_flags_u64 *symbol_array, + size_t symbol_array_size) { int i; const char *ret =3D trace_seq_buffer_ptr(p); =20 - for (i =3D 0; symbol_array[i].name; i++) { + for (i =3D 0; i < symbol_array_size; i++) { =20 if (val !=3D symbol_array[i].mask) continue; diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index 37317b8..8ad72e1 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c @@ -174,7 +174,6 @@ sys_enter_openat_print(struct syscall_trace_enter *trac= e, struct syscall_metadat { O_NOFOLLOW, "O_NOFOLLOW" }, { O_NOATIME, "O_NOATIME" }, { O_CLOEXEC, "O_CLOEXEC" }, - { -1, NULL } }; =20 trace_seq_printf(s, "%s(", entry->name); @@ -205,7 +204,7 @@ sys_enter_openat_print(struct syscall_trace_enter *trac= e, struct syscall_metadat trace_seq_puts(s, "O_RDONLY|"); } =20 - trace_print_flags_seq(s, "|", bits, __flags); + trace_print_flags_seq(s, "|", bits, __flags, ARRAY_SIZE(__flags)); /* * trace_print_flags_seq() adds a '\0' to the * buffer, but this needs to append more to the seq.