From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793831299; b=pb/9SCPZ7lA7qkmZuZ12j6euraDRJcETxr35o1gwsvMR5PwTxplYoA/liRBJDqPUoU2y +dYuutfnP8V8TPjCb0iOzAhzFjBWgZ3yPf+1+oD3dmXUzw150DHV3o8pBqE7Ml54CXotf iiq34CHgVtonpOPjQBusAZ85AE27jzCxmFU8Z1G9odUCibk0NtPONU8ONlJWp60asKHq/ 4bilae+p1f33HL8iYbVC5lyA1E6JKUoXhe06WQ68uNm3alRL72P4D20tW6ji/RxT+NHXs BID8Td7LlQkTI0w3ujkQNfocZ6u68QVCQVIycmriwuZxGe+m+l13oMhLeLXVJJDmYFw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793831299; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=QzxAPCnic284xt8FqUxpZkMfyIoRkAUiW0g0gzRhy90=; b=11UK/p8vL1z1k5KnPiaY5dbG7Yq9KO+cNbg2OfRMJuLk2rSbPR6dNChj048XWI+TvaVg Vff3dCS73OYMxfG6ptPtCTpeaiLeKr4jzffv2mvcQQaiy7rA3wjj83JvU1Aj/qBh0EDGX ObPEggmBXndkcNTGBRuTcoD6hkbk4U7bpLSucCeOJnBlrMDnlo8Emu62qaJAnHfFvi4JY ZshUIvWbf1rbvaorvM4ZVFNMXa2czrkmAqtIx6qnx0dJxMmAcx7QennLoqPKUo1gUrndz fncT3MgZR7sSCKKL+rIMtPmOaO+eBUIx/rY5JIDuYiULiZ7lH20If4/SHVOHsnJK9Dw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2iJQK1vp; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B50F0606AC3A; Wed, 4 Nov 2026 22:28:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2iJQK1vp Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40F3E1F0093A; Wed, 4 Nov 2026 22:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1793831298; bh=QzxAPCnic284xt8FqUxpZkMfyIoRkAUiW0g0gzRhy90=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2iJQK1vpHcJc8Y5Bl8B0rMFB/JJb0Gr1gYgRicRu52xNiWG/3BR7jBKW56xsp4ILC gyKxB0HAN7wg4tqZYI7qNHpdou3e46ADFXHvPWSb6gvyQO39fHAHID3dxV3fkhNhbn Q4tJC/j42PhClFBltEh4U6w4ldOcN0qvXhqbAZsA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tom Zanussi , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 6.18 0618/1005] tracing: Fix fully-qualified variable reference printing in histograms Date: Wed, 4 Nov 2026 16:05:51 -0500 Message-ID: <20261104211101.134859796@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261104211043.516122098@linuxfoundation.org> References: <20261104211043.516122098@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tom Zanussi [ Upstream commit 9236eebd138aa2753f7b30fc6cee7b7202841247 ] 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=next_comm:vals=hitcount:wakeup_lat=common_timestamp.usecs-$sched.sched_wakeup.ts0: ... After: trigger info: hist:keys=next_comm:vals=hitcount:wakeup_lat=common_timestamp.usecs-sched.sched_wakeup.$ts0: ... Link: https://patch.msgid.link/5dee9a86d062a4dd68c2214f3d90ac93811e1951.1776112478.git.zanussi@kernel.org Signed-off-by: Tom Zanussi Signed-off-by: Steven Rostedt (Google) Stable-dep-of: a0777b9e5315 ("tracing: Fix NULL dereference when copying keys for a field variable") Signed-off-by: Sasha Levin --- 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_hist.c index 9254e6c17d630..cbeb3c146d8fa 100644 --- a/kernel/trace/trace_events_hist.c +++ b/kernel/trace/trace_events_hist.c @@ -1355,9 +1355,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; - len = snprintf(full_name, sizeof(full_name), "%s.%s.%s", + fmt = field->flags & HIST_FIELD_FL_VAR_REF ? "%s.%s.$%s" : "%s.%s.%s"; + + len = snprintf(full_name, sizeof(full_name), fmt, field->system, field->event_name, field->name); if (len < sizeof(full_name)) @@ -1734,9 +1737,10 @@ static const char *get_hist_field_flags(struct hist_field *hist_field) 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]; snprintf(str, HIST_CONST_DIGITS_MAX, "%llu", field->constant); @@ -6165,7 +6169,8 @@ static void hist_field_print(struct seq_file *m, struct 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"); -- 2.53.0