From mboxrd@z Thu Jan 1 00:00:00 1970 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-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.1776112478.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-event/trigger-fully-qualified-var-ref.tc diff --git a/tools/testing/selftests/ftrace/test.d/trigger/inter-event/trigger-fully-qualified-var-ref.tc b/tools/testing/selftests/ftrace/test.d/trigger/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-fully-qualified-var-ref.tc @@ -0,0 +1,34 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: event trigger - test fully-qualified variable reference support +# requires: set_event synthetic_events events/sched/sched_process_fork/hist 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]' > synthetic_events +echo 'hist:keys=comm:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_waking/trigger +echo 'hist:keys=comm:ts0=common_timestamp.usecs if comm=="ping"' > events/sched/sched_wakeup/trigger +echo 'hist:keys=next_comm:wakeup_lat=common_timestamp.usecs-sched.sched_wakeup.$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,sched.sched_waking.prio,next_comm) if next_comm=="ping"' > events/sched/sched_switch/trigger +echo 'hist:keys=pid,prio,comm:vals=lat:sort=pid,prio' > events/synthetic/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=prio" events/sched/sched_waking/hist; then + fail "Failed to create histogram with fully-qualified variable reference" +fi + +echo '!hist:keys=next_comm:wakeup_lat=common_timestamp.usecs-sched.sched_wakeup.$ts0:onmatch(sched.sched_waking).wakeup_latency($wakeup_lat,next_pid,sched.sched_waking.prio,next_comm) if next_comm=="ping"' >> events/sched/sched_switch/trigger + +if grep -q "synthetic_prio=prio" events/sched/sched_waking/hist; then + fail "Failed to remove histogram with fully-qualified variable reference" +fi + +exit 0 -- 2.51.0