From nobody Mon Oct 6 06:36:17 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAC301E8338 for ; Wed, 23 Jul 2025 15:36:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753284962; cv=none; b=nzQxamtJbrGWVKq7PQpnRbt1fuxHqZ8d/bTJOD59DUT4salYODhoFPlhpRy39SToS9TmKhy8Ibdn0SaaGbOtoUaU0G/0gWl/1ts/Hh9f5N2aO40AI5mFuDt3E/WOKNKW+xUVg9Drkg1nYP0NnAOgcA4faxUcTka157hQEJuWwyI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753284962; c=relaxed/simple; bh=2AJ3pnQjZ1aKTWM8TU5LnO0jhfi+rzvH5e3vxC/0WFY=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Loe7KYvqQB9MjRaSOVzQkUulfA90W7TSI5LfUQ/ZEnXVrhfTMmKFMWhlxgkZceP64EkxJQMlA0NC1KLOVqGgqnWzsxW4cAC3wv2Fz9+8zD9Dd2WUHYTFO3KfXAU6vzEr4gT+ifYn4ApbBD27hzOL60OWdbjoq0zHIRZ8s5fb4z4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CUqciMYD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CUqciMYD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 323E8C4CEE7; Wed, 23 Jul 2025 15:36:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753284962; bh=2AJ3pnQjZ1aKTWM8TU5LnO0jhfi+rzvH5e3vxC/0WFY=; h=Date:From:To:Cc:Subject:References:From; b=CUqciMYDnWOV9PagnDvvC/P797z7s34XI3i4fAyUTv3KbUUC8/XhfvGN+kIs5QOvn Wq7w/044qzsx/HW+lTZheTzi2oABFio3lCgROECWdNqrtdd8Ch/8pLLmgRFSIIkD2n x7dPr+Br9Gc5wqXsdBOhnLCb4We/uoWM6cygDdOIkJ2gtYGBVgMyZLJEO18RIFE3Xf nPUan2HHcy+1QuH0GX8n+gMHI4xxxbDCIRlXSjjFoaPL8+xfklkCaZiSND2ntmW5Bo MEDO+2+EFOvImF/D0XIa+quOc1vcVCdBYacols4+Z6AYOvssqTkHOiQzGoeVet4ly1 ctvSE5wvt7KQw== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1ueamd-00000000LPF-2j1l; Wed, 23 Jul 2025 10:49:27 -0400 Message-ID: <20250723144927.507197150@kernel.org> User-Agent: quilt/0.68 Date: Wed, 23 Jul 2025 10:49:08 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Yury Norov Subject: [for-next][PATCH 1/8] tracing: Replace opencoded cpumask_next_wrap() in move_to_next_cpu() References: <20250723144907.219256132@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Yury Norov The dedicated cpumask_next_wrap() is more verbose and effective than cpumask_next() followed by cpumask_first(). Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Link: https://lore.kernel.org/20250605000651.45281-1-yury.norov@gmail.com Signed-off-by: Yury Norov Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_hwlat.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kernel/trace/trace_hwlat.c b/kernel/trace/trace_hwlat.c index b65353ec2837..2f7b94e98317 100644 --- a/kernel/trace/trace_hwlat.c +++ b/kernel/trace/trace_hwlat.c @@ -325,12 +325,9 @@ static void move_to_next_cpu(void) =20 cpus_read_lock(); cpumask_and(current_mask, cpu_online_mask, tr->tracing_cpumask); - next_cpu =3D cpumask_next(raw_smp_processor_id(), current_mask); + next_cpu =3D cpumask_next_wrap(raw_smp_processor_id(), current_mask); cpus_read_unlock(); =20 - if (next_cpu >=3D nr_cpu_ids) - next_cpu =3D cpumask_first(current_mask); - if (next_cpu >=3D nr_cpu_ids) /* Shouldn't happen! */ goto change_mode; =20 --=20 2.47.2 From nobody Mon Oct 6 06:36:17 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD6222F94BA for ; Wed, 23 Jul 2025 14:49:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753282167; cv=none; b=sLYTKjYjvbCoXjh/jgppZOb7ILF2taVQE8hUTfbvClWPm6Iir0d4fyh0eSy55chT2HZcoxD75lgOPET+jiWUB0omfGHhMl+/KpE3AnPufxOkOOHHBLNOwCnMxIu9+8GW8PptiyTciPuS4PCrxHnQ69uJO0MlFmAZxO6OAkoOhic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753282167; c=relaxed/simple; bh=RVU8e3tPxKExebVReo9iYbzkYxmRBIQqTKXARYt+7+k=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=cN2J3K4NNJj5dRNguLAtgcbkicoI6stoeCO9CZuUxuHgh3EL6FrUSHHeEwI02noYqANFGJl2C6kqxWWco27l+6juYzSumXTfBN1Z0dAWUro382kBQmrE/4vomoruGH6nffkKe+ZFQIsFUbQ8crXBD1K3wRT9RpELXG/U3oIHKj0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=W8N/Qwza; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="W8N/Qwza" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E564BC2BCF7; Wed, 23 Jul 2025 14:49:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753282167; bh=RVU8e3tPxKExebVReo9iYbzkYxmRBIQqTKXARYt+7+k=; h=Date:From:To:Cc:Subject:References:From; b=W8N/QwzaX2N7sDL2v8mUi7q7wL6Rar1vnFyKeQTpg6wjwCuyv0pfoX2TdaTSWGezG GwCSQDQUfT4ZValhmtKqqbcpD9/m4E8gBj8KbUOMuE6ntKBtFC8SFp+BXknvNM+0fa ZLMRl9G1mUlihKOhslcRRF6XU66LCocClKnTnEGKSYa8hNflqVFwdklZxs86DAlJIM OFV39a8IyBBCN8S9pX+WVBw1LdYll1mW95XDBcaoIQemmJ5UtZT4oVLQD8GlvFl8MR VTcnf+Yk3k5khVC14N1dURNQOZbV2nsNH0J+Y6QBtlvf54b60+aKO9t7TY+b/OUNmW Ae0icNExAWtrw== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1ueamd-00000000LPj-3QhN; Wed, 23 Jul 2025 10:49:27 -0400 Message-ID: <20250723144927.671461904@kernel.org> User-Agent: quilt/0.68 Date: Wed, 23 Jul 2025 10:49:09 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , "Paul E. McKenney" Subject: [for-next][PATCH 2/8] tracing: Use queue_rcu_work() to free filters References: <20250723144907.219256132@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Steven Rostedt Freeing of filters requires to wait for both an RCU grace period as well as a RCU task trace wait period after they have been detached from their lists. The trace task period can be quite large so the freeing of the filters was moved to use the call_rcu*() routines. The problem with that is that the callback functions of call_rcu*() is done from a soft irq and can cause latencies if the callback takes a bit of time. The filters are freed per event in a system and the syscalls system contains an event per system call, which can be over 700 events. Freeing 700 filters in a bottom half is undesirable. Instead, move the freeing to use queue_rcu_work() which is done in task context. Link: https://lore.kernel.org/all/9a2f0cd0-1561-4206-8966-f93ccd25927f@paul= mck-laptop/ Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Link: https://lore.kernel.org/20250609131732.04fd303b@gandalf.local.home Fixes: a9d0aab5eb33 ("tracing: Fix regression of filter waiting a long time= on RCU synchronization") Suggested-by: "Paul E. McKenney" Reviewed-by: Paul E. McKenney Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_events_filter.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events= _filter.c index 3885aadc434d..196c8bf34970 100644 --- a/kernel/trace/trace_events_filter.c +++ b/kernel/trace/trace_events_filter.c @@ -1344,13 +1344,14 @@ struct filter_list { =20 struct filter_head { struct list_head list; - struct rcu_head rcu; + union { + struct rcu_head rcu; + struct rcu_work rwork; + }; }; =20 - -static void free_filter_list(struct rcu_head *rhp) +static void free_filter_list(struct filter_head *filter_list) { - struct filter_head *filter_list =3D container_of(rhp, struct filter_head,= rcu); struct filter_list *filter_item, *tmp; =20 list_for_each_entry_safe(filter_item, tmp, &filter_list->list, list) { @@ -1361,9 +1362,20 @@ static void free_filter_list(struct rcu_head *rhp) kfree(filter_list); } =20 +static void free_filter_list_work(struct work_struct *work) +{ + struct filter_head *filter_list; + + filter_list =3D container_of(to_rcu_work(work), struct filter_head, rwork= ); + free_filter_list(filter_list); +} + static void free_filter_list_tasks(struct rcu_head *rhp) { - call_rcu(rhp, free_filter_list); + struct filter_head *filter_list =3D container_of(rhp, struct filter_head,= rcu); + + INIT_RCU_WORK(&filter_list->rwork, free_filter_list_work); + queue_rcu_work(system_wq, &filter_list->rwork); } =20 /* @@ -1460,7 +1472,7 @@ static void filter_free_subsystem_filters(struct trac= e_subsystem_dir *dir, tracepoint_synchronize_unregister(); =20 if (head) - free_filter_list(&head->rcu); + free_filter_list(head); =20 list_for_each_entry(file, &tr->events, list) { if (file->system !=3D dir || !file->filter) @@ -2305,7 +2317,7 @@ static int process_system_preds(struct trace_subsyste= m_dir *dir, return 0; fail: /* No call succeeded */ - free_filter_list(&filter_list->rcu); + free_filter_list(filter_list); parse_error(pe, FILT_ERR_BAD_SUBSYS_FILTER, 0); return -EINVAL; fail_mem: @@ -2315,7 +2327,7 @@ static int process_system_preds(struct trace_subsyste= m_dir *dir, if (!fail) delay_free_filter(filter_list); else - free_filter_list(&filter_list->rcu); + free_filter_list(filter_list); =20 return -ENOMEM; } --=20 2.47.2 From nobody Mon Oct 6 06:36:17 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D7081F3B8A for ; Wed, 23 Jul 2025 15:36:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753284963; cv=none; b=TIayObE0Q836HnYrrEcUDNXxNYOZoOS8rn/1Dkhecb7PI2yMELKLJx1Ox6R3logPXmObl51/sGLibI8RzkX46+aawGyTNCJuIPKI5SHOCfSHPYkOnZyZEaB8vcjMZyupodCC2fUPj9DEtDNYYJsuBguxWq7fxpquClE9h8CF7oA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753284963; c=relaxed/simple; bh=ZvXKGt+TTpbDKDr6EJ7fxN2C5u+9aqZGHrvGXXcGovU=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=kLbysPK5sIRgFwTJphaLgFPYxc6JzzD0yx/zh2pTUTqrBnCWYFTH1dR4AuJB3PhNuPt3ZVvazf8TbReCpbJimRXxKyPP/Vzk4XnqoBWja5CSioD5CXMhXTxe7oft59XncWPx4vnHYrFHctOdlFyhj/JG+MWJ8ONsP+uEdTVcqWM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZlzQh9sz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZlzQh9sz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7411C4CEF7; Wed, 23 Jul 2025 15:36:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753284962; bh=ZvXKGt+TTpbDKDr6EJ7fxN2C5u+9aqZGHrvGXXcGovU=; h=Date:From:To:Cc:Subject:References:From; b=ZlzQh9szu7jpVc+b9G9eMGPueaBi7QbXpil2Zo+swjRepswBtAL9KCvXjwXmdPmq/ 1lXhMXH8160hDebPOL1/ncv32lPt4EQidaSAE1osq0gr84rAiTW3Ig/YHAQiiBDEt/ 2FsGbpjgFoJ6Z/ThB/XLjuL1A4hzWA7Gy5BjQgz6+zPvJuhOAVOPguruacoJonu6Z/ e6byPyAw+Ueyb6wlX9sVpMdAyx8RNwRijaUpqzgoNFbT423Dr+nahManpKyA0fEjSY tLlqN+1G5ua31Yb5qyhBSzQuxAfPo/XXTeYbr9uo3V4k1BtKXWPIz1n3UhumbOzq5g sLil8w080iDIA== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1ueamd-00000000LQE-47iM; Wed, 23 Jul 2025 10:49:27 -0400 Message-ID: <20250723144927.839559500@kernel.org> User-Agent: quilt/0.68 Date: Wed, 23 Jul 2025 10:49:10 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Song Chen , Arnd Bergmann Subject: [for-next][PATCH 3/8] kernel: trace: preemptirq_delay_test: use offstack cpu mask References: <20250723144907.219256132@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Arnd Bergmann A CPU mask on the stack is broken for large values of CONFIG_NR_CPUS: kernel/trace/preemptirq_delay_test.c: In function =E2=80=98preemptirq_delay= _run=E2=80=99: kernel/trace/preemptirq_delay_test.c:143:1: error: the frame size of 8512 b= ytes is larger than 1536 bytes [-Werror=3Dframe-larger-than=3D] Fall back to dynamic allocation here. Cc: Masami Hiramatsu Cc: Song Chen Cc: Mathieu Desnoyers Link: https://lore.kernel.org/20250620111215.3365305-1-arnd@kernel.org Fixes: 4b9091e1c194 ("kernel: trace: preemptirq_delay_test: add cpu affinit= y") Signed-off-by: Arnd Bergmann Signed-off-by: Steven Rostedt (Google) --- kernel/trace/preemptirq_delay_test.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/kernel/trace/preemptirq_delay_test.c b/kernel/trace/preemptirq= _delay_test.c index 314ffc143039..acb0c971a408 100644 --- a/kernel/trace/preemptirq_delay_test.c +++ b/kernel/trace/preemptirq_delay_test.c @@ -117,12 +117,15 @@ static int preemptirq_delay_run(void *data) { int i; int s =3D MIN(burst_size, NR_TEST_FUNCS); - struct cpumask cpu_mask; + cpumask_var_t cpu_mask; + + if (!alloc_cpumask_var(&cpu_mask, GFP_KERNEL)) + return -ENOMEM; =20 if (cpu_affinity > -1) { - cpumask_clear(&cpu_mask); - cpumask_set_cpu(cpu_affinity, &cpu_mask); - if (set_cpus_allowed_ptr(current, &cpu_mask)) + cpumask_clear(cpu_mask); + cpumask_set_cpu(cpu_affinity, cpu_mask); + if (set_cpus_allowed_ptr(current, cpu_mask)) pr_err("cpu_affinity:%d, failed\n", cpu_affinity); } =20 @@ -139,6 +142,8 @@ static int preemptirq_delay_run(void *data) =20 __set_current_state(TASK_RUNNING); =20 + free_cpumask_var(cpu_mask); + return 0; } =20 --=20 2.47.2 From nobody Mon Oct 6 06:36:17 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0ECB1FDA82 for ; Wed, 23 Jul 2025 15:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753284963; cv=none; b=um7vX8mS8VotrPuW7WHGOqn9KG1cjJ+OUvP/e0cKCVSNypcBvYKe0X9dLvtDou9Q7NoXPVMjvz8QAQ9YJvynPld8DSjehhPkU693Q0OOJ5+Qu3YSFTJQyUjRfwie9JX3ov+Z5yNZecA3oAiGZB5gsu8ddZExPsnmTASzaJLbI7Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753284963; c=relaxed/simple; bh=1ZYm2iX/5igYMVfe4wwokyCMPT4ImHaWCrh+ggIYA/o=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=pILVy08PCmm7clBJm8OrylZMN4sPG7BdLMVbeK9f0RJKDYV6t2oV9u9odIarZ6JbmIAK3Ial2TPIeAa9HCULJqv0RUkqv/2xT1FuYqyPtsrnkpWQWkrD+fp+BF+QXr6pTnAsK6QUwZ1/Z24eEmoFi4Lt4KUxJlFyHugNLy1Ys24= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ST2hgEZi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ST2hgEZi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A077AC4CEEF; Wed, 23 Jul 2025 15:36:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753284963; bh=1ZYm2iX/5igYMVfe4wwokyCMPT4ImHaWCrh+ggIYA/o=; h=Date:From:To:Cc:Subject:References:From; b=ST2hgEZih1qXqc9S0u+iT24ZB/cgD8iTtF5bOFRXdnC1Ku6zvMKNXgIIK6vjCFRG+ H9FTkr6hUFoJGbjdnBCPHzyMbuQYpTB9twAeHQhBPnnl4JUzrU18FXPQyWROwRdo2w 8Q32hW4ECC1c1ns+YHqn6oY814W9eC05ztSF1SEMiAmB7IVWtwpQqo4uupt1n336lY toaTSMpeyqOXsKmFU1Qg7x9N98iLIuq2PHXb8gQTU2Z38y70FzkT1p+NTwywX9ZDh+ vlqrsbQa/t8gpE3knZ3NpU3GHvYmWFDYOv2WqHldzzVGThJBU6Uo1Wo77moyFsU8b6 47nbT/CDiNCvg== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1ueame-00000000LQj-0dBj; Wed, 23 Jul 2025 10:49:28 -0400 Message-ID: <20250723144928.003886193@kernel.org> User-Agent: quilt/0.68 Date: Wed, 23 Jul 2025 10:49:11 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Ricardo Neri , Ricardo Neri Subject: [for-next][PATCH 4/8] tracing/sched: Remove obsolete comment on suffixes References: <20250723144907.219256132@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Ricardo Neri Commit ac01fa73f530 ("tracepoint: Have tracepoints created with DECLARE_ TRACE() have _tp suffix") makes it unnecessary to manually add a suffix. Remove a now obsolete comment. Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Cc: Ricardo Neri Link: https://lore.kernel.org/20250620-rneri-tp-comment-fix-v1-1-e0f6495ac3= 3c@linux.intel.com Signed-off-by: Ricardo Neri Signed-off-by: Steven Rostedt (Google) --- include/trace/events/sched.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h index 4e6b2910cec3..f24c373bcc44 100644 --- a/include/trace/events/sched.h +++ b/include/trace/events/sched.h @@ -829,8 +829,6 @@ TRACE_EVENT(sched_wake_idle_without_ipi, /* * Following tracepoints are not exported in tracefs and provide hooking * mechanisms only for testing and debugging purposes. - * - * Postfixed with _tp to make them easily identifiable in the code. */ DECLARE_TRACE(pelt_cfs, TP_PROTO(struct cfs_rq *cfs_rq), --=20 2.47.2 From nobody Mon Oct 6 06:36:17 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CAB71F5827 for ; Wed, 23 Jul 2025 15:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753284963; cv=none; b=O5lsKgji+RmqwRNcU0KTkI/AfkuHgyEKOyXV56FSySxrOBM23jhHfY69WxkLydRitUB+QYSTnDkwCLBTdouR8ZoKqcDbzjDGazI7ChPvIWG8QlBTmyIJS6e+f0WRpJPpChTXY5t3Kg1RScGUgodZrb9hsEBJnLS7ZvJw61sNaqk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753284963; c=relaxed/simple; bh=MyJ++kcHYsc3TCfHXbv+NA4FXvwX5QEPx0gAXoTb3hY=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=PjVvOwZVXuODVrhME2XPAvkAlaM8PMiUSDbaF3e9kP3ORcTghrDY4mTKMaUgpBoPmDvpx/n7Kxzdd68JgXfoLXOwZdyL9ohGLtVV10M+pwNJzXumwsuWDMjC9EMOTTX5MDsT39pgVTxoe5PCnRTj8fCge+eNXV8KyAAzhGkCtD8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=H/z1oUoq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="H/z1oUoq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8BB6C4CEF1; Wed, 23 Jul 2025 15:36:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753284962; bh=MyJ++kcHYsc3TCfHXbv+NA4FXvwX5QEPx0gAXoTb3hY=; h=Date:From:To:Cc:Subject:References:From; b=H/z1oUoqdE4mhVOrC6MhD8WXLFY2KK+JNvR4Umc7VhVsk6sFHUJq9as9Gs2rAW9gw tmek4m+csrLGTiT/JQcu4X5Z74tzHSpMYIKrljVXszOAsaxzryjoP5How8/kBRSF3x hHBVf5N7Bt8AlkPnk6/yAs9Ha4we6KSn6qD7jPXJdJHPyEsS7dgOqsFMWg0KfUYdDi xfv86byfUFsTyTxjKVsbWy36q9xcHHP5pG+p+w0Nl/nID+STNUj1aFRtMKV4XnfSFW 3B0pb+ocdjM/r+zsh2zsnSIn7grPJfCnNNcUaE4gKLMUcBhxvJefm3U7K+Ln/PAqTI /JJSsrSqdV/4Q== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1ueame-00000000LRE-1LUB; Wed, 23 Jul 2025 10:49:28 -0400 Message-ID: <20250723144928.172299624@kernel.org> User-Agent: quilt/0.68 Date: Wed, 23 Jul 2025 10:49:12 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Gabriele Monaco , Nam Cao Subject: [for-next][PATCH 5/8] tracing: Remove pointless memory barriers References: <20250723144907.219256132@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Nam Cao Memory barriers are useful to ensure memory accesses from one CPU appear in the original order as seen by other CPUs. Some smp_rmb() and smp_wmb() are used, but they are not ordering multiple memory accesses. Remove them. Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Cc: Gabriele Monaco Link: https://lore.kernel.org/20250626151940.1756398-1-namcao@linutronix.de Signed-off-by: Nam Cao Signed-off-by: Steven Rostedt (Google) --- kernel/trace/rv/rv.c | 6 ------ kernel/trace/trace.c | 7 ------- 2 files changed, 13 deletions(-) diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c index e4077500a91d..c04a49da4328 100644 --- a/kernel/trace/rv/rv.c +++ b/kernel/trace/rv/rv.c @@ -675,8 +675,6 @@ static bool __read_mostly monitoring_on; */ bool rv_monitoring_on(void) { - /* Ensures that concurrent monitors read consistent monitoring_on */ - smp_rmb(); return READ_ONCE(monitoring_on); } =20 @@ -696,8 +694,6 @@ static ssize_t monitoring_on_read_data(struct file *fil= p, char __user *user_buf, static void turn_monitoring_off(void) { WRITE_ONCE(monitoring_on, false); - /* Ensures that concurrent monitors read consistent monitoring_on */ - smp_wmb(); } =20 static void reset_all_monitors(void) @@ -713,8 +709,6 @@ static void reset_all_monitors(void) static void turn_monitoring_on(void) { WRITE_ONCE(monitoring_on, true); - /* Ensures that concurrent monitors read consistent monitoring_on */ - smp_wmb(); } =20 static void turn_monitoring_on_with_reset(void) diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 95ae7c4e5835..0dff4298fc0e 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -936,7 +936,6 @@ int tracing_is_enabled(void) * return the mirror variable of the state of the ring buffer. * It's a little racy, but we don't really care. */ - smp_rmb(); return !global_trace.buffer_disabled; } =20 @@ -1107,8 +1106,6 @@ void tracer_tracing_on(struct trace_array *tr) * important to be fast than accurate. */ tr->buffer_disabled =3D 0; - /* Make the flag seen by readers */ - smp_wmb(); } =20 /** @@ -1640,8 +1637,6 @@ void tracer_tracing_off(struct trace_array *tr) * important to be fast than accurate. */ tr->buffer_disabled =3D 1; - /* Make the flag seen by readers */ - smp_wmb(); } =20 /** @@ -2710,8 +2705,6 @@ void trace_buffered_event_enable(void) =20 static void enable_trace_buffered_event(void *data) { - /* Probably not needed, but do it anyway */ - smp_rmb(); this_cpu_dec(trace_buffered_event_cnt); } =20 --=20 2.47.2 From nobody Mon Oct 6 06:36:17 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6D5B1F12E0 for ; Wed, 23 Jul 2025 15:36:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753284962; cv=none; b=skrEzTELSq6/G8taucChWkPdtIBQHllrcydWWuZmMe+DH3VRjGysCVDqb+q6i/BDI2vxui34hlk4hBQ7hkP4aLtcwqh9jgOnQgBonmMswb2Rsucu6b7iHnAYGZebIVGdYaio5bFKCecx3eFL+QG2+Y7QiU8lhR14DmF4+Juaud0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753284962; c=relaxed/simple; bh=mrCVMwB0r4GEpqhegCCAOZeTt67vnx2mLaFmd/ePuwM=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=aeXqCTAR+aeUnwMiMSUIOjH9Jifm4BJxcg1axslYr+hr74eA+Q9CSDio9olbYvDpkR5HwqEBQ93e1HV/vlVU8KlaEwujXiP/O0464htOFa++KAPrD4PcBu32g9lp3IZRIC/hGIpjBYjEIObT4Ww6ezYou3UEqm43bS1gsJmEApQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=f/aYE6Tf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="f/aYE6Tf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 662EBC4CEEF; Wed, 23 Jul 2025 15:36:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753284962; bh=mrCVMwB0r4GEpqhegCCAOZeTt67vnx2mLaFmd/ePuwM=; h=Date:From:To:Cc:Subject:References:From; b=f/aYE6TfgPyPCzUPq7BSKBSR9n7sbtb5QTQEMIE7wV0UqLiuFeO48h0TIgXr+I+hC I0w6kykXAGketNu+UcQFAgzrQI+BiipFf0Wn+tR8HmtUf1qAdMWCAxkMazADTaSGtH RkTOy2swvFy6XG6fUp8vGejiv7H8Qw3AjfJHXNe4RFk2s360Gw4JG1vf6XUE8gE9yM QMXtN3OXa4MjdmGWjeccO8sQLea5mFxFxMPXlFivXA1QKkK52DIRN4HS81USeW1655 JxcrqcvH11ngI+TDVt0rEyt/WJIR1VTbUXPJb59a40XOiBE6gELXM0S6jL082u7TNc QZUuQ8FSArRFQ== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1ueame-00000000LRi-224k; Wed, 23 Jul 2025 10:49:28 -0400 Message-ID: <20250723144928.341184323@kernel.org> User-Agent: quilt/0.68 Date: Wed, 23 Jul 2025 10:49:13 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Gabriele Paoloni Subject: [for-next][PATCH 6/8] tracing: Remove EVENT_FILE_FL_SOFT_MODE flag References: <20250723144907.219256132@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Steven Rostedt When soft disabling of trace events was first created, it needed to have a way to know if a file had a user that was using it with soft disabled (for triggers that need to enable or disable events from a context that can not really enable or disable the event, it would set SOFT_DISABLED to state it is disabled). The flag SOFT_MODE was used to denote that an event had a user that would enable or disable it via the SOFT_DISABLED flag. Commit 1cf4c0732db3c ("tracing: Modify soft-mode only if there's no other referrer") fixed a bug where if two users were using the SOFT_DISABLED flag the accounting would get messed up as the SOFT_MODE flag could only handle one user. That commit added the sm_ref counter which kept track of how many users were using the event in "soft mode". This made the SOFT_MODE flag redundant as it should only be set if the sm_ref counter is non zero. Remove the SOFT_MODE flag and just use the sm_ref counter to know the event is in soft mode or not. This makes the code a bit simpler. Link: https://lore.kernel.org/all/20250702111908.03759998@batman.local.home/ Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Cc: Gabriele Paoloni Link: https://lore.kernel.org/20250702143657.18dd1882@batman.local.home Signed-off-by: Steven Rostedt (Google) --- include/linux/trace_events.h | 3 --- kernel/trace/trace_events.c | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index fa9cf4292dff..04307a19cde3 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -480,7 +480,6 @@ enum { EVENT_FILE_FL_RECORDED_TGID_BIT, EVENT_FILE_FL_FILTERED_BIT, EVENT_FILE_FL_NO_SET_FILTER_BIT, - EVENT_FILE_FL_SOFT_MODE_BIT, EVENT_FILE_FL_SOFT_DISABLED_BIT, EVENT_FILE_FL_TRIGGER_MODE_BIT, EVENT_FILE_FL_TRIGGER_COND_BIT, @@ -618,7 +617,6 @@ extern int __kprobe_event_add_fields(struct dynevent_cm= d *cmd, ...); * RECORDED_TGID - The tgids should be recorded at sched_switch * FILTERED - The event has a filter attached * NO_SET_FILTER - Set when filter has error and is to be ignored - * SOFT_MODE - The event is enabled/disabled by SOFT_DISABLED * SOFT_DISABLED - When set, do not trace the event (even though its * tracepoint may be enabled) * TRIGGER_MODE - When set, invoke the triggers associated with the event @@ -633,7 +631,6 @@ enum { EVENT_FILE_FL_RECORDED_TGID =3D (1 << EVENT_FILE_FL_RECORDED_TGID_BIT), EVENT_FILE_FL_FILTERED =3D (1 << EVENT_FILE_FL_FILTERED_BIT), EVENT_FILE_FL_NO_SET_FILTER =3D (1 << EVENT_FILE_FL_NO_SET_FILTER_BIT), - EVENT_FILE_FL_SOFT_MODE =3D (1 << EVENT_FILE_FL_SOFT_MODE_BIT), EVENT_FILE_FL_SOFT_DISABLED =3D (1 << EVENT_FILE_FL_SOFT_DISABLED_BIT), EVENT_FILE_FL_TRIGGER_MODE =3D (1 << EVENT_FILE_FL_TRIGGER_MODE_BIT), EVENT_FILE_FL_TRIGGER_COND =3D (1 << EVENT_FILE_FL_TRIGGER_COND_BIT), diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 120531268abf..0980f4def360 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -768,6 +768,7 @@ static int __ftrace_event_enable_disable(struct trace_e= vent_file *file, { struct trace_event_call *call =3D file->event_call; struct trace_array *tr =3D file->tr; + bool soft_mode =3D atomic_read(&file->sm_ref) !=3D 0; int ret =3D 0; int disable; =20 @@ -782,7 +783,7 @@ static int __ftrace_event_enable_disable(struct trace_e= vent_file *file, * is set we do not want the event to be enabled before we * clear the bit. * - * When soft_disable is not set but the SOFT_MODE flag is, + * When soft_disable is not set but the soft_mode is, * we do nothing. Do not disable the tracepoint, otherwise * "soft enable"s (clearing the SOFT_DISABLED bit) wont work. */ @@ -790,11 +791,11 @@ static int __ftrace_event_enable_disable(struct trace= _event_file *file, if (atomic_dec_return(&file->sm_ref) > 0) break; disable =3D file->flags & EVENT_FILE_FL_SOFT_DISABLED; - clear_bit(EVENT_FILE_FL_SOFT_MODE_BIT, &file->flags); + soft_mode =3D false; /* Disable use of trace_buffered_event */ trace_buffered_event_disable(); } else - disable =3D !(file->flags & EVENT_FILE_FL_SOFT_MODE); + disable =3D !soft_mode; =20 if (disable && (file->flags & EVENT_FILE_FL_ENABLED)) { clear_bit(EVENT_FILE_FL_ENABLED_BIT, &file->flags); @@ -812,8 +813,8 @@ static int __ftrace_event_enable_disable(struct trace_e= vent_file *file, =20 WARN_ON_ONCE(ret); } - /* If in SOFT_MODE, just set the SOFT_DISABLE_BIT, else clear it */ - if (file->flags & EVENT_FILE_FL_SOFT_MODE) + /* If in soft mode, just set the SOFT_DISABLE_BIT, else clear it */ + if (soft_mode) set_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags); else clear_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags); @@ -823,7 +824,7 @@ static int __ftrace_event_enable_disable(struct trace_e= vent_file *file, * When soft_disable is set and enable is set, we want to * register the tracepoint for the event, but leave the event * as is. That means, if the event was already enabled, we do - * nothing (but set SOFT_MODE). If the event is disabled, we + * nothing (but set soft_mode). If the event is disabled, we * set SOFT_DISABLED before enabling the event tracepoint, so * it still seems to be disabled. */ @@ -832,7 +833,7 @@ static int __ftrace_event_enable_disable(struct trace_e= vent_file *file, else { if (atomic_inc_return(&file->sm_ref) > 1) break; - set_bit(EVENT_FILE_FL_SOFT_MODE_BIT, &file->flags); + soft_mode =3D true; /* Enable use of trace_buffered_event */ trace_buffered_event_enable(); } @@ -840,7 +841,7 @@ static int __ftrace_event_enable_disable(struct trace_e= vent_file *file, if (!(file->flags & EVENT_FILE_FL_ENABLED)) { bool cmd =3D false, tgid =3D false; =20 - /* Keep the event disabled, when going to SOFT_MODE. */ + /* Keep the event disabled, when going to soft mode. */ if (soft_disable) set_bit(EVENT_FILE_FL_SOFT_DISABLED_BIT, &file->flags); =20 @@ -1792,8 +1793,7 @@ event_enable_read(struct file *filp, char __user *ubu= f, size_t cnt, !(flags & EVENT_FILE_FL_SOFT_DISABLED)) strcpy(buf, "1"); =20 - if (flags & EVENT_FILE_FL_SOFT_DISABLED || - flags & EVENT_FILE_FL_SOFT_MODE) + if (atomic_read(&file->sm_ref) !=3D 0) strcat(buf, "*"); =20 strcat(buf, "\n"); @@ -3584,7 +3584,7 @@ static int probe_remove_event_call(struct trace_event= _call *call) continue; /* * We can't rely on ftrace_event_enable_disable(enable =3D> 0) - * we are going to do, EVENT_FILE_FL_SOFT_MODE can suppress + * we are going to do, soft mode can suppress * TRACE_REG_UNREGISTER. */ if (file->flags & EVENT_FILE_FL_ENABLED) @@ -3997,7 +3997,7 @@ static int free_probe_data(void *data) =20 edata->ref--; if (!edata->ref) { - /* Remove the SOFT_MODE flag */ + /* Remove soft mode */ __ftrace_event_enable_disable(edata->file, 0, 1); trace_event_put_ref(edata->file->event_call); kfree(edata); --=20 2.47.2 From nobody Mon Oct 6 06:36:17 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DB101F873B for ; Wed, 23 Jul 2025 15:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753284963; cv=none; b=ZlgkiOMz7n770HHDYWtFcnA/o2PUH7CN2rPS8ysiH5A9sgKMKJ3FnVAxuv/CRyqlDtPOD/jEcEi1PeHOHERz5ttH40XJkjJ/K+GCZd9FrA9G5zQaBYQCXJ/xApYcmbDrAm/mk/qzaLz0tch5KqyX+ZukIA/iRM3YWBhNDN8XSLs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753284963; c=relaxed/simple; bh=yVIOa+DTn1e/7d+LPldgDm3WHR6HDvflPpU5M2yKt1s=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Z2LZaZ4Tu5eJqZ8M1zogP7SWDhXFfd0WvMOTwHT5+jhrhtRj3bSybZq+5y4Wi1OP+KA++i57Fu8vM0DDqFclajQMPyjlHSyrLGN8f6pDmy8rfMi8QY8ULxZ1hjTFbCEK5CT4voeMIeF5Bo3we0FEqSAclMHbFEnAlvPy5vmLI50= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uaIWUlqI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uaIWUlqI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27D78C4CEEF; Wed, 23 Jul 2025 15:36:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753284963; bh=yVIOa+DTn1e/7d+LPldgDm3WHR6HDvflPpU5M2yKt1s=; h=Date:From:To:Cc:Subject:References:From; b=uaIWUlqIlQewAo9PqeT45+fepsMLfyppNbXVqfsUieGaBFsWoA8HvdZ1D4kVKxoNB WsCGP3tEHh4vbl0Kt8RCPXJ3b+lrdYjnB1DTG1sQDW0pJLReCSFir4QNkMnLOtvAB/ JCnxWpK1IsHjV6azeoLEFT7470DYZWnRw9Hi4FmNC7VJrnr25xVEvSwO7tDTD5YkKS qYSQYQerfSRqJeT2vsIcShqM+qDwtl/ujo9P3gE/VmK9fET4kvjXvtOOuU8t3Xso+s XX231RluW/AYKY8251oDzY4OfQZPdmJZ+r8uL1QA55SHhBt+Vq+23z93DDxnujfp2w 005iVM6vTPrxg== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1ueame-00000000LSC-2iqC; Wed, 23 Jul 2025 10:49:28 -0400 Message-ID: <20250723144928.504865336@kernel.org> User-Agent: quilt/0.68 Date: Wed, 23 Jul 2025 10:49:14 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton Subject: [for-next][PATCH 7/8] tracing: Fix comment in trace_module_remove_events() References: <20250723144907.219256132@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Steven Rostedt Fix typo "allocade" -> "allocated". Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Link: https://lore.kernel.org/20250710095628.42ed6b06@batman.local.home Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_events.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 0980f4def360..6c0783fc4c2c 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -3695,7 +3695,7 @@ static void trace_module_remove_events(struct module = *mod) if (call->module =3D=3D mod) __trace_remove_event_call(call); } - /* Check for any strings allocade for this module */ + /* Check for any strings allocated for this module */ list_for_each_entry_safe(modstr, m, &module_strings, next) { if (modstr->module !=3D mod) continue; --=20 2.47.2 From nobody Mon Oct 6 06:36:17 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C531A1FDE19; Wed, 23 Jul 2025 15:36:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753284963; cv=none; b=PnxXV3SEt+W4goGf42M5LQ8nzidMz7vwOXEDdG8fOMB6tlkFRuf5xipfP0iTKEc6kICu+8aRQfup64h2nNrn5DHoqpdfz3X1I+lMKPAQ8Gfx06+VPdjv5HDnhvGiUjXcOgcnAWhEyYOqErqHK8e7ilD2gOALNeu/ZaqjzqstYyo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753284963; c=relaxed/simple; bh=rTQGugShZti2f9v7pSRRbFs59pGwLmOlLKMGN2HNkLQ=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=IY1t6gcQTY1LJZaQJEP6LZtV9XVOU8yOtdHY+ALZ7EOrw+unNoBS1zdU8SFOa9I9i2FMIITSW9oazJ2bJlpMuvJ0LHeuiLT46b0/WFqnMouHNj/ISebq43uvKwfYLOGqBcrYeiMsnM5F9c7h/E1+faCQCV0lviAkVwO5O0i6uWw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e2ku0l8X; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e2ku0l8X" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D0BBC4CEFB; Wed, 23 Jul 2025 15:36:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753284963; bh=rTQGugShZti2f9v7pSRRbFs59pGwLmOlLKMGN2HNkLQ=; h=Date:From:To:Cc:Subject:References:From; b=e2ku0l8Xot3BTlM+bKXeTKYeDdHOvzhAjhX0bmKmhbGLs5MgVAoSQ4qzrJaqTS8Sp 8CRc3qyzAf5RiQ95rHQq9rnTi5baoNjB7Ruo2QXvzjtUWZec/ru0gbuuJQJ4bTjVug Ix+slT4C51qR8b3l9+0pziT9Yi8yZWQ0bL/S1L3bBgOydTR3gkA4fFyatxWv2rdxYp LJ/fBq9VRImcJ3FqGhXQte8oq5KGhnEdlvhw1W0ZUugiBoEpB4qmWNIivb8W0yOEJ2 F7szrQamhp0sFjboHM/H9JSkS/IYTbmgCVdv6zNIUVFRCf55mR4SyRTZc6qrJ8anyM 63vyBTdYiZUxQ== Received: from rostedt by gandalf with local (Exim 4.98.2) (envelope-from ) id 1ueame-00000000LSg-3QMA; Wed, 23 Jul 2025 10:49:28 -0400 Message-ID: <20250723144928.669828393@kernel.org> User-Agent: quilt/0.68 Date: Wed, 23 Jul 2025 10:49:15 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , , Peter Zijlstra , Thomas Gleixner , Sebastian Andrzej Siewior , Namhyung Kim , Linus Torvalds , Greg Kroah-Hartman , Al Viro , Christian Brauner , Jan Kara , Arnaldo Carvalho de Melo , Frederic Weisbecker , Jiri Olsa , Ian Rogers Subject: [for-next][PATCH 8/8] tracing: Deprecate auto-mounting tracefs in debugfs References: <20250723144907.219256132@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Steven Rostedt In January 2015, tracefs was created to allow access to the tracing infrastructure without needing to compile in debugfs. When tracefs is configured, the directory /sys/kernel/tracing will exist and tooling is expected to use that path to access the tracing infrastructure. To allow backward compatibility, when debugfs is mounted, it would automount tracefs in its "tracing" directory so that tooling that had hard coded /sys/kernel/debug/tracing would still work. It has been over 10 years since the new interface was introduced, and all tooling should now be using it. Start the process of deprecating the old path so that it doesn't need to be maintained anymore. A new config is added to allow distributions to disable automounting of tracefs on debugfs. If /sys/kernel/debug/tracing is accessed, a pr_warn() will trigger stating: "NOTICE: Automounting of tracing to debugfs is deprecated and will be remov= ed in 2030" Expect to remove this feature in 5 years (2030). Cc: Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Cc: Mark Rutland Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Sebastian Andrzej Siewior Cc: Namhyung Kim Cc: Linus Torvalds Cc: Andrew Morton Cc: Greg Kroah-Hartman Cc: Al Viro Cc: Christian Brauner Cc: Jan Kara Cc: Arnaldo Carvalho de Melo Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Ian Rogers Link: https://lore.kernel.org/20250722170806.40c068c6@gandalf.local.home Signed-off-by: Steven Rostedt (Google) --- .../ABI/obsolete/automount-tracefs-debugfs | 20 +++++++++++++++++++ kernel/trace/Kconfig | 13 ++++++++++++ kernel/trace/trace.c | 14 +++++++++---- 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 Documentation/ABI/obsolete/automount-tracefs-debugfs diff --git a/Documentation/ABI/obsolete/automount-tracefs-debugfs b/Documen= tation/ABI/obsolete/automount-tracefs-debugfs new file mode 100644 index 000000000000..a5196ec78cb5 --- /dev/null +++ b/Documentation/ABI/obsolete/automount-tracefs-debugfs @@ -0,0 +1,20 @@ +What: /sys/kernel/debug/tracing +Date: May 2008 +KernelVersion: 2.6.27 +Contact: linux-trace-kernel@vger.kernel.org +Description: + + The ftrace was first added to the kernel, its interface was placed + into the debugfs file system under the "tracing" directory. Access + to the files were in /sys/kernel/debug/tracing. As systems wanted + access to the tracing interface without having to enable debugfs, a + new interface was created called "tracefs". This was a stand alone + file system and was usually mounted in /sys/kernel/tracing. + + To allow older tooling to continue to operate, when mounting + debugfs, the tracefs file system would automatically get mounted in + the "tracing" directory of debugfs. The tracefs interface was added + in January 2015 in the v4.1 kernel. + + All tooling should now be using tracefs directly and the "tracing" + directory in debugfs should be removed by January 2030. diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index a3f35c7d83b6..93e8e7fc11c0 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig @@ -199,6 +199,19 @@ menuconfig FTRACE =20 if FTRACE =20 +config TRACEFS_AUTOMOUNT_DEPRECATED + bool "Automount tracefs on debugfs [DEPRECATED]" + depends on TRACING + default y + help + The tracing interface was moved from /sys/kernel/debug/tracing + to /sys/kernel/tracing in 2015, but the tracing file system + was still automounted in /sys/kernel/debug for backward + compatibility with tooling. + + The new interface has been around for more than 10 years and + the old debug mount will soon be removed. + config BOOTTIME_TRACING bool "Boot-time Tracing support" depends on TRACING diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 0dff4298fc0e..06ab5b7a8711 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -6296,7 +6296,7 @@ static bool tracer_options_updated; static void add_tracer_options(struct trace_array *tr, struct tracer *t) { /* Only enable if the directory has been created already. */ - if (!tr->dir) + if (!tr->dir && !(tr->flags & TRACE_ARRAY_FL_GLOBAL)) return; =20 /* Only create trace option files after update_tracer_options finish */ @@ -8977,13 +8977,13 @@ static inline __init int register_snapshot_cmd(void= ) { return 0; } =20 static struct dentry *tracing_get_dentry(struct trace_array *tr) { - if (WARN_ON(!tr->dir)) - return ERR_PTR(-ENODEV); - /* Top directory uses NULL as the parent */ if (tr->flags & TRACE_ARRAY_FL_GLOBAL) return NULL; =20 + if (WARN_ON(!tr->dir)) + return ERR_PTR(-ENODEV); + /* All sub buffers have a descriptor */ return tr->dir; } @@ -10249,6 +10249,7 @@ init_tracer_tracefs(struct trace_array *tr, struct = dentry *d_tracer) ftrace_init_tracefs(tr, d_tracer); } =20 +#ifdef CONFIG_TRACEFS_AUTOMOUNT_DEPRECATED static struct vfsmount *trace_automount(struct dentry *mntpt, void *ingore) { struct vfsmount *mnt; @@ -10270,6 +10271,8 @@ static struct vfsmount *trace_automount(struct dent= ry *mntpt, void *ingore) if (IS_ERR(fc)) return ERR_CAST(fc); =20 + pr_warn("NOTICE: Automounting of tracing to debugfs is deprecated and wil= l be removed in 2030\n"); + ret =3D vfs_parse_fs_string(fc, "source", "tracefs", strlen("tracefs")); if (!ret) @@ -10280,6 +10283,7 @@ static struct vfsmount *trace_automount(struct dent= ry *mntpt, void *ingore) put_fs_context(fc); return mnt; } +#endif =20 /** * tracing_init_dentry - initialize top level trace array @@ -10304,6 +10308,7 @@ int tracing_init_dentry(void) if (WARN_ON(!tracefs_initialized())) return -ENODEV; =20 +#ifdef CONFIG_TRACEFS_AUTOMOUNT_DEPRECATED /* * As there may still be users that expect the tracing * files to exist in debugfs/tracing, we must automount @@ -10312,6 +10317,7 @@ int tracing_init_dentry(void) */ tr->dir =3D debugfs_create_automount("tracing", NULL, trace_automount, NULL); +#endif =20 return 0; } --=20 2.47.2