From nobody Tue Jun 16 04:57:36 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CDA34384234 for ; Thu, 16 Apr 2026 08:41:51 +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=1776328911; cv=none; b=m5j6FiyI4Jf6owCjdALNQ9PvelH1wS3rYFnM19Qn9IKWbzTz4YpalNn2Lc8NKmeVwrC/fYsmQ55Y8oi+Zsy7HEX33ixHndXyqgA/vOjOq+5GFzL2tg+Q06lbrKFVpHwXcI3S6ywk2i0tUZsvY809Z6oypB1puTxnWdngISnW9A8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776328911; c=relaxed/simple; bh=wuG5fRqyyeq7ZFA2zBqw8azLfs+ap3Y3o5BeeK/+Awg=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=sIU2V5MUjZGQ4Io5Mv7i5mQCeGuRtFuzILymCwRTAVl0ma0iKmiySiMUJOroRgMcc0tObcKYzCG/N4/0tJrIWmNcsFVnYJpCf5wn4pVTYFUl10sm/Ba6bMfrZlf+zmaKu9R666xjBZjrMumBdJuDOvjY+ZfYbKIoz1SmZxibiXc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Vq63zsGh; 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="Vq63zsGh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FF9AC2BCB5; Thu, 16 Apr 2026 08:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776328911; bh=wuG5fRqyyeq7ZFA2zBqw8azLfs+ap3Y3o5BeeK/+Awg=; h=Date:From:To:Cc:Subject:References:From; b=Vq63zsGhv85ZclXFWCBFgP2UgHC4sVC2xyMTFBTOqQliGpUMn+idJHfOtPtT9lylS dw4ouuJt2sJ80u0JhRL9v2GB4qNSp1XHtyuyJmGvsT6TycwQOunSUAuE3P3jPMMdpL vGQ9zRAZkmcfangkbWQ+YDCNLNi/L3biYEFoCdkXquCpoGSutYkNdyRbWExr06w2Wr 85ivFCfKpxU3J8p60KQj4iiDCpr94rMN27Gtt9WCFHjUiM1AeuY41BQqBQMgEx0H6R bgG4fx5mpZ5uSbPGp+rHrrSNbnuYVEBz8pTaV1AyqR+mcwtSRg2mC5yi/5hc0JnoIw N9LvIELP+dW1g== Received: from rostedt by gandalf with local (Exim 4.99.1) (envelope-from ) id 1wDIJq-00000005auw-0DWv; Thu, 16 Apr 2026 04:43:26 -0400 Message-ID: <20260416084325.915589726@kernel.org> User-Agent: quilt/0.69 Date: Thu, 16 Apr 2026 04:42:55 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , CaoRuichuang Subject: [for-next][PATCH 1/5] tracing: Report ipi_raise target CPUs as cpumask References: <20260416084254.980129867@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: CaoRuichuang Bugzilla 217447 points out that ftrace bitmask fields still use the legacy dynamic-array format, which makes trace consumers treat them as unsigned long arrays instead of bitmaps. This is visible in the ipi events today: ipi_send_cpumask already reports its CPU mask as '__data_loc cpumask_t', but ipi_raise still exposes target_cpus as '__data_loc unsigned long[]'. Switch ipi_raise to __cpumask() and the matching helpers so its tracefs format matches the existing cpumask representation used by the other ipi event. The underlying storage size stays the same, but trace data consumers can now recognize the field as a cpumask directly. Link: https://patch.msgid.link/20260406162434.40767-1-create0818@163.com Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D217447 Signed-off-by: CaoRuichuang Signed-off-by: Steven Rostedt (Google) --- include/trace/events/ipi.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/trace/events/ipi.h b/include/trace/events/ipi.h index 9912f0ded81d..fae4f8eac411 100644 --- a/include/trace/events/ipi.h +++ b/include/trace/events/ipi.h @@ -68,16 +68,16 @@ TRACE_EVENT(ipi_raise, TP_ARGS(mask, reason), =20 TP_STRUCT__entry( - __bitmask(target_cpus, nr_cpumask_bits) + __cpumask(target_cpus) __field(const char *, reason) ), =20 TP_fast_assign( - __assign_bitmask(target_cpus, cpumask_bits(mask), nr_cpumask_bits); + __assign_cpumask(target_cpus, cpumask_bits(mask)); __entry->reason =3D reason; ), =20 - TP_printk("target_mask=3D%s (%s)", __get_bitmask(target_cpus), __entry->r= eason) + TP_printk("target_mask=3D%s (%s)", __get_cpumask(target_cpus), __entry->r= eason) ); =20 DECLARE_EVENT_CLASS(ipi_handler, --=20 2.51.0 From nobody Tue Jun 16 04:57:36 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DD9538A721 for ; Thu, 16 Apr 2026 08:41:52 +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=1776328912; cv=none; b=IGoeVJZaTrIGCxxqXxWi+U8A4fkfJ1aXsW9HDQ5MAkqsP/PLH4RsVIMpfDTLfKvgZ8soyetYQ0DTpyVFY4SSJgI30Z79V0NrTDUOM9qkEYMZU2wUmX6NbsnHMzlzoQc0vvv+ojfELmDxTLVTU54TQfn9YttS0ll8mTpijIVXnZQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776328912; c=relaxed/simple; bh=pGQkb28/qMQLZ9h8EpLWkyQaacTnDN0MKgraTTc1cDA=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=r960U1dQnaEpw9cWwNZMe2f33S1HRR47Ho8xMf3zA2QsojIKJAjLHYgDjgQvGFFFTMPf4PZhRGFSnecC3gWjGCk6ljuBdfECRZKbq0tkYMispbQCprRs/IBd2sC8sXxHCJP4jzhEV5jlWGRlNyeXZ6ngZwSiPMEbCUe70CV6NaM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pU4IxJb+; 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="pU4IxJb+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C68E5C2BCB3; Thu, 16 Apr 2026 08:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776328911; bh=pGQkb28/qMQLZ9h8EpLWkyQaacTnDN0MKgraTTc1cDA=; h=Date:From:To:Cc:Subject:References:From; b=pU4IxJb+P7lVAoufuk/jYGxsOeaOTqVrJ9D8ptd6XjtH4I++0/VI1vK+tCMylyzYn Ud2LWaqYPtUuA8BYgX9gyPZtEB7tJ2DcG9JRAjAax+6INP1w++1HvxfNwcYIDvi3v5 QMbGmg9QYatjbDpBP/1NYLg2F6i/wLDaTLk8I6hlVzs1EuLdoqCo2PrZqfvLr7pV+/ UDJLlXjtjBlWZev+yFzf2FOLgCvmdSAXY6pECeNs+HveZ6dKk0i0/sLAcLdHvkKTvV cqKsIG92MF3kqiUWnup7Vme8ihZlIxn/936UFeGpJl9yUct4lPagQkTnRBPoEwJqOa 4oLvkO7uZDDkA== Received: from rostedt by gandalf with local (Exim 4.99.1) (envelope-from ) id 1wDIJq-00000005avR-0rBy; Thu, 16 Apr 2026 04:43:26 -0400 Message-ID: <20260416084326.069067160@kernel.org> User-Agent: quilt/0.69 Date: Thu, 16 Apr 2026 04:42:56 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Tom Zanussi , Pengpeng Hou Subject: [for-next][PATCH 2/5] tracing: Rebuild full_name on each hist_field_name() call References: <20260416084254.980129867@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: Pengpeng Hou hist_field_name() uses a static MAX_FILTER_STR_VAL buffer for fully qualified variable-reference names, but it currently appends into that buffer with strcat() without rebuilding it first. As a result, repeated calls append a new "system.event.field" name onto the previous one, which can eventually run past the end of full_name. Build the name with snprintf() on each call and return NULL if the fully qualified name does not fit in MAX_FILTER_STR_VAL. Link: https://patch.msgid.link/20260401112224.85582-1-pengpeng@iscas.ac.cn Fixes: 067fe038e70f ("tracing: Add variable reference handling to hist trig= gers") Reviewed-by: Tom Zanussi Tested-by: Tom Zanussi Signed-off-by: Pengpeng Hou Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_events_hist.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_h= ist.c index 67cb92310864..b2b675c7d663 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -1361,12 +1361,14 @@ static const char *hist_field_name(struct hist_fiel= d *field, field->flags & HIST_FIELD_FL_VAR_REF) { if (field->system) { static char full_name[MAX_FILTER_STR_VAL]; + int len; + + len =3D snprintf(full_name, sizeof(full_name), "%s.%s.%s", + field->system, field->event_name, + field->name); + if (len >=3D sizeof(full_name)) + return NULL; =20 - strcat(full_name, field->system); - strcat(full_name, "."); - strcat(full_name, field->event_name); - strcat(full_name, "."); - strcat(full_name, field->name); field_name =3D full_name; } else field_name =3D field->name; --=20 2.51.0 From nobody Tue Jun 16 04:57:36 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2C74938B7BD; Thu, 16 Apr 2026 08:41:52 +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=1776328912; cv=none; b=KZpQyokE6PP/6sHJTI/EijGLBeV7muY/UU7gYeKm+BFNjUeh+d6H3KB8FVe+/ma1euBuXjwYXwrcZ4PMMIRF295tc8nF0Q1hi8WrVjcy5fCO5grXZHIzfyTA5LWAK/02CDCKdbn4dghZGBa0afDDWUPG0UJ5K0r+xxcv41AJXKo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776328912; c=relaxed/simple; bh=0J3tkdy+okol4NtJaMhqlRalobhJ+tasAuRBXeB69KE=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=KFWp2tb8U0sDxPvO9AMhsCJnlM0aKyGe0NF6aDBVp2V2QCocWITT7npGRtvA5fhoksrIsbsR/4EEM9/hRtkIZg06Th8Lr5Fn6ciU8JZ4pdDZnKzqm55tFjq+iKLRgNN8djrZXLC53pZxcbGIjZgIv78SSgxa6vmCkaX9F31zrn4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BAqCuX5O; 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="BAqCuX5O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02950C2BCAF; Thu, 16 Apr 2026 08:41:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776328912; bh=0J3tkdy+okol4NtJaMhqlRalobhJ+tasAuRBXeB69KE=; h=Date:From:To:Cc:Subject:References:From; b=BAqCuX5ObrqoXZ2lhwVRoGLHYL5uXax1KOCXgXRUiBDBlJcNyU5zw13/UhmWsitFi zOfTm7lakGw8E5GPleS41yW7Kl+jzM2nttpKR5ZKt7miYP+wiRYLTHSnBkFXMuA6er /AJ/a9kTDZCOX/X15HRmJhXjfZDGxbgX/svUD8YxDkBcO2j516DwAamn2wyGj6gJGT nbLXviCYaveHtAmuDLY27xLBlydvOocnLVuW5DhsAJoBVr5n8SeDg9kA4TR+IQA5WY do7K08UNb/x8CXjwYeyZFd8J7ftFW6HVclYpGoWJlhG6D2oQDOLz+1qMYDui+e6ry7 OjI/st2g4gS3g== Received: from rostedt by gandalf with local (Exim 4.99.1) (envelope-from ) id 1wDIJq-00000005avv-1U0h; Thu, 16 Apr 2026 04:43:26 -0400 Message-ID: <20260416084326.223858869@kernel.org> User-Agent: quilt/0.69 Date: Thu, 16 Apr 2026 04:42:57 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , stable@vger.kernel.org, David Carlier Subject: [for-next][PATCH 3/5] tracepoint: balance regfunc() on func_add() failure in tracepoint_add_func() References: <20260416084254.980129867@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: David Carlier When a tracepoint goes through the 0 -> 1 transition, tracepoint_add_func() invokes the subsystem's ext->regfunc() before attempting to install the new probe via func_add(). If func_add() then fails (for example, when allocate_probes() cannot allocate a new probe array under memory pressure and returns -ENOMEM), the function returns the error without calling the matching ext->unregfunc(), leaving the side effects of regfunc() behind with no installed probe to justify them. For syscall tracepoints this is particularly unpleasant: syscall_regfunc() bumps sys_tracepoint_refcount and sets SYSCALL_TRACEPOINT on every task. After a leaked failure, the refcount is stuck at a non-zero value with no consumer, and every task continues paying the syscall trace entry/exit overhead until reboot. Other subsystems providing regfunc()/unregfunc() pairs exhibit similarly scoped persistent state. Mirror the existing 1 -> 0 cleanup and call ext->unregfunc() in the func_add() error path, gated on the same condition used there so the unwind is symmetric with the registration. Fixes: 8cf868affdc4 ("tracing: Have the reg function allow to fail") Cc: stable@vger.kernel.org Cc: Masami Hiramatsu Cc: Mathieu Desnoyers Link: https://patch.msgid.link/20260413190601.21993-1-devnexen@gmail.com Signed-off-by: David Carlier Signed-off-by: Steven Rostedt (Google) --- kernel/tracepoint.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/tracepoint.c b/kernel/tracepoint.c index 91905aa19294..dffef52a807b 100644 --- a/kernel/tracepoint.c +++ b/kernel/tracepoint.c @@ -300,6 +300,8 @@ static int tracepoint_add_func(struct tracepoint *tp, lockdep_is_held(&tracepoints_mutex)); old =3D func_add(&tp_funcs, func, prio); if (IS_ERR(old)) { + if (tp->ext && tp->ext->unregfunc && !static_key_enabled(&tp->key)) + tp->ext->unregfunc(); WARN_ON_ONCE(warn && PTR_ERR(old) !=3D -ENOMEM); return PTR_ERR(old); } --=20 2.51.0 From nobody Tue Jun 16 04:57:36 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4209E38D6A4 for ; Thu, 16 Apr 2026 08:41:52 +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=1776328912; cv=none; b=PKtGUkuJSABQgau+VEP5JQROXkoR/1a1exU7iFAJUlpcjZeJFFXSBGZ2KOd4culWxo5SgOTVsXmAhsHiQW3u67uIpfZQHmd+t9e26mszJ5+zU64gIgBq47rHE83X8q9RdEEBrOjIw0p+4iURcsITcy5qEMxlhKuuv/w51gM/BXo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776328912; c=relaxed/simple; bh=CgwhL3BOTkEXTJn8VDvcHuTRnTwP5WMWhEUfbrNCLLU=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=Zmeub4Y6VYsLLYrBNrNhdsLbtEd1WKC23iUnD3dNori7ODiiVWNZwZhE3vghW1UU+uGCN1/BR1X98PZU2RbhBzCEEB/lx5P8rf8kIA7eOvUEs0O3fM03T8K3d+00io9MzIWYODH6ZodTBgvhYMA0YyHyQLylmbfS1i9rCL3Q0Fc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oZR2TeRR; 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="oZR2TeRR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11150C2BCB5; Thu, 16 Apr 2026 08:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776328912; bh=CgwhL3BOTkEXTJn8VDvcHuTRnTwP5WMWhEUfbrNCLLU=; h=Date:From:To:Cc:Subject:References:From; b=oZR2TeRRWyicNF2VING0Dw1GzqHgqCdfnVSpUZdYZEWNdXO2jNzHD+0t37P3nELTp jWlDl1cRCsogzuhGt0M7eWtQs8d7wuzDN8qsL+nxz2sHHrl2FUYZV4sx16l1WIeheh Lpr05EwoQtjRqnPhyERUisP9uSS5BjOMJVDqEpVfki2UUjSeHZSzxA6cZwmXdWSxb7 7DVK2dYYUDatpy3RbPwEHUilSEZtya/YIrANiJR9nnvshsPYSi4Z+8JPtXTr61L6Yx GoTueSlfVIGkbariYvTmQmVnRsQdzHCSyCvmGnDDXtVCFtRnAbSJdhwUcPVkCoM1v4 2BKcvnGjJdlAw== Received: from rostedt by gandalf with local (Exim 4.99.1) (envelope-from ) id 1wDIJq-00000005awP-26Mv; Thu, 16 Apr 2026 04:43:26 -0400 Message-ID: <20260416084326.371411112@kernel.org> User-Agent: quilt/0.69 Date: Thu, 16 Apr 2026 04:42:58 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Tom Zanussi Subject: [for-next][PATCH 4/5] tracing: Fix fully-qualified variable reference printing in histograms References: <20260416084254.980129867@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: Tom Zanussi The syntax for fully-qualified variable references in histograms is subsys.event.$var, which is parsed correctly, but not displayed correctly when printing a histogram spec. The current code puts the $ reference at the beginning of the fully-qualified variable name i.e. $subsys.event.var, which is incorrect. Before: trigger info: hist:keys=3Dnext_comm:vals=3Dhitcount:wakeup_lat=3Dcommon_tim= estamp.usecs-$sched.sched_wakeup.ts0: ... After: trigger info: hist:keys=3Dnext_comm:vals=3Dhitcount:wakeup_lat=3Dcommon_tim= estamp.usecs-sched.sched_wakeup.$ts0: ... Link: https://patch.msgid.link/5dee9a86d062a4dd68c2214f3d90ac93811e1951.177= 6112478.git.zanussi@kernel.org Signed-off-by: Tom Zanussi Signed-off-by: Steven Rostedt (Google) --- kernel/trace/trace_events_hist.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_h= ist.c index b2b675c7d663..0dbbf6cca9bc 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -1361,9 +1361,12 @@ static const char *hist_field_name(struct hist_field= *field, field->flags & HIST_FIELD_FL_VAR_REF) { if (field->system) { static char full_name[MAX_FILTER_STR_VAL]; + static char *fmt; int len; =20 - len =3D snprintf(full_name, sizeof(full_name), "%s.%s.%s", + fmt =3D field->flags & HIST_FIELD_FL_VAR_REF ? "%s.%s.$%s" : "%s.%s.%s"; + + len =3D snprintf(full_name, sizeof(full_name), fmt, field->system, field->event_name, field->name); if (len >=3D sizeof(full_name)) @@ -1742,9 +1745,10 @@ static const char *get_hist_field_flags(struct hist_= field *hist_field) =20 static void expr_field_str(struct hist_field *field, char *expr) { - if (field->flags & HIST_FIELD_FL_VAR_REF) - strcat(expr, "$"); - else if (field->flags & HIST_FIELD_FL_CONST) { + if (field->flags & HIST_FIELD_FL_VAR_REF) { + if (!field->system) + strcat(expr, "$"); + } else if (field->flags & HIST_FIELD_FL_CONST) { char str[HIST_CONST_DIGITS_MAX]; =20 snprintf(str, HIST_CONST_DIGITS_MAX, "%llu", field->constant); @@ -6156,7 +6160,8 @@ static void hist_field_print(struct seq_file *m, stru= ct hist_field *hist_field) else if (field_name) { if (hist_field->flags & HIST_FIELD_FL_VAR_REF || hist_field->flags & HIST_FIELD_FL_ALIAS) - seq_putc(m, '$'); + if (!hist_field->system) + seq_putc(m, '$'); seq_printf(m, "%s", field_name); } else if (hist_field->flags & HIST_FIELD_FL_TIMESTAMP) seq_puts(m, "common_timestamp"); --=20 2.51.0 From nobody Tue Jun 16 04:57:36 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4D014391855 for ; Thu, 16 Apr 2026 08:41:52 +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=1776328912; cv=none; b=gctCGYxuOk4KclYamxjTZ4KogLn9HxaZWjf6iT7CqLI5/Zm9zkBS6hpsw+PwZMraJSd10F7D+79apSli8PAifuJ0Yjs7c5GaeqaWbs6xMEOgKzDG3Z4fp8okiKUfz0hZYiSRYF/riHwgH0R2fWl/U1TFcJdWlJ8s6ypjdPtruX0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776328912; c=relaxed/simple; bh=+qWHyLuuRH21bd7rxUzMXhqoK9oXeDYpOBTw6InshR8=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=FxBuUn25bmA+aRKg7pX84TEqpixDUatq8p3iUsZ+sqRZ1MWMybCcXl5YjjeW+ekv3kbu/aqiUDkM+0k8q5DMCXi8SmsfYaRy+1B3bHPfRLst87mf+vI+qds/RYXRzo/PsJGsON+014vwh209yqNn0EUofGK8COhg1nD/PyX3jRI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ll920PAs; 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="Ll920PAs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F109C2BCB6; Thu, 16 Apr 2026 08:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776328912; bh=+qWHyLuuRH21bd7rxUzMXhqoK9oXeDYpOBTw6InshR8=; h=Date:From:To:Cc:Subject:References:From; b=Ll920PAshaA7wHdggE1F06TM6POSTmQnbMhkYycLhwMa/nDQRXbWPrGHKIRcBv+6B p726xnMaj3N67N6D4vkYBbGUMOfDYw+NA7S1n/h0StLz1V2vwI+isOkz5L4xkQLrwu FamqDSf7AViJwybaFgVw85H+/y5jM+ZEFwehCHIZOukZHmR8bU3urVu1ih0/AJP8KN AK3nx9Cfs1yXwfor9FPLXk9dtvGXryMyeJN0n6jBTz/UpIo4tlislFWvt7qEtaDkwC rLo+eq7zb2HZmPZoG/tB6MTEfmP4atXE+g+zX5jw6iQSbZsBglR44cwnFK4EVM6zcl RFaPEcg8JKe2g== Received: from rostedt by gandalf with local (Exim 4.99.1) (envelope-from ) id 1wDIJq-00000005awt-2hCL; Thu, 16 Apr 2026 04:43:26 -0400 Message-ID: <20260416084326.520527394@kernel.org> User-Agent: quilt/0.69 Date: Thu, 16 Apr 2026 04:42:59 -0400 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Tom Zanussi Subject: [for-next][PATCH 5/5] selftests/ftrace: Add test case for fully-qualified variable references References: <20260416084254.980129867@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: Tom Zanussi This test adds a variable (ts0) to two events (sched_waking and sched_wakeup) and uses a fully-qualified variable reference to expicitly choose a particular one (sched_wakeup.$ts0) when calculating the wakeup latency. Link: https://patch.msgid.link/ce9d96aeb84b2d40bd469fe9a346e225442873b1.177= 6112478.git.zanussi@kernel.org Signed-off-by: Tom Zanussi Signed-off-by: Steven Rostedt (Google) --- .../trigger-fully-qualified-var-ref.tc | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/trigger/inter-eve= nt/trigger-fully-qualified-var-ref.tc diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trig= ger-fully-qualified-var-ref.tc b/tools/testing/selftests/ftrace/test.d/trig= ger/inter-event/trigger-fully-qualified-var-ref.tc new file mode 100644 index 000000000000..8d12cdd06f1d --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-ful= ly-qualified-var-ref.tc @@ -0,0 +1,34 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: event trigger - test fully-qualified variable reference sup= port +# requires: set_event synthetic_events events/sched/sched_process_fork/his= t ping:program + +fail() { #msg + echo $1 + exit_fail +} + +echo "Test fully-qualified variable reference support" + +echo 'wakeup_latency u64 lat; pid_t pid; int prio; char comm[16]' > synthe= tic_events +echo 'hist:keys=3Dcomm:ts0=3Dcommon_timestamp.usecs if comm=3D=3D"ping"' >= events/sched/sched_waking/trigger +echo 'hist:keys=3Dcomm:ts0=3Dcommon_timestamp.usecs if comm=3D=3D"ping"' >= events/sched/sched_wakeup/trigger +echo 'hist:keys=3Dnext_comm:wakeup_lat=3Dcommon_timestamp.usecs-sched.sche= d_wakeup.$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_p= id,sched.sched_waking.prio,next_comm) if next_comm=3D=3D"ping"' > events/sc= hed/sched_switch/trigger +echo 'hist:keys=3Dpid,prio,comm:vals=3Dlat:sort=3Dpid,prio' > events/synth= etic/wakeup_latency/trigger + +ping $LOCALHOST -c 3 +if ! grep -q "ping" events/synthetic/wakeup_latency/hist; then + fail "Failed to create inter-event histogram" +fi + +if ! grep -q "synthetic_prio=3Dprio" events/sched/sched_waking/hist; then + fail "Failed to create histogram with fully-qualified variable referen= ce" +fi + +echo '!hist:keys=3Dnext_comm:wakeup_lat=3Dcommon_timestamp.usecs-sched.sch= ed_wakeup.$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_= pid,sched.sched_waking.prio,next_comm) if next_comm=3D=3D"ping"' >> events/= sched/sched_switch/trigger + +if grep -q "synthetic_prio=3Dprio" events/sched/sched_waking/hist; then + fail "Failed to remove histogram with fully-qualified variable referen= ce" +fi + +exit 0 --=20 2.51.0