From nobody Fri Dec 19 17:36:17 2025 Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 E13A616FF44; Sun, 18 May 2025 19:10:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747595404; cv=none; b=KYYlaTljS+pRlqxkJ5EXSxUZqox5bR5TEbhv2I5ItZV6s0EWK7C2XSuBmLAILGnO3NtAevSOxuME/x1OEq7tta0dq5Az6Qq50zM5Gb2qEIDttPQzwgHJuO84tQv8zh8OA6UtXD9a+YaOXEjnVHEgGgNSRpi6dO0hU/eGNjavDBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747595404; c=relaxed/simple; bh=8TFIlL+9Nqb7USj2bx1x7nSvC+emH7rIhEN9SdoxRiE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ijTJ4LFxPPtxriTplmC+uwiOcnOweNaKMHNc0AOSvMww5MYLZQPeSh+lgQWJg44oNWKM0t7Z3BBW7W/hpaqvqNn/PrZRbu67BbeV7O8CWS8/7bHEHUSOKLtu+RVIhGK8p+sj3oK3ZL7sqHhqWi9QU8AaQhyCL21waYBlFv8RyI8= 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=NhA+1lK+; arc=none smtp.client-ip=209.85.214.178 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="NhA+1lK+" Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-2302d90c7f7so47714055ad.3; Sun, 18 May 2025 12:10:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747595402; x=1748200202; 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=NhA+1lK+VoHVh7KKez4Lb4nI+aRwdehHDf1+kamc8w2xWJXZnwrOYrvULZK0yHJci2 uXspu5DaKAfTKSn3KzaSQhjZ/4nkaj+3ejjYTTONAKB+CfgcAwDnoafUEp95VdPYKpCj pyhmWGVS2QjXkcerBe4jdWjBrJoMM9C+F+pfl4f9DxA5AhTl8nOf0+GsEPJE2/RyKhLV mbMQ5MOlXc14PpoGzgf4uc2EA1JSQ82qYVFQXfgAUmPzvvf7pZW4kSBnE9o3gpJu/c4f 2gmLIDO6gbNOe6zP3Sv/GMY5R+HOvl1NG5ICUdd4nOfmjrQM5LJUy0zNI1mXVDPIUZbl ap+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747595402; x=1748200202; 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=JknxJ47F14FT9oyNR/tdxqPUvW0lqnQMtB2UO+HxdZp+QpILhNBo9bCAve+Dvh6bUa mRjhV1XJRSOHSM+hfDt7knbCob/wmvQAt4Xlb4icuhpsTWnpMITcKxTwlGv3M3lnwyQG axYKNmD/UjrNIUxGePzTvi2x9pNSLXGiWwtZHRwES/GsjBF2tH/1tDgotgCGWWDY64m7 /vVKt6E9qzTCoEbuA0PM9mz+HY9FqHIHuL2CcXqhrqcBUHDxuHZeC7bfw1TrPnwcytzF xokmj9Iho97i1DWFeBkXchFtHOknDLtP+IzWI5WSV9tWc8lRphFuHWhTjagZAl20F3Ul EE5A== X-Forwarded-Encrypted: i=1; AJvYcCUclXTdMLo2AXLc9KhtjgzWAPFbwBaVL17m69NtXGOkGFCGxXFtJYlOweYHMKP8dsum0xleH29RSrpsV5A=@vger.kernel.org, AJvYcCWZlcS6HdCopjpzUX1X/77qHl3FNaA4srpKpJjYCz2yXzFXqlkPBZHBIjg4CBYtCMPi6IUS1IrV6duZ/8kW+M+Bsg==@vger.kernel.org X-Gm-Message-State: AOJu0YyNPy5pI+f6F5gl8esOJX0fPQ6TpL5JgDQpLrW3t8PIizKvv3qO 3mMSjj7/WIYIAz3hp1OlJPWkgj3CZrZNvvSvFAoWYPFQcqmS+gKmiP2b X-Gm-Gg: ASbGncskfWrHpnrNbCbw9t+FvKYLmE5x1WTleUl1Ln40QEawVvu1BQ0G2RTqRxSXTZn EUonv1AwWw3wGWvSDZU+6VgK2xTlOjTM6y2hXfSxV0MmniejFVNjL6L5KHdPtvD6gXWz6qsE15q Eigx9xLgF6vqn4Dgar9DzYaPT6kWDyrIsFadUEPaFETzHKfm8eaNBUOnF+PDwUXHsfO2zOY5qKC sJtiecKpIC/wPrcDOjYt8FnneVKlzQGXIFaw/wvaBUG2VXsnfi2nNq1z/l59/NZGkZyItjLkGuC sYn5PwTqwrruNTfoPwPfnzW9GGSRrXQLdBu9T2XNHco5dD8TPrgYHYq6hJXlz42Pc7oUkjGOHlo doyG7AUEa7Qc4UG88P6xaO2f53Wab9mo= X-Google-Smtp-Source: AGHT+IHn3gpN7eO0RbqSUsuf3uyvSj2hHfe+JZJwLdbfEmAmLCno1DtUKlaV3l64I9H6FuMJA01j9g== X-Received: by 2002:a17:903:2f43:b0:22e:3c2:d477 with SMTP id d9443c01a7336-231d43bdf52mr159364385ad.25.1747595402064; Sun, 18 May 2025 12:10:02 -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 d9443c01a7336-231d4adafedsm46022135ad.56.2025.05.18.12.10.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 May 2025 12:10:01 -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 v2 1/5] perf test trace: Use shell's -f flag to check if vmlinux exists Date: Sun, 18 May 2025 12:09:53 -0700 Message-ID: <20250518190957.58932-2-howardchu95@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250518190957.58932-1-howardchu95@gmail.com> References: <20250518190957.58932-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:36:17 2025 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.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 442F91EF382; Sun, 18 May 2025 19:10:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747595405; cv=none; b=ZQDWw1wmul76HvmJimjd5S0LVB/OKWDpcqnE/t/MAUvhVk9p+glOVBTAy7CT5AEGtiXcUBJ2M6q1SWgkiFQRo0T+VoTOy//16iFj4hLTr62kR2krWj9plgtYy8qdWjm1YIAkVeBN7oy5hqHUhOIdFpNtyHOnyCi6KftoMyMA9WM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747595405; c=relaxed/simple; bh=mVeS1DwLh3YN2Z8nLwdQ0FcDREC0Wysb9FnWiUZNLec=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dVHD6wu5byGIk6pRybd1AgCcG/866/rJxiuSZAtAgMBVZyyvMAVfqPgbijNSdEx5xPHSGqrtO8LavYjQL2vIXVR7y6kKR8aPKF5IFgsKg7Yq4gugw0H3l6zp7GwpN9UvtSH08gcKWHamgcXUxsIGaRIorpqYt3d58wRxTb/aqrA= 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=RRjOQgdC; arc=none smtp.client-ip=209.85.215.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="RRjOQgdC" Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-b26f7d2c1f1so1895725a12.0; Sun, 18 May 2025 12:10:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747595403; x=1748200203; 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=/NfU6lKh/CqCSh0qCEAauDus8fp/OoFPPrxMtpXJevk=; b=RRjOQgdCv9SADVmz6IJJk9EALRgkwsMQHdOKrJATyrORTuVNsW3v1fhcUpNjOgqIpx TH6maEm9V6d1Vye/WFvYCj5XQGmdIPwTMYCegmdUN8R9lOtDbR84nDgfo/AffYGuJ54/ yKdp0dWLxv/pXNHhXLaF8eCVM5sqUzoEhteKyBqIVrvah0PaQQ1DiImIJiJxzS3unidJ 3oZRN4fjZ1JWFV41dXHEnSQu0JUHeHlUqZaerJGRqavmnhsuOjQKJYvkNShEl9jelQOo DR6h/BephjM6bjn/SFTaa+/mBC4pCQCgqhmZK0Mm//bGEq8G0jtivRNELri0Kjmx2aQL zyow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747595403; x=1748200203; 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=/NfU6lKh/CqCSh0qCEAauDus8fp/OoFPPrxMtpXJevk=; b=LIxhfqbGx7BVzF0yg/fzaJu/awYwJ6HeSJps9ZVzcO9bo+QEXHB0bX0ajWDN4Dm1H9 SDBg0cAor03qpAeB/uImKbyA77nvvdU8i9iXNR5pUJfmuQDQc0hHs/Ldnktdtd+ZMF7u Ws6oEMmcKNNROW6znliIfKrpssyC4Ax4iUvG13gta24NuWw+CqWQHMXx7Aq84Ghq+aHP XDcfPMT4+LIrgmfagdghRECqlk0jek7CNZKJYR4Hq2cDpICgzWPVYdhFROx4vZ6tXiIQ wX96vJHa3nR1kbYpiGZkVZcaqlZD2KgxZ/z+o7XIk/Q94zsDMNhEehbpEYDcm0OIOTgn PgAQ== X-Forwarded-Encrypted: i=1; AJvYcCUfsJ+LZVN9Ci3zhoNAxOCAUd1eOd/ndJHQ/xSAyO8w9rcu3+H10oGeF5qSGDi/mXCU6tSoDpJaEpwkc5o0MTZtEA==@vger.kernel.org, AJvYcCXlxMlxYRklKXqVIUnUDN1Yd+9vwK4UtlWxjxnjTgmLYuCyLe3ROPryS10Q9ehPUhjYt2FwTjfepQaTVrQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yw5YdOwdrlPIeGxH3WKgdmtLh4FSj55J+6gD9K08z/Re/qCGj31 kvR1Gw//NZLkAoxrttqgfReYb8SanS7tNM+tND+C4VknvwMjA7Leo5gB X-Gm-Gg: ASbGncuiC3UHedLIrWBii+fnChMLhrIRWG7hEdnrVgMVYOJl4IHh449nF82kvpuMqJJ kGnnUi97q1xWLRCNCaueL4t4186ucEDYjwGscpaQF3nLig4JW1FxZ6yJxoO1Nzm4AABNbaCSeCX 3UWtwR+51VDA8sakwwt7+AsLBprLO4f1qDYbeu/Tquxnpu4QEh58TKVFeiMxqywm3f62SakUcGp w7tzWs2ark0Jotr/aYgLuBve0juTpT1EfmH7SVZJxPUJJdldcW3GjNYU51gic3wb7SLBlS+sqhW dgn4L9FOnzFAsuo1uakC3RUlY8deL1oug4hSqD+Z9e9QIngzedVEaccWuivkR3uyhcmQ4sE4/yB AQ1MqwFqVvAacvZilHgSX X-Google-Smtp-Source: AGHT+IEKMZJ0YvL4SM//gxtxMZQSKwUVudvCUhfcos3ksHyibDxnj2ZuVJs4tggRfGzKgq8eQvaYLQ== X-Received: by 2002:a17:902:ea12:b0:231:c6d0:f784 with SMTP id d9443c01a7336-231de37623amr155259115ad.28.1747595403383; Sun, 18 May 2025 12:10:03 -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 d9443c01a7336-231d4adafedsm46022135ad.56.2025.05.18.12.10.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 May 2025 12:10:03 -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 v2 2/5] perf test trace: Remove set -e and print trace test's error messages Date: Sun, 18 May 2025 12:09:54 -0700 Message-ID: <20250518190957.58932-3-howardchu95@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250518190957.58932-1-howardchu95@gmail.com> References: <20250518190957.58932-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..f59ba34fac4c 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\n" 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\n" err=3D1 fi } --=20 2.45.2 From nobody Fri Dec 19 17:36:17 2025 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (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 8ED5A1E5B82; Sun, 18 May 2025 19:10:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747595407; cv=none; b=bvxT259RHwM4L4DTmZ0RUJg1yCUf1l07MyE1MKT4P1INrJvkwbR3Rj7iBiqmGI7efiPvW6k/rF+hx/rpQqzf4KbkB/StnR6D0KdPxGGZmBvLWc2mJH2Iii3WVYJjLXVWD+lW1ixM/4qwjFNaNpGUfrh04jsvDvmb3tY0lrXsz0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747595407; c=relaxed/simple; bh=HG/dOz1lUTBRbsbrIN5BoAJntNUMI8JcyM3yL1TC0mg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Cq+ZdQHuRnpM+A4i2CXE+6X5a5/WGhnN+RsFvWZyI3PXXia0bRzz3CQx3hKv9tzDsQqwEgbOUhBGfCSURB1paCK06T3s1scpNYA+AuwEYM+Z2aWWOtlxLPpwPv0QnL+nc0rL1QYbsiz1quKaRFw+dWtRWuvRXHC8B4DmfHPCA7I= 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=PBfQlw0R; arc=none smtp.client-ip=209.85.214.176 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="PBfQlw0R" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-23211e62204so5503875ad.3; Sun, 18 May 2025 12:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747595405; x=1748200205; 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=twBj1QB2d3zPEN2bcWML/rrXbWI+c5IxpKvrPzrniRQ=; b=PBfQlw0RgIDLK04n/tWTimkZ5ClyM7V0iC5DWAdvOI5k3H1sYZOwUF9gdpFzWSTqds wQ9Hpw50PPb4ALJBEXxe12tnH9tFmptdZlB4CYzIAzZoMRPcB3AVoiJSmaIKX18jJq1f c4PyupAeEdZLLxcIlFVGzM0YJBxKq6wfR0cwI9mI48NIFmtYVm6qz5pFTOsNkXu4Oiag 99gHRI8MFxIIbwcYIiAWEWva+HqRRifgNOFQtfRhpYU+vfb65JXWGn4yHTE4KBSTJJk7 mEZj45VhG9HoNRj33gOZwoihCmS4e5jC/RxLxsHEsWeAukA1klJFCIH5gnXGshSX9js0 NYxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747595405; x=1748200205; 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=twBj1QB2d3zPEN2bcWML/rrXbWI+c5IxpKvrPzrniRQ=; b=N2uBp7f3+CzgsY8mQCoieAaIbLMWZCnV06mKJvO/N+8Tg70au68ndwmjbSRR3Ypqgs 0eRqXOT4quxTVOv9l+apE1LnyrQwJ0x9iXOQCsE3pbn0Z0eTLco1Xi9yiDVxJ7yiZ6GG bVV3+IeWSo8ITib3B5+CyF349YBhHwM58/usMTMONrSD4lBkQdmXKtHe7LID2ZWyAkcb UB0KaNAYjPLRk0ciIqPRUCZj0aLWE3ZpWMsVEnDArMcnaGmyvxVCgf+urUQxYBuxNOY2 3G1VZAmGVlcnv9FtuuybnzfDeAQVXk1X2WVcM9emXV/non4tU87Xgq/ary6xq/Wk6eU6 5ZBA== X-Forwarded-Encrypted: i=1; AJvYcCWCVpXUgfZWZJfQ/zLFIRIoilWvWtY/9SzkgxKVw1u14tY+kF9Qg1CVrjfc7eHgtyqcDjl3Z+9QJi8lYKUOS3zlSA==@vger.kernel.org, AJvYcCWyf/YCo3LFFFRvR/D+naVjGryoSqNwvJgqlcFVGLnidx4rjO+pwiLWwf+5lae49PEmuo5BwKmFf/MfZGg=@vger.kernel.org X-Gm-Message-State: AOJu0YxdyiDYipt+galgSGgUtCFm6GgqYWaI6q3a28mWZ62qIMteVoMe tX5TGDkqVO0J/wOpjk59G3eiQtIGHEjcO3W1n5RoB6OVMzdXRpr9Eq7/ X-Gm-Gg: ASbGncsbJDDz+EvYmA0UsVn4s3mLSQ1hPNIOJbFdwPZqwclI7QOYOD/3r6hnKMG8j2O cQqaXPe292bfn/Ha6iOhNMvdlTmZz/ocPrCxDKu4NagXnDFBCExICWG+6IQrb0p5jjPdg1fncRN q7Fmpsep6yNFA8Qu5DpWCpBFm9by+/4YFGH85l6ESjO/GnANz9tbPcrtQToj0zEAe5GlyTIxvXD V1QLsIXdPHCyuZmeCidKA0l9ZRMYX4rZEazGXSQ0RlxIzrEyEAE+yxvVWw0NpFdoje6STPs0Bih g/MOFBn9m+cc3XzJRSRPFw/u3/2roBYbA9moOb5rrT5nRL1SGx5+PG4I2WE6NuqK7VToj6azbgW FjCJIJbo4mV0u7dHNL3nZ X-Google-Smtp-Source: AGHT+IG6YMgBJWT7eCqVBTsf5BlvqHMqPwdt1koNjI1X6M4Dcceg6Pch6tS96IZ0QPE7mYlgcnVBAg== X-Received: by 2002:a17:903:234f:b0:231:b37e:4da8 with SMTP id d9443c01a7336-231d459a604mr174360575ad.41.1747595404723; Sun, 18 May 2025 12:10:04 -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 d9443c01a7336-231d4adafedsm46022135ad.56.2025.05.18.12.10.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 May 2025 12:10:04 -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 v2 3/5] perf test trace: Stop tracing hrtimer_setup event in trace enum test Date: Sun, 18 May 2025 12:09:55 -0700 Message-ID: <20250518190957.58932-4-howardchu95@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250518190957.58932-1-howardchu95@gmail.com> References: <20250518190957.58932-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 f59ba34fac4c..c37017bfeb5e 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:36:17 2025 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.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 C22691FAC42; Sun, 18 May 2025 19:10:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747595408; cv=none; b=rQyE1S81LIxW4m6/2n4uD0ou25CH9P3M16nRiHTH1ZTO/+MHFpm52zVXsGz0hr41B3TvtKi7aJNRCtTkaiY5Z7LxwizoCVG+TS0bn8hn12F3OiRiL79UHyR9zlLXzZIWzOwITsPJqkNbR4WdRbFsXlZpw9bRsd10ahNQEjFJFAs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747595408; c=relaxed/simple; bh=pYg8TLTjgS0BjbaSB6NlASqTqqK6Bkw6JNseF6OIUqo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WI65hsROu5YfybDnpmn6VZ2rLndskoNzYJaL4qiMTjcUnvPv6HgqDhdi0sGYTiTyng5WktnwKoOx3WfmXUrm+7C37YHnideSMELiwwmmhIMa1ePgHoDwDWgbG/PeBAqJa/g7H7AsiBUHhVnRHX3Rls6vMLw5DibjXeXBbjyM0u0= 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=MlyFg7QJ; arc=none smtp.client-ip=209.85.214.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="MlyFg7QJ" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-231bf5851b7so26729795ad.0; Sun, 18 May 2025 12:10:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747595406; x=1748200206; 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=Gg68t38uPzYyo7Ew0hkP+phW30lhRktPX+3plUsKhsk=; b=MlyFg7QJkoflbAhwJo95//9hYJuIoUTw7pBdVeeUUTImZuJ1Ref+ZWS8LA5BRC7Q0E K/g/Qf29MTI7gTH4UizDNbHfgnVuWoBljqarP/vJ570ES8uhMpBGp/noPculAELeaX+M TW9NXhiHnGuUfsk3B1gpoR3fbimwQMSzQBqDKHk47GNl6PHzBcETT38vjQHbdeK+EVS2 elDIxuZ36UfAmbWRt00BpXzFRrShgKiIpa4a2dykoRJbApqI5APAqw0eHRwKaXXH3N9D 2aWfjA7GnfHIbvZaejlpHGXVL887QrNa7CKB5TbEX1xiE8Mk+CPu6TBEcKuKS0LYr7dD gt9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747595406; x=1748200206; 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=Gg68t38uPzYyo7Ew0hkP+phW30lhRktPX+3plUsKhsk=; b=VQWmgdl271DgILtiUuN7OiunRZTR0lI0s6w0gBILhg22CHA81ByuXp1LNpYUCkJcA1 Zlutc4mIhqNbLvtthbuzKSs8xc30eXL/BI3f+tplWcU3rXvex6nbsUQZ2SuT7Jra/VAx IrKbVbW9KonxzirKXYI5UWyjK5VHvwZOgHDNO33n42t+piax7B0AIS8EjBMrjyuGEoJN SU2ccxMm73vw38teq4SnpSXBFRsAizTHzwOLnvb+mMmY/JNJ7ySbpqpvq+WxeDo5TMqj N438CWPM4ZEimtOYIOMzHWiOHoshG/6zxN3hD7E/SUiH6Eqs0Lo2b05vXdIFn/wIAynG iErw== X-Forwarded-Encrypted: i=1; AJvYcCU7Ycl1Zdong+NsW5lFui4OANhE3wEPktEaWtn6b/yDUXSCloPKP/E1/5zchll5f3PtsHEF4SNiHXk44QK+spqHpg==@vger.kernel.org, AJvYcCWIFi9dQZPp7mBtV06N3FhGgKn9ldcaZ4rOKBIrBwkB+P5Xq09VIylICNugBhrZUbYGISlv6dARKXEWUDs=@vger.kernel.org X-Gm-Message-State: AOJu0YwFJgVmp4dmeoKhdDwuxPmAiI8Xrc+ZKlpklBoIymMUflUtC7Ax p5I1A7vFywxE+FC81gn5OgN2wjqucJznZUIw2PjvKgZN8TyfADW8N0D3 X-Gm-Gg: ASbGncu6RFuhMetNlaV4RmdzE5aCDWwdVh6+7TKQsjWSZdHlliaa9PxUUKdxi3voDrq hdWVpxXvUpiKd9p8+lKSs10gPE4FR4nOmVOMeWlAmy6e1ee8kp6KoPcyAWr2Rn3xRHv96HohGpr Rjn7IxRkxx0YbvE2pZq3tpWTCUv+52D2xb+c/UNEZ4V4nti7XfHOLwDisW1QSziyIYg7C8/yZpx BQQtGUSxHFo2dhNeL+H5urVZoxHhpMaLlwnQjQpfk6Gy7Nqacmt/UJkiBMyPkzccxPf+xOJMTjg IMjGqMIIIkdmTW3+BFVYsIX8QNmQs7Mmakkf8Jagr7Qol2UlfaQnjSmjB2ZyI7QVE+DRVUB2Y67 NAObrLr9gqurto4G6d5sr X-Google-Smtp-Source: AGHT+IEZ+CNZegmFA3/pDVUcTNJ0I3/eER/AjxzmrzrDj6Sf8UCfCIWws5x0zR8IGWZePkLwXSyeng== X-Received: by 2002:a17:902:e5d1:b0:223:54aa:6d15 with SMTP id d9443c01a7336-231d44e4599mr156668615ad.12.1747595406034; Sun, 18 May 2025 12:10:06 -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 d9443c01a7336-231d4adafedsm46022135ad.56.2025.05.18.12.10.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 May 2025 12:10:05 -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 v2 4/5] perf test trace: Remove set -e for BTF general tests Date: Sun, 18 May 2025 12:09:56 -0700 Message-ID: <20250518190957.58932-5-howardchu95@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250518190957.58932-1-howardchu95@gmail.com> References: <20250518190957.58932-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..5fa50d815203 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\n" 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\n" 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\n" err=3D1 fi } --=20 2.45.2 From nobody Fri Dec 19 17:36:17 2025 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (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 4C99A1EB5DA; Sun, 18 May 2025 19:10:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747595409; cv=none; b=VaqM2Rhmq5/0a5CBFaKeibM7JIqZGqpfRA+H3ZGz3mphR24/2NV4R4Is3InSrSAa9fxoLC7uiOIBMUa/hIRKxKd/jjpNnQ3xRaiRjvhhen17wiLVJ8re4Yzfrj2CGCraO4c6kRFicYhW+9ZNj7eUe4oFtPvDIxXZE9ZZT7pCPwM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747595409; c=relaxed/simple; bh=z0CasqAEvTfFdfOdHo4OuX7jWHBbJ5PPksEWEZz0WwQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D9If7d7C7znPGj3hafHOVFKZXr0Q1dUmDKlmdROIxoLMyKvcMeZrcujY5otoCZEvksvIxVYdGZTngYcyLBGEtuIpKQEMhFmaIhDF0pEx7016FMO3MTWv1S6qMMrMTHAE36lmuKSJ6a2cwOXesnMAx8iAhimhpyz+q2VrprOaqMc= 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=QVFjzAnb; arc=none smtp.client-ip=209.85.215.178 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="QVFjzAnb" Received: by mail-pg1-f178.google.com with SMTP id 41be03b00d2f7-af5085f7861so2374723a12.3; Sun, 18 May 2025 12:10:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747595407; x=1748200207; 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=UPASqWbwMcCUMi4ZOjE3DcJ6mOdKDFpi0lCkuF6a4EE=; b=QVFjzAnb2p0UcjrleaQ95tNKCgo5rYBxqRsT1bCix39Gwke0xIT9UnrnDxzHUtXmEo 5byTltgTkYjC2K67kOUcvs1CaUToLA09a+nPAMLu2zMBaNG1ctLVuLTUjuBIAVb4Wygz vPRU0NhG7bW2L2HcPR23AVOSWJfdcW5w0B3Gm5Qj3ihb14MnK9ZaQ0iBMsyltFNkIjXT UebEWTQ2ajQRbKAwpCi4IGNU3JTEvYz6P/u0TY6ywMhjZso/rkH3lmX63Fsjb1sKwpvN Fe+HerLV+cHq8iyhtzhMtsMix5UyyFuNPENTAAbpgUCIUaduJa1iGL3BLoHmRBHSHGnq QmeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747595407; x=1748200207; 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=UPASqWbwMcCUMi4ZOjE3DcJ6mOdKDFpi0lCkuF6a4EE=; b=K4ge7veIQwyJKgEf/UioKEpWXxYyd1YTnIMBdxXB/kgf5jXjuFj64oe/UBIq69lWXp 4qSpysfPgQs8ja/MuHtldl+HCyvZNW27qPxAqHhvvsyzSfdwnvkFfulSEPZfFHdj1Yvo E7ujGRUGf53f0MRqTjyHxrvOCvl/P09w/14HSPRb8t9BWwrW+hJ7gjaVIpqC3/779IIs avxcR+0bR8uQ1oP9Q1Ok+OL2qQRJr9uVuC7uZVjLUhdEsnYuXd9mNkzYQpkevN42ZvJM HIOfsYq3L+1RtA96SNmxIqns6oyP0YB51I+DLkd8JyNKoLw1cbj7VFE3P//87peq/n3T umlg== X-Forwarded-Encrypted: i=1; AJvYcCVRE78jcW3HnpWBGMr438rpJie0RZFG1tLBGb05D1dMR6fKKA51pRu6JS2puXqfeboJoLCUBYviWHG+tmw=@vger.kernel.org, AJvYcCWWzKDlU3/ZyIv0eGMZGhhjn1xXrFq67AApjRBcM3EV27eFVgW5YX1bCXXpDShTfgO7pvM7n+3zr6HyP3fUzFo/9Q==@vger.kernel.org X-Gm-Message-State: AOJu0YzoJqHyFtThHSwQnbhnxJ2iS1ZfE0DjoooRqK21Es2xInCiDkCW dJvj2Gp1+sR6InJIdoKgBVSVQJqswZxhjz2dF95zoOoRUxKPUPXob/Xc X-Gm-Gg: ASbGncthXRk+4w7d58MTxFM/vZS7C+kXbaGPtdRfQ9DhimufChrt4o2uzyJz8zdEBuW NJa/hw5HW9X+bo6SUZ2Yg4cEux250EFiq0+mU49Y4IJ0nPZfm3nzMIe9C/C/fI+sTTNysh0wiNQ tqf33EJJx6hj3xnVGIUpRpZPpbCVZ42EMkHro/4IB3nR21RQAdjjQqltDmSfTvGS++jBd8mfefD n1fpmDYqLfns9AyjIYPIilqdBd7t1TU1ipSrGZoZmgcJwCcnl1PwHbbjP4v7UeJRFVIFUonfG7X EQwqOwF2OQjZ6p6lkRo74MWMRC/z9uFAxDB6r/PIAOaOxwIsmEtjUanGvDIofSNod9hqgS/c0uv tNNpToECvRfZMfzOSceh/6FjUgHNvquw= X-Google-Smtp-Source: AGHT+IGsxIQ3q9cWJ+EyipAsTSsuKiCIUqXrsmQgjMFkJsHTFQ15ruIkysVpxTG60OserRb8uwfGEg== X-Received: by 2002:a17:902:ea12:b0:22e:7f20:52c6 with SMTP id d9443c01a7336-231de317d0dmr136676575ad.23.1747595407360; Sun, 18 May 2025 12:10:07 -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 d9443c01a7336-231d4adafedsm46022135ad.56.2025.05.18.12.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 18 May 2025 12:10:07 -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 v2 5/5] perf test trace BTF: Use --sort-events in BTF general tests Date: Sun, 18 May 2025 12:09:57 -0700 Message-ID: <20250518190957.58932-6-howardchu95@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250518190957.58932-1-howardchu95@gmail.com> References: <20250518190957.58932-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: [2]. 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/ [2]: https://gist.githubusercontent.com/Sberm/6b72b2a1cf1c62244f1f996481769= baf/raw/529667bd74a2e7e1953bbd4be545bf875da8a3e7/unsorted.patch 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 5fa50d815203..30cd3a53f868 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\n" @@ -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\n" @@ -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\n" --=20 2.45.2