From nobody Sat Apr 11 22:50:58 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E0D7C19F28 for ; Wed, 3 Aug 2022 13:57:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238324AbiHCN5n (ORCPT ); Wed, 3 Aug 2022 09:57:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238752AbiHCNzw (ORCPT ); Wed, 3 Aug 2022 09:55:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA4D4E030 for ; Wed, 3 Aug 2022 06:55:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5E4AA6156D for ; Wed, 3 Aug 2022 13:55:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C12A1C433D6; Wed, 3 Aug 2022 13:55:38 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1oJEqX-007kQ4-2Q; Wed, 03 Aug 2022 09:55:37 -0400 Message-ID: <20220803135537.585734993@goodmis.org> User-Agent: quilt/0.66 Date: Wed, 03 Aug 2022 09:55:09 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , Zhiqiang Liu Subject: [for-next][PATCH 1/5] tracing: Use free_trace_buffer() in allocate_trace_buffers() References: <20220803135508.240797292@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Zhiqiang Liu In allocate_trace_buffers(), if allocating tr->max_buffer fails, we can directly call free_trace_buffer to free tr->array_buffer. Link: https://lkml.kernel.org/r/65f0702d-07f6-08de-2a07-4c50af56a67b@huawei= .com Signed-off-by: Zhiqiang Liu Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 301305ec134b..27febd4ee33e 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -9101,6 +9101,16 @@ allocate_trace_buffer(struct trace_array *tr, struct= array_buffer *buf, int size return 0; } =20 +static void free_trace_buffer(struct array_buffer *buf) +{ + if (buf->buffer) { + ring_buffer_free(buf->buffer); + buf->buffer =3D NULL; + free_percpu(buf->data); + buf->data =3D NULL; + } +} + static int allocate_trace_buffers(struct trace_array *tr, int size) { int ret; @@ -9113,10 +9123,7 @@ static int allocate_trace_buffers(struct trace_array= *tr, int size) ret =3D allocate_trace_buffer(tr, &tr->max_buffer, allocate_snapshot ? size : 1); if (MEM_FAIL(ret, "Failed to allocate trace buffer\n")) { - ring_buffer_free(tr->array_buffer.buffer); - tr->array_buffer.buffer =3D NULL; - free_percpu(tr->array_buffer.data); - tr->array_buffer.data =3D NULL; + free_trace_buffer(&tr->array_buffer); return -ENOMEM; } tr->allocated_snapshot =3D allocate_snapshot; @@ -9131,16 +9138,6 @@ static int allocate_trace_buffers(struct trace_array= *tr, int size) return 0; } =20 -static void free_trace_buffer(struct array_buffer *buf) -{ - if (buf->buffer) { - ring_buffer_free(buf->buffer); - buf->buffer =3D NULL; - free_percpu(buf->data); - buf->data =3D NULL; - } -} - static void free_trace_buffers(struct trace_array *tr) { if (!tr) --=20 2.35.1 From nobody Sat Apr 11 22:50:58 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A468DC19F2C for ; Wed, 3 Aug 2022 13:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231845AbiHCN4j (ORCPT ); Wed, 3 Aug 2022 09:56:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238751AbiHCNzw (ORCPT ); Wed, 3 Aug 2022 09:55:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 057432A2 for ; Wed, 3 Aug 2022 06:55:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 715756141B for ; Wed, 3 Aug 2022 13:55:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC836C433B5; Wed, 3 Aug 2022 13:55:38 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1oJEqX-007kQd-30; Wed, 03 Aug 2022 09:55:37 -0400 Message-ID: <20220803135537.769811554@goodmis.org> User-Agent: quilt/0.66 Date: Wed, 03 Aug 2022 09:55:10 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , Li zeming Subject: [for-next][PATCH 2/5] tracepoints: It is CONFIG_TRACEPOINTS not CONFIG_TRACEPOINT References: <20220803135508.240797292@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Li zeming When reading this note, CONFIG_TRACEPOINT searches my configuration file, and the result is CONFIG_TRACEPOINTS, the search results are consistent with the following macro definitions. I think it should be repaired. Link: https://lkml.kernel.org/r/20220721081904.3798-1-zeming@nfschina.com Signed-off-by: Li zeming Signed-off-by: Steven Rostedt (Google) --- include/linux/tracepoint.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 28031b15f878..2908cc5ed70e 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -151,7 +151,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(t= racepoint_ptr_t *p) /* * Individual subsystem my have a separate configuration to * enable their tracepoints. By default, this file will create - * the tracepoints if CONFIG_TRACEPOINT is defined. If a subsystem + * the tracepoints if CONFIG_TRACEPOINTS is defined. If a subsystem * wants to be able to disable its tracepoints from being created * it can define NOTRACE before including the tracepoint headers. */ --=20 2.35.1 From nobody Sat Apr 11 22:50:58 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28342C19F28 for ; Wed, 3 Aug 2022 13:56:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238117AbiHCN4m (ORCPT ); Wed, 3 Aug 2022 09:56:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238750AbiHCNzw (ORCPT ); Wed, 3 Aug 2022 09:55:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B4DF101DE for ; Wed, 3 Aug 2022 06:55:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B940F61582 for ; Wed, 3 Aug 2022 13:55:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A6E6C433D7; Wed, 3 Aug 2022 13:55:39 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1oJEqY-007kRB-0M; Wed, 03 Aug 2022 09:55:38 -0400 Message-ID: <20220803135537.946670434@goodmis.org> User-Agent: quilt/0.66 Date: Wed, 03 Aug 2022 09:55:11 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , Slark Xiao Subject: [for-next][PATCH 3/5] scripts/tracing: Fix typo the the in comment References: <20220803135508.240797292@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Slark Xiao Replace 'the the' with 'the' in the comment. Link: https://lkml.kernel.org/r/20220722102907.81949-1-slark_xiao@163.com Signed-off-by: Slark Xiao Signed-off-by: Steven Rostedt (Google) --- scripts/tracing/draw_functrace.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_funct= race.py index 7011fbe003ff..438516bdfb3c 100755 --- a/scripts/tracing/draw_functrace.py +++ b/scripts/tracing/draw_functrace.py @@ -8,7 +8,7 @@ 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 the call time are provided. +calls. Only the functions's names and the call time are provided. =20 Usage: Be sure that you have CONFIG_FUNCTION_TRACER --=20 2.35.1 From nobody Sat Apr 11 22:50:58 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6D25C19F28 for ; Wed, 3 Aug 2022 13:57:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238351AbiHCN5B (ORCPT ); Wed, 3 Aug 2022 09:57:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238779AbiHCNzx (ORCPT ); Wed, 3 Aug 2022 09:55:53 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEB441055C for ; Wed, 3 Aug 2022 06:55:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id F2836CE23A0 for ; Wed, 3 Aug 2022 13:55:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45390C43143; Wed, 3 Aug 2022 13:55:39 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1oJEqY-007kRj-0w; Wed, 03 Aug 2022 09:55:38 -0400 Message-ID: <20220803135538.130965846@goodmis.org> User-Agent: quilt/0.66 Date: Wed, 03 Aug 2022 09:55:12 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , "Masami Hiramatsu (Google)" Subject: [for-next][PATCH 4/5] tracing/eprobe: Show syntax error logs in error_log file References: <20220803135508.240797292@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Masami Hiramatsu (Google)" Show the syntax errors for event probes in error_log file as same as other dynamic events, so that user can understand what is the problem. Link: https://lkml.kernel.org/r/165932113556.2850673.3483079297896607612.st= git@devnote2 Signed-off-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_eprobe.c | 11 +++++++++-- kernel/trace/trace_probe.h | 5 ++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c index a30f21499e81..4a0e9d927443 100644 --- a/kernel/trace/trace_eprobe.c +++ b/kernel/trace/trace_eprobe.c @@ -839,8 +839,11 @@ static int trace_eprobe_tp_update_arg(struct trace_epr= obe *ep, const char *argv[ if (ret) return ret; =20 - if (ep->tp.args[i].code->op =3D=3D FETCH_OP_TP_ARG) + if (ep->tp.args[i].code->op =3D=3D FETCH_OP_TP_ARG) { ret =3D trace_eprobe_tp_arg_update(ep, i); + if (ret) + trace_probe_log_err(0, BAD_ATTACH_ARG); + } =20 return ret; } @@ -880,8 +883,10 @@ static int __trace_eprobe_create(int argc, const char = *argv[]) trace_probe_log_set_index(1); sys_event =3D argv[1]; ret =3D traceprobe_parse_event_name(&sys_event, &sys_name, buf2, 0); - if (!sys_event || !sys_name) + if (!sys_event || !sys_name) { + trace_probe_log_err(0, NO_EVENT_INFO); goto parse_error; + } =20 if (!event) { strscpy(buf1, argv[1], MAX_EVENT_NAME_LEN); @@ -896,6 +901,8 @@ static int __trace_eprobe_create(int argc, const char *= argv[]) =20 if (IS_ERR(ep)) { ret =3D PTR_ERR(ep); + if (ret =3D=3D -ENODEV) + trace_probe_log_err(0, BAD_ATTACH_EVENT); /* This must return -ENOMEM or missing event, else there is a bug */ WARN_ON_ONCE(ret !=3D -ENOMEM && ret !=3D -ENODEV); ep =3D NULL; diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 92cc149af0fd..3b3869ae8cfd 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -442,7 +442,10 @@ extern int traceprobe_define_arg_fields(struct trace_e= vent_call *event_call, C(FAIL_REG_PROBE, "Failed to register probe event"),\ C(DIFF_PROBE_TYPE, "Probe type is different from existing probe"),\ C(DIFF_ARG_TYPE, "Argument type or name is different from existing probe"= ),\ - C(SAME_PROBE, "There is already the exact same probe event"), + C(SAME_PROBE, "There is already the exact same probe event"),\ + C(NO_EVENT_INFO, "This requires both group and event name to attach"),\ + C(BAD_ATTACH_EVENT, "Attached event does not exist"),\ + C(BAD_ATTACH_ARG, "Attached event does not have this field"), =20 #undef C #define C(a, b) TP_ERR_##a --=20 2.35.1 From nobody Sat Apr 11 22:50:58 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB189C19F28 for ; Wed, 3 Aug 2022 13:56:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238348AbiHCN4u (ORCPT ); Wed, 3 Aug 2022 09:56:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238755AbiHCNzw (ORCPT ); Wed, 3 Aug 2022 09:55:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E4E410542 for ; Wed, 3 Aug 2022 06:55:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 01BE86158F for ; Wed, 3 Aug 2022 13:55:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FF78C43141; Wed, 3 Aug 2022 13:55:39 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1oJEqY-007kSH-1W; Wed, 03 Aug 2022 09:55:38 -0400 Message-ID: <20220803135538.312181330@goodmis.org> User-Agent: quilt/0.66 Date: Wed, 03 Aug 2022 09:55:13 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Ingo Molnar , Andrew Morton , David Laight Subject: [for-next][PATCH 5/5] tracing: Use alignof__(struct {type b;}) instead of offsetof() References: <20220803135508.240797292@goodmis.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Steven Rostedt (Google)" Simplify: #define ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;},= b))) with #define ALIGN_STRUCTFIELD(type) __alignof__(struct {type b;}) Which works just the same. Link: https://lore.kernel.org/all/a7d202457150472588df0bd3b7334b3f@AcuMS.ac= ulab.com/ Link: https://lkml.kernel.org/r/20220802154412.513c50e3@gandalf.local.home Suggested-by: David Laight Signed-off-by: Steven Rostedt (Google) --- include/trace/stages/stage4_event_fields.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trace/stages/stage4_event_fields.h b/include/trace/sta= ges/stage4_event_fields.h index 80d34f396555..a8fb25f39a99 100644 --- a/include/trace/stages/stage4_event_fields.h +++ b/include/trace/stages/stage4_event_fields.h @@ -2,7 +2,7 @@ =20 /* Stage 4 definitions for creating trace events */ =20 -#define ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;}, = b))) +#define ALIGN_STRUCTFIELD(type) ((int)(__alignof__(struct {type b;}))) =20 #undef __field_ext #define __field_ext(_type, _item, _filter_type) { \ --=20 2.35.1