From nobody Mon Apr 6 11:53:32 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 0B0ACC07E9D for ; Tue, 27 Sep 2022 16:01:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232550AbiI0QBo (ORCPT ); Tue, 27 Sep 2022 12:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232316AbiI0QBf (ORCPT ); Tue, 27 Sep 2022 12:01:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43F3658531 for ; Tue, 27 Sep 2022 09:01:32 -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 D16DB61A25 for ; Tue, 27 Sep 2022 16:01:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40348C433D7; Tue, 27 Sep 2022 16:01:31 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2f-00G2na-26; Tue, 27 Sep 2022 12:02:41 -0400 Message-ID: <20220927160241.258139610@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:17 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Tzvetomir Stoyanov , Ingo Molnar , "Masami Hiramatsu (Google)" Subject: [for-next][PATCH 01/20] tracing/eprobe: Add eprobe filter support References: <20220927160216.349640304@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)" Add the filter option to the event probe. This is useful if user wants to derive a new event based on the condition of the original event. E.g. echo 'e:egroup/stat_runtime_4core sched/sched_stat_runtime \ runtime=3D$runtime:u32 if cpu < 4' >> ../dynamic_events Then it can filter the events only on first 4 cores. Note that the fields used for 'if' must be the fields in the original events, not eprobe events. Link: https://lkml.kernel.org/r/165932114513.2850673.2592206685744598080.st= git@devnote2 Cc: Tzvetomir Stoyanov Cc: Ingo Molnar Signed-off-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_eprobe.c | 104 +++++++++++++++++++++++++++++++++--- kernel/trace/trace_probe.h | 3 +- 2 files changed, 98 insertions(+), 9 deletions(-) diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c index 1783e3478912..78299d3724a2 100644 --- a/kernel/trace/trace_eprobe.c +++ b/kernel/trace/trace_eprobe.c @@ -26,6 +26,9 @@ struct trace_eprobe { /* tracepoint event */ const char *event_name; =20 + /* filter string for the tracepoint */ + char *filter_str; + struct trace_event_call *event; =20 struct dyn_event devent; @@ -664,14 +667,15 @@ static struct event_trigger_data * new_eprobe_trigger(struct trace_eprobe *ep, struct trace_event_file *file) { struct event_trigger_data *trigger; + struct event_filter *filter =3D NULL; struct eprobe_data *edata; + int ret; =20 edata =3D kzalloc(sizeof(*edata), GFP_KERNEL); trigger =3D kzalloc(sizeof(*trigger), GFP_KERNEL); if (!trigger || !edata) { - kfree(edata); - kfree(trigger); - return ERR_PTR(-ENOMEM); + ret =3D -ENOMEM; + goto error; } =20 trigger->flags =3D EVENT_TRIGGER_FL_PROBE; @@ -686,13 +690,25 @@ new_eprobe_trigger(struct trace_eprobe *ep, struct tr= ace_event_file *file) trigger->cmd_ops =3D &event_trigger_cmd; =20 INIT_LIST_HEAD(&trigger->list); - RCU_INIT_POINTER(trigger->filter, NULL); + + if (ep->filter_str) { + ret =3D create_event_filter(file->tr, file->event_call, + ep->filter_str, false, &filter); + if (ret) + goto error; + } + RCU_INIT_POINTER(trigger->filter, filter); =20 edata->file =3D file; edata->ep =3D ep; trigger->private_data =3D edata; =20 return trigger; +error: + free_event_filter(filter); + kfree(edata); + kfree(trigger); + return ERR_PTR(ret); } =20 static int enable_eprobe(struct trace_eprobe *ep, @@ -726,6 +742,7 @@ static int disable_eprobe(struct trace_eprobe *ep, { struct event_trigger_data *trigger =3D NULL, *iter; struct trace_event_file *file; + struct event_filter *filter; struct eprobe_data *edata; =20 file =3D find_event_file(tr, ep->event_system, ep->event_name); @@ -752,6 +769,10 @@ static int disable_eprobe(struct trace_eprobe *ep, /* Make sure nothing is using the edata or trigger */ tracepoint_synchronize_unregister(); =20 + filter =3D rcu_access_pointer(trigger->filter); + + if (filter) + free_event_filter(filter); kfree(edata); kfree(trigger); =20 @@ -927,12 +948,62 @@ static int trace_eprobe_tp_update_arg(struct trace_ep= robe *ep, const char *argv[ return ret; } =20 +static int trace_eprobe_parse_filter(struct trace_eprobe *ep, int argc, co= nst char *argv[]) +{ + struct event_filter *dummy; + int i, ret, len =3D 0; + char *p; + + if (argc =3D=3D 0) { + trace_probe_log_err(0, NO_EP_FILTER); + return -EINVAL; + } + + /* Recover the filter string */ + for (i =3D 0; i < argc; i++) + len +=3D strlen(argv[i]) + 1; + + ep->filter_str =3D kzalloc(len, GFP_KERNEL); + if (!ep->filter_str) + return -ENOMEM; + + p =3D ep->filter_str; + for (i =3D 0; i < argc; i++) { + ret =3D snprintf(p, len, "%s ", argv[i]); + if (ret < 0) + goto error; + if (ret > len) { + ret =3D -E2BIG; + goto error; + } + p +=3D ret; + len -=3D ret; + } + p[-1] =3D '\0'; + + /* + * Ensure the filter string can be parsed correctly. Note, this + * filter string is for the original event, not for the eprobe. + */ + ret =3D create_event_filter(top_trace_array(), ep->event, ep->filter_str, + true, &dummy); + free_event_filter(dummy); + if (ret) + goto error; + + return 0; +error: + kfree(ep->filter_str); + ep->filter_str =3D NULL; + return ret; +} + static int __trace_eprobe_create(int argc, const char *argv[]) { /* * Argument syntax: - * e[:[GRP/][ENAME]] SYSTEM.EVENT [FETCHARGS] - * Fetch args: + * e[:[GRP/][ENAME]] SYSTEM.EVENT [FETCHARGS] [if FILTER] + * Fetch args (no space): * =3D$[:TYPE] */ const char *event =3D NULL, *group =3D EPROBE_EVENT_SYSTEM; @@ -942,8 +1013,8 @@ static int __trace_eprobe_create(int argc, const char = *argv[]) char buf1[MAX_EVENT_NAME_LEN]; char buf2[MAX_EVENT_NAME_LEN]; char gbuf[MAX_EVENT_NAME_LEN]; - int ret =3D 0; - int i; + int ret =3D 0, filter_idx =3D 0; + int i, filter_cnt; =20 if (argc < 2 || argv[0][0] !=3D 'e') return -ECANCELED; @@ -973,6 +1044,15 @@ static int __trace_eprobe_create(int argc, const char= *argv[]) event =3D buf1; } =20 + for (i =3D 2; i < argc; i++) { + if (!strcmp(argv[i], "if")) { + filter_idx =3D i + 1; + filter_cnt =3D argc - filter_idx; + argc =3D i; + break; + } + } + mutex_lock(&event_mutex); event_call =3D find_and_get_event(sys_name, sys_event); ep =3D alloc_event_probe(group, event, event_call, argc - 2); @@ -988,6 +1068,14 @@ static int __trace_eprobe_create(int argc, const char= *argv[]) goto error; } =20 + if (filter_idx) { + trace_probe_log_set_index(filter_idx); + ret =3D trace_eprobe_parse_filter(ep, filter_cnt, argv + filter_idx); + if (ret) + goto parse_error; + } else + ep->filter_str =3D NULL; + argc -=3D 2; argv +=3D 2; /* parse arguments */ for (i =3D 0; i < argc && i < MAX_TRACE_ARGS; i++) { diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h index 3b3869ae8cfd..de38f1c03776 100644 --- a/kernel/trace/trace_probe.h +++ b/kernel/trace/trace_probe.h @@ -445,7 +445,8 @@ extern int traceprobe_define_arg_fields(struct trace_ev= ent_call *event_call, 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"), + C(BAD_ATTACH_ARG, "Attached event does not have this field"),\ + C(NO_EP_FILTER, "No filter rule after 'if'"), =20 #undef C #define C(a, b) TP_ERR_##a --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 092E6C54EE9 for ; Tue, 27 Sep 2022 16:01:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232559AbiI0QBr (ORCPT ); Tue, 27 Sep 2022 12:01:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232323AbiI0QBh (ORCPT ); Tue, 27 Sep 2022 12:01:37 -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 8732B114B for ; Tue, 27 Sep 2022 09:01:32 -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 22DCE61A85 for ; Tue, 27 Sep 2022 16:01:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DABEC43140; Tue, 27 Sep 2022 16:01:31 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2g-00G2o8-0M; Tue, 27 Sep 2022 12:02:42 -0400 Message-ID: <20220927160241.746173925@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:18 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Tzvetomir Stoyanov , Ingo Molnar , "Masami Hiramatsu (Google)" Subject: [for-next][PATCH 02/20] selftests/ftrace: Add eprobe syntax error testcase References: <20220927160216.349640304@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)" Add a syntax error test case for eprobe as same as kprobes. Link: https://lkml.kernel.org/r/165932115471.2850673.8014722990775242727.st= git@devnote2 Cc: Tzvetomir Stoyanov Cc: Ingo Molnar Signed-off-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- .../test.d/dynevent/eprobes_syntax_errors.tc | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/dynevent/eprobes_= syntax_errors.tc diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/eprobes_syntax_= errors.tc b/tools/testing/selftests/ftrace/test.d/dynevent/eprobes_syntax_e= rrors.tc new file mode 100644 index 000000000000..fc1daac7f066 --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/dynevent/eprobes_syntax_errors.= tc @@ -0,0 +1,27 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Event probe event parser error log check +# requires: dynamic_events events/syscalls/sys_enter_openat ". []":README error_log + +check_error() { # command-with-error-pos-by-^ + ftrace_errlog_check 'event_probe' "$1" 'dynamic_events' +} + +check_error 'e ^a.' # NO_EVENT_INFO +check_error 'e ^.b' # NO_EVENT_INFO +check_error 'e ^a.b' # BAD_ATTACH_EVENT +check_error 'e syscalls/sys_enter_openat ^foo' # BAD_ATTACH_ARG +check_error 'e:^/bar syscalls/sys_enter_openat' # NO_GROUP_NAME +check_error 'e:^1234567890123456789012345678901234567890123456789012345678= 9012345/bar syscalls/sys_enter_openat' # GROUP_TOO_LONG + +check_error 'e:^foo.1/bar syscalls/sys_enter_openat' # BAD_GROUP_NAME +check_error 'e:^ syscalls/sys_enter_openat' # NO_EVENT_NAME +check_error 'e:foo/^123456789012345678901234567890123456789012345678901234= 56789012345 syscalls/sys_enter_openat' # EVENT_TOO_LONG +check_error 'e:foo/^bar.1 syscalls/sys_enter_openat' # BAD_EVENT_NAME + +check_error 'e:foo/bar syscalls/sys_enter_openat arg=3D^dfd' # BAD_FETCH_A= RG +check_error 'e:foo/bar syscalls/sys_enter_openat ^arg=3D$foo' # BAD_ATTACH= _ARG + +check_error 'e:foo/bar syscalls/sys_enter_openat if ^' # NO_EP_FILTER + +exit 0 --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 62A12C07E9D for ; Tue, 27 Sep 2022 16:01:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232594AbiI0QBv (ORCPT ); Tue, 27 Sep 2022 12:01:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232363AbiI0QBh (ORCPT ); Tue, 27 Sep 2022 12:01:37 -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 0D698D01C4 for ; Tue, 27 Sep 2022 09:01:33 -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 99F6961A8B for ; Tue, 27 Sep 2022 16:01:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E5F1C433B5; Tue, 27 Sep 2022 16:01:32 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2g-00G2og-1v; Tue, 27 Sep 2022 12:02:42 -0400 Message-ID: <20220927160242.207148054@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:19 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , , Zeng Heng Subject: [for-next][PATCH 03/20] rv/monitors: add static qualifier for local symbols References: <20220927160216.349640304@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: Zeng Heng The sparse tool complains as follows: kernel/trace/rv/monitors/wwnr/wwnr.c:18:19: warning: symbol 'rv_wwnr' was not declared. Should it be static? The `rv_wwnr` symbol is not dereferenced by other extern files, so add static qualifier for it. So does wip module. Link: https://lkml.kernel.org/r/20220824034357.2014202-2-zengheng4@huawei.c= om Cc: Fixes: ccc319dcb450 ("rv/monitor: Add the wwnr monitor") Fixes: 8812d21219b9 ("rv/monitor: Add the wip monitor skeleton created by d= ot2k") Signed-off-by: Zeng Heng Acked-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) --- kernel/trace/rv/monitors/wip/wip.c | 4 ++-- kernel/trace/rv/monitors/wwnr/wwnr.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/trace/rv/monitors/wip/wip.c b/kernel/trace/rv/monitors/= wip/wip.c index 83cace53b9fa..1a989bc142f3 100644 --- a/kernel/trace/rv/monitors/wip/wip.c +++ b/kernel/trace/rv/monitors/wip/wip.c @@ -16,7 +16,7 @@ =20 #include "wip.h" =20 -struct rv_monitor rv_wip; +static struct rv_monitor rv_wip; DECLARE_DA_MON_PER_CPU(wip, unsigned char); =20 static void handle_preempt_disable(void *data, unsigned long ip, unsigned = long parent_ip) @@ -60,7 +60,7 @@ static void disable_wip(void) da_monitor_destroy_wip(); } =20 -struct rv_monitor rv_wip =3D { +static struct rv_monitor rv_wip =3D { .name =3D "wip", .description =3D "wakeup in preemptive per-cpu testing monitor.", .enable =3D enable_wip, diff --git a/kernel/trace/rv/monitors/wwnr/wwnr.c b/kernel/trace/rv/monitor= s/wwnr/wwnr.c index 599225d9cf38..a063b93c6a1d 100644 --- a/kernel/trace/rv/monitors/wwnr/wwnr.c +++ b/kernel/trace/rv/monitors/wwnr/wwnr.c @@ -15,7 +15,7 @@ =20 #include "wwnr.h" =20 -struct rv_monitor rv_wwnr; +static struct rv_monitor rv_wwnr; DECLARE_DA_MON_PER_TASK(wwnr, unsigned char); =20 static void handle_switch(void *data, bool preempt, struct task_struct *p, @@ -59,7 +59,7 @@ static void disable_wwnr(void) da_monitor_destroy_wwnr(); } =20 -struct rv_monitor rv_wwnr =3D { +static struct rv_monitor rv_wwnr =3D { .name =3D "wwnr", .description =3D "wakeup while not running per-task testing model.", .enable =3D enable_wwnr, --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 3B43EC07E9D for ; Tue, 27 Sep 2022 16:01:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232661AbiI0QBy (ORCPT ); Tue, 27 Sep 2022 12:01:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232378AbiI0QBh (ORCPT ); Tue, 27 Sep 2022 12:01:37 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 694F93B71B for ; Tue, 27 Sep 2022 09:01:35 -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 ams.source.kernel.org (Postfix) with ESMTPS id 29168B81C4D for ; Tue, 27 Sep 2022 16:01:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACF19C433D6; Tue, 27 Sep 2022 16:01:32 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2h-00G2pH-0L; Tue, 27 Sep 2022 12:02:43 -0400 Message-ID: <20220927160242.688382747@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:20 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , , Zeng Heng Subject: [for-next][PATCH 04/20] rv/dot2K: add static qualifier for local variable References: <20220927160216.349640304@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: Zeng Heng Following Daniel's suggestion, fix similar warning in template files, which would prevent new monitors from such warning. Link: https://lkml.kernel.org/r/20220824034357.2014202-3-zengheng4@huawei.c= om Cc: Fixes: 24bce201d798 ("tools/rv: Add dot2k") Suggested-by: Daniel Bristot de Oliveira Signed-off-by: Zeng Heng Acked-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) --- tools/verification/dot2/dot2k_templates/main_global.c | 4 ++-- tools/verification/dot2/dot2k_templates/main_per_cpu.c | 4 ++-- tools/verification/dot2/dot2k_templates/main_per_task.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/verification/dot2/dot2k_templates/main_global.c b/tools/= verification/dot2/dot2k_templates/main_global.c index f4b712dbc92e..dcd1162dced8 100644 --- a/tools/verification/dot2/dot2k_templates/main_global.c +++ b/tools/verification/dot2/dot2k_templates/main_global.c @@ -27,7 +27,7 @@ * * The rv monitor reference is needed for the monitor declaration. */ -struct rv_monitor rv_MODEL_NAME; +static struct rv_monitor rv_MODEL_NAME; DECLARE_DA_MON_GLOBAL(MODEL_NAME, MIN_TYPE); =20 /* @@ -63,7 +63,7 @@ TRACEPOINT_DETACH /* * This is the monitor register section. */ -struct rv_monitor rv_MODEL_NAME =3D { +static struct rv_monitor rv_MODEL_NAME =3D { .name =3D "MODEL_NAME", .description =3D "auto-generated MODEL_NAME", .enable =3D enable_MODEL_NAME, diff --git a/tools/verification/dot2/dot2k_templates/main_per_cpu.c b/tools= /verification/dot2/dot2k_templates/main_per_cpu.c index 4080d1ca3354..8f877e86a22f 100644 --- a/tools/verification/dot2/dot2k_templates/main_per_cpu.c +++ b/tools/verification/dot2/dot2k_templates/main_per_cpu.c @@ -27,7 +27,7 @@ * * The rv monitor reference is needed for the monitor declaration. */ -struct rv_monitor rv_MODEL_NAME; +static struct rv_monitor rv_MODEL_NAME; DECLARE_DA_MON_PER_CPU(MODEL_NAME, MIN_TYPE); =20 /* @@ -63,7 +63,7 @@ TRACEPOINT_DETACH /* * This is the monitor register section. */ -struct rv_monitor rv_MODEL_NAME =3D { +static struct rv_monitor rv_MODEL_NAME =3D { .name =3D "MODEL_NAME", .description =3D "auto-generated MODEL_NAME", .enable =3D enable_MODEL_NAME, diff --git a/tools/verification/dot2/dot2k_templates/main_per_task.c b/tool= s/verification/dot2/dot2k_templates/main_per_task.c index 89197175384f..8c2fdb824634 100644 --- a/tools/verification/dot2/dot2k_templates/main_per_task.c +++ b/tools/verification/dot2/dot2k_templates/main_per_task.c @@ -27,7 +27,7 @@ * * The rv monitor reference is needed for the monitor declaration. */ -struct rv_monitor rv_MODEL_NAME; +static struct rv_monitor rv_MODEL_NAME; DECLARE_DA_MON_PER_TASK(MODEL_NAME, MIN_TYPE); =20 /* @@ -63,7 +63,7 @@ TRACEPOINT_DETACH /* * This is the monitor register section. */ -struct rv_monitor rv_MODEL_NAME =3D { +static struct rv_monitor rv_MODEL_NAME =3D { .name =3D "MODEL_NAME", .description =3D "auto-generated MODEL_NAME", .enable =3D enable_MODEL_NAME, --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 5F656C07E9D for ; Tue, 27 Sep 2022 16:02:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232852AbiI0QCS (ORCPT ); Tue, 27 Sep 2022 12:02:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232395AbiI0QBk (ORCPT ); Tue, 27 Sep 2022 12:01:40 -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 0A42779A41 for ; Tue, 27 Sep 2022 09:01:37 -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 56B84CE189A for ; Tue, 27 Sep 2022 16:01:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44F5BC433C1; Tue, 27 Sep 2022 16:01:33 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2h-00G2pv-26; Tue, 27 Sep 2022 12:02:43 -0400 Message-ID: <20220927160243.204183194@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:21 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Ingo Molnar , Andrew Morton , Masami Hiramatsu , Tom Zanussi Subject: [for-next][PATCH 05/20] tracing: Add numeric delta time to the trace event benchmark References: <20220927160216.349640304@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)" In order to testing filtering and histograms via the trace event benchmark, record the delta time of the last event as a numeric value (currently, it just saves it within the string) so that filters and histograms can use it. Link: https://lkml.kernel.org/r/20220906225529.213677569@goodmis.org Cc: Ingo Molnar Cc: Andrew Morton Cc: Masami Hiramatsu Cc: Tom Zanussi Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_benchmark.c | 2 +- kernel/trace/trace_benchmark.h | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel/trace/trace_benchmark.c b/kernel/trace/trace_benchmark.c index 801c2a7f7605..54d5fa35c90a 100644 --- a/kernel/trace/trace_benchmark.c +++ b/kernel/trace/trace_benchmark.c @@ -51,7 +51,7 @@ static void trace_do_benchmark(void) =20 local_irq_disable(); start =3D trace_clock_local(); - trace_benchmark_event(bm_str); + trace_benchmark_event(bm_str, bm_last); stop =3D trace_clock_local(); local_irq_enable(); =20 diff --git a/kernel/trace/trace_benchmark.h b/kernel/trace/trace_benchmark.h index 79e6fbe5b365..c3e91060dc94 100644 --- a/kernel/trace/trace_benchmark.h +++ b/kernel/trace/trace_benchmark.h @@ -14,19 +14,21 @@ extern void trace_benchmark_unreg(void); =20 TRACE_EVENT_FN(benchmark_event, =20 - TP_PROTO(const char *str), + TP_PROTO(const char *str, u64 delta), =20 - TP_ARGS(str), + TP_ARGS(str, delta), =20 TP_STRUCT__entry( __array( char, str, BENCHMARK_EVENT_STRLEN ) + __field( u64, delta) ), =20 TP_fast_assign( memcpy(__entry->str, str, BENCHMARK_EVENT_STRLEN); + __entry->delta =3D delta; ), =20 - TP_printk("%s", __entry->str), + TP_printk("%s delta=3D%llu", __entry->str, __entry->delta), =20 trace_benchmark_reg, trace_benchmark_unreg ); --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 BBCABC54EE9 for ; Tue, 27 Sep 2022 16:02:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232890AbiI0QC1 (ORCPT ); Tue, 27 Sep 2022 12:02:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232419AbiI0QBk (ORCPT ); Tue, 27 Sep 2022 12:01:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C373A1B95DA for ; Tue, 27 Sep 2022 09:01:36 -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 ams.source.kernel.org (Postfix) with ESMTPS id 3E6BCB81C5C for ; Tue, 27 Sep 2022 16:01:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9E6AC4347C; Tue, 27 Sep 2022 16:01:33 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2i-00G2qc-0v; Tue, 27 Sep 2022 12:02:44 -0400 Message-ID: <20220927160243.783297676@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:22 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Ingo Molnar , Andrew Morton , Masami Hiramatsu , Tom Zanussi Subject: [for-next][PATCH 06/20] tracing/hist: Call hist functions directly via a switch statement References: <20220927160216.349640304@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)" Due to retpolines, indirect calls are much more expensive than direct calls. The histograms have a select set of functions it uses for the histograms, instead of using function pointers to call them, create a hist_fn_call() function that uses a switch statement to call the histogram functions directly. This gives a 13% speedup to the histogram logic. Using the histogram benchmark: Before: # event histogram # # trigger info: hist:keys=3Ddelta:vals=3Dhitcount:sort=3Ddelta:size=3D2048= if delta > 0 [active] # { delta: 129 } hitcount: 2213 { delta: 130 } hitcount: 285965 { delta: 131 } hitcount: 1146545 { delta: 132 } hitcount: 5185432 { delta: 133 } hitcount: 19896215 { delta: 134 } hitcount: 53118616 { delta: 135 } hitcount: 83816709 { delta: 136 } hitcount: 68329562 { delta: 137 } hitcount: 41859349 { delta: 138 } hitcount: 46257797 { delta: 139 } hitcount: 54400831 { delta: 140 } hitcount: 72875007 { delta: 141 } hitcount: 76193272 { delta: 142 } hitcount: 49504263 { delta: 143 } hitcount: 38821072 { delta: 144 } hitcount: 47702679 { delta: 145 } hitcount: 41357297 { delta: 146 } hitcount: 22058238 { delta: 147 } hitcount: 9720002 { delta: 148 } hitcount: 3193542 { delta: 149 } hitcount: 927030 { delta: 150 } hitcount: 850772 { delta: 151 } hitcount: 1477380 { delta: 152 } hitcount: 2687977 { delta: 153 } hitcount: 2865985 { delta: 154 } hitcount: 1977492 { delta: 155 } hitcount: 2475607 { delta: 156 } hitcount: 3403612 After: # event histogram # # trigger info: hist:keys=3Ddelta:vals=3Dhitcount:sort=3Ddelta:size=3D2048= if delta > 0 [active] # { delta: 113 } hitcount: 272 { delta: 114 } hitcount: 840 { delta: 118 } hitcount: 344 { delta: 119 } hitcount: 25428 { delta: 120 } hitcount: 350590 { delta: 121 } hitcount: 1892484 { delta: 122 } hitcount: 6205004 { delta: 123 } hitcount: 11583521 { delta: 124 } hitcount: 37590979 { delta: 125 } hitcount: 108308504 { delta: 126 } hitcount: 131672461 { delta: 127 } hitcount: 88700598 { delta: 128 } hitcount: 65939870 { delta: 129 } hitcount: 45055004 { delta: 130 } hitcount: 33174464 { delta: 131 } hitcount: 31813493 { delta: 132 } hitcount: 29011676 { delta: 133 } hitcount: 22798782 { delta: 134 } hitcount: 22072486 { delta: 135 } hitcount: 17034113 { delta: 136 } hitcount: 8982490 { delta: 137 } hitcount: 2865908 { delta: 138 } hitcount: 980382 { delta: 139 } hitcount: 1651944 { delta: 140 } hitcount: 4112073 { delta: 141 } hitcount: 3963269 { delta: 142 } hitcount: 1712508 { delta: 143 } hitcount: 575941 { delta: 144 } hitcount: 351427 { delta: 145 } hitcount: 218077 { delta: 146 } hitcount: 167297 { delta: 147 } hitcount: 146198 { delta: 148 } hitcount: 116122 { delta: 149 } hitcount: 58993 { delta: 150 } hitcount: 40228 The delta above is in nanoseconds. It brings the fastest time down from 129ns to 113ns, and the peak from 141ns to 126ns. Link: https://lkml.kernel.org/r/20220906225529.411545333@goodmis.org Cc: Ingo Molnar Cc: Andrew Morton Cc: Masami Hiramatsu Cc: Tom Zanussi Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_events_hist.c | 246 +++++++++++++++++++++---------- 1 file changed, 169 insertions(+), 77 deletions(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_h= ist.c index fdf784620c28..48465f7e97b4 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -104,6 +104,38 @@ enum field_op_id { FIELD_OP_MULT, }; =20 +enum hist_field_fn { + HIST_FIELD_FN_NOP, + HIST_FIELD_FN_VAR_REF, + HIST_FIELD_FN_COUNTER, + HIST_FIELD_FN_CONST, + HIST_FIELD_FN_LOG2, + HIST_FIELD_FN_BUCKET, + HIST_FIELD_FN_TIMESTAMP, + HIST_FIELD_FN_CPU, + HIST_FIELD_FN_STRING, + HIST_FIELD_FN_DYNSTRING, + HIST_FIELD_FN_RELDYNSTRING, + HIST_FIELD_FN_PSTRING, + HIST_FIELD_FN_S64, + HIST_FIELD_FN_U64, + HIST_FIELD_FN_S32, + HIST_FIELD_FN_U32, + HIST_FIELD_FN_S16, + HIST_FIELD_FN_U16, + HIST_FIELD_FN_S8, + HIST_FIELD_FN_U8, + HIST_FIELD_FN_UMINUS, + HIST_FIELD_FN_MINUS, + HIST_FIELD_FN_PLUS, + HIST_FIELD_FN_DIV, + HIST_FIELD_FN_MULT, + HIST_FIELD_FN_DIV_POWER2, + HIST_FIELD_FN_DIV_NOT_POWER2, + HIST_FIELD_FN_DIV_MULT_SHIFT, + HIST_FIELD_FN_EXECNAME, +}; + /* * A hist_var (histogram variable) contains variable information for * hist_fields having the HIST_FIELD_FL_VAR or HIST_FIELD_FL_VAR_REF @@ -123,15 +155,15 @@ struct hist_var { struct hist_field { struct ftrace_event_field *field; unsigned long flags; - hist_field_fn_t fn; - unsigned int ref; - unsigned int size; - unsigned int offset; - unsigned int is_signed; unsigned long buckets; const char *type; struct hist_field *operands[HIST_FIELD_OPERANDS_MAX]; struct hist_trigger_data *hist_data; + enum hist_field_fn fn_num; + unsigned int ref; + unsigned int size; + unsigned int offset; + unsigned int is_signed; =20 /* * Variable fields contain variable-specific info in var. @@ -166,14 +198,11 @@ struct hist_field { u64 div_multiplier; }; =20 -static u64 hist_field_none(struct hist_field *field, - struct tracing_map_elt *elt, - struct trace_buffer *buffer, - struct ring_buffer_event *rbe, - void *event) -{ - return 0; -} +static u64 hist_fn_call(struct hist_field *hist_field, + struct tracing_map_elt *elt, + struct trace_buffer *buffer, + struct ring_buffer_event *rbe, + void *event); =20 static u64 hist_field_const(struct hist_field *field, struct tracing_map_elt *elt, @@ -250,7 +279,7 @@ static u64 hist_field_log2(struct hist_field *hist_fiel= d, { struct hist_field *operand =3D hist_field->operands[0]; =20 - u64 val =3D operand->fn(operand, elt, buffer, rbe, event); + u64 val =3D hist_fn_call(operand, elt, buffer, rbe, event); =20 return (u64) ilog2(roundup_pow_of_two(val)); } @@ -264,7 +293,7 @@ static u64 hist_field_bucket(struct hist_field *hist_fi= eld, struct hist_field *operand =3D hist_field->operands[0]; unsigned long buckets =3D hist_field->buckets; =20 - u64 val =3D operand->fn(operand, elt, buffer, rbe, event); + u64 val =3D hist_fn_call(operand, elt, buffer, rbe, event); =20 if (WARN_ON_ONCE(!buckets)) return val; @@ -285,8 +314,8 @@ static u64 hist_field_plus(struct hist_field *hist_fiel= d, struct hist_field *operand1 =3D hist_field->operands[0]; struct hist_field *operand2 =3D hist_field->operands[1]; =20 - u64 val1 =3D operand1->fn(operand1, elt, buffer, rbe, event); - u64 val2 =3D operand2->fn(operand2, elt, buffer, rbe, event); + u64 val1 =3D hist_fn_call(operand1, elt, buffer, rbe, event); + u64 val2 =3D hist_fn_call(operand2, elt, buffer, rbe, event); =20 return val1 + val2; } @@ -300,8 +329,8 @@ static u64 hist_field_minus(struct hist_field *hist_fie= ld, struct hist_field *operand1 =3D hist_field->operands[0]; struct hist_field *operand2 =3D hist_field->operands[1]; =20 - u64 val1 =3D operand1->fn(operand1, elt, buffer, rbe, event); - u64 val2 =3D operand2->fn(operand2, elt, buffer, rbe, event); + u64 val1 =3D hist_fn_call(operand1, elt, buffer, rbe, event); + u64 val2 =3D hist_fn_call(operand2, elt, buffer, rbe, event); =20 return val1 - val2; } @@ -315,8 +344,8 @@ static u64 hist_field_div(struct hist_field *hist_field, struct hist_field *operand1 =3D hist_field->operands[0]; struct hist_field *operand2 =3D hist_field->operands[1]; =20 - u64 val1 =3D operand1->fn(operand1, elt, buffer, rbe, event); - u64 val2 =3D operand2->fn(operand2, elt, buffer, rbe, event); + u64 val1 =3D hist_fn_call(operand1, elt, buffer, rbe, event); + u64 val2 =3D hist_fn_call(operand2, elt, buffer, rbe, event); =20 /* Return -1 for the undefined case */ if (!val2) @@ -338,7 +367,7 @@ static u64 div_by_power_of_two(struct hist_field *hist_= field, struct hist_field *operand1 =3D hist_field->operands[0]; struct hist_field *operand2 =3D hist_field->operands[1]; =20 - u64 val1 =3D operand1->fn(operand1, elt, buffer, rbe, event); + u64 val1 =3D hist_fn_call(operand1, elt, buffer, rbe, event); =20 return val1 >> __ffs64(operand2->constant); } @@ -352,7 +381,7 @@ static u64 div_by_not_power_of_two(struct hist_field *h= ist_field, struct hist_field *operand1 =3D hist_field->operands[0]; struct hist_field *operand2 =3D hist_field->operands[1]; =20 - u64 val1 =3D operand1->fn(operand1, elt, buffer, rbe, event); + u64 val1 =3D hist_fn_call(operand1, elt, buffer, rbe, event); =20 return div64_u64(val1, operand2->constant); } @@ -366,7 +395,7 @@ static u64 div_by_mult_and_shift(struct hist_field *his= t_field, struct hist_field *operand1 =3D hist_field->operands[0]; struct hist_field *operand2 =3D hist_field->operands[1]; =20 - u64 val1 =3D operand1->fn(operand1, elt, buffer, rbe, event); + u64 val1 =3D hist_fn_call(operand1, elt, buffer, rbe, event); =20 /* * If the divisor is a constant, do a multiplication and shift instead. @@ -400,8 +429,8 @@ static u64 hist_field_mult(struct hist_field *hist_fiel= d, struct hist_field *operand1 =3D hist_field->operands[0]; struct hist_field *operand2 =3D hist_field->operands[1]; =20 - u64 val1 =3D operand1->fn(operand1, elt, buffer, rbe, event); - u64 val2 =3D operand2->fn(operand2, elt, buffer, rbe, event); + u64 val1 =3D hist_fn_call(operand1, elt, buffer, rbe, event); + u64 val2 =3D hist_fn_call(operand2, elt, buffer, rbe, event); =20 return val1 * val2; } @@ -414,7 +443,7 @@ static u64 hist_field_unary_minus(struct hist_field *hi= st_field, { struct hist_field *operand =3D hist_field->operands[0]; =20 - s64 sval =3D (s64)operand->fn(operand, elt, buffer, rbe, event); + s64 sval =3D (s64)hist_fn_call(operand, elt, buffer, rbe, event); u64 val =3D (u64)-sval; =20 return val; @@ -657,19 +686,19 @@ struct snapshot_context { * Returns the specific division function to use if the divisor * is constant. This avoids extra branches when the trigger is hit. */ -static hist_field_fn_t hist_field_get_div_fn(struct hist_field *divisor) +static enum hist_field_fn hist_field_get_div_fn(struct hist_field *divisor) { u64 div =3D divisor->constant; =20 if (!(div & (div - 1))) - return div_by_power_of_two; + return HIST_FIELD_FN_DIV_POWER2; =20 /* If the divisor is too large, do a regular division */ if (div > (1 << HIST_DIV_SHIFT)) - return div_by_not_power_of_two; + return HIST_FIELD_FN_DIV_NOT_POWER2; =20 divisor->div_multiplier =3D div64_u64((u64)(1 << HIST_DIV_SHIFT), div); - return div_by_mult_and_shift; + return HIST_FIELD_FN_DIV_MULT_SHIFT; } =20 static void track_data_free(struct track_data *track_data) @@ -1334,38 +1363,32 @@ static const char *hist_field_name(struct hist_fiel= d *field, return field_name; } =20 -static hist_field_fn_t select_value_fn(int field_size, int field_is_signed) +static enum hist_field_fn select_value_fn(int field_size, int field_is_sig= ned) { - hist_field_fn_t fn =3D NULL; - switch (field_size) { case 8: if (field_is_signed) - fn =3D hist_field_s64; + return HIST_FIELD_FN_S64; else - fn =3D hist_field_u64; - break; + return HIST_FIELD_FN_U64; case 4: if (field_is_signed) - fn =3D hist_field_s32; + return HIST_FIELD_FN_S32; else - fn =3D hist_field_u32; - break; + return HIST_FIELD_FN_U32; case 2: if (field_is_signed) - fn =3D hist_field_s16; + return HIST_FIELD_FN_S16; else - fn =3D hist_field_u16; - break; + return HIST_FIELD_FN_U16; case 1: if (field_is_signed) - fn =3D hist_field_s8; + return HIST_FIELD_FN_S8; else - fn =3D hist_field_u8; - break; + return HIST_FIELD_FN_U8; } =20 - return fn; + return HIST_FIELD_FN_NOP; } =20 static int parse_map_size(char *str) @@ -1922,19 +1945,19 @@ static struct hist_field *create_hist_field(struct = hist_trigger_data *hist_data, goto out; /* caller will populate */ =20 if (flags & HIST_FIELD_FL_VAR_REF) { - hist_field->fn =3D hist_field_var_ref; + hist_field->fn_num =3D HIST_FIELD_FN_VAR_REF; goto out; } =20 if (flags & HIST_FIELD_FL_HITCOUNT) { - hist_field->fn =3D hist_field_counter; + hist_field->fn_num =3D HIST_FIELD_FN_COUNTER; hist_field->size =3D sizeof(u64); hist_field->type =3D "u64"; goto out; } =20 if (flags & HIST_FIELD_FL_CONST) { - hist_field->fn =3D hist_field_const; + hist_field->fn_num =3D HIST_FIELD_FN_CONST; hist_field->size =3D sizeof(u64); hist_field->type =3D kstrdup("u64", GFP_KERNEL); if (!hist_field->type) @@ -1943,14 +1966,14 @@ static struct hist_field *create_hist_field(struct = hist_trigger_data *hist_data, } =20 if (flags & HIST_FIELD_FL_STACKTRACE) { - hist_field->fn =3D hist_field_none; + hist_field->fn_num =3D HIST_FIELD_FN_NOP; goto out; } =20 if (flags & (HIST_FIELD_FL_LOG2 | HIST_FIELD_FL_BUCKET)) { unsigned long fl =3D flags & ~(HIST_FIELD_FL_LOG2 | HIST_FIELD_FL_BUCKET= ); - hist_field->fn =3D flags & HIST_FIELD_FL_LOG2 ? hist_field_log2 : - hist_field_bucket; + hist_field->fn_num =3D flags & HIST_FIELD_FL_LOG2 ? HIST_FIELD_FN_LOG2 : + HIST_FIELD_FN_BUCKET; hist_field->operands[0] =3D create_hist_field(hist_data, field, fl, NULL= ); hist_field->size =3D hist_field->operands[0]->size; hist_field->type =3D kstrdup_const(hist_field->operands[0]->type, GFP_KE= RNEL); @@ -1960,14 +1983,14 @@ static struct hist_field *create_hist_field(struct = hist_trigger_data *hist_data, } =20 if (flags & HIST_FIELD_FL_TIMESTAMP) { - hist_field->fn =3D hist_field_timestamp; + hist_field->fn_num =3D HIST_FIELD_FN_TIMESTAMP; hist_field->size =3D sizeof(u64); hist_field->type =3D "u64"; goto out; } =20 if (flags & HIST_FIELD_FL_CPU) { - hist_field->fn =3D hist_field_cpu; + hist_field->fn_num =3D HIST_FIELD_FN_CPU; hist_field->size =3D sizeof(int); hist_field->type =3D "unsigned int"; goto out; @@ -1987,14 +2010,14 @@ static struct hist_field *create_hist_field(struct = hist_trigger_data *hist_data, goto free; =20 if (field->filter_type =3D=3D FILTER_STATIC_STRING) { - hist_field->fn =3D hist_field_string; + hist_field->fn_num =3D HIST_FIELD_FN_STRING; hist_field->size =3D field->size; } else if (field->filter_type =3D=3D FILTER_DYN_STRING) { - hist_field->fn =3D hist_field_dynstring; + hist_field->fn_num =3D HIST_FIELD_FN_DYNSTRING; } else if (field->filter_type =3D=3D FILTER_RDYN_STRING) - hist_field->fn =3D hist_field_reldynstring; + hist_field->fn_num =3D HIST_FIELD_FN_RELDYNSTRING; else - hist_field->fn =3D hist_field_pstring; + hist_field->fn_num =3D HIST_FIELD_FN_PSTRING; } else { hist_field->size =3D field->size; hist_field->is_signed =3D field->is_signed; @@ -2002,9 +2025,9 @@ static struct hist_field *create_hist_field(struct hi= st_trigger_data *hist_data, if (!hist_field->type) goto free; =20 - hist_field->fn =3D select_value_fn(field->size, - field->is_signed); - if (!hist_field->fn) { + hist_field->fn_num =3D select_value_fn(field->size, + field->is_signed); + if (hist_field->fn_num =3D=3D HIST_FIELD_FN_NOP) { destroy_hist_field(hist_field, 0); return NULL; } @@ -2340,7 +2363,7 @@ static struct hist_field *create_alias(struct hist_tr= igger_data *hist_data, if (!alias) return NULL; =20 - alias->fn =3D var_ref->fn; + alias->fn_num =3D var_ref->fn_num; alias->operands[0] =3D var_ref; =20 if (init_var_ref(alias, var_ref, var_ref->system, var_ref->event_name)) { @@ -2523,7 +2546,7 @@ static struct hist_field *parse_unary(struct hist_tri= gger_data *hist_data, =20 expr->flags |=3D operand1->flags & (HIST_FIELD_FL_TIMESTAMP | HIST_FIELD_FL_TIMESTAMP_USECS); - expr->fn =3D hist_field_unary_minus; + expr->fn_num =3D HIST_FIELD_FN_UMINUS; expr->operands[0] =3D operand1; expr->size =3D operand1->size; expr->is_signed =3D operand1->is_signed; @@ -2595,7 +2618,7 @@ static struct hist_field *parse_expr(struct hist_trig= ger_data *hist_data, unsigned long operand_flags, operand2_flags; int field_op, ret =3D -EINVAL; char *sep, *operand1_str; - hist_field_fn_t op_fn; + enum hist_field_fn op_fn; bool combine_consts; =20 if (*n_subexprs > 3) { @@ -2654,16 +2677,16 @@ static struct hist_field *parse_expr(struct hist_tr= igger_data *hist_data, =20 switch (field_op) { case FIELD_OP_MINUS: - op_fn =3D hist_field_minus; + op_fn =3D HIST_FIELD_FN_MINUS; break; case FIELD_OP_PLUS: - op_fn =3D hist_field_plus; + op_fn =3D HIST_FIELD_FN_PLUS; break; case FIELD_OP_DIV: - op_fn =3D hist_field_div; + op_fn =3D HIST_FIELD_FN_DIV; break; case FIELD_OP_MULT: - op_fn =3D hist_field_mult; + op_fn =3D HIST_FIELD_FN_MULT; break; default: ret =3D -EINVAL; @@ -2719,13 +2742,16 @@ static struct hist_field *parse_expr(struct hist_tr= igger_data *hist_data, op_fn =3D hist_field_get_div_fn(operand2); } =20 + expr->fn_num =3D op_fn; + if (combine_consts) { if (var1) expr->operands[0] =3D var1; if (var2) expr->operands[1] =3D var2; =20 - expr->constant =3D op_fn(expr, NULL, NULL, NULL, NULL); + expr->constant =3D hist_fn_call(expr, NULL, NULL, NULL, NULL); + expr->fn_num =3D HIST_FIELD_FN_CONST; =20 expr->operands[0] =3D NULL; expr->operands[1] =3D NULL; @@ -2739,8 +2765,6 @@ static struct hist_field *parse_expr(struct hist_trig= ger_data *hist_data, =20 expr->name =3D expr_str(expr, 0); } else { - expr->fn =3D op_fn; - /* The operand sizes should be the same, so just pick one */ expr->size =3D operand1->size; expr->is_signed =3D operand1->is_signed; @@ -3065,7 +3089,7 @@ static inline void __update_field_vars(struct tracing= _map_elt *elt, struct hist_field *var =3D field_var->var; struct hist_field *val =3D field_var->val; =20 - var_val =3D val->fn(val, elt, buffer, rbe, rec); + var_val =3D hist_fn_call(val, elt, buffer, rbe, rec); var_idx =3D var->var.idx; =20 if (val->flags & HIST_FIELD_FL_STRING) { @@ -4186,6 +4210,74 @@ static u64 hist_field_execname(struct hist_field *hi= st_field, return (u64)(unsigned long)(elt_data->comm); } =20 +static u64 hist_fn_call(struct hist_field *hist_field, + struct tracing_map_elt *elt, + struct trace_buffer *buffer, + struct ring_buffer_event *rbe, + void *event) +{ + switch (hist_field->fn_num) { + case HIST_FIELD_FN_VAR_REF: + return hist_field_var_ref(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_COUNTER: + return hist_field_counter(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_CONST: + return hist_field_const(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_LOG2: + return hist_field_log2(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_BUCKET: + return hist_field_bucket(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_TIMESTAMP: + return hist_field_timestamp(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_CPU: + return hist_field_cpu(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_STRING: + return hist_field_string(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_DYNSTRING: + return hist_field_dynstring(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_RELDYNSTRING: + return hist_field_reldynstring(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_PSTRING: + return hist_field_pstring(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_S64: + return hist_field_s64(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_U64: + return hist_field_u64(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_S32: + return hist_field_s32(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_U32: + return hist_field_u32(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_S16: + return hist_field_s16(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_U16: + return hist_field_u16(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_S8: + return hist_field_s8(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_U8: + return hist_field_u8(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_UMINUS: + return hist_field_unary_minus(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_MINUS: + return hist_field_minus(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_PLUS: + return hist_field_plus(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_DIV: + return hist_field_div(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_MULT: + return hist_field_mult(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_DIV_POWER2: + return div_by_power_of_two(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_DIV_NOT_POWER2: + return div_by_not_power_of_two(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_DIV_MULT_SHIFT: + return div_by_mult_and_shift(hist_field, elt, buffer, rbe, event); + case HIST_FIELD_FN_EXECNAME: + return hist_field_execname(hist_field, elt, buffer, rbe, event); + default: + return 0; + } +} + /* Convert a var that points to common_pid.execname to a string */ static void update_var_execname(struct hist_field *hist_field) { @@ -4197,7 +4289,7 @@ static void update_var_execname(struct hist_field *hi= st_field) kfree_const(hist_field->type); hist_field->type =3D "char[]"; =20 - hist_field->fn =3D hist_field_execname; + hist_field->fn_num =3D HIST_FIELD_FN_EXECNAME; } =20 static int create_var_field(struct hist_trigger_data *hist_data, @@ -4956,7 +5048,7 @@ static void hist_trigger_elt_update(struct hist_trigg= er_data *hist_data, =20 for_each_hist_val_field(i, hist_data) { hist_field =3D hist_data->fields[i]; - hist_val =3D hist_field->fn(hist_field, elt, buffer, rbe, rec); + hist_val =3D hist_fn_call(hist_field, elt, buffer, rbe, rec); if (hist_field->flags & HIST_FIELD_FL_VAR) { var_idx =3D hist_field->var.idx; =20 @@ -4987,7 +5079,7 @@ static void hist_trigger_elt_update(struct hist_trigg= er_data *hist_data, for_each_hist_key_field(i, hist_data) { hist_field =3D hist_data->fields[i]; if (hist_field->flags & HIST_FIELD_FL_VAR) { - hist_val =3D hist_field->fn(hist_field, elt, buffer, rbe, rec); + hist_val =3D hist_fn_call(hist_field, elt, buffer, rbe, rec); var_idx =3D hist_field->var.idx; tracing_map_set_var(elt, var_idx, hist_val); } @@ -5062,7 +5154,7 @@ static void event_hist_trigger(struct event_trigger_d= ata *data, HIST_STACKTRACE_SKIP); key =3D entries; } else { - field_contents =3D key_field->fn(key_field, elt, buffer, rbe, rec); + field_contents =3D hist_fn_call(key_field, elt, buffer, rbe, rec); if (key_field->flags & HIST_FIELD_FL_STRING) { key =3D (void *)(unsigned long)field_contents; use_compound_key =3D true; --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 01DCCC07E9D for ; Tue, 27 Sep 2022 16:02:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232799AbiI0QCI (ORCPT ); Tue, 27 Sep 2022 12:02:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232288AbiI0QBj (ORCPT ); Tue, 27 Sep 2022 12:01:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F34021B95F8 for ; Tue, 27 Sep 2022 09:01:36 -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 ams.source.kernel.org (Postfix) with ESMTPS id 9AAD7B81C62 for ; Tue, 27 Sep 2022 16:01:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67A81C433D6; Tue, 27 Sep 2022 16:01:34 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2i-00G2rC-2o; Tue, 27 Sep 2022 12:02:44 -0400 Message-ID: <20220927160244.410510528@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:23 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Ingo Molnar , Andrew Morton , Masami Hiramatsu , Tom Zanussi Subject: [for-next][PATCH 07/20] tracing: Move struct filter_pred into trace_events_filter.c References: <20220927160216.349640304@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)" The structure filter_pred and the typedef of the function used are only referenced by trace_events_filter.c. There's no reason to have it in an external header file. Move them into the only file they are used in. Link: https://lkml.kernel.org/r/20220906225529.598047132@goodmis.org Cc: Ingo Molnar Cc: Andrew Morton Cc: Masami Hiramatsu Cc: Tom Zanussi Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace.h | 13 ------------- kernel/trace/trace_events_filter.c | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 900e75d96c84..54ee5711c729 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -1435,8 +1435,6 @@ event_trigger_unlock_commit(struct trace_event_file *= file, struct filter_pred; struct regex; =20 -typedef int (*filter_pred_fn_t) (struct filter_pred *pred, void *event); - typedef int (*regex_match_func)(char *str, struct regex *r, int len); =20 enum regex_type { @@ -1455,17 +1453,6 @@ struct regex { regex_match_func match; }; =20 -struct filter_pred { - filter_pred_fn_t fn; - u64 val; - struct regex regex; - unsigned short *ops; - struct ftrace_event_field *field; - int offset; - int not; - int op; -}; - static inline bool is_string_field(struct ftrace_event_field *field) { return field->filter_type =3D=3D FILTER_DYN_STRING || diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events= _filter.c index 4b1057ab9d96..c49c689ce4ad 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c @@ -43,6 +43,19 @@ enum filter_op_ids { OPS }; =20 static const char * ops[] =3D { OPS }; =20 +typedef int (*filter_pred_fn_t) (struct filter_pred *pred, void *event); + +struct filter_pred { + filter_pred_fn_t fn; + u64 val; + struct regex regex; + unsigned short *ops; + struct ftrace_event_field *field; + int offset; + int not; + int op; +}; + /* * pred functions are OP_LE, OP_LT, OP_GE, OP_GT, and OP_BAND * pred_funcs_##type below must match the order of them above. --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 EBD16C07E9D for ; Tue, 27 Sep 2022 16:02:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232779AbiI0QCE (ORCPT ); Tue, 27 Sep 2022 12:02:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232221AbiI0QBj (ORCPT ); Tue, 27 Sep 2022 12:01:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C3E4100A8B for ; Tue, 27 Sep 2022 09:01:36 -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 9CF7761A55 for ; Tue, 27 Sep 2022 16:01:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7659C433B5; Tue, 27 Sep 2022 16:01:34 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2j-00G2rl-1N; Tue, 27 Sep 2022 12:02:45 -0400 Message-ID: <20220927160244.996770559@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:24 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Ingo Molnar , Andrew Morton , Masami Hiramatsu , Tom Zanussi Subject: [for-next][PATCH 08/20] tracing/filter: Call filter predicate functions directly via a switch statement References: <20220927160216.349640304@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)" Due to retpolines, indirect calls are much more expensive than direct calls. The filters have a select set of functions it uses for the predicates. Instead of using function pointers to call them, create a filter_pred_fn_call() function that uses a switch statement to call the predicate functions directly. This gives almost a 10% speedup to the filter logic. Using the histogram benchmark: Before: # event histogram # # trigger info: hist:keys=3Ddelta:vals=3Dhitcount:sort=3Ddelta:size=3D2048= if delta > 0 [active] # { delta: 113 } hitcount: 272 { delta: 114 } hitcount: 840 { delta: 118 } hitcount: 344 { delta: 119 } hitcount: 25428 { delta: 120 } hitcount: 350590 { delta: 121 } hitcount: 1892484 { delta: 122 } hitcount: 6205004 { delta: 123 } hitcount: 11583521 { delta: 124 } hitcount: 37590979 { delta: 125 } hitcount: 108308504 { delta: 126 } hitcount: 131672461 { delta: 127 } hitcount: 88700598 { delta: 128 } hitcount: 65939870 { delta: 129 } hitcount: 45055004 { delta: 130 } hitcount: 33174464 { delta: 131 } hitcount: 31813493 { delta: 132 } hitcount: 29011676 { delta: 133 } hitcount: 22798782 { delta: 134 } hitcount: 22072486 { delta: 135 } hitcount: 17034113 { delta: 136 } hitcount: 8982490 { delta: 137 } hitcount: 2865908 { delta: 138 } hitcount: 980382 { delta: 139 } hitcount: 1651944 { delta: 140 } hitcount: 4112073 { delta: 141 } hitcount: 3963269 { delta: 142 } hitcount: 1712508 { delta: 143 } hitcount: 575941 After: # event histogram # # trigger info: hist:keys=3Ddelta:vals=3Dhitcount:sort=3Ddelta:size=3D2048= if delta > 0 [active] # { delta: 103 } hitcount: 60 { delta: 104 } hitcount: 16966 { delta: 105 } hitcount: 396625 { delta: 106 } hitcount: 3223400 { delta: 107 } hitcount: 12053754 { delta: 108 } hitcount: 20241711 { delta: 109 } hitcount: 14850200 { delta: 110 } hitcount: 4946599 { delta: 111 } hitcount: 3479315 { delta: 112 } hitcount: 18698299 { delta: 113 } hitcount: 62388733 { delta: 114 } hitcount: 95803834 { delta: 115 } hitcount: 58278130 { delta: 116 } hitcount: 15364800 { delta: 117 } hitcount: 5586866 { delta: 118 } hitcount: 2346880 { delta: 119 } hitcount: 1131091 { delta: 120 } hitcount: 620896 { delta: 121 } hitcount: 236652 { delta: 122 } hitcount: 105957 { delta: 123 } hitcount: 119107 { delta: 124 } hitcount: 54494 { delta: 125 } hitcount: 63856 { delta: 126 } hitcount: 64454 { delta: 127 } hitcount: 34818 { delta: 128 } hitcount: 41446 { delta: 129 } hitcount: 51242 { delta: 130 } hitcount: 28361 { delta: 131 } hitcount: 23926 The peak before was 126ns per event, after the peak is 114ns, and the fastest time went from 113ns to 103ns. Link: https://lkml.kernel.org/r/20220906225529.781407172@goodmis.org Cc: Ingo Molnar Cc: Andrew Morton Cc: Masami Hiramatsu Cc: Tom Zanussi Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_events_filter.c | 230 ++++++++++++++++++++--------- 1 file changed, 157 insertions(+), 73 deletions(-) diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events= _filter.c index c49c689ce4ad..96acc2b71ac7 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c @@ -43,10 +43,33 @@ enum filter_op_ids { OPS }; =20 static const char * ops[] =3D { OPS }; =20 -typedef int (*filter_pred_fn_t) (struct filter_pred *pred, void *event); +enum filter_pred_fn { + FILTER_PRED_FN_NOP, + FILTER_PRED_FN_64, + FILTER_PRED_FN_S64, + FILTER_PRED_FN_U64, + FILTER_PRED_FN_32, + FILTER_PRED_FN_S32, + FILTER_PRED_FN_U32, + FILTER_PRED_FN_16, + FILTER_PRED_FN_S16, + FILTER_PRED_FN_U16, + FILTER_PRED_FN_8, + FILTER_PRED_FN_S8, + FILTER_PRED_FN_U8, + FILTER_PRED_FN_COMM, + FILTER_PRED_FN_STRING, + FILTER_PRED_FN_STRLOC, + FILTER_PRED_FN_STRRELLOC, + FILTER_PRED_FN_PCHAR_USER, + FILTER_PRED_FN_PCHAR, + FILTER_PRED_FN_CPU, + FILTER_PRED_FN_, + FILTER_PRED_TEST_VISITED, +}; =20 struct filter_pred { - filter_pred_fn_t fn; + enum filter_pred_fn fn_num; u64 val; struct regex regex; unsigned short *ops; @@ -603,44 +626,48 @@ predicate_parse(const char *str, int nr_parens, int n= r_preds, return ERR_PTR(ret); } =20 +enum pred_cmp_types { + PRED_CMP_TYPE_NOP, + PRED_CMP_TYPE_LT, + PRED_CMP_TYPE_LE, + PRED_CMP_TYPE_GT, + PRED_CMP_TYPE_GE, + PRED_CMP_TYPE_BAND, +}; + #define DEFINE_COMPARISON_PRED(type) \ -static int filter_pred_LT_##type(struct filter_pred *pred, void *event) \ -{ \ - type *addr =3D (type *)(event + pred->offset); \ - type val =3D (type)pred->val; \ - return *addr < val; \ -} \ -static int filter_pred_LE_##type(struct filter_pred *pred, void *event) \ +static int filter_pred_##type(struct filter_pred *pred, void *event) \ { \ - type *addr =3D (type *)(event + pred->offset); \ - type val =3D (type)pred->val; \ - return *addr <=3D val; \ -} \ -static int filter_pred_GT_##type(struct filter_pred *pred, void *event) \ -{ \ - type *addr =3D (type *)(event + pred->offset); \ - type val =3D (type)pred->val; \ - return *addr > val; \ -} \ -static int filter_pred_GE_##type(struct filter_pred *pred, void *event) \ -{ \ - type *addr =3D (type *)(event + pred->offset); \ - type val =3D (type)pred->val; \ - return *addr >=3D val; \ -} \ -static int filter_pred_BAND_##type(struct filter_pred *pred, void *event) \ -{ \ - type *addr =3D (type *)(event + pred->offset); \ - type val =3D (type)pred->val; \ - return !!(*addr & val); \ -} \ -static const filter_pred_fn_t pred_funcs_##type[] =3D { \ - filter_pred_LE_##type, \ - filter_pred_LT_##type, \ - filter_pred_GE_##type, \ - filter_pred_GT_##type, \ - filter_pred_BAND_##type, \ -}; + switch (pred->op) { \ + case OP_LT: { \ + type *addr =3D (type *)(event + pred->offset); \ + type val =3D (type)pred->val; \ + return *addr < val; \ + } \ + case OP_LE: { \ + type *addr =3D (type *)(event + pred->offset); \ + type val =3D (type)pred->val; \ + return *addr <=3D val; \ + } \ + case OP_GT: { \ + type *addr =3D (type *)(event + pred->offset); \ + type val =3D (type)pred->val; \ + return *addr > val; \ + } \ + case OP_GE: { \ + type *addr =3D (type *)(event + pred->offset); \ + type val =3D (type)pred->val; \ + return *addr >=3D val; \ + } \ + case OP_BAND: { \ + type *addr =3D (type *)(event + pred->offset); \ + type val =3D (type)pred->val; \ + return !!(*addr & val); \ + } \ + default: \ + return 0; \ + } \ +} =20 #define DEFINE_EQUALITY_PRED(size) \ static int filter_pred_##size(struct filter_pred *pred, void *event) \ @@ -849,11 +876,6 @@ static int filter_pred_comm(struct filter_pred *pred, = void *event) return cmp ^ pred->not; } =20 -static int filter_pred_none(struct filter_pred *pred, void *event) -{ - return 0; -} - /* * regex_match_foo - Basic regex callbacks * @@ -999,6 +1021,19 @@ static void filter_build_regex(struct filter_pred *pr= ed) } } =20 + +#ifdef CONFIG_FTRACE_STARTUP_TEST +static int test_pred_visited_fn(struct filter_pred *pred, void *event); +#else +static int test_pred_visited_fn(struct filter_pred *pred, void *event) +{ + return 0; +} +#endif + + +static int filter_pred_fn_call(struct filter_pred *pred, void *event); + /* return 1 if event matches, 0 otherwise (discard) */ int filter_match_preds(struct event_filter *filter, void *rec) { @@ -1016,7 +1051,7 @@ int filter_match_preds(struct event_filter *filter, v= oid *rec) =20 for (i =3D 0; prog[i].pred; i++) { struct filter_pred *pred =3D prog[i].pred; - int match =3D pred->fn(pred, rec); + int match =3D filter_pred_fn_call(pred, rec); if (match =3D=3D prog[i].when_to_branch) i =3D prog[i].target; } @@ -1202,10 +1237,10 @@ int filter_assign_type(const char *type) return FILTER_OTHER; } =20 -static filter_pred_fn_t select_comparison_fn(enum filter_op_ids op, - int field_size, int field_is_signed) +static enum filter_pred_fn select_comparison_fn(enum filter_op_ids op, + int field_size, int field_is_signed) { - filter_pred_fn_t fn =3D NULL; + enum filter_pred_fn fn =3D FILTER_PRED_FN_NOP; int pred_func_index =3D -1; =20 switch (op) { @@ -1214,50 +1249,99 @@ static filter_pred_fn_t select_comparison_fn(enum f= ilter_op_ids op, break; default: if (WARN_ON_ONCE(op < PRED_FUNC_START)) - return NULL; + return fn; pred_func_index =3D op - PRED_FUNC_START; if (WARN_ON_ONCE(pred_func_index > PRED_FUNC_MAX)) - return NULL; + return fn; } =20 switch (field_size) { case 8: if (pred_func_index < 0) - fn =3D filter_pred_64; + fn =3D FILTER_PRED_FN_64; else if (field_is_signed) - fn =3D pred_funcs_s64[pred_func_index]; + fn =3D FILTER_PRED_FN_S64; else - fn =3D pred_funcs_u64[pred_func_index]; + fn =3D FILTER_PRED_FN_U64; break; case 4: if (pred_func_index < 0) - fn =3D filter_pred_32; + fn =3D FILTER_PRED_FN_32; else if (field_is_signed) - fn =3D pred_funcs_s32[pred_func_index]; + fn =3D FILTER_PRED_FN_S32; else - fn =3D pred_funcs_u32[pred_func_index]; + fn =3D FILTER_PRED_FN_U32; break; case 2: if (pred_func_index < 0) - fn =3D filter_pred_16; + fn =3D FILTER_PRED_FN_16; else if (field_is_signed) - fn =3D pred_funcs_s16[pred_func_index]; + fn =3D FILTER_PRED_FN_S16; else - fn =3D pred_funcs_u16[pred_func_index]; + fn =3D FILTER_PRED_FN_U16; break; case 1: if (pred_func_index < 0) - fn =3D filter_pred_8; + fn =3D FILTER_PRED_FN_8; else if (field_is_signed) - fn =3D pred_funcs_s8[pred_func_index]; + fn =3D FILTER_PRED_FN_S8; else - fn =3D pred_funcs_u8[pred_func_index]; + fn =3D FILTER_PRED_FN_U8; break; } =20 return fn; } =20 + +static int filter_pred_fn_call(struct filter_pred *pred, void *event) +{ + switch (pred->fn_num) { + case FILTER_PRED_FN_64: + return filter_pred_64(pred, event); + case FILTER_PRED_FN_S64: + return filter_pred_s64(pred, event); + case FILTER_PRED_FN_U64: + return filter_pred_u64(pred, event); + case FILTER_PRED_FN_32: + return filter_pred_32(pred, event); + case FILTER_PRED_FN_S32: + return filter_pred_s32(pred, event); + case FILTER_PRED_FN_U32: + return filter_pred_u32(pred, event); + case FILTER_PRED_FN_16: + return filter_pred_16(pred, event); + case FILTER_PRED_FN_S16: + return filter_pred_s16(pred, event); + case FILTER_PRED_FN_U16: + return filter_pred_u16(pred, event); + case FILTER_PRED_FN_8: + return filter_pred_8(pred, event); + case FILTER_PRED_FN_S8: + return filter_pred_s8(pred, event); + case FILTER_PRED_FN_U8: + return filter_pred_u8(pred, event); + case FILTER_PRED_FN_COMM: + return filter_pred_comm(pred, event); + case FILTER_PRED_FN_STRING: + return filter_pred_string(pred, event); + case FILTER_PRED_FN_STRLOC: + return filter_pred_strloc(pred, event); + case FILTER_PRED_FN_STRRELLOC: + return filter_pred_strrelloc(pred, event); + case FILTER_PRED_FN_PCHAR_USER: + return filter_pred_pchar_user(pred, event); + case FILTER_PRED_FN_PCHAR: + return filter_pred_pchar(pred, event); + case FILTER_PRED_FN_CPU: + return filter_pred_cpu(pred, event); + case FILTER_PRED_TEST_VISITED: + return test_pred_visited_fn(pred, event); + default: + return 0; + } +} + /* Called when a predicate is encountered by predicate_parse() */ static int parse_pred(const char *str, void *data, int pos, struct filter_parse_error *pe, @@ -1351,7 +1435,7 @@ static int parse_pred(const char *str, void *data, parse_error(pe, FILT_ERR_IP_FIELD_ONLY, pos + i); goto err_free; } - pred->fn =3D filter_pred_none; + pred->fn_num =3D FILTER_PRED_FN_NOP; =20 /* * Quotes are not required, but if they exist then we need @@ -1429,16 +1513,16 @@ static int parse_pred(const char *str, void *data, filter_build_regex(pred); =20 if (field->filter_type =3D=3D FILTER_COMM) { - pred->fn =3D filter_pred_comm; + pred->fn_num =3D FILTER_PRED_FN_COMM; =20 } else if (field->filter_type =3D=3D FILTER_STATIC_STRING) { - pred->fn =3D filter_pred_string; + pred->fn_num =3D FILTER_PRED_FN_STRING; pred->regex.field_len =3D field->size; =20 } else if (field->filter_type =3D=3D FILTER_DYN_STRING) { - pred->fn =3D filter_pred_strloc; + pred->fn_num =3D FILTER_PRED_FN_STRLOC; } else if (field->filter_type =3D=3D FILTER_RDYN_STRING) - pred->fn =3D filter_pred_strrelloc; + pred->fn_num =3D FILTER_PRED_FN_STRRELLOC; else { =20 if (!ustring_per_cpu) { @@ -1449,9 +1533,9 @@ static int parse_pred(const char *str, void *data, } =20 if (ustring) - pred->fn =3D filter_pred_pchar_user; + pred->fn_num =3D FILTER_PRED_FN_PCHAR_USER; else - pred->fn =3D filter_pred_pchar; + pred->fn_num =3D FILTER_PRED_FN_PCHAR; } /* go past the last quote */ i++; @@ -1499,10 +1583,10 @@ static int parse_pred(const char *str, void *data, pred->val =3D val; =20 if (field->filter_type =3D=3D FILTER_CPU) - pred->fn =3D filter_pred_cpu; + pred->fn_num =3D FILTER_PRED_FN_CPU; else { - pred->fn =3D select_comparison_fn(pred->op, field->size, - field->is_signed); + pred->fn_num =3D select_comparison_fn(pred->op, field->size, + field->is_signed); if (pred->op =3D=3D OP_NE) pred->not =3D 1; } @@ -2309,7 +2393,7 @@ static void update_pred_fn(struct event_filter *filte= r, char *fields) struct filter_pred *pred =3D prog[i].pred; struct ftrace_event_field *field =3D pred->field; =20 - WARN_ON_ONCE(!pred->fn); + WARN_ON_ONCE(pred->fn_num =3D=3D FILTER_PRED_FN_NOP); =20 if (!field) { WARN_ONCE(1, "all leafs should have field defined %d", i); @@ -2319,7 +2403,7 @@ static void update_pred_fn(struct event_filter *filte= r, char *fields) if (!strchr(fields, *field->name)) continue; =20 - pred->fn =3D test_pred_visited_fn; + pred->fn_num =3D FILTER_PRED_TEST_VISITED; } } =20 --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 9546DC54EE9 for ; Tue, 27 Sep 2022 16:02:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232916AbiI0QCd (ORCPT ); Tue, 27 Sep 2022 12:02:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232457AbiI0QBl (ORCPT ); Tue, 27 Sep 2022 12:01:41 -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 5222258531 for ; Tue, 27 Sep 2022 09:01: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 sin.source.kernel.org (Postfix) with ESMTPS id 31853CE19D0 for ; Tue, 27 Sep 2022 16:01:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B832C433D7; Tue, 27 Sep 2022 16:01:35 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2j-00G2sK-37; Tue, 27 Sep 2022 12:02:45 -0400 Message-ID: <20220927160245.524291097@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:25 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Zhen Lei Subject: [for-next][PATCH 09/20] tracepoint: Optimize the critical region of mutex_lock in tracepoint_module_coming() References: <20220927160216.349640304@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: Zhen Lei The memory allocation of 'tp_mod' does not require mutex_lock() protection, move it out. Link: https://lkml.kernel.org/r/20220914061416.1630-1-thunder.leizhen@huawe= i.com Signed-off-by: Zhen Lei Signed-off-by: Steven Rostedt (Google) --- kernel/tracepoint.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c index ef42c1a11920..f23144af5743 100644 --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c @@ -640,7 +640,6 @@ static void tp_module_going_check_quiescent(struct trac= epoint *tp, void *priv) static int tracepoint_module_coming(struct module *mod) { struct tp_module *tp_mod; - int ret =3D 0; =20 if (!mod->num_tracepoints) return 0; @@ -652,19 +651,18 @@ static int tracepoint_module_coming(struct module *mo= d) */ if (trace_module_has_bad_taint(mod)) return 0; - mutex_lock(&tracepoint_module_list_mutex); + tp_mod =3D kmalloc(sizeof(struct tp_module), GFP_KERNEL); - if (!tp_mod) { - ret =3D -ENOMEM; - goto end; - } + if (!tp_mod) + return -ENOMEM; tp_mod->mod =3D mod; + + mutex_lock(&tracepoint_module_list_mutex); list_add_tail(&tp_mod->list, &tracepoint_module_list); blocking_notifier_call_chain(&tracepoint_notify_list, MODULE_STATE_COMING, tp_mod); -end: mutex_unlock(&tracepoint_module_list_mutex); - return ret; + return 0; } =20 static void tracepoint_module_going(struct module *mod) --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 C4F18C54EE9 for ; Tue, 27 Sep 2022 16:02:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232745AbiI0QCA (ORCPT ); Tue, 27 Sep 2022 12:02:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232218AbiI0QBh (ORCPT ); Tue, 27 Sep 2022 12:01:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC01918B4BE for ; Tue, 27 Sep 2022 09:01:36 -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 493F961A85 for ; Tue, 27 Sep 2022 16:01:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24407C433D6; Tue, 27 Sep 2022 16:01:36 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2k-00G2su-1n; Tue, 27 Sep 2022 12:02:46 -0400 Message-ID: <20220927160246.094153309@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:26 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , , , , , , , , , , Gaosheng Cui Subject: [for-next][PATCH 10/20] x86/ftrace: Remove unused modifying_ftrace_code declaration References: <20220927160216.349640304@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: Gaosheng Cui All uses of modifying_ftrace_code have been removed by commit 768ae4406a5c ("x86/ftrace: Use text_poke()"), so remove the declaration, too. Link: https://lkml.kernel.org/r/20220914110437.1436353-2-cuigaosheng1@huawe= i.com Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Signed-off-by: Gaosheng Cui Signed-off-by: Steven Rostedt (Google) --- arch/x86/include/asm/ftrace.h | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h index b5ef474be858..908d99b127d3 100644 --- a/arch/x86/include/asm/ftrace.h +++ b/arch/x86/include/asm/ftrace.h @@ -23,7 +23,6 @@ #define HAVE_FUNCTION_GRAPH_RET_ADDR_PTR =20 #ifndef __ASSEMBLY__ -extern atomic_t modifying_ftrace_code; extern void __fentry__(void); =20 static inline unsigned long ftrace_call_adjust(unsigned long addr) --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 85A4DC07E9D for ; Tue, 27 Sep 2022 16:02:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232830AbiI0QCN (ORCPT ); Tue, 27 Sep 2022 12:02:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232380AbiI0QBk (ORCPT ); Tue, 27 Sep 2022 12:01:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A07B0A2A9F for ; Tue, 27 Sep 2022 09:01:37 -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 EAF3F61A95 for ; Tue, 27 Sep 2022 16:01:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4DC4C433B5; Tue, 27 Sep 2022 16:01:36 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2l-00G2tU-0y; Tue, 27 Sep 2022 12:02:47 -0400 Message-ID: <20220927160246.762009135@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:27 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , , , , , , , , , , Gaosheng Cui Subject: [for-next][PATCH 11/20] x86/kprobes: Remove unused arch_kprobe_override_function() declaration References: <20220927160216.349640304@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: Gaosheng Cui All uses of arch_kprobe_override_function() have been removed by commit 540adea3809f ("error-injection: Separate error-injection from kprobe"), so remove the declaration, too. Link: https://lkml.kernel.org/r/20220914110437.1436353-3-cuigaosheng1@huawe= i.com Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Signed-off-by: Gaosheng Cui Signed-off-by: Steven Rostedt (Google) --- arch/x86/include/asm/kprobes.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/include/asm/kprobes.h b/arch/x86/include/asm/kprobes.h index 71ea2eab43d5..a2e9317aad49 100644 --- a/arch/x86/include/asm/kprobes.h +++ b/arch/x86/include/asm/kprobes.h @@ -50,8 +50,6 @@ extern const int kretprobe_blacklist_size; =20 void arch_remove_kprobe(struct kprobe *p); =20 -extern void arch_kprobe_override_function(struct pt_regs *regs); - /* Architecture specific copy of original instruction*/ struct arch_specific_insn { /* copy of the original instruction */ --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 83252C6FA83 for ; Tue, 27 Sep 2022 16:02:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232561AbiI0QCh (ORCPT ); Tue, 27 Sep 2022 12:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232488AbiI0QBm (ORCPT ); Tue, 27 Sep 2022 12:01:42 -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 D2121114B for ; Tue, 27 Sep 2022 09:01: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 sin.source.kernel.org (Postfix) with ESMTPS id 10D6DCE19D1 for ; Tue, 27 Sep 2022 16:01:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 792CBC433B5; Tue, 27 Sep 2022 16:01:37 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2m-00G2u5-04; Tue, 27 Sep 2022 12:02:48 -0400 Message-ID: <20220927160247.410787337@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:28 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , , , , , , , , , Yipeng Zou , "Masami Hiramatsu (Google)" Subject: [for-next][PATCH 12/20] tracing: kprobe: Fix kprobe event gen test module on exit References: <20220927160216.349640304@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: Yipeng Zou Correct gen_kretprobe_test clr event para on module exit. This will make it can't to delete. Link: https://lkml.kernel.org/r/20220919125629.238242-2-zouyipeng@huawei.com Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Fixes: 64836248dda2 ("tracing: Add kprobe event command generation test mod= ule") Signed-off-by: Yipeng Zou Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- kernel/trace/kprobe_event_gen_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/kprobe_event_gen_test.c b/kernel/trace/kprobe_eve= nt_gen_test.c index 18b0f1cbb947..e023154be0f8 100644 --- a/kernel/trace/kprobe_event_gen_test.c +++ b/kernel/trace/kprobe_event_gen_test.c @@ -206,7 +206,7 @@ static void __exit kprobe_event_gen_test_exit(void) WARN_ON(kprobe_event_delete("gen_kprobe_test")); =20 /* Disable the event or you can't remove it */ - WARN_ON(trace_array_set_clr_event(gen_kprobe_test->tr, + WARN_ON(trace_array_set_clr_event(gen_kretprobe_test->tr, "kprobes", "gen_kretprobe_test", false)); =20 --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 4DA73C54EE9 for ; Tue, 27 Sep 2022 16:02:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232876AbiI0QCX (ORCPT ); Tue, 27 Sep 2022 12:02:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232418AbiI0QBk (ORCPT ); Tue, 27 Sep 2022 12:01:40 -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 521901EEE1 for ; Tue, 27 Sep 2022 09:01: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 C1D4E61AA6 for ; Tue, 27 Sep 2022 16:01:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37C33C433C1; Tue, 27 Sep 2022 16:01:38 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2m-00G2ue-28; Tue, 27 Sep 2022 12:02:48 -0400 Message-ID: <20220927160248.135304467@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:29 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , , , , , , , , , Yipeng Zou , "Masami Hiramatsu (Google)" Subject: [for-next][PATCH 13/20] tracing: kprobe: Make gen test module work in arm and riscv References: <20220927160216.349640304@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: Yipeng Zou For now, this selftest module can only work in x86 because of the kprobe cmd was fixed use of x86 registers. This patch adapted to register names under arm and riscv, So that this module can be worked on those platform. Link: https://lkml.kernel.org/r/20220919125629.238242-3-zouyipeng@huawei.com Cc: Cc: Cc: Cc: Cc: Cc: Cc: Cc: Fixes: 64836248dda2 ("tracing: Add kprobe event command generation test mod= ule") Signed-off-by: Yipeng Zou Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- kernel/trace/kprobe_event_gen_test.c | 47 +++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/kernel/trace/kprobe_event_gen_test.c b/kernel/trace/kprobe_eve= nt_gen_test.c index e023154be0f8..80e04a1e1977 100644 --- a/kernel/trace/kprobe_event_gen_test.c +++ b/kernel/trace/kprobe_event_gen_test.c @@ -35,6 +35,45 @@ static struct trace_event_file *gen_kprobe_test; static struct trace_event_file *gen_kretprobe_test; =20 +#define KPROBE_GEN_TEST_FUNC "do_sys_open" + +/* X86 */ +#if defined(CONFIG_X86_64) || defined(CONFIG_X86_32) +#define KPROBE_GEN_TEST_ARG0 "dfd=3D%ax" +#define KPROBE_GEN_TEST_ARG1 "filename=3D%dx" +#define KPROBE_GEN_TEST_ARG2 "flags=3D%cx" +#define KPROBE_GEN_TEST_ARG3 "mode=3D+4($stack)" + +/* ARM64 */ +#elif defined(CONFIG_ARM64) +#define KPROBE_GEN_TEST_ARG0 "dfd=3D%x0" +#define KPROBE_GEN_TEST_ARG1 "filename=3D%x1" +#define KPROBE_GEN_TEST_ARG2 "flags=3D%x2" +#define KPROBE_GEN_TEST_ARG3 "mode=3D%x3" + +/* ARM */ +#elif defined(CONFIG_ARM) +#define KPROBE_GEN_TEST_ARG0 "dfd=3D%r0" +#define KPROBE_GEN_TEST_ARG1 "filename=3D%r1" +#define KPROBE_GEN_TEST_ARG2 "flags=3D%r2" +#define KPROBE_GEN_TEST_ARG3 "mode=3D%r3" + +/* RISCV */ +#elif defined(CONFIG_RISCV) +#define KPROBE_GEN_TEST_ARG0 "dfd=3D%a0" +#define KPROBE_GEN_TEST_ARG1 "filename=3D%a1" +#define KPROBE_GEN_TEST_ARG2 "flags=3D%a2" +#define KPROBE_GEN_TEST_ARG3 "mode=3D%a3" + +/* others */ +#else +#define KPROBE_GEN_TEST_ARG0 NULL +#define KPROBE_GEN_TEST_ARG1 NULL +#define KPROBE_GEN_TEST_ARG2 NULL +#define KPROBE_GEN_TEST_ARG3 NULL +#endif + + /* * Test to make sure we can create a kprobe event, then add more * fields. @@ -58,14 +97,14 @@ static int __init test_gen_kprobe_cmd(void) * fields. */ ret =3D kprobe_event_gen_cmd_start(&cmd, "gen_kprobe_test", - "do_sys_open", - "dfd=3D%ax", "filename=3D%dx"); + KPROBE_GEN_TEST_FUNC, + KPROBE_GEN_TEST_ARG0, KPROBE_GEN_TEST_ARG1); if (ret) goto free; =20 /* Use kprobe_event_add_fields to add the rest of the fields */ =20 - ret =3D kprobe_event_add_fields(&cmd, "flags=3D%cx", "mode=3D+4($stack)"); + ret =3D kprobe_event_add_fields(&cmd, KPROBE_GEN_TEST_ARG2, KPROBE_GEN_TE= ST_ARG3); if (ret) goto free; =20 @@ -128,7 +167,7 @@ static int __init test_gen_kretprobe_cmd(void) * Define the kretprobe event. */ ret =3D kretprobe_event_gen_cmd_start(&cmd, "gen_kretprobe_test", - "do_sys_open", + KPROBE_GEN_TEST_FUNC, "$retval"); if (ret) goto free; --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 F3F4FC07E9D for ; Tue, 27 Sep 2022 16:02:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232535AbiI0QCa (ORCPT ); Tue, 27 Sep 2022 12:02:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232455AbiI0QBl (ORCPT ); Tue, 27 Sep 2022 12:01:41 -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 813721BB236 for ; Tue, 27 Sep 2022 09:01: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 EFCF361AA0 for ; Tue, 27 Sep 2022 16:01:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCC71C433D6; Tue, 27 Sep 2022 16:01:38 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2n-00G2vD-10; Tue, 27 Sep 2022 12:02:49 -0400 Message-ID: <20220927160248.807986897@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:30 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Nico Pache Subject: [for-next][PATCH 14/20] tracing/osnoise: Fix possible recursive locking in stop_per_cpu_kthreads References: <20220927160216.349640304@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: Nico Pache There is a recursive lock on the cpu_hotplug_lock. In kernel/trace/trace_osnoise.c:_per_cpu_kthreads: - start_per_cpu_kthreads calls cpus_read_lock() and if start_kthreads returns a error it will call stop_per_cpu_kthreads. - stop_per_cpu_kthreads then calls cpus_read_lock() again causing deadlock. Fix this by calling cpus_read_unlock() before calling stop_per_cpu_kthreads. This behavior can also be seen in commit f46b16520a08 ("trace/hwlat: Implement the per-cpu mode"). This error was noticed during the LTP ftrace-stress-test: WARNING: possible recursive locking detected Acked-by: Daniel Bristot de Oliveira -------------------------------------------- sh/275006 is trying to acquire lock: ffffffffb02f5400 (cpu_hotplug_lock){++++}-{0:0}, at: stop_per_cpu_kthreads but task is already holding lock: ffffffffb02f5400 (cpu_hotplug_lock){++++}-{0:0}, at: start_per_cpu_kthreads other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(cpu_hotplug_lock); lock(cpu_hotplug_lock); *** DEADLOCK *** May be due to missing lock nesting notation 3 locks held by sh/275006: #0: ffff8881023f0470 (sb_writers#24){.+.+}-{0:0}, at: ksys_write #1: ffffffffb084f430 (trace_types_lock){+.+.}-{3:3}, at: rb_simple_write #2: ffffffffb02f5400 (cpu_hotplug_lock){++++}-{0:0}, at: start_per_cpu_kth= reads Link: https://lkml.kernel.org/r/20220919144932.3064014-1-npache@redhat.com Fixes: c8895e271f79 ("trace/osnoise: Support hotplug operations") Signed-off-by: Nico Pache Acked-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_osnoise.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c index 313439920a8c..78d536d3ff3d 100644 --- a/kernel/trace/trace_osnoise.c +++ b/kernel/trace/trace_osnoise.c @@ -1786,8 +1786,9 @@ static int start_per_cpu_kthreads(void) for_each_cpu(cpu, current_mask) { retval =3D start_kthread(cpu); if (retval) { + cpus_read_unlock(); stop_per_cpu_kthreads(); - break; + return retval; } } =20 --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 19FB7C07E9D for ; Tue, 27 Sep 2022 16:02:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232960AbiI0QCr (ORCPT ); Tue, 27 Sep 2022 12:02:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232311AbiI0QBo (ORCPT ); Tue, 27 Sep 2022 12:01:44 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A0889B856 for ; Tue, 27 Sep 2022 09:01: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 0515ACE189A for ; Tue, 27 Sep 2022 16:01:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60485C433C1; Tue, 27 Sep 2022 16:01:39 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2n-00G2vl-2h; Tue, 27 Sep 2022 12:02:49 -0400 Message-ID: <20220927160249.405813022@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:31 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Xiu Jianfeng Subject: [for-next][PATCH 15/20] rv/monitor: Add __init/__exit annotations to module init/exit funcs References: <20220927160216.349640304@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: Xiu Jianfeng Add missing __init/__exit annotations to module init/exit funcs. Link: https://lkml.kernel.org/r/20220922103208.162869-1-xiujianfeng@huawei.= com Fixes: 24bce201d798 ("tools/rv: Add dot2k") Fixes: 8812d21219b9 ("rv/monitor: Add the wip monitor skeleton created by d= ot2k") Fixes: ccc319dcb450 ("rv/monitor: Add the wwnr monitor") Signed-off-by: Xiu Jianfeng Acked-by: Daniel Bristot de Oliveira Signed-off-by: Steven Rostedt (Google) --- kernel/trace/rv/monitors/wip/wip.c | 4 ++-- kernel/trace/rv/monitors/wwnr/wwnr.c | 4 ++-- tools/verification/dot2/dot2k_templates/main_global.c | 4 ++-- tools/verification/dot2/dot2k_templates/main_per_cpu.c | 4 ++-- tools/verification/dot2/dot2k_templates/main_per_task.c | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/kernel/trace/rv/monitors/wip/wip.c b/kernel/trace/rv/monitors/= wip/wip.c index 1a989bc142f3..b2b49a27e886 100644 --- a/kernel/trace/rv/monitors/wip/wip.c +++ b/kernel/trace/rv/monitors/wip/wip.c @@ -69,13 +69,13 @@ static struct rv_monitor rv_wip =3D { .enabled =3D 0, }; =20 -static int register_wip(void) +static int __init register_wip(void) { rv_register_monitor(&rv_wip); return 0; } =20 -static void unregister_wip(void) +static void __exit unregister_wip(void) { rv_unregister_monitor(&rv_wip); } diff --git a/kernel/trace/rv/monitors/wwnr/wwnr.c b/kernel/trace/rv/monitor= s/wwnr/wwnr.c index a063b93c6a1d..0e43dd2db685 100644 --- a/kernel/trace/rv/monitors/wwnr/wwnr.c +++ b/kernel/trace/rv/monitors/wwnr/wwnr.c @@ -68,13 +68,13 @@ static struct rv_monitor rv_wwnr =3D { .enabled =3D 0, }; =20 -static int register_wwnr(void) +static int __init register_wwnr(void) { rv_register_monitor(&rv_wwnr); return 0; } =20 -static void unregister_wwnr(void) +static void __exit unregister_wwnr(void) { rv_unregister_monitor(&rv_wwnr); } diff --git a/tools/verification/dot2/dot2k_templates/main_global.c b/tools/= verification/dot2/dot2k_templates/main_global.c index dcd1162dced8..a5658bfb9044 100644 --- a/tools/verification/dot2/dot2k_templates/main_global.c +++ b/tools/verification/dot2/dot2k_templates/main_global.c @@ -72,13 +72,13 @@ static struct rv_monitor rv_MODEL_NAME =3D { .enabled =3D 0, }; =20 -static int register_MODEL_NAME(void) +static int __init register_MODEL_NAME(void) { rv_register_monitor(&rv_MODEL_NAME); return 0; } =20 -static void unregister_MODEL_NAME(void) +static void __exit unregister_MODEL_NAME(void) { rv_unregister_monitor(&rv_MODEL_NAME); } diff --git a/tools/verification/dot2/dot2k_templates/main_per_cpu.c b/tools= /verification/dot2/dot2k_templates/main_per_cpu.c index 8f877e86a22f..03539a97633f 100644 --- a/tools/verification/dot2/dot2k_templates/main_per_cpu.c +++ b/tools/verification/dot2/dot2k_templates/main_per_cpu.c @@ -72,13 +72,13 @@ static struct rv_monitor rv_MODEL_NAME =3D { .enabled =3D 0, }; =20 -static int register_MODEL_NAME(void) +static int __init register_MODEL_NAME(void) { rv_register_monitor(&rv_MODEL_NAME); return 0; } =20 -static void unregister_MODEL_NAME(void) +static void __exit unregister_MODEL_NAME(void) { rv_unregister_monitor(&rv_MODEL_NAME); } diff --git a/tools/verification/dot2/dot2k_templates/main_per_task.c b/tool= s/verification/dot2/dot2k_templates/main_per_task.c index 8c2fdb824634..ffd92af87a86 100644 --- a/tools/verification/dot2/dot2k_templates/main_per_task.c +++ b/tools/verification/dot2/dot2k_templates/main_per_task.c @@ -72,13 +72,13 @@ static struct rv_monitor rv_MODEL_NAME =3D { .enabled =3D 0, }; =20 -static int register_MODEL_NAME(void) +static int __init register_MODEL_NAME(void) { rv_register_monitor(&rv_MODEL_NAME); return 0; } =20 -static void unregister_MODEL_NAME(void) +static void __exit unregister_MODEL_NAME(void) { rv_unregister_monitor(&rv_MODEL_NAME); } --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 2824BC54EE9 for ; Tue, 27 Sep 2022 16:02:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232950AbiI0QCn (ORCPT ); Tue, 27 Sep 2022 12:02:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232294AbiI0QBo (ORCPT ); Tue, 27 Sep 2022 12:01:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DEBD3B71B for ; Tue, 27 Sep 2022 09:01: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 ams.source.kernel.org (Postfix) with ESMTPS id 1120BB81C5C for ; Tue, 27 Sep 2022 16:01:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFCFEC433D6; Tue, 27 Sep 2022 16:01:39 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2o-00G2wK-12; Tue, 27 Sep 2022 12:02:50 -0400 Message-ID: <20220927160249.931823392@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:32 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , stable@vger.kerne.org, Waiman Long Subject: [for-next][PATCH 16/20] tracing: Disable interrupt or preemption before acquiring arch_spinlock_t References: <20220927160216.349640304@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: Waiman Long It was found that some tracing functions in kernel/trace/trace.c acquire an arch_spinlock_t with preemption and irqs enabled. An example is the tracing_saved_cmdlines_size_read() function which intermittently causes a "BUG: using smp_processor_id() in preemptible" warning when the LTP read_all_proc test is run. That can be problematic in case preemption happens after acquiring the lock. Add the necessary preemption or interrupt disabling code in the appropriate places before acquiring an arch_spinlock_t. The convention here is to disable preemption for trace_cmdline_lock and interupt for max_lock. Link: https://lkml.kernel.org/r/20220922145622.1744826-1-longman@redhat.com Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Will Deacon Cc: Boqun Feng Cc: stable@vger.kerne.org Fixes: a35873a0993b ("tracing: Add conditional snapshot") Fixes: 939c7a4f04fc ("tracing: Introduce saved_cmdlines_size file") Suggested-by: Steven Rostedt Signed-off-by: Waiman Long Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index d3005279165d..aed7ea6e6045 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -1193,12 +1193,14 @@ void *tracing_cond_snapshot_data(struct trace_array= *tr) { void *cond_data =3D NULL; =20 + local_irq_disable(); arch_spin_lock(&tr->max_lock); =20 if (tr->cond_snapshot) cond_data =3D tr->cond_snapshot->cond_data; =20 arch_spin_unlock(&tr->max_lock); + local_irq_enable(); =20 return cond_data; } @@ -1334,9 +1336,11 @@ int tracing_snapshot_cond_enable(struct trace_array = *tr, void *cond_data, goto fail_unlock; } =20 + local_irq_disable(); arch_spin_lock(&tr->max_lock); tr->cond_snapshot =3D cond_snapshot; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); =20 mutex_unlock(&trace_types_lock); =20 @@ -1363,6 +1367,7 @@ int tracing_snapshot_cond_disable(struct trace_array = *tr) { int ret =3D 0; =20 + local_irq_disable(); arch_spin_lock(&tr->max_lock); =20 if (!tr->cond_snapshot) @@ -1373,6 +1378,7 @@ int tracing_snapshot_cond_disable(struct trace_array = *tr) } =20 arch_spin_unlock(&tr->max_lock); + local_irq_enable(); =20 return ret; } @@ -2200,6 +2206,11 @@ static size_t tgid_map_max; =20 #define SAVED_CMDLINES_DEFAULT 128 #define NO_CMDLINE_MAP UINT_MAX +/* + * Preemption must be disabled before acquiring trace_cmdline_lock. + * The various trace_arrays' max_lock must be acquired in a context + * where interrupt is disabled. + */ static arch_spinlock_t trace_cmdline_lock =3D __ARCH_SPIN_LOCK_UNLOCKED; struct saved_cmdlines_buffer { unsigned map_pid_to_cmdline[PID_MAX_DEFAULT+1]; @@ -2412,7 +2423,11 @@ static int trace_save_cmdline(struct task_struct *ts= k) * the lock, but we also don't want to spin * nor do we want to disable interrupts, * so if we miss here, then better luck next time. + * + * This is called within the scheduler and wake up, so interrupts + * had better been disabled and run queue lock been held. */ + lockdep_assert_preemption_disabled(); if (!arch_spin_trylock(&trace_cmdline_lock)) return 0; =20 @@ -5890,9 +5905,11 @@ tracing_saved_cmdlines_size_read(struct file *filp, = char __user *ubuf, char buf[64]; int r; =20 + preempt_disable(); arch_spin_lock(&trace_cmdline_lock); r =3D scnprintf(buf, sizeof(buf), "%u\n", savedcmd->cmdline_num); arch_spin_unlock(&trace_cmdline_lock); + preempt_enable(); =20 return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); } @@ -5917,10 +5934,12 @@ static int tracing_resize_saved_cmdlines(unsigned i= nt val) return -ENOMEM; } =20 + preempt_disable(); arch_spin_lock(&trace_cmdline_lock); savedcmd_temp =3D savedcmd; savedcmd =3D s; arch_spin_unlock(&trace_cmdline_lock); + preempt_enable(); free_saved_cmdlines_buffer(savedcmd_temp); =20 return 0; @@ -6373,10 +6392,12 @@ int tracing_set_tracer(struct trace_array *tr, cons= t char *buf) =20 #ifdef CONFIG_TRACER_SNAPSHOT if (t->use_max_tr) { + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (tr->cond_snapshot) ret =3D -EBUSY; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); if (ret) goto out; } @@ -7436,10 +7457,12 @@ tracing_snapshot_write(struct file *filp, const cha= r __user *ubuf, size_t cnt, goto out; } =20 + local_irq_disable(); arch_spin_lock(&tr->max_lock); if (tr->cond_snapshot) ret =3D -EBUSY; arch_spin_unlock(&tr->max_lock); + local_irq_enable(); if (ret) goto out; =20 --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 9F615C6FA82 for ; Tue, 27 Sep 2022 16:02:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232965AbiI0QCx (ORCPT ); Tue, 27 Sep 2022 12:02:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232525AbiI0QBo (ORCPT ); Tue, 27 Sep 2022 12:01:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3145EF087 for ; Tue, 27 Sep 2022 09:01: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 ams.source.kernel.org (Postfix) with ESMTPS id 96B12B81C64 for ; Tue, 27 Sep 2022 16:01:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65225C433D7; Tue, 27 Sep 2022 16:01:40 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2o-00G2wt-2j; Tue, 27 Sep 2022 12:02:50 -0400 Message-ID: <20220927160250.439945082@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:33 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Gaosheng Cui Subject: [for-next][PATCH 17/20] ftrace: Remove obsoleted code from ftrace and task_struct References: <20220927160216.349640304@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: Gaosheng Cui The trace of "struct task_struct" was no longer used since commit 345ddcc882d8 ("ftrace: Have set_ftrace_pid use the bitmap like events do"), and the functions about flags for current->trace is useless, so remove them. Link: https://lkml.kernel.org/r/20220923090012.505990-1-cuigaosheng1@huawei= .com Signed-off-by: Gaosheng Cui Signed-off-by: Steven Rostedt (Google) --- include/linux/ftrace.h | 41 ----------------------------------------- include/linux/sched.h | 3 --- 2 files changed, 44 deletions(-) diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 0b61371e287b..62557d4bffc2 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h @@ -1122,47 +1122,6 @@ static inline void unpause_graph_tracing(void) { } #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ =20 #ifdef CONFIG_TRACING - -/* flags for current->trace */ -enum { - TSK_TRACE_FL_TRACE_BIT =3D 0, - TSK_TRACE_FL_GRAPH_BIT =3D 1, -}; -enum { - TSK_TRACE_FL_TRACE =3D 1 << TSK_TRACE_FL_TRACE_BIT, - TSK_TRACE_FL_GRAPH =3D 1 << TSK_TRACE_FL_GRAPH_BIT, -}; - -static inline void set_tsk_trace_trace(struct task_struct *tsk) -{ - set_bit(TSK_TRACE_FL_TRACE_BIT, &tsk->trace); -} - -static inline void clear_tsk_trace_trace(struct task_struct *tsk) -{ - clear_bit(TSK_TRACE_FL_TRACE_BIT, &tsk->trace); -} - -static inline int test_tsk_trace_trace(struct task_struct *tsk) -{ - return tsk->trace & TSK_TRACE_FL_TRACE; -} - -static inline void set_tsk_trace_graph(struct task_struct *tsk) -{ - set_bit(TSK_TRACE_FL_GRAPH_BIT, &tsk->trace); -} - -static inline void clear_tsk_trace_graph(struct task_struct *tsk) -{ - clear_bit(TSK_TRACE_FL_GRAPH_BIT, &tsk->trace); -} - -static inline int test_tsk_trace_graph(struct task_struct *tsk) -{ - return tsk->trace & TSK_TRACE_FL_GRAPH; -} - enum ftrace_dump_mode; =20 extern enum ftrace_dump_mode ftrace_dump_on_oops; diff --git a/include/linux/sched.h b/include/linux/sched.h index e7b2f8a5c711..c7ee04e9147a 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1381,9 +1381,6 @@ struct task_struct { #endif =20 #ifdef CONFIG_TRACING - /* State flags for use by tracers: */ - unsigned long trace; - /* Bitmask and counter of trace recursion: */ unsigned long trace_recursion; #endif /* CONFIG_TRACING */ --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 08197C07E9D for ; Tue, 27 Sep 2022 16:03:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232991AbiI0QDC (ORCPT ); Tue, 27 Sep 2022 12:03:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232364AbiI0QBr (ORCPT ); Tue, 27 Sep 2022 12:01:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BB38F6863 for ; Tue, 27 Sep 2022 09:01:43 -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 ams.source.kernel.org (Postfix) with ESMTPS id 1E1ACB81C63 for ; Tue, 27 Sep 2022 16:01:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA163C433B5; Tue, 27 Sep 2022 16:01:40 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2p-00G2xS-17; Tue, 27 Sep 2022 12:02:51 -0400 Message-ID: <20220927160250.943561392@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:34 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Chen Zhongjin , "Masami Hiramatsu (Google)" Subject: [for-next][PATCH 18/20] x86: kprobes: Remove unused macro stack_addr References: <20220927160216.349640304@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: Chen Zhongjin An unused macro reported by [-Wunused-macros]. This macro is used to access the sp in pt_regs because at that time x86_32 can only get sp by kernel_stack_pointer(regs). '3c88c692c287 ("x86/stackframe/32: Provide consistent pt_regs")' This commit have unified the pt_regs and from them we can get sp from pt_regs with regs->sp easily. Nowhere is using this macro anymore. Refrencing pt_regs directly is more clear. Remove this macro for code cleaning. Link: https://lkml.kernel.org/r/20220924072629.104759-1-chenzhongjin@huawei= .com Signed-off-by: Chen Zhongjin Acked-by: Masami Hiramatsu (Google) Signed-off-by: Steven Rostedt (Google) --- arch/x86/kernel/kprobes/core.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 4c3c27b6aea3..eb8bc82846b9 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c @@ -59,8 +59,6 @@ DEFINE_PER_CPU(struct kprobe *, current_kprobe) =3D NULL; DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); =20 -#define stack_addr(regs) ((unsigned long *)regs->sp) - #define W(row, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be,= bf)\ (((b0##UL << 0x0)|(b1##UL << 0x1)|(b2##UL << 0x2)|(b3##UL << 0x3) | \ (b4##UL << 0x4)|(b5##UL << 0x5)|(b6##UL << 0x6)|(b7##UL << 0x7) | \ --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 AD7F6C54EE9 for ; Tue, 27 Sep 2022 16:02:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232975AbiI0QC4 (ORCPT ); Tue, 27 Sep 2022 12:02:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232367AbiI0QBr (ORCPT ); Tue, 27 Sep 2022 12:01:47 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB70FD98C2; Tue, 27 Sep 2022 09:01:44 -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 EAF27CE19D1; Tue, 27 Sep 2022 16:01:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48BE2C43470; Tue, 27 Sep 2022 16:01:41 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2p-00G2y1-2g; Tue, 27 Sep 2022 12:02:51 -0400 Message-ID: <20220927160251.443413557@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:35 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , Ingo Molnar , Tom Zanussi , Linyu Yuan , stable@vger.kernel.org, "Masami Hiramatsu (Google)" , Tao Chen Subject: [for-next][PATCH 19/20] tracing/eprobe: Fix alloc event dir failed when event name no set References: <20220927160216.349640304@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: Tao Chen The event dir will alloc failed when event name no set, using the command: "echo "e:esys/ syscalls/sys_enter_openat file=3D\$filename:string" >> dynamic_events" It seems that dir name=3D"syscalls/sys_enter_openat" is not allowed in debugfs. So just use the "sys_enter_openat" as the event name. Link: https://lkml.kernel.org/r/1664028814-45923-1-git-send-email-chentao.k= ernel@linux.alibaba.com Cc: Ingo Molnar Cc: Tom Zanussi Cc: Linyu Yuan Cc: Tao Chen Signed-off-by: Tao Chen Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_eprobe.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c index 78299d3724a2..c08bde9871ec 100644 --- a/kernel/trace/trace_eprobe.c +++ b/kernel/trace/trace_eprobe.c @@ -1039,8 +1039,7 @@ static int __trace_eprobe_create(int argc, const char= *argv[]) } =20 if (!event) { - strscpy(buf1, argv[1], MAX_EVENT_NAME_LEN); - sanitize_event_name(buf1); + strscpy(buf1, sys_event, MAX_EVENT_NAME_LEN); event =3D buf1; } =20 --=20 2.35.1 From nobody Mon Apr 6 11:53:32 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 8A774C07E9D for ; Tue, 27 Sep 2022 16:03:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232997AbiI0QDG (ORCPT ); Tue, 27 Sep 2022 12:03:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232447AbiI0QBr (ORCPT ); Tue, 27 Sep 2022 12:01:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9785C1EEE1; Tue, 27 Sep 2022 09:01:44 -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 ams.source.kernel.org (Postfix) with ESMTPS id 1714CB81C66; Tue, 27 Sep 2022 16:01:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9328C433C1; Tue, 27 Sep 2022 16:01:41 +0000 (UTC) Received: from rostedt by gandalf.local.home with local (Exim 4.96) (envelope-from ) id 1odD2q-00G2ye-19; Tue, 27 Sep 2022 12:02:52 -0400 Message-ID: <20220927160251.950267059@goodmis.org> User-Agent: quilt/0.66 Date: Tue, 27 Sep 2022 12:02:36 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Daniel Bristot de Oliveira , , stable@vger.kernel.org, Zheng Yejian Subject: [for-next][PATCH 20/20] ftrace: Properly unset FTRACE_HASH_FL_MOD References: <20220927160216.349640304@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: Zheng Yejian When executing following commands like what document said, but the log "#### all functions enabled ####" was not shown as expect: 1. Set a 'mod' filter: $ echo 'write*:mod:ext3' > /sys/kernel/tracing/set_ftrace_filter 2. Invert above filter: $ echo '!write*:mod:ext3' >> /sys/kernel/tracing/set_ftrace_filter 3. Read the file: $ cat /sys/kernel/tracing/set_ftrace_filter By some debugging, I found that flag FTRACE_HASH_FL_MOD was not unset after inversion like above step 2 and then result of ftrace_hash_empty() is incorrect. Link: https://lkml.kernel.org/r/20220926152008.2239274-1-zhengyejian1@huawe= i.com Cc: Cc: stable@vger.kernel.org Fixes: 8c08f0d5c6fb ("ftrace: Have cached module filters be an active filte= r") Signed-off-by: Zheng Yejian Signed-off-by: Steven Rostedt (Google) --- kernel/trace/ftrace.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 439e2ab6905e..5a1ec7e1af33 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -6081,8 +6081,12 @@ int ftrace_regex_release(struct inode *inode, struct= file *file) =20 if (filter_hash) { orig_hash =3D &iter->ops->func_hash->filter_hash; - if (iter->tr && !list_empty(&iter->tr->mod_trace)) - iter->hash->flags |=3D FTRACE_HASH_FL_MOD; + if (iter->tr) { + if (list_empty(&iter->tr->mod_trace)) + iter->hash->flags &=3D ~FTRACE_HASH_FL_MOD; + else + iter->hash->flags |=3D FTRACE_HASH_FL_MOD; + } } else orig_hash =3D &iter->ops->func_hash->notrace_hash; =20 --=20 2.35.1