From nobody Mon Feb 9 12:00:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7BCF31C8604 for ; Sun, 23 Mar 2025 12:29:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732950; cv=none; b=rexjKEocgz5cAi0xEsgSGDo6pLjURrBxWGfjOutASqDgnBIzKOxCCPZF2KqJnHvhqTZnDCEZiEP1QE7KZwFchaNokZCww2x8lq4XfMRAzhnI2CdySy7EnHDMC9D0M79DLQE6WCsArM3IAIXXG1MpiTGvfxLKhqfUpPZXA8/aSIE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732950; c=relaxed/simple; bh=mac9E2reOOVM6xy+JAuu3a3ABPbtI6G6MycBtkaDQno=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=a6xDy9XoqrnuhPSeNhe/PzVqVQsatoF0/u/XQO9XVuJzUCKQUtLQVnr2bMq3bR1Xd/T25oc39lnu+0pHn4YR9UoNqwlum8P7FWSFri1onTRaLQULzQD24k2+OovOnxXayy+r722BJAmLRZy2pEWobxfJ61rzEIKoHBu+xsaH16k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19B19C4CEEE; Sun, 23 Mar 2025 12:29:10 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1twKSb-00000001ydm-1VSU; Sun, 23 Mar 2025 08:29:49 -0400 Message-ID: <20250323122949.208190772@goodmis.org> User-Agent: quilt/0.68 Date: Sun, 23 Mar 2025 08:29:34 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Frederic Weisbecker , Uday Shankar , Masahiro Yamada Subject: [for-next][PATCH 01/10] scripts/tracing: Remove scripts/tracing/draw_functrace.py References: <20250323122933.407277911@goodmis.org> 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: Steven Rostedt The draw_functrace.py hasn't worked in years. There's better ways to accomplish the same thing (via libtracefs). Remove it. Link: https://lore.kernel.org/linux-trace-kernel/20250210-debuginfo-v1-1-36= 8feb58292a@purestorage.com/ Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Frederic Weisbecker Cc: Mathieu Desnoyers Cc: Uday Shankar Cc: Masahiro Yamada Link: https://lore.kernel.org/20250307103941.070654e7@gandalf.local.home Signed-off-by: Steven Rostedt (Google) --- scripts/tracing/draw_functrace.py | 129 ------------------------------ 1 file changed, 129 deletions(-) delete mode 100755 scripts/tracing/draw_functrace.py diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_funct= race.py deleted file mode 100755 index 42fa87300941..000000000000 --- a/scripts/tracing/draw_functrace.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env python -# SPDX-License-Identifier: GPL-2.0-only - -""" -Copyright 2008 (c) Frederic Weisbecker - -This script parses a trace provided by the function tracer in -kernel/trace/trace_functions.c -The resulted trace is processed into a tree to produce a more human -view of the call stack by drawing textual but hierarchical tree of -calls. Only the functions's names and the call time are provided. - -Usage: - Be sure that you have CONFIG_FUNCTION_TRACER - # mount -t tracefs nodev /sys/kernel/tracing - # echo function > /sys/kernel/tracing/current_tracer - $ cat /sys/kernel/tracing/trace_pipe > ~/raw_trace_func - Wait some times but not too much, the script is a bit slow. - Break the pipe (Ctrl + Z) - $ scripts/tracing/draw_functrace.py < ~/raw_trace_func > draw_functrace - Then you have your drawn trace in draw_functrace -""" - - -import sys, re - -class CallTree: - """ This class provides a tree representation of the functions - call stack. If a function has no parent in the kernel (interrupt, - syscall, kernel thread...) then it is attached to a virtual parent - called ROOT. - """ - ROOT =3D None - - def __init__(self, func, time =3D None, parent =3D None): - self._func =3D func - self._time =3D time - if parent is None: - self._parent =3D CallTree.ROOT - else: - self._parent =3D parent - self._children =3D [] - - def calls(self, func, calltime): - """ If a function calls another one, call this method to insert it - into the tree at the appropriate place. - @return: A reference to the newly created child node. - """ - child =3D CallTree(func, calltime, self) - self._children.append(child) - return child - - def getParent(self, func): - """ Retrieve the last parent of the current node that - has the name given by func. If this function is not - on a parent, then create it as new child of root - @return: A reference to the parent. - """ - tree =3D self - while tree !=3D CallTree.ROOT and tree._func !=3D func: - tree =3D tree._parent - if tree =3D=3D CallTree.ROOT: - child =3D CallTree.ROOT.calls(func, None) - return child - return tree - - def __repr__(self): - return self.__toString("", True) - - def __toString(self, branch, lastChild): - if self._time is not None: - s =3D "%s----%s (%s)\n" % (branch, self._func, self._time) - else: - s =3D "%s----%s\n" % (branch, self._func) - - i =3D 0 - if lastChild: - branch =3D branch[:-1] + " " - while i < len(self._children): - if i !=3D len(self._children) - 1: - s +=3D "%s" % self._children[i].__toString(branch +\ - " |", False) - else: - s +=3D "%s" % self._children[i].__toString(branch +\ - " |", True) - i +=3D 1 - return s - -class BrokenLineException(Exception): - """If the last line is not complete because of the pipe breakage, - we want to stop the processing and ignore this line. - """ - pass - -class CommentLineException(Exception): - """ If the line is a comment (as in the beginning of the trace file), - just ignore it. - """ - pass - - -def parseLine(line): - line =3D line.strip() - if line.startswith("#"): - raise CommentLineException - m =3D re.match("[^]]+?\\] +([a-z.]+) +([0-9.]+): (\\w+) <-(\\w+)", line) - if m is None: - raise BrokenLineException - return (m.group(2), m.group(3), m.group(4)) - - -def main(): - CallTree.ROOT =3D CallTree("Root (Nowhere)", None, None) - tree =3D CallTree.ROOT - - for line in sys.stdin: - try: - calltime, callee, caller =3D parseLine(line) - except BrokenLineException: - break - except CommentLineException: - continue - tree =3D tree.getParent(caller) - tree =3D tree.calls(callee, calltime) - - print(CallTree.ROOT) - -if __name__ =3D=3D "__main__": - main() --=20 2.47.2 From nobody Mon Feb 9 12:00:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 90387204C00 for ; Sun, 23 Mar 2025 12:29:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732950; cv=none; b=dMhHNKl9iWZFdQcUiSXO4DqGC5uDnbWO8wMs8PSwwvpijdIFM1BeTV71WynVxt7feAhrmz/PL/27bNRugYTdTcWZ7PBtyW5fn0Is1/RAYhcvVfT6WQ9vwTA3sJo14DMIxiEb2j0JdNssTFAcUiJD+Nujk0xtBXGaZ72THvlRr1k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732950; c=relaxed/simple; bh=7h63btXGzhfMzbY5uYxN9Me1NcMrRXNldjL3B37vY2k=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Y42EPJyhmOR/p/4ofTgrIiO1hKgDGRTH/XzuDm3a/mofmH5SywPYXwT3SGbS/g7ylBe4mqpoM7Xtgf1aq3AM/PD1kka/KR/mDxJSpTCNyLK4xgRhT5M0z0Upx69KHz464bHi1OuPcz6kNeI7Q3UtsAAWEqY/dvB0jPixvj517W0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20AA0C4CEED; Sun, 23 Mar 2025 12:29:10 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1twKSb-00000001yeG-2DgJ; Sun, 23 Mar 2025 08:29:49 -0400 Message-ID: <20250323122949.379865816@goodmis.org> User-Agent: quilt/0.68 Date: Sun, 23 Mar 2025 08:29:35 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Christophe JAILLET Subject: [for-next][PATCH 02/10] tracing: Constify struct event_trigger_ops References: <20250323122933.407277911@goodmis.org> 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: Christophe JAILLET 'event_trigger_ops mwifiex_if_ops' are not modified in these drivers. Constifying these structures moves some data to a read-only section, so increase overall security, especially when the structure holds some function pointers. On a x86_64, with allmodconfig, as an example: Before: =3D=3D=3D=3D=3D=3D text data bss dec hex filename 31368 9024 6200 46592 b600 kernel/trace/trace_events_trigger.o After: =3D=3D=3D=3D=3D text data bss dec hex filename 31752 8608 6200 46560 b5e0 kernel/trace/trace_events_trigger.o Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Link: https://lore.kernel.org/66e8f990e649678e4be37d4d1a19158ca0dea2f4.1741= 521295.git.christophe.jaillet@wanadoo.fr Signed-off-by: Christophe JAILLET Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace.h | 4 +-- kernel/trace/trace_eprobe.c | 6 ++--- kernel/trace/trace_events_hist.c | 20 +++++++-------- kernel/trace/trace_events_trigger.c | 38 ++++++++++++++--------------- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 9c21ba45b7af..880cf9abc055 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -1714,7 +1714,7 @@ struct event_trigger_data { unsigned long count; int ref; int flags; - struct event_trigger_ops *ops; + const struct event_trigger_ops *ops; struct event_command *cmd_ops; struct event_filter __rcu *filter; char *filter_str; @@ -1959,7 +1959,7 @@ struct event_command { int (*set_filter)(char *filter_str, struct event_trigger_data *data, struct trace_event_file *file); - struct event_trigger_ops *(*get_trigger_ops)(char *cmd, char *param); + const struct event_trigger_ops *(*get_trigger_ops)(char *cmd, char *param= ); }; =20 /** diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c index 82fd637cfc19..c1cc2fe54887 100644 --- a/kernel/trace/trace_eprobe.c +++ b/kernel/trace/trace_eprobe.c @@ -478,7 +478,7 @@ static void eprobe_trigger_func(struct event_trigger_da= ta *data, __eprobe_trace_func(edata, rec); } =20 -static struct event_trigger_ops eprobe_trigger_ops =3D { +static const struct event_trigger_ops eprobe_trigger_ops =3D { .trigger =3D eprobe_trigger_func, .print =3D eprobe_trigger_print, .init =3D eprobe_trigger_init, @@ -507,8 +507,8 @@ static void eprobe_trigger_unreg_func(char *glob, =20 } =20 -static struct event_trigger_ops *eprobe_trigger_get_ops(char *cmd, - char *param) +static const struct event_trigger_ops *eprobe_trigger_get_ops(char *cmd, + char *param) { return &eprobe_trigger_ops; } diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_h= ist.c index 261163b00137..d3c4880fa8b1 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -6191,7 +6191,7 @@ static void event_hist_trigger_free(struct event_trig= ger_data *data) } } =20 -static struct event_trigger_ops event_hist_trigger_ops =3D { +static const struct event_trigger_ops event_hist_trigger_ops =3D { .trigger =3D event_hist_trigger, .print =3D event_hist_trigger_print, .init =3D event_hist_trigger_init, @@ -6223,15 +6223,15 @@ static void event_hist_trigger_named_free(struct ev= ent_trigger_data *data) } } =20 -static struct event_trigger_ops event_hist_trigger_named_ops =3D { +static const struct event_trigger_ops event_hist_trigger_named_ops =3D { .trigger =3D event_hist_trigger, .print =3D event_hist_trigger_print, .init =3D event_hist_trigger_named_init, .free =3D event_hist_trigger_named_free, }; =20 -static struct event_trigger_ops *event_hist_get_trigger_ops(char *cmd, - char *param) +static const struct event_trigger_ops *event_hist_get_trigger_ops(char *cm= d, + char *param) { return &event_hist_trigger_ops; } @@ -6826,38 +6826,38 @@ hist_enable_count_trigger(struct event_trigger_data= *data, hist_enable_trigger(data, buffer, rec, event); } =20 -static struct event_trigger_ops hist_enable_trigger_ops =3D { +static const struct event_trigger_ops hist_enable_trigger_ops =3D { .trigger =3D hist_enable_trigger, .print =3D event_enable_trigger_print, .init =3D event_trigger_init, .free =3D event_enable_trigger_free, }; =20 -static struct event_trigger_ops hist_enable_count_trigger_ops =3D { +static const struct event_trigger_ops hist_enable_count_trigger_ops =3D { .trigger =3D hist_enable_count_trigger, .print =3D event_enable_trigger_print, .init =3D event_trigger_init, .free =3D event_enable_trigger_free, }; =20 -static struct event_trigger_ops hist_disable_trigger_ops =3D { +static const struct event_trigger_ops hist_disable_trigger_ops =3D { .trigger =3D hist_enable_trigger, .print =3D event_enable_trigger_print, .init =3D event_trigger_init, .free =3D event_enable_trigger_free, }; =20 -static struct event_trigger_ops hist_disable_count_trigger_ops =3D { +static const struct event_trigger_ops hist_disable_count_trigger_ops =3D { .trigger =3D hist_enable_count_trigger, .print =3D event_enable_trigger_print, .init =3D event_trigger_init, .free =3D event_enable_trigger_free, }; =20 -static struct event_trigger_ops * +static const struct event_trigger_ops * hist_enable_get_trigger_ops(char *cmd, char *param) { - struct event_trigger_ops *ops; + const struct event_trigger_ops *ops; bool enable; =20 enable =3D (strcmp(cmd, ENABLE_HIST_STR) =3D=3D 0); diff --git a/kernel/trace/trace_events_trigger.c b/kernel/trace/trace_event= s_trigger.c index d45448947094..b66b6d235d91 100644 --- a/kernel/trace/trace_events_trigger.c +++ b/kernel/trace/trace_events_trigger.c @@ -825,7 +825,7 @@ struct event_trigger_data *event_trigger_alloc(struct e= vent_command *cmd_ops, void *private_data) { struct event_trigger_data *trigger_data; - struct event_trigger_ops *trigger_ops; + const struct event_trigger_ops *trigger_ops; =20 trigger_ops =3D cmd_ops->get_trigger_ops(cmd, param); =20 @@ -1367,38 +1367,38 @@ traceoff_trigger_print(struct seq_file *m, struct e= vent_trigger_data *data) data->filter_str); } =20 -static struct event_trigger_ops traceon_trigger_ops =3D { +static const struct event_trigger_ops traceon_trigger_ops =3D { .trigger =3D traceon_trigger, .print =3D traceon_trigger_print, .init =3D event_trigger_init, .free =3D event_trigger_free, }; =20 -static struct event_trigger_ops traceon_count_trigger_ops =3D { +static const struct event_trigger_ops traceon_count_trigger_ops =3D { .trigger =3D traceon_count_trigger, .print =3D traceon_trigger_print, .init =3D event_trigger_init, .free =3D event_trigger_free, }; =20 -static struct event_trigger_ops traceoff_trigger_ops =3D { +static const struct event_trigger_ops traceoff_trigger_ops =3D { .trigger =3D traceoff_trigger, .print =3D traceoff_trigger_print, .init =3D event_trigger_init, .free =3D event_trigger_free, }; =20 -static struct event_trigger_ops traceoff_count_trigger_ops =3D { +static const struct event_trigger_ops traceoff_count_trigger_ops =3D { .trigger =3D traceoff_count_trigger, .print =3D traceoff_trigger_print, .init =3D event_trigger_init, .free =3D event_trigger_free, }; =20 -static struct event_trigger_ops * +static const struct event_trigger_ops * onoff_get_trigger_ops(char *cmd, char *param) { - struct event_trigger_ops *ops; + const struct event_trigger_ops *ops; =20 /* we register both traceon and traceoff to this callback */ if (strcmp(cmd, "traceon") =3D=3D 0) @@ -1491,21 +1491,21 @@ snapshot_trigger_print(struct seq_file *m, struct e= vent_trigger_data *data) data->filter_str); } =20 -static struct event_trigger_ops snapshot_trigger_ops =3D { +static const struct event_trigger_ops snapshot_trigger_ops =3D { .trigger =3D snapshot_trigger, .print =3D snapshot_trigger_print, .init =3D event_trigger_init, .free =3D event_trigger_free, }; =20 -static struct event_trigger_ops snapshot_count_trigger_ops =3D { +static const struct event_trigger_ops snapshot_count_trigger_ops =3D { .trigger =3D snapshot_count_trigger, .print =3D snapshot_trigger_print, .init =3D event_trigger_init, .free =3D event_trigger_free, }; =20 -static struct event_trigger_ops * +static const struct event_trigger_ops * snapshot_get_trigger_ops(char *cmd, char *param) { return param ? &snapshot_count_trigger_ops : &snapshot_trigger_ops; @@ -1586,21 +1586,21 @@ stacktrace_trigger_print(struct seq_file *m, struct= event_trigger_data *data) data->filter_str); } =20 -static struct event_trigger_ops stacktrace_trigger_ops =3D { +static const struct event_trigger_ops stacktrace_trigger_ops =3D { .trigger =3D stacktrace_trigger, .print =3D stacktrace_trigger_print, .init =3D event_trigger_init, .free =3D event_trigger_free, }; =20 -static struct event_trigger_ops stacktrace_count_trigger_ops =3D { +static const struct event_trigger_ops stacktrace_count_trigger_ops =3D { .trigger =3D stacktrace_count_trigger, .print =3D stacktrace_trigger_print, .init =3D event_trigger_init, .free =3D event_trigger_free, }; =20 -static struct event_trigger_ops * +static const struct event_trigger_ops * stacktrace_get_trigger_ops(char *cmd, char *param) { return param ? &stacktrace_count_trigger_ops : &stacktrace_trigger_ops; @@ -1711,28 +1711,28 @@ void event_enable_trigger_free(struct event_trigger= _data *data) } } =20 -static struct event_trigger_ops event_enable_trigger_ops =3D { +static const struct event_trigger_ops event_enable_trigger_ops =3D { .trigger =3D event_enable_trigger, .print =3D event_enable_trigger_print, .init =3D event_trigger_init, .free =3D event_enable_trigger_free, }; =20 -static struct event_trigger_ops event_enable_count_trigger_ops =3D { +static const struct event_trigger_ops event_enable_count_trigger_ops =3D { .trigger =3D event_enable_count_trigger, .print =3D event_enable_trigger_print, .init =3D event_trigger_init, .free =3D event_enable_trigger_free, }; =20 -static struct event_trigger_ops event_disable_trigger_ops =3D { +static const struct event_trigger_ops event_disable_trigger_ops =3D { .trigger =3D event_enable_trigger, .print =3D event_enable_trigger_print, .init =3D event_trigger_init, .free =3D event_enable_trigger_free, }; =20 -static struct event_trigger_ops event_disable_count_trigger_ops =3D { +static const struct event_trigger_ops event_disable_count_trigger_ops =3D { .trigger =3D event_enable_count_trigger, .print =3D event_enable_trigger_print, .init =3D event_trigger_init, @@ -1916,10 +1916,10 @@ void event_enable_unregister_trigger(char *glob, data->ops->free(data); } =20 -static struct event_trigger_ops * +static const struct event_trigger_ops * event_enable_get_trigger_ops(char *cmd, char *param) { - struct event_trigger_ops *ops; + const struct event_trigger_ops *ops; bool enable; =20 #ifdef CONFIG_HIST_TRIGGERS --=20 2.47.2 From nobody Mon Feb 9 12:00:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CAECE2054E8 for ; Sun, 23 Mar 2025 12:29:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732950; cv=none; b=gUs/HxKHbkkzqp5wDUkZUzIWYxfxKdpKklezmNpNYACyWdHyE7Wfu8GXfJbIcLFV3Mv8KMY5w32hZg0DVCnCYU1Z0/f3NJ+bvIs3qqy8M+xezpSv1s3IR+6TmlHjfUQfhMtFimPEaNwV7LlCcUb4MUN1yKtbKfwtaZxvXkR1b+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732950; c=relaxed/simple; bh=Uwb4Lb9eyabuPAjwq6WajlQAHEed0Uk9bkWZRPTAICg=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=SlSMdFEBAuhiox0f8ow0TDGLta3FrGUbHuakDk6N7tNip/NzPOXjQsgWqrSqK8VMeKbLBh8Z1Y9c2+eEzSSynlBjh5bNgdAEpTn6CigVxqn0LWRwrLbp3jXylG/S0QmptBGS6r1zy0hgjAttcSUDQdghCurdsGRt4vk45DNiL94= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FD53C4CEE8; Sun, 23 Mar 2025 12:29:10 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1twKSb-00000001yek-2wx1; Sun, 23 Mar 2025 08:29:49 -0400 Message-ID: <20250323122949.551203678@goodmis.org> User-Agent: quilt/0.68 Date: Sun, 23 Mar 2025 08:29:36 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Huang Shijie Subject: [for-next][PATCH 03/10] tracepoint: Print the function symbol when tracepoint_debug is set References: <20250323122933.407277911@goodmis.org> 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: Huang Shijie When tracepoint_debug is set, we may get the output in kernel log: [ 380.013843] Probe 0 : 00000000f0d68cda It is not readable, so change to print the function symbol. After this patch, the output may becomes: [ 55.225555] Probe 0 : perf_trace_sched_wakeup_template+0x0/0x20 Link: https://lore.kernel.org/20250307033858.4134-1-shijie@os.amperecomputi= ng.com Signed-off-by: Huang Shijie Signed-off-by: Steven Rostedt (Google) --- kernel/tracepoint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c index 1848ce7e2976..62719d2941c9 100644 --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c @@ -127,7 +127,7 @@ static void debug_print_probes(struct tracepoint_func *= funcs) return; =20 for (i =3D 0; funcs[i].func; i++) - printk(KERN_DEBUG "Probe %d : %p\n", i, funcs[i].func); + printk(KERN_DEBUG "Probe %d : %pSb\n", i, funcs[i].func); } =20 static struct tracepoint_func * --=20 2.47.2 From nobody Mon Feb 9 12:00:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2286F205AC6 for ; Sun, 23 Mar 2025 12:29:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732951; cv=none; b=s9o+MBWXgngNLRiZCvpaojzJ392rAR154P0lCMTHQCVYHElHdeJSwoizA+C/C1dqKLfkPg5P6CUevA/WOCYg4iXCPdywmJsHpbXBIerWAyQr/IBaOhIGKz/j8rkACxmjPOMBuu8uCXFvx7SkIZj7XJ45PQXGLZFS8pQjLOM+ssk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732951; c=relaxed/simple; bh=cd3LNfemcSgCououTTCnVgTcEGfS6qWC5kUBf/M2nhE=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=h3ngJblhM3jr8kbrVUhzuO86iSdgYLSNR/gFVeKpjU/fAxZTG8Ix0NjtClXNo1ySZ7VEH/zjrFHJFt9IQv0TZVrxQw71+u4buHf7e2x0ogfGA8Q0XbeDJ5F+iQTW6pr8M+vNUgTWPqjRUYhYO8q5VHqhYAPBZ0SypAyrQfWL5EA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A1F1C4CEEF; Sun, 23 Mar 2025 12:29:10 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1twKSb-00000001yfE-3f7f; Sun, 23 Mar 2025 08:29:49 -0400 Message-ID: <20250323122949.723796800@goodmis.org> User-Agent: quilt/0.68 Date: Sun, 23 Mar 2025 08:29:37 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Michael Petlan , Veronika Molnarova , Suren Baghdasaryan , Rasmus Villemoes , Andy Shevchenko , Tamir Duberstein , Linus Torvalds , Petr Mladek Subject: [for-next][PATCH 04/10] tracing: gfp: vsprintf: Do not print "none" when using %pGg printf format References: <20250323122933.407277911@goodmis.org> 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: Petr Mladek The commit ca29a0bf122145 ("tracing: gfp: Remove duplication of recording GFP flags") caused the following regression in printf_test selftest: [ 46.208199] test_printf: kvasprintf(..., "%pGg", ...) returned 'none|0xf= c000000', expected '0xfc000000' [ 46.208209] test_printf: kvasprintf(..., "%pGg", ...) returned '__GFP_HI= GH|none|0xfc000000', expected '__GFP_HIGH|0xfc000000' The problem is the new '{ 0, "none" }' entry in __def_gfpflag_names macro and the following code: char *format_flags(char *buf, char *end, unsigned long flags, const struct trace_print_flags *names) { [...] if ((flags & mask) !=3D mask) continue; [...] } The purpose of the code is to print the name of a mask instead of bits, for example, printk "GFP_ZONEMASK", instead of "__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE". Unfortunately, the mask "0" pass this check and "none" is always printed. A solution would be to move TRACE_GFP_FLAGS up so that it is not the last entry. But it breaks the rule that named masks must be defined before names of single bytes. Otherwise, it would print the names of the bytes instead of the mask. Instead, replace '{ 0, "none" }' with '{ 0, NULL }'. It works because __def_gfpflag_names defines a standalone array and this is the standard trailing entry. The code processing these arrays always ends the cycle when flag->name =3D=3D NULL. Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Cc: Andrew Morton Cc: Michael Petlan Cc: Veronika Molnarova Cc: Suren Baghdasaryan Cc: Rasmus Villemoes Cc: Andy Shevchenko Cc: Tamir Duberstein Cc: Linus Torvalds Link: https://lore.kernel.org/Z9Q5d11ZbA3CNMZm@pathway.suse.cz Fixes: ca29a0bf122145 ("tracing: gfp: Remove duplication of recording GFP f= lags") Signed-off-by: Petr Mladek Signed-off-by: Steven Rostedt (Google) --- include/trace/events/mmflags.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index 82371177ef79..15aae955a10b 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -101,7 +101,7 @@ TRACE_DEFINE_ENUM(___GFP_LAST_BIT); gfpflag_string(GFP_DMA32), \ gfpflag_string(__GFP_RECLAIM), \ TRACE_GFP_FLAGS \ - { 0, "none" } + { 0, NULL } =20 #define show_gfp_flags(flags) \ (flags) ? __print_flags(flags, "|", __def_gfpflag_names \ --=20 2.47.2 From nobody Mon Feb 9 12:00:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 23FF7205AC7 for ; Sun, 23 Mar 2025 12:29:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732951; cv=none; b=m7Fqic18Dr84cx4kXkdw8fnk6a7PUdLgOsIortbAsA35lHl0bhZKEhUTGO08JN1TxNO+GP3UvjSfPFATocBSq83p0hrM8J36OYuCz8w+n5BZh0FNZ08gmLLdOyqr+skSO7LMzatrX0I5wEtiVtZ9yB8kVPJseydKmG0357m2Bbg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732951; c=relaxed/simple; bh=i5XarV9KCEDCcdJI/pujoKeQy3eMNiCv9+BoZzU3Qhk=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=R09GCoN+meW/FaDP425n/nqmO9FmujZWXd/K2W3oLc6Kp40G19kMHP7dh5A0XNtk5L33aoIZ8jEmkbkYN/XzylA5ilSwcNA1jEiQrNsA4GyBpvbtahEMFsu5fnK0dCFxkl1KX+lmDhApduTDXXfUtwABPYD4TQP1/puXU7BePn8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4161C4CEED; Sun, 23 Mar 2025 12:29:10 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1twKSc-00000001yfi-09sb; Sun, 23 Mar 2025 08:29:50 -0400 Message-ID: <20250323122949.894511377@goodmis.org> User-Agent: quilt/0.68 Date: Sun, 23 Mar 2025 08:29:38 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Sasha Levin Subject: [for-next][PATCH 05/10] tracing: Use hashtable.h for event_hash References: <20250323122933.407277911@goodmis.org> 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: Sasha Levin Convert the event_hash array in trace_output.c to use the generic hashtable implementation from hashtable.h instead of the manually implemented hash table. This simplifies the code and makes it more maintainable by using the standard hashtable API defined in hashtable.h. Rename EVENT_HASHSIZE to EVENT_HASH_BITS to properly reflect its new meaning as the number of bits for the hashtable size. Link: https://lore.kernel.org/20250319190545.3058319-1-sashal@kernel.org Signed-off-by: Sasha Levin Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_output.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 03d56f711ad1..3144d020e6c6 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -12,15 +12,16 @@ #include #include #include +#include =20 #include "trace_output.h" =20 -/* must be a power of 2 */ -#define EVENT_HASHSIZE 128 +/* 2^7 =3D 128 */ +#define EVENT_HASH_BITS 7 =20 DECLARE_RWSEM(trace_event_sem); =20 -static struct hlist_head event_hash[EVENT_HASHSIZE] __read_mostly; +static DEFINE_HASHTABLE(event_hash, EVENT_HASH_BITS); =20 enum print_line_t trace_print_bputs_msg_only(struct trace_iterator *iter) { @@ -694,11 +695,8 @@ int trace_print_lat_context(struct trace_iterator *ite= r) struct trace_event *ftrace_find_event(int type) { struct trace_event *event; - unsigned key; =20 - key =3D type & (EVENT_HASHSIZE - 1); - - hlist_for_each_entry(event, &event_hash[key], node) { + hash_for_each_possible(event_hash, event, node, type) { if (event->type =3D=3D type) return event; } @@ -753,7 +751,6 @@ void trace_event_read_unlock(void) */ int register_trace_event(struct trace_event *event) { - unsigned key; int ret =3D 0; =20 down_write(&trace_event_sem); @@ -786,9 +783,7 @@ int register_trace_event(struct trace_event *event) if (event->funcs->binary =3D=3D NULL) event->funcs->binary =3D trace_nop_print; =20 - key =3D event->type & (EVENT_HASHSIZE - 1); - - hlist_add_head(&event->node, &event_hash[key]); + hash_add(event_hash, &event->node, event->type); =20 ret =3D event->type; out: @@ -803,7 +798,7 @@ EXPORT_SYMBOL_GPL(register_trace_event); */ int __unregister_trace_event(struct trace_event *event) { - hlist_del(&event->node); + hash_del(&event->node); free_trace_event_type(event->type); return 0; } --=20 2.47.2 From nobody Mon Feb 9 12:00:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 38ADE205E09 for ; Sun, 23 Mar 2025 12:29:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732951; cv=none; b=OTGtjDKS3A7XeekpjVpL+QGFaNqfnQCs9UVaKePJbaGfi6oeXlOJcmSQaFzKQq/xruFbs5dNTnDtPo7c+PFKjSPO+UWdFsg9tMLZCPWRfSG3udlFIiXgnGw9mj4EHu134Hum4k70suHJK+JJJg05/Y7U4z/cBsOMEc+kC8KRiL8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732951; c=relaxed/simple; bh=/yXhofCAGEzzJEbCcqOQZFRFpTHBKM2oi283WB+2IM4=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=rN847L0oW0mafvlh63z6dAWj20wnX0CxdpEqc5IVLbhXdNP2lyl8GqlHIbqnMQCOGFq5yJeW30kOiqgSfWLhpv0OB3ScxfCwYBqUm45HQf5Ll3qMnugQOPQTIDtLNseGlzcAZd5KDBHfk/Sp9eZOHGwPWyr+OHD0/7IeI1Ulg14= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2427C4CEF3; Sun, 23 Mar 2025 12:29:10 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1twKSc-00000001ygC-0rMX; Sun, 23 Mar 2025 08:29:50 -0400 Message-ID: <20250323122950.059768296@goodmis.org> User-Agent: quilt/0.68 Date: Sun, 23 Mar 2025 08:29:39 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Douglas Raillard Subject: [for-next][PATCH 06/10] tracing: Align synth event print fmt References: <20250323122933.407277911@goodmis.org> 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: Douglas Raillard The vast majority of ftrace event print fmt consist of a space-separated field=3Dvalue pair. Synthetic event currently use a comma-separated field=3Dvalue pair, which sticks out from events created via more classical means. Align the format of synth events so they look just like any other event, for better consistency and less headache when doing crude text-based data processing. Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Link: https://lore.kernel.org/20250319215028.1680278-1-douglas.raillard@arm= .com Signed-off-by: Douglas Raillard Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_events_synth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_= synth.c index e3f7d09e5512..07ff8be8267e 100644 --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -612,7 +612,7 @@ static int __set_synth_event_print_fmt(struct synth_eve= nt *event, fmt =3D synth_field_fmt(event->fields[i]->type); pos +=3D snprintf(buf + pos, LEN_OR_ZERO, "%s=3D%s%s", event->fields[i]->name, fmt, - i =3D=3D event->n_fields - 1 ? "" : ", "); + i =3D=3D event->n_fields - 1 ? "" : " "); } pos +=3D snprintf(buf + pos, LEN_OR_ZERO, "\""); =20 --=20 2.47.2 From nobody Mon Feb 9 12:00:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 12D37205509; Sun, 23 Mar 2025 12:29:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732951; cv=none; b=hHtqyuly7HM/dVMK8Yd3WJrxPYig71QToL3uGf4ZopKiGJPe4/xGvlVI8FIq1JJ/kqTgFcHpQd8TuydJ9Z7bUh5GAGLMbI28OmNikfo6wqJswq4UMo3IrJVHxbZIQUJ1EDrFnXF2IYxDFAs5uAXJ8ofqT4db5yUOYK7WqOA2WaQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732951; c=relaxed/simple; bh=CkrBHiN5ZuIDl8W7bZl9s8bI76KmJujKfjx/76h1sBc=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=dtmaIPq2YGYn2K643dtklUoMWHXYbnn2rHuxpDNUswtdFJEKtJk8dEiXZAW0usmc/qIJfr2uxbnMPEJ+VXX2R9498FLmyQf6SB01pyZB6xWLVZXdouG6kBss2TJGmuCezor+BGIf7fkQ3grMmCBY9i/6Z0q2Nsh3WmGdfPnzfAY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB922C4CEF1; Sun, 23 Mar 2025 12:29:10 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1twKSc-00000001ygh-1Zdt; Sun, 23 Mar 2025 08:29:50 -0400 Message-ID: <20250323122950.226477423@goodmis.org> User-Agent: quilt/0.68 Date: Sun, 23 Mar 2025 08:29:40 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , stable@vger.kernel.org, Ran Xiaokai Subject: [for-next][PATCH 07/10] tracing/osnoise: Fix possible recursive locking for cpus_read_lock() References: <20250323122933.407277911@goodmis.org> 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: Ran Xiaokai Lockdep reports this deadlock log: osnoise: could not start sampling thread =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D WARNING: possible recursive locking detected -------------------------------------------- CPU0 ---- lock(cpu_hotplug_lock); lock(cpu_hotplug_lock); Call Trace: print_deadlock_bug+0x282/0x3c0 __lock_acquire+0x1610/0x29a0 lock_acquire+0xcb/0x2d0 cpus_read_lock+0x49/0x120 stop_per_cpu_kthreads+0x7/0x60 start_kthread+0x103/0x120 osnoise_hotplug_workfn+0x5e/0x90 process_one_work+0x44f/0xb30 worker_thread+0x33e/0x5e0 kthread+0x206/0x3b0 ret_from_fork+0x31/0x50 ret_from_fork_asm+0x11/0x20 This is the deadlock scenario: osnoise_hotplug_workfn() guard(cpus_read_lock)(); // first lock call start_kthread(cpu) if (IS_ERR(kthread)) { stop_per_cpu_kthreads(); { cpus_read_lock(); // second lock call. Cause the AA deadlock } } It is not necessary to call stop_per_cpu_kthreads() which stops osnoise kthread for every other CPUs in the system if a failure occurs during hotplug of a certain CPU. For start_per_cpu_kthreads(), if the start_kthread() call fails, this function calls stop_per_cpu_kthreads() to handle the error. Therefore, similarly, there is no need to call stop_per_cpu_kthreads() again within start_kthread(). So just remove stop_per_cpu_kthreads() from start_kthread to solve this iss= ue. Cc: stable@vger.kernel.org Link: https://lore.kernel.org/20250321095249.2739397-1-ranxiaokai627@163.com Fixes: c8895e271f79 ("trace/osnoise: Support hotplug operations") Signed-off-by: Ran Xiaokai Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_osnoise.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c index f3a2722ee4c0..c83a51218ee5 100644 --- a/kernel/trace/trace_osnoise.c +++ b/kernel/trace/trace_osnoise.c @@ -2032,7 +2032,6 @@ static int start_kthread(unsigned int cpu) =20 if (IS_ERR(kthread)) { pr_err(BANNER "could not start sampling thread\n"); - stop_per_cpu_kthreads(); return -ENOMEM; } =20 --=20 2.47.2 From nobody Mon Feb 9 12:00:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 39004205E0A for ; Sun, 23 Mar 2025 12:29:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732951; cv=none; b=ax7Bzig4+mKDQb+tOJkG0YWTgd7J9wRMVwZNxB1Nv9Anop0lJbevqRotd5qHFHInrgo0UIS0yMwTUzZ2sQJ5wX3JI0Lx6Jq86b5diYchJJtkyx9oPzbZFuCBLsB1/wOtlYHN2Cw5oey2nMGlmy1yy73tuu7MXktjuReJUFKT1JE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732951; c=relaxed/simple; bh=6b+1hq0u02rQnD+nc7i3nUA1B1IWhtOUZIFiB9pYoB0=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=bMm54yGUxvESAOWGex5CRPAEMVit2+wAN71xOFDdGLf2/fSz0G/UIjDb7kL+9YwL4CZ+k6b9CAzbA0F4iQBON3ro1fpHeIw8tQRWehs/XeMqR1/g192wpXWy5tSG24DJ7zbuLiHETlT+9iKnt0Z/dqw6q/77PFLI3h1az8z8p5o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EC94C4AF0B; Sun, 23 Mar 2025 12:29:11 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1twKSc-00000001yhC-2Gn5; Sun, 23 Mar 2025 08:29:50 -0400 Message-ID: <20250323122950.397439862@goodmis.org> User-Agent: quilt/0.68 Date: Sun, 23 Mar 2025 08:29:41 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Gabriele Paoloni Subject: [for-next][PATCH 08/10] tracing: fix return value in __ftrace_event_enable_disable for TRACE_REG_UNREGISTER References: <20250323122933.407277911@goodmis.org> 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: Gabriele Paoloni When __ftrace_event_enable_disable invokes the class callback to unregister the event, the return value is not reported up to the caller, hence leading to event unregister failures being silently ignored. This patch assigns the ret variable to the invocation of the event unregister callback, so that its return value is stored and reported to the caller, and it raises a warning in case of error. Link: https://lore.kernel.org/20250321170821.101403-1-gpaoloni@redhat.com Signed-off-by: Gabriele Paoloni Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_events.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 513de9ceb80e..8e7603acca21 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -790,7 +790,9 @@ static int __ftrace_event_enable_disable(struct trace_e= vent_file *file, clear_bit(EVENT_FILE_FL_RECORDED_TGID_BIT, &file->flags); } =20 - call->class->reg(call, TRACE_REG_UNREGISTER, file); + ret =3D call->class->reg(call, TRACE_REG_UNREGISTER, file); + + WARN_ON_ONCE(ret); } /* If in SOFT_MODE, just set the SOFT_DISABLE_BIT, else clear it */ if (file->flags & EVENT_FILE_FL_SOFT_MODE) --=20 2.47.2 From nobody Mon Feb 9 12:00:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 942622066E6; Sun, 23 Mar 2025 12:29:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732951; cv=none; b=kxWyytlYJtPJY8SL2f2/CtGh77UJ2b4FsKsELd0s4I+uCh3es7VxmU2mmxCLxtpuu+H9SHTzjZcgmwyBM4S9lB5ImYYs1+ehNJhIk+9h40Xp72GGTO5ejpWLkyh4lbrRSOOPBGNiNgw3oStEAmW4CyPSDPy08bGv/TXnBhptLJw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732951; c=relaxed/simple; bh=caJWxZ2qGvBRp3vjbDmGUiLOtxKw98Sfx2PvuoPsUMg=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=cdLPkR3lwFV7P6R9LjsDWySa+COWIuQyVJa7lkeQSVCOCzD08CUAkDPDPwNhc3rX96i20hXL2FuSv9JWFKN1NV7fMtqIIoMXufcoZ5+K1BIXMKGrnrpXezfLqype0T+qWcyqQKl/s0Mbfz1KQJidbAaqEQuwB7mAe79ACsCqvjo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CA1DC4CEE2; Sun, 23 Mar 2025 12:29:11 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1twKSc-00000001yhh-2xfT; Sun, 23 Mar 2025 08:29:50 -0400 Message-ID: <20250323122950.561440367@goodmis.org> User-Agent: quilt/0.68 Date: Sun, 23 Mar 2025 08:29:42 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , stable@vger.kernel.org, Douglas Raillard Subject: [for-next][PATCH 09/10] tracing: Ensure module defining synth event cannot be unloaded while tracing References: <20250323122933.407277911@goodmis.org> 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: Douglas Raillard Currently, using synth_event_delete() will fail if the event is being used (tracing in progress), but that is normally done in the module exit function. At that stage, failing is problematic as returning a non-zero status means the module will become locked (impossible to unload or reload again). Instead, ensure the module exit function does not get called in the first place by increasing the module refcnt when the event is enabled. Cc: stable@vger.kernel.org Cc: Mathieu Desnoyers Fixes: 35ca5207c2d11 ("tracing: Add synthetic event command generation func= tions") Link: https://lore.kernel.org/20250318180906.226841-1-douglas.raillard@arm.= com Signed-off-by: Douglas Raillard Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_events_synth.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_= synth.c index 07ff8be8267e..463b0073629a 100644 --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -852,6 +852,34 @@ static struct trace_event_fields synth_event_fields_ar= ray[] =3D { {} }; =20 +static int synth_event_reg(struct trace_event_call *call, + enum trace_reg type, void *data) +{ + struct synth_event *event =3D container_of(call, struct synth_event, call= ); + + switch (type) { + case TRACE_REG_REGISTER: + case TRACE_REG_PERF_REGISTER: + if (!try_module_get(event->mod)) + return -EBUSY; + break; + default: + break; + } + + int ret =3D trace_event_reg(call, type, data); + + switch (type) { + case TRACE_REG_UNREGISTER: + case TRACE_REG_PERF_UNREGISTER: + module_put(event->mod); + break; + default: + break; + } + return ret; +} + static int register_synth_event(struct synth_event *event) { struct trace_event_call *call =3D &event->call; @@ -881,7 +909,7 @@ static int register_synth_event(struct synth_event *eve= nt) goto out; } call->flags =3D TRACE_EVENT_FL_TRACEPOINT; - call->class->reg =3D trace_event_reg; + call->class->reg =3D synth_event_reg; call->class->probe =3D trace_event_raw_event_synth; call->data =3D event; call->tp =3D event->tp; --=20 2.47.2 From nobody Mon Feb 9 12:00:59 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0E31C20C039 for ; Sun, 23 Mar 2025 12:29:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732952; cv=none; b=WMJuqPVOLhwdHFG2fjC//3lx5XI/hDaPSj3vG1e1shV2Plp7C6HdVl6b9spPWZ7Id1KiVoINnJyqOkbpc3tCAxByEJ+bWUlN2IM/m1UjG7i/H71fIQdeusgRuEtw4qkp4BofHqluevemQynCgW90A7d5T6TtCF/pTH1FjRV7aVs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742732952; c=relaxed/simple; bh=kQE7lWjLc5+4FxD4hTC5SbZ6DD1VpQnZCqJXFz/ycLI=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Zscv6N+nRk1LY8ehRuUwwHYECA4MQ/IAhqDxdYf/aNxzNNlDVI3a8Gi1osJTrAggsGZmFB43BVK9SQY5SyfSuEiwmpYX7AflAQD69CLD5iM5rdezKkoM3gA2u5bhSD+8B4Px61PJGcBHMdFCq5jn7sdTdxxcqkHumyc4nld4Z8U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80DCEC4CEF8; Sun, 23 Mar 2025 12:29:11 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1twKSc-00000001yiC-3eEJ; Sun, 23 Mar 2025 08:29:50 -0400 Message-ID: <20250323122950.727283891@goodmis.org> User-Agent: quilt/0.68 Date: Sun, 23 Mar 2025 08:29:43 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Douglas Raillard Subject: [for-next][PATCH 10/10] tracing: Fix synth event printk format for str fields References: <20250323122933.407277911@goodmis.org> 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: Douglas Raillard The printk format for synth event uses "%.*s" to print string fields, but then only passes the pointer part as var arg. Add the missing precision var arg. Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Link: https://lore.kernel.org/20250318180939.227696-1-douglas.raillard@arm.= com Signed-off-by: Douglas Raillard Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_events_synth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_events_synth.c b/kernel/trace/trace_events_= synth.c index 463b0073629a..d91205bc9f61 100644 --- a/kernel/trace/trace_events_synth.c +++ b/kernel/trace/trace_events_synth.c @@ -620,7 +620,8 @@ static int __set_synth_event_print_fmt(struct synth_eve= nt *event, if (event->fields[i]->is_string && event->fields[i]->is_dynamic) pos +=3D snprintf(buf + pos, LEN_OR_ZERO, - ", __get_str(%s)", event->fields[i]->name); + ", (int)__get_dynamic_array_len(%s), __get_str(%s)", + event->fields[i]->name, event->fields[i]->name); else if (event->fields[i]->is_stack) pos +=3D snprintf(buf + pos, LEN_OR_ZERO, ", __get_stacktrace(%s)", event->fields[i]->name); --=20 2.47.2