From nobody Fri Dec 19 17:16:27 2025 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83FED19E967; Sat, 17 May 2025 16:32:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747499557; cv=none; b=dEEzucF/udAz6H2lAqWCj4n0xEh90mPURVMJSrrx/qV9LKN5rxfhfvS0UoK9SRWXocMtUGvI8XgMxTOY4xYCt3mSN8MjRUy/EE3f1ebUMFJ7pV1mlhd3Hug0adB4UDGPm1kh8T4han+t7rYMpDvt2rOuQ9HERxsImbKMZ/eoQe4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747499557; c=relaxed/simple; bh=8TFIlL+9Nqb7USj2bx1x7nSvC+emH7rIhEN9SdoxRiE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TfvTOC00uqROciubswjKgfKsDnjTToUf0tDJv40I/XHqVs4Iafq/tyqiWg/zXAHOl4GAXP+tcKlQVH1v1rRlMsmUhl+/K+wLyZGYcRh14AwlNiJhXmSqRHj4CECDkP0Wz11A0a+ta99YXH+4Znu9d8smGTMkwB9wylDkfS1Un8s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZogGzwF9; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZogGzwF9" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-7423fadbe77so3153046b3a.3; Sat, 17 May 2025 09:32:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747499556; x=1748104356; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+Ujzt0Z1mlstm8/GkFppvnEuth0oQ41DBzEMpZiCaoQ=; b=ZogGzwF9f6XXaw5WW4OFR24FQQBrWSP28CiheQCbdeRnxlLCBUFZIhp84nVzWngF0J aLWQXcvG+CJ+kS+6UJVjLy3ZfzrWP/IqeQx5J3oVDclxf4PERjkdsuJO84uoQtImQvF6 6LyiIw9TmV/j/jCUquNWeCy3lb9vC4vj1cYQkMuwTuntnt9xbr+7R4iDv/f1WY5CCW+8 Y/FuytQQspZd6YQQNQnYBYnjKVtzoQ8BkHsUl64RPM5iwSOtMcpLKNw2zgcMkGQFH8gw VpRurWx5TNXRG7UhmmtuL0GNF2ghvAWp+eTLLBxeDnB2BfwGz4rrHYKzUTLsvs6GBPzi eZAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747499556; x=1748104356; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+Ujzt0Z1mlstm8/GkFppvnEuth0oQ41DBzEMpZiCaoQ=; b=j61j7vGgs2SJyeakLRHIFAuiDHvYoc8W6cnpAPOUtFJu/jelXNh2EyF3LhfPTgf9W7 lkjqM/Zxz3hIsDln/IZocTYu9Pwwh4u2upHg590eb/wMKXHJwljsvlmGnP2ZJWeYmuzR VtQZWhUI9VlFc6SXgzEhaTS3MPg0jp3Nhd2w6CjNIQkMl8YFBnzUx5t8XV/L6+0xaeOd Q0mvT5QGXRMViByYClVNtC1wSGbuaZJrT+f5NFbIhXV6yaFaQljc0jV3hsOnqpU+fkRG F6GF55QONM5t1wYK/HEwIyhX8opzIqbG8RyLD8UNCIwy+CE8BNNWm53qRwzaX/xbjfDo WKcw== X-Forwarded-Encrypted: i=1; AJvYcCU8XNQzlBfOTPpYTOBzSvnK0WOcAO45XRWuGrsFC88QeuS4CICkW8f+p2UFnpVO5mEsNKM5zEFWK0AHfBg=@vger.kernel.org, AJvYcCVW2l+kMJJUVWT3DCO3/fCk1CKPHjRMTRxbPKWJGksS2h0t7wpGjWawRWecmtj3oXjreyWgrWxYQtHrjf45AniHUw==@vger.kernel.org X-Gm-Message-State: AOJu0Yzy1OWKnrSOIPL5hOsJb1HWKjrzb0BXt0dMk/DxE0u8HkTdiLXy RofhtBBK9qpYYKRC/K0msvG+vHkdpFKxjtfKKrf4H/n/HOMac+1l4EaR X-Gm-Gg: ASbGncsbOf00LM95/61zh3maGdpO3pXEDDBT/udBZH8bvEeIYUAO1d8sMqtAlwugBT8 4vou9qBoHWgnQrcJCbtf53kPW7JTYL9gMvnBwzFWGTK4RekAIF1T5D0deLuzsNOP6wCQqQ3sueq zb/Ns77PBLDqV0EVESAUsDDt+2VLxsz9ahs4L7Hl8eqAjPGDEU1zrzgJ2mrNmLGmqIe1NJ+rtP8 KUe24QF0jcBnfx42hA5QmtLKmvmwmGK+YI3GG/C3khlIdcxyk28XSoaN3+16y3SZx9HCca+NhfD ex0eeeiNUCOlexJafPGNgH8f7Il232X8i7hnfhwPif29m1MsV2UPwPu1eW+L440OhUoIqhTQ/sA rimKO/uxNCSsCmewL5hIbRIhPJ83Ic+4= X-Google-Smtp-Source: AGHT+IHbrkynmdB+VZALfNq2GX+99oVP5YB+NxnCCnHaJD2VoSsYHYD/tPhZEzUFvZbEBFVaIld/YA== X-Received: by 2002:a05:6a00:278f:b0:742:acb6:b7c3 with SMTP id d2e1a72fcca58-742acce03bfmr8113967b3a.12.1747499555696; Sat, 17 May 2025 09:32:35 -0700 (PDT) Received: from howard-ubuntu.lan (c-73-202-46-50.hsd1.ca.comcast.net. [73.202.46.50]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b26eb085ad4sm3330321a12.59.2025.05.17.09.32.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 May 2025 09:32:35 -0700 (PDT) From: Howard Chu To: acme@kernel.org Cc: mingo@redhat.com, namhyung@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, peterz@infradead.org, kan.liang@linux.intel.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Howard Chu Subject: [PATCH v1 1/5] perf test trace: Use shell's -f flag to check if vmlinux exists Date: Sat, 17 May 2025 09:32:26 -0700 Message-ID: <20250517163230.1237469-2-howardchu95@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250517163230.1237469-1-howardchu95@gmail.com> References: <20250517163230.1237469-1-howardchu95@gmail.com> 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" To match the style of the existing codebase, no functional changes were applied. Signed-off-by: Howard Chu --- tools/perf/tests/shell/trace_btf_enum.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/tests/shell/trace_btf_enum.sh b/tools/perf/tests/sh= ell/trace_btf_enum.sh index f0b49f7fb57d..b3775209a0b1 100755 --- a/tools/perf/tests/shell/trace_btf_enum.sh +++ b/tools/perf/tests/shell/trace_btf_enum.sh @@ -17,7 +17,7 @@ skip_if_no_perf_trace || exit 2 =20 check_vmlinux() { echo "Checking if vmlinux exists" - if ! ls /sys/kernel/btf/vmlinux 1>/dev/null 2>&1 + if [ ! -f /sys/kernel/btf/vmlinux ] then echo "trace+enum test [Skipped missing vmlinux BTF support]" err=3D2 --=20 2.45.2 From nobody Fri Dec 19 17:16:27 2025 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E09F820B80C; Sat, 17 May 2025 16:32:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747499559; cv=none; b=D31u+x+tz6M7qi6HeAySzFIknj9QppdO7MLRIJKwg/BWkhuZnXPwkqmg5FD1I5MQurjO+7J8HeiY3q0TGWjNek9M5dgjwn08AFjzcLfgoZOcQ8hMIVMPTiblLEUdye8PWpAadKKJ1/2S7AAUywERW2oqpBdRjrMiQrJzFrhbxrE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747499559; c=relaxed/simple; bh=JpitFxDZDkuLTGhIYbm2ECfB2WguZ4Bf2Hed/FiGZI0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ce9lmXPOsWvTDwyWDvda1JRYy5+lqfEHN+ECADJ9ENwMNz2efpA+LAtsbZ5We+yqkWwAz6w/S7VJE8XNAqLYTJqYvmZYFAK0+/psaUv0kScr45mBuu2txqd6YokPCbgS5d3qpOpflakGJeR+Oh3P8IlxDiowsybfch60LVfsqbU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=niNioji2; arc=none smtp.client-ip=209.85.210.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="niNioji2" Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-74237a74f15so4324248b3a.0; Sat, 17 May 2025 09:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747499557; x=1748104357; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mfoZKaGdxA/TqDgfmwlz1BlHb88Ak1UL58E9cYAzYtw=; b=niNioji2TPrPyL0uZ6eR8qJREI8YhMz4H3+7TCmx+uFq2QAMM4iZ8NlgZN8gt079j5 T4xVc3eWZcE6PEilQWpiYuJxQIZOjXR11vTkhQdq/RCrtck+HeQHs6Hw5tC1GaI79fjv 1JVU+9fSXatMRlGyeGXGCYSQSRBMoxp0w0eXUm8dstXX/miqvEVin1kQuiJ3WadbFq8S 2cm8NAk/1M6SsPoHaQXSDC3sKeQk6WqcKI813QH5xdJsotzHasz5Vq5H++Ii7ux2tQso o4QNEurl7rHmn81K+4+r3wd3HC+HdOnQAEUzQ5nfVxmdyl9lHSjwAEVdt6nbpu9NWMMo S03g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747499557; x=1748104357; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mfoZKaGdxA/TqDgfmwlz1BlHb88Ak1UL58E9cYAzYtw=; b=ThnylkbYwGCy+I6BSXYMx+qKRGt0hAAULQI+jaI4NcAfe47RCN67hoc7VdXD+mfEGW 3X273zL+/LyLokXUMdiPorbPvd9iJbeGWkOeCcqh4mD5WJJupE+y5l4i3r/N3BlcunwS VBOX8BUv13rAmFL2f5pvM6sOSo/ycozYX25IigUZdDRXd71GHgMU5ZnJvE2gHLtoJdpM WtyKa4nzkJ9nu2wxn3Mha0YHXqZC/frpbXdzlOrAJo6y1QCk4nhulVigfvVQgwzDaBxf a1Y5D0bL1Otg8MQFroxxMbQJ7aVZigLCyNpUQTKFsb4ExNDgEmnCsa8YN43f+tRtIFpe ZDDg== X-Forwarded-Encrypted: i=1; AJvYcCXEzLC2Nv7h21SotfkZJ1UBKJsDC2cYeh5Ea6pUAVwsHxSpYjF19HbKXcRq6grOY371feCMkKdIqnBNx6Y=@vger.kernel.org, AJvYcCXmdOIBOrBGCBwhzWNR9RQacruBuCRe5wXcYFm9prKxtYYe6I+OJLfRJVTVvs2gZfNSDp0sAI/mwjAfOhP96EwQBA==@vger.kernel.org X-Gm-Message-State: AOJu0Yyctrao7/bPrM3z4ABXgpUZz8SCOwV+DnIyfhuhydsIdfDK0/BA fVPUnhDBgg2VZ8DwXNJYwd8R4wfNXIkgqKRuE2dEDQw5G/WGw3PXmJDL X-Gm-Gg: ASbGncuPDrZIVf4MdvZrvN7srXFDEtQ6bRyuqGkCe+rxUa7dSCvKaJOGHBHrurJcyKZ 6YCuM9byJplT4OkWR53oMrkSHSqZ2wL468ipBgRlTBhpM8l184mKcTUy2Xadc65KDXD9Ruq09yu LRhrXy1GrWJnaBklnGcVzs8W49cvnKa8csaRTPF53LH7t9DUOvgJUB3aLT7OdUbFQ/mXJYA8Wpd Zaqc5KLPXqGJTYw0nt9MviheWeKrxyQmQsOFiShCdOl0QxzYJKAn9hRbuBALYnt05QaeAmSSreJ 0Dwqz+Rdla73VE9Or+o58v7foZ5dJ7O9gYjhVXZggFgMfI2dpU6w6Xa2A9A0E3FfLE+3iYy43Zc J/p70luruwH0tfA8LZRmS X-Google-Smtp-Source: AGHT+IEG/SV69zB8iNq1UYH7j0kXtoztTzF1FmciK2mZMnfBxL46epRnuerfKd/ZJfUxmrph+Nk5MQ== X-Received: by 2002:a05:6a20:3d83:b0:20d:d31c:cd28 with SMTP id adf61e73a8af0-21621876c6cmr12180463637.7.1747499557100; Sat, 17 May 2025 09:32:37 -0700 (PDT) Received: from howard-ubuntu.lan (c-73-202-46-50.hsd1.ca.comcast.net. [73.202.46.50]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b26eb085ad4sm3330321a12.59.2025.05.17.09.32.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 May 2025 09:32:36 -0700 (PDT) From: Howard Chu To: acme@kernel.org Cc: mingo@redhat.com, namhyung@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, peterz@infradead.org, kan.liang@linux.intel.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Howard Chu Subject: [PATCH v1 2/5] perf test trace: Remove set -e and print trace test's error messages Date: Sat, 17 May 2025 09:32:27 -0700 Message-ID: <20250517163230.1237469-3-howardchu95@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250517163230.1237469-1-howardchu95@gmail.com> References: <20250517163230.1237469-1-howardchu95@gmail.com> 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" Currently perf test utilizes the set -e option in shell that exit immediately if a command exits with a non-zero status, this prevents further error handling and introduces ambiguity. This patch removes set -e and prints the error message after invoking perf trace during perf tests. In my case, the command that exits with a non-zero status is perf trace instead of grep, because it can't find the 'timer:hrtimer_setup' tracepoint, see below. Before: $ sudo /tmp/perf test enum -vv 107: perf trace enum augmentation tests: 107: perf trace enum augmentation tests : = Running --- start --- test child forked, pid 783533 Checking if vmlinux exists Tracing syscall landlock_add_rule Tracing non-syscall tracepoint syscall ---- end(-1) ---- 107: perf trace enum augmentation tests : = FAILED! After: $ sudo /tmp/perf test enum -vv 107: perf trace enum augmentation tests: 107: perf trace enum augmentation tests : = Running --- start --- test child forked, pid 851658 Checking if vmlinux exists Tracing syscall landlock_add_rule Tracing non-syscall tracepoint timer:hrtimer_setup,timer:hrtimer_start [tracepoint failure] Failed to trace tracepoint timer:hrtimer_setup,tim= er:hrtimer_start, output: event syntax error: 'timer:hrtimer_setup,timer:hrtimer_start' \___ unknown tracepoint Error: File /sys/kernel/tracing//events/timer/hrtimer_setup not found. Hint: Perhaps this kernel misses some CONFIG_ setting to enable this = feature?. Run 'perf list' for a list of valid events Usage: perf trace [] [] or: perf trace [] -- [] or: perf trace record [] [] or: perf trace record [] -- [] -e, --event event/syscall selector. use 'perf list' to list avai= lable events---- end(-1) ---- 107: perf trace enum augmentation tests : = FAILED! Signed-off-by: Howard Chu --- tools/perf/tests/shell/trace_btf_enum.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/perf/tests/shell/trace_btf_enum.sh b/tools/perf/tests/sh= ell/trace_btf_enum.sh index b3775209a0b1..cd4c8754f5d4 100755 --- a/tools/perf/tests/shell/trace_btf_enum.sh +++ b/tools/perf/tests/shell/trace_btf_enum.sh @@ -3,7 +3,6 @@ # SPDX-License-Identifier: GPL-2.0 =20 err=3D0 -set -e =20 syscall=3D"landlock_add_rule" non_syscall=3D"timer:hrtimer_setup,timer:hrtimer_start" @@ -34,22 +33,24 @@ trace_landlock() { return fi =20 - if perf trace -e $syscall $TESTPROG 2>&1 | \ - grep -q -E ".*landlock_add_rule\(ruleset_fd: 11, rule_type: (LANDLOCK= _RULE_PATH_BENEATH|LANDLOCK_RULE_NET_PORT), rule_attr: 0x[a-f0-9]+, flags: = 45\) =3D -1.*" + output=3D"$(perf trace -e $syscall $TESTPROG 2>&1)" + if echo "$output" | grep -q -E ".*landlock_add_rule\(ruleset_fd: 11, rul= e_type: (LANDLOCK_RULE_PATH_BENEATH|LANDLOCK_RULE_NET_PORT), rule_attr: 0x[= a-f0-9]+, flags: 45\) =3D -1.*" then err=3D0 else + printf "[syscall failure] Failed to trace syscall $syscall, output:\n$out= put" err=3D1 fi } =20 trace_non_syscall() { - echo "Tracing non-syscall tracepoint ${non-syscall}" - if perf trace -e $non_syscall --max-events=3D1 2>&1 | \ - grep -q -E '.*timer:hrtimer_.*\(.*mode: HRTIMER_MODE_.*\)$' + echo "Tracing non-syscall tracepoint ${non_syscall}" + output=3D"$(perf trace -e $non_syscall --max-events=3D1 2>&1)" + if echo "$output" | grep -q -E '.*timer:hrtimer_.*\(.*mode: HRTIMER_MODE= _.*\)$' then err=3D0 else + printf "[tracepoint failure] Failed to trace tracepoint $non_syscall, out= put:\n$output" err=3D1 fi } --=20 2.45.2 From nobody Fri Dec 19 17:16:27 2025 Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 707D620CCC9; Sat, 17 May 2025 16:32:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747499561; cv=none; b=SO6JhRML3MlEDo4ic1/jaZE1DY3ZR9zkl0dw48EjqgsavIDlKD/7FmbzqLiiRRaDQX/oRQqpmJlN4TOdC74xz6irqEXoMe4tjKTjr66lEVoq3mOAP865n3h1o+Vqbdu70Z1irofpApRxxWhpPsBR5l4tFxje+FcMbjitYqf3qEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747499561; c=relaxed/simple; bh=Uh9Z7wvd+KbCKVhLYcHj1vnjI+C5lpp+HRMDkgEd7/Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gGZSGSjkPMhAIxhAYhA7gDI52gtdO6YxrNZR08V7Lg4w3CBGsHZLW6Yk+8bDy0tt48/WH7a3hjuVS8AcbKj93SQK8KdO9yo04Om2ov3Iekh8pvGuSKS2DUkSW7Qa1pR1GMFNxsOrDZ8O+w5D4IIFlE970L+y4TE4sSH27hV1b3c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=MN0ZPWqo; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MN0ZPWqo" Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-b27015122c4so226719a12.3; Sat, 17 May 2025 09:32:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747499559; x=1748104359; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mmSSATjp3lH9WYqjUjXBBWOvACi2ZWxGK/PyKr3xEcE=; b=MN0ZPWqogFgHtj8/S6nnVSLUUpmGf1OlePKoe5hr+uBokxd/W0mR44up582L0HCMX3 fL9qSG9uKxlzn+S79sZuCRKiDlZc9xJF1e3Kl20gyUGQ30IA8YpA9UQipohMz9CriGrz 7cdhw4sIj3p2MQ5j0xRJGMhMcO+fVHyWjTYDx9676QGnl55vyI9hg8ipdcCMTsUs9JIq X3Exkopc42CFjWrOFq9aPGLEvu5Qbu557AHjN+vee5161b3eSaP1kj+azRF8/3iQ5bWc 7MScQd9tvGItQA1T8ZwQghDA9oVzftsV0kaaYuvpLkRCMYsX4VSC96WUC3cTjhX/1l7F NqYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747499559; x=1748104359; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mmSSATjp3lH9WYqjUjXBBWOvACi2ZWxGK/PyKr3xEcE=; b=FGQmoKIsnO8UCURUO3Q0r0WFyj4l+Dn0CObjJ04LsKiAhtGs0sAljxYST0GfCIguu9 yTqG8Iz01r3T/EytPknTM/3rZEWlDhRaCN+3gFKgXK4V1lEB1AWvxLiqtkc/3HCJptRp SOKyfQejymaAvnFfSaGNs0JdybrJKMXHc0yDEbbWWHTqYUI8QkLfbf0VUN9zoE95eEY2 WL9lzl9S1miHEmZP+rHK6xGIzbtLtB+nnJJs/n6JYSedH7Q5PU/Hk5gTowW8/QFxOw3v zWYuENOOgy6+0/px7oaOcB6CStfrWUdSu0wAX9oFo4PRTALC5xqugsdaXdh2VLfs5lgR 9wjg== X-Forwarded-Encrypted: i=1; AJvYcCUXG78dwSzLIvalTYlXPhyUFny9qcSONWmrMJk07BAFc8kkFm/5+5de4BeQdJiny8NxxiA4asgfolP716I=@vger.kernel.org, AJvYcCWBBca8Ys2AXwKKPGw6DXxMidzKZvrSG+YTC/SJ0F7TzibYj7/MtC7wLSAkbqD90dawiL9AM7wblnCPzl3NfSCxIA==@vger.kernel.org X-Gm-Message-State: AOJu0YwgnXlQGtqQd5XeSEuzse5fARs6nLMJSuWIsVJZyvlBnoyD4FDJ RD94jo1XpcUgex5QmPqu6xk2N1dvXL8ObNogwLtFOkRRL/CqbOQyqfvf X-Gm-Gg: ASbGncvgxmlT5PlTIMRpEXOF/c6hS235Ah+/5kMPb5BFTYTItsNmrIpHJ5udpCTSMV4 qHsylCWh3p6fIp4TMjy+Pt3HKhJEpdJxnPKmr6wgAMIxGC0DKPP25Y2vB+0KXO6KqBHGeugnq7/ J5rgIKTYT9dI7INuM5r8XB15cQs1hwZDXdLr/MM6xM+iRipcjTA7XYPtfA6RpkgJ5erA0xB5nWd ZkQ/Qwhzv4Dsks4VcJP3r0sLO8v8hIX31weLl8s+dSS07mqp3sRDC/zB7g/TKtfX9TL1daY/3j6 NJDI75kJXNpTGmRNnqV89DXHc6btziW1T/vm2kNIwI48090P7FIiA09xAFhScS0Re1MGSvfQt9w /tR+si0H01qAf5jN277BR X-Google-Smtp-Source: AGHT+IFhRVnlYOvCLVuYmMmVRk1oMIWJSwOLRc05ZVgFlRDImlEyIm3RoQBKPQGScw2pjjQchhScew== X-Received: by 2002:a17:902:ea0a:b0:22c:35c5:e30a with SMTP id d9443c01a7336-231d44d70a9mr98230455ad.16.1747499558577; Sat, 17 May 2025 09:32:38 -0700 (PDT) Received: from howard-ubuntu.lan (c-73-202-46-50.hsd1.ca.comcast.net. [73.202.46.50]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b26eb085ad4sm3330321a12.59.2025.05.17.09.32.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 May 2025 09:32:38 -0700 (PDT) From: Howard Chu To: acme@kernel.org Cc: mingo@redhat.com, namhyung@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, peterz@infradead.org, kan.liang@linux.intel.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Howard Chu Subject: [PATCH v1 3/5] perf test trace: Stop tracing hrtimer_init event in trace enum test Date: Sat, 17 May 2025 09:32:28 -0700 Message-ID: <20250517163230.1237469-4-howardchu95@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250517163230.1237469-1-howardchu95@gmail.com> References: <20250517163230.1237469-1-howardchu95@gmail.com> 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" The event 'timer:hrtimer_setup' is relatively new, for older kernels, perf trace enum tests won't run as the event 'timer:hrtimer_setup' cannot be found. It was originally called 'timer:hrtimer_init', before being renamed in: commit 244132c4e577 ("tracing/timers: Rename the hrtimer_init event to hrti= mer_setup") Using timer:hrtimer_start should be enough for current testing, and hopefully 'start' won't be renamed in the future. Before: $ sudo /tmp/perf test enum -vv 107: perf trace enum augmentation tests: 107: perf trace enum augmentation tests : = Running --- start --- test child forked, pid 786187 Checking if vmlinux exists Tracing syscall landlock_add_rule Tracing non-syscall tracepoint timer:hrtimer_setup,timer:hrtimer_start [tracepoint failure] Failed to trace timer:hrtimer_setup,timer:hrtimer_= start tracepoint, output: event syntax error: 'timer:hrtimer_setup,timer:hrtimer_start' \___ unknown tracepoint Error: File /sys/kernel/tracing//events/timer/hrtimer_setup not found. Hint: Perhaps this kernel misses some CONFIG_ setting to enable this = feature?. Run 'perf list' for a list of valid events Usage: perf trace [] [] or: perf trace [] -- [] or: perf trace record [] [] or: perf trace record [] -- [] -e, --event event/syscall selector. use 'perf list' to list avai= lable events ---- end(-1) ---- 107: perf trace enum augmentation tests : = FAILED! After: $ sudo /tmp/perf test enum -vv 107: perf trace enum augmentation tests: 107: perf trace enum augmentation tests : = Running --- start --- test child forked, pid 808547 Checking if vmlinux exists Tracing syscall landlock_add_rule Tracing non-syscall tracepoint timer:hrtimer_start ---- end(0) ---- 107: perf trace enum augmentation tests : = Ok Signed-off-by: Howard Chu --- tools/perf/tests/shell/trace_btf_enum.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/tests/shell/trace_btf_enum.sh b/tools/perf/tests/sh= ell/trace_btf_enum.sh index cd4c8754f5d4..da6903108c8b 100755 --- a/tools/perf/tests/shell/trace_btf_enum.sh +++ b/tools/perf/tests/shell/trace_btf_enum.sh @@ -5,7 +5,7 @@ err=3D0 =20 syscall=3D"landlock_add_rule" -non_syscall=3D"timer:hrtimer_setup,timer:hrtimer_start" +non_syscall=3D"timer:hrtimer_start" =20 TESTPROG=3D"perf test -w landlock" =20 --=20 2.45.2 From nobody Fri Dec 19 17:16:27 2025 Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0B2620E033; Sat, 17 May 2025 16:32:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747499563; cv=none; b=smfaEKpeU8or5yHLaYEdv85uPTZuUxwm29eNKFpj0p5fqF+nxbJjk4bP/dVuFDuFOVfRAjEI6J2JGzPuJvqYwhrwIYd/TftKj3UPEEbr84gdWUyhtYkBIqh0RFJ3N+EuvjiQNoe5hVdkHa9nauLIw3uLgj4Ko7/MpgrXd5PEqOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747499563; c=relaxed/simple; bh=HGl5/1C+PePacGkaulqAAE63eATlJ5yTexSJ13I7erw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qfzu6gkG1+bm67fVKbGBrxzWT4gChhFcVLuqenZY2fIY0B019VE2OxucnVUKsMsH6y8/5U6diWVLNZ4IqYTP3vGbUkSKqnfCOep0KiRZk7q7Y8b2htKuHq6IRSqAAko9qGrPlpiiaoLyT9OEof7BkCUBHexnzJstJmb41STWPAU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IQIObIWB; arc=none smtp.client-ip=209.85.210.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IQIObIWB" Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-72d3b48d2ffso3176306b3a.2; Sat, 17 May 2025 09:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747499560; x=1748104360; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3m04i5CpY17sULHpU46/kb/9C20sfEkyj4cyY5wnvww=; b=IQIObIWB+eCcM7nOYopVYUlAQgfjnJIs2+yyGL7RafmNQb2G2tTvu+d+BCL5Dbq2vl 0CmnnnkpOTEzaaksPl0yny2cWdpCVItK8dubWxDshliGPCN40T3+tS5nmzCeJiKSu7Lx /4a0iYFltAePoNXjJ7MFsI+5sx0o2apxY3GrUiDBsT7xUwlsmzjEPXvpUahW9a1c3qnH 2GwWS3ESAEZSj8uhP8oDh/Ad8mFX30FVL9xj9a46ZyTQUrufNfufv6cmLJ0hWTuGiLTS KwmuC/SPlUgp8e2Y0Gqscgru9IZn4gnpd5eRgbIPGnIaYLPS/aLsA6xaSM1YX+n+eAYV mqhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747499560; x=1748104360; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3m04i5CpY17sULHpU46/kb/9C20sfEkyj4cyY5wnvww=; b=VvVLS9vwCiadgnUL6DbqpaImSqeqoiTnP171m5ezgZVeXwOAY1e+YCWCMSN6xuvJaY Aq0z/sYfQ4sI5NToNvDHJTi1qPhJq1U5/8NUlavJ3KoIajl0ZYF6IAQKv2cheRSv3rZ5 vfzjhgsWbTrc2Gx6i3bmUG7MpOoAkkCZalDy/4gqQvX7vwTcqiawb7qnLPIXyt/n5nOK +8cYzUL1amFFXNm/m5Zcyz7stgvGE6hVHqW744zhVfc9j4WJdLzZgJ8zdrHx8U78pDkV 2Jz9K+AjRLjfss2lwWGThpA8EogUNQbuYgs+9zOpdocxBnJ6Vs2TRUEflTacBgfZE7sX DajQ== X-Forwarded-Encrypted: i=1; AJvYcCVNKIu4UoZ5045SzLTN/uKdk+YV4Pi+a6uHOCMPv/S31QVde7PC55d1c7ua0iPsfxjXQUDEyNTafndL0sR6dpyv5w==@vger.kernel.org, AJvYcCXKKKh/BQucDSn/zh/06mJqz/gpPGLyh9v4sqnfKEWkB32k0Yfa464SwzVNwoEbMhWJoRzI+31b3lnycUw=@vger.kernel.org X-Gm-Message-State: AOJu0YymmDFP9s2DdFGgo7Yee394rYXX3X6gPWwZf93eAhrQjQxSNeC3 Llk5mpvCmxYJpUtGju58JkB/nRhB5hQWofYLuXguPhBJX1EwH7gSe7RG X-Gm-Gg: ASbGnctsk2L4YIHggM/m4RHbLM/B+wRrzQhR0XHsEDJej54F3ofZE8TK1Imn84KGZIf zXCzPTsSlSkbQWu5B5sJGOhbQB5uDYLkug7iRoM5g3fRqVal9S0V/HrIjMVJdu54RZse2p6F7rq pNchKad7Zun0Wb2fa79G0R+qs3OZdNRrI68+9Bu+kGKyl4PEct96sT/46rZRTL6jYBlq7hj+qTt j0wdl4WtlHgUc9Gg6pKtT8ENkFLC6vMS6SjJ0kLKGgYW+7t0xpMAFlcE/fyCauu7Hl0gIUy6lhF r0VdRHZX6vlR2U/0hgCG3Td9qLEdq7PQZ362Hkwf3q+quwnF8faKQ9ZRORy7swey5ibs8Hx6F/r 9nVqAZybpODeN3B4Dmm6QhZe47FM33fQ= X-Google-Smtp-Source: AGHT+IHCRl5jY/TsTkh7gQnEOTXbYQetSvinEsMw/lQo+CvDS/qm+Guemjo9FM6LYGeiZdT3pWcu9w== X-Received: by 2002:a05:6a00:4106:b0:740:9d6f:a73b with SMTP id d2e1a72fcca58-742acd509c3mr8207212b3a.17.1747499560023; Sat, 17 May 2025 09:32:40 -0700 (PDT) Received: from howard-ubuntu.lan (c-73-202-46-50.hsd1.ca.comcast.net. [73.202.46.50]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b26eb085ad4sm3330321a12.59.2025.05.17.09.32.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 May 2025 09:32:39 -0700 (PDT) From: Howard Chu To: acme@kernel.org Cc: mingo@redhat.com, namhyung@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, peterz@infradead.org, kan.liang@linux.intel.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Howard Chu Subject: [PATCH v1 4/5] perf test trace: Remove set -e for BTF general tests Date: Sat, 17 May 2025 09:32:29 -0700 Message-ID: <20250517163230.1237469-5-howardchu95@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250517163230.1237469-1-howardchu95@gmail.com> References: <20250517163230.1237469-1-howardchu95@gmail.com> 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" Remove set -e and print error messages in BTF general tests. Before: $ sudo /tmp/perf test btf -vv 108: perf trace BTF general tests: 108: perf trace BTF general tests : = Running --- start --- test child forked, pid 889299 Checking if vmlinux BTF exists Testing perf trace's string augmentation String augmentation test failed ---- end(-1) ---- 108: perf trace BTF general tests : = FAILED! After: $ sudo /tmp/perf test btf -vv 108: perf trace BTF general tests: 108: perf trace BTF general tests : = Running --- start --- test child forked, pid 886551 Checking if vmlinux BTF exists Testing perf trace's string augmentation String augmentation test failed, output: :886566/886566 renameat2(CWD, "/tmp/file1_RcMa", CWD, "/tmp/file2_RcMa"= , NOREPLACE) =3D 0---- end(-1) ---- 108: perf trace BTF general tests : = FAILED! Signed-off-by: Howard Chu --- tools/perf/tests/shell/trace_btf_general.sh | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tools/perf/tests/shell/trace_btf_general.sh b/tools/perf/tests= /shell/trace_btf_general.sh index a25d8744695e..e78e653fc8f1 100755 --- a/tools/perf/tests/shell/trace_btf_general.sh +++ b/tools/perf/tests/shell/trace_btf_general.sh @@ -3,7 +3,6 @@ # SPDX-License-Identifier: GPL-2.0 =20 err=3D0 -set -e =20 # shellcheck source=3Dlib/probe.sh . "$(dirname $0)"/lib/probe.sh @@ -28,10 +27,10 @@ check_vmlinux() { =20 trace_test_string() { echo "Testing perf trace's string augmentation" - if ! perf trace -e renameat* --max-events=3D1 -- mv ${file1} ${file2} 2>= &1 | \ - grep -q -E "^mv/[0-9]+ renameat(2)?\(.*, \"${file1}\", .*, \"${file2}\= ", .*\) +=3D +[0-9]+$" + output=3D"$(perf trace -e renameat* --max-events=3D1 -- mv ${file1} ${fi= le2} 2>&1)" + if ! echo "$output" | grep -q -E "^mv/[0-9]+ renameat(2)?\(.*, \"${file1= }\", .*, \"${file2}\", .*\) +=3D +[0-9]+$" then - echo "String augmentation test failed" + printf "String augmentation test failed, output:\n$output" err=3D1 fi } @@ -39,20 +38,20 @@ trace_test_string() { trace_test_buffer() { echo "Testing perf trace's buffer augmentation" # echo will insert a newline (\10) at the end of the buffer - if ! perf trace -e write --max-events=3D1 -- echo "${buffer}" 2>&1 | \ - grep -q -E "^echo/[0-9]+ write\([0-9]+, ${buffer}.*, [0-9]+\) +=3D +[0= -9]+$" + output=3D"$(perf trace -e write --max-events=3D1 -- echo "${buffer}" 2>&= 1)" + if ! echo "$output" | grep -q -E "^echo/[0-9]+ write\([0-9]+, ${buffer}.= *, [0-9]+\) +=3D +[0-9]+$" then - echo "Buffer augmentation test failed" + printf "Buffer augmentation test failed, output:\n$output" err=3D1 fi } =20 trace_test_struct_btf() { echo "Testing perf trace's struct augmentation" - if ! perf trace -e clock_nanosleep --force-btf --max-events=3D1 -- sleep= 1 2>&1 | \ - grep -q -E "^sleep/[0-9]+ clock_nanosleep\(0, 0, \{1,\}, 0x[0-9a-f]+\)= +=3D +[0-9]+$" + output=3D"$(perf trace -e clock_nanosleep --force-btf --max-events=3D1 -= - sleep 1 2>&1)" + if ! echo "$output" | grep -q -E "^sleep/[0-9]+ clock_nanosleep\(0, 0, \= {1,\}, 0x[0-9a-f]+\) +=3D +[0-9]+$" then - echo "BTF struct augmentation test failed" + printf "BTF struct augmentation test failed, output:\n$output" err=3D1 fi } --=20 2.45.2 From nobody Fri Dec 19 17:16:27 2025 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3341820E328; Sat, 17 May 2025 16:32:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747499563; cv=none; b=GfQOBrzKBKH1zVr/IYviLmnMd8Lk6hsucPwudtU1eKwvbmqwZb8jhOJJQuflPu2pFEqNP9Xe3woJVBmNCGU8mMA1CaAMv30iRwqP/q7nniYqGJlvgrimCPFxb7aKqYwNbSj50l/8tAPsQsJkWaOnd/oZnAlMiuQwGquIEQGJGOM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747499563; c=relaxed/simple; bh=pM2afdtWvN63wnZ9N1Ue8glUb7E0MP5sU0X3dPkt0Qs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rE1Xj+30c1Knx2a/UMt0AEoyiOShNLA/KtgJLhPTN4eiQtOBjvk0uGzh2ErxlwtAV1Qsg0WGlXTaubt61M0MAo3QGyQIs7/yRjysHLFg4ncRGnxjqZlQ/kK2PnMYiYrjqWfmIt3cfn0c/PBdqSOKuO2E5/XqKjcVOvZ/K2iGLPQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IOLJ5EGE; arc=none smtp.client-ip=209.85.210.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IOLJ5EGE" Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-7423fadbe77so3153079b3a.3; Sat, 17 May 2025 09:32:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747499561; x=1748104361; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Kr6fiqTS4hy2eJG+DPR1iFk2n4/BwG2AsU5uh7Vgz78=; b=IOLJ5EGE/aJLUogx4zyMgyWH2CJUdGiFbUSphNf2MYfSYcgJAEctFS9otsBo6blgsz MJy/uEYxO1JPRM39l/jEM0b8wNBE+2zSWvh+12PzXmXCzDypKWn9Zh5VspQCEd2ZGZCx GzR/FtD1YhO0Yb25rgr4/KentEzGRwEGWB2j0iMeEeDuujncd1dTXT/1tZxIKUAp0U2o 0a2lpldJoWpTzTbmbjtGaUWgsPrtY7p74gT+rPOvZJ+jwt4AtRdtQS+0uooyIbMZyvbk 3QEu0Iuuxp/JSRIfyBAgo71a6HmjllNMoTa/qmCnJdV46cOD9cncD5U30fVbtY7HRgjJ 9HJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747499561; x=1748104361; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Kr6fiqTS4hy2eJG+DPR1iFk2n4/BwG2AsU5uh7Vgz78=; b=HhShuaRRI3qi9H6jFvdotJ48ADgKTe6tXMlZxueQcWjF3/w5jUws2N34qfvM2SiEQO O58T8TbMDidGJnhmR1RxdFFGYwQYBR7ggPvQ3V016dRGApPkOd891zEWlakfIQEVVaTy atIHSS247Uw4bF+odl4kRYfnZz9STWzca+W8XiLK2n2oFVUr3rnsnOeANauYxGgKkO15 /qndwLYGa01p7suuEcJTgb4tooEjhe9bOh0wU1lXt004WP+vJPTchl24G9K/gmkgeaJj 83Tg1tVhBHLWz5fKaewzKxgiHldskgYtG51mRZ5230A/+jiOJC1XfsGdGRsS9QqE/pBr TP8A== X-Forwarded-Encrypted: i=1; AJvYcCU7p6wmcSwlRhYdBP9Xgrodo9+NUglBiJLs1a8KlquXAO8QUFS4vsHCeo8faSaV5gJkcGk0k6L7ZkVpODE=@vger.kernel.org, AJvYcCUP4lrNu7OtxK3/cDMqunICdxhrFirF/JfFzJ/zqtfE6xSlTr2ciI1Tfe4whxIEZyJUExEhtFAQCVT5xSrT7G+l7A==@vger.kernel.org X-Gm-Message-State: AOJu0YxZoCYSDqwkkR9fjaHE/BmJL0Pu7e7xAHRyOe60KCTSIBAFUfJ8 ddjCOsgZqv0iHxfEd9agt01tcwjGccuVdoVRPyAbfD1zsUiqEEDNbmyu X-Gm-Gg: ASbGncttl0ntAySYFtjqC5JBpKv/Nmx5qXeWEBUvnq8iTQlfERdB46cn9tzd2pym/HO 6mQq4yd06+78pQHjPp+JppBJFaXJTkgHDsRJdFRJ1uzQjrzLDngw1HtQerWR73MeM9+weh7YwEr kDXD3Mpga5CbAzp3wkUcOTnwLqtuHc7ZisrSNwuLJQDJSkxD1SaTKUTDZzhtrKv04eOVumpk2BX rauffPe8v28ekeZFp7sG4XbMM0CkVkjDW0KFXK6Fal+eFD6rRlVx5a1iS2uuiKaq8HVsoyRak23 /e0aJTZUjb6bQI1yMUrbe7OSbDACuulNBY0DTsFxMcl60mdVviqBpwOToDfH9ornCPE/O188Ijk XA30EX706qEFjeN1tdcbQ X-Google-Smtp-Source: AGHT+IH3Cnkw0BkKS37E/fvbvaTiH6Q3NfTFfO/wbE5+wRZnXJlUHyRfpuExd9vq8uz4zG6bMchDdg== X-Received: by 2002:a05:6a21:3a45:b0:1f5:8dea:bb93 with SMTP id adf61e73a8af0-2170cb07df4mr11168676637.7.1747499561417; Sat, 17 May 2025 09:32:41 -0700 (PDT) Received: from howard-ubuntu.lan (c-73-202-46-50.hsd1.ca.comcast.net. [73.202.46.50]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-b26eb085ad4sm3330321a12.59.2025.05.17.09.32.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 May 2025 09:32:41 -0700 (PDT) From: Howard Chu To: acme@kernel.org Cc: mingo@redhat.com, namhyung@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, peterz@infradead.org, kan.liang@linux.intel.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Howard Chu Subject: [PATCH v1 5/5] perf test trace BTF: Use --sort-events in BTF general tests Date: Sat, 17 May 2025 09:32:30 -0700 Message-ID: <20250517163230.1237469-6-howardchu95@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250517163230.1237469-1-howardchu95@gmail.com> References: <20250517163230.1237469-1-howardchu95@gmail.com> 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" Without the '--sort-events' flag, perf trace doesn't receive and process events based on their arrival time, thus PERF_RECORD_COMM event that assigns the correct comm to a PID, may be delivered and processed after regular samples, causing trace outputs not having a 'comm', e.g. 'mv', instead, having the default PID placeholder, e.g. ':14514'. Hopefully this answers Namhyung's question in [1]. You can simply justify the statement with this diff: ---8<--- diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index edab0ff60b3c..f042afed5b74 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -4204,6 +4204,7 @@ static int trace__deliver_event(struct trace *trace, = union perf_event *event) { int err; + printf("[debug] deliver\n"); if (!trace->sort_events) return __trace__deliver_event(trace, event); diff --git a/tools/perf/util/comm.c b/tools/perf/util/comm.c index 8aa456d7c2cd..76df9886429e 100644 --- a/tools/perf/util/comm.c +++ b/tools/perf/util/comm.c @@ -213,6 +213,7 @@ int comm__override(struct comm *comm, const char *str, = u64 timestamp, bool exec) new =3D comm_strs__findnew(str); if (!new) return -ENOMEM; + printf("[OVERRIDE] old %s new %s str %s\n", old->str, new->str, str); comm_str__put(old); comm->comm_str =3D new; diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 2531b373f2cf..5a501fe304d2 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -578,6 +578,7 @@ int machine__process_comm_event(struct machine *machine= , union perf_event *event if (dump_trace) perf_event__fprintf_comm(event, stdout); + printf("[debug] machine__process_comm_event\n"); if (thread =3D=3D NULL || __thread__set_comm(thread, event->comm.comm, sample->time, exec)) { dump_printf("problem processing PERF_RECORD_COMM, skipping event.\n"); Now, simply run this command multiple times: $ touch /tmp/file1 && sudo /tmp/perf trace -e renameat* -- mv /tmp/file= 1 /tmp/file2 && rm -f /tmp/file2 And you should see two types of results: $ touch /tmp/file1 && sudo /tmp/perf trace -e renameat* -- mv /tmp/file= 1 /tmp/file2 && rm -f /tmp/file2 [debug] deliver [debug] machine__process_comm_event [OVERRIDE] old :1221169 new mv str mv [debug] deliver [debug] deliver [debug] deliver [debug] deliver [debug] deliver [debug] deliver [debug] deliver [debug] deliver [debug] deliver [debug] deliver 0.000 ( 0.013 ms): mv/1221169 renameat2(olddfd: CWD, oldname: "/tmp/file1= ", newdfd: CWD, newname: "/tmp/file2", flags: NOREPLACE) =3D 0 [debug] deliver $ touch /tmp/file1 && sudo /tmp/perf trace -e renameat* -- mv /tmp/file= 1 /tmp/file2 && rm -f /tmp/file2 [debug] deliver [debug] deliver [debug] deliver [debug] deliver [debug] deliver [debug] deliver [debug] deliver 0.000 ( 0.014 ms): :1221398/1221398 renameat2(olddfd: CWD, oldname: "/tmp= /file1", newdfd: CWD, newname: "/tmp/file2", flags: NOREPLACE) =3D 0 [debug] deliver [debug] deliver [debug] machine__process_comm_event [OVERRIDE] old :1221398 new mv str mv [debug] deliver [debug] deliver [debug] deliver Anyway, use --sort-events in BTF general tests to avoid :PID, a comm is preferred. [1]: https://lore.kernel.org/linux-perf-users/Z_AeswETE5xLcPT8@google.com/ Signed-off-by: Howard Chu --- tools/perf/tests/shell/trace_btf_general.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/shell/trace_btf_general.sh b/tools/perf/tests= /shell/trace_btf_general.sh index e78e653fc8f1..a15cdb5fa309 100755 --- a/tools/perf/tests/shell/trace_btf_general.sh +++ b/tools/perf/tests/shell/trace_btf_general.sh @@ -27,7 +27,7 @@ check_vmlinux() { =20 trace_test_string() { echo "Testing perf trace's string augmentation" - output=3D"$(perf trace -e renameat* --max-events=3D1 -- mv ${file1} ${fi= le2} 2>&1)" + output=3D"$(perf trace --sort-events -e renameat* --max-events=3D1 -- mv= ${file1} ${file2} 2>&1)" if ! echo "$output" | grep -q -E "^mv/[0-9]+ renameat(2)?\(.*, \"${file1= }\", .*, \"${file2}\", .*\) +=3D +[0-9]+$" then printf "String augmentation test failed, output:\n$output" @@ -38,7 +38,7 @@ trace_test_string() { trace_test_buffer() { echo "Testing perf trace's buffer augmentation" # echo will insert a newline (\10) at the end of the buffer - output=3D"$(perf trace -e write --max-events=3D1 -- echo "${buffer}" 2>&= 1)" + output=3D"$(perf trace --sort-events -e write --max-events=3D1 -- echo "= ${buffer}" 2>&1)" if ! echo "$output" | grep -q -E "^echo/[0-9]+ write\([0-9]+, ${buffer}.= *, [0-9]+\) +=3D +[0-9]+$" then printf "Buffer augmentation test failed, output:\n$output" @@ -48,7 +48,7 @@ trace_test_buffer() { =20 trace_test_struct_btf() { echo "Testing perf trace's struct augmentation" - output=3D"$(perf trace -e clock_nanosleep --force-btf --max-events=3D1 -= - sleep 1 2>&1)" + output=3D"$(perf trace --sort-events -e clock_nanosleep --force-btf --ma= x-events=3D1 -- sleep 1 2>&1)" if ! echo "$output" | grep -q -E "^sleep/[0-9]+ clock_nanosleep\(0, 0, \= {1,\}, 0x[0-9a-f]+\) +=3D +[0-9]+$" then printf "BTF struct augmentation test failed, output:\n$output" --=20 2.45.2