From patchwork Tue Aug 13 13:23:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13762044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9682CC52D7B for ; Tue, 13 Aug 2024 13:29:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FXow/HXS2t6eZsIhNK0KrvK5I+CXmczupsEF4/wQsaM=; b=BsduNrgF5jJoR7c0PKVwZCduPA t1WvEosSY6cnc4O2UwbiWw/eqPqnduuIG/7k7RF+gr2j7LhVQwWyhVyfnQfoKvZMQ7chty+tnzjVh YRgo4+JGTWfUx/DmXYNDHLbkiHASR1Bi2B8YxXvLTcHpWuYhTZiCoJ2zyhIrCFgNhHMIaojDH90G1 6/1ygQRIlenvhjmTSztGULfNuqah4xR17L+iCgzDas35od49FBb7DZE2a5NH+eWCHC9hs0QA0tWub BTN/qbPG5PC9Omk1bgGJkyNabw2uVoFffpAOFeB/RnRjMu/V+Cj5fZTrgziG/SXE35Ye1gUcw4EZW ccu9Uc8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdraC-00000003sNc-2hvj; Tue, 13 Aug 2024 13:29:04 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sdrWt-00000003rPE-28SQ for linux-arm-kernel@lists.infradead.org; Tue, 13 Aug 2024 13:25:40 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-428fb103724so36911065e9.1 for ; Tue, 13 Aug 2024 06:25:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723555537; x=1724160337; darn=lists.infradead.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=FXow/HXS2t6eZsIhNK0KrvK5I+CXmczupsEF4/wQsaM=; b=xr29Zl/otHnCqMx7F/22OqaXL8fDYa66cOOc82s0HpN0/SphQMF3hvKOIALSnIDHy/ Bm4oOrnssZlmvDkom9oGPwSLvnI3+K5XfKz1bt0fqIbsgtNL2S0xz/MTgReg0H7WHCTp Pxok1aggwXxV0Gdoref/yWjcwjrzHTcBGqlnmDDpUhrWxjUBBklms13PhyWtfzI1ivqj t41DpljcQ4Igol4r4yf4oZjNgS9hqwj/Mr9+54HHWioOkMad0569WSEaBiSjwEPCvCN8 7JB2BrX9SSAcir8s/8bb4xlekO6Iai35/IUEMYuXBPuyv6cXqUWVEjCOJ9z106TE8Q6L 5ipQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723555537; x=1724160337; 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=FXow/HXS2t6eZsIhNK0KrvK5I+CXmczupsEF4/wQsaM=; b=WBaoT221q/u1Qw24Lbk/U3ahkmPnVH/+VOLF34/rA9Kab7Q2XKrZ6V9akGfZPhBFVX B9nuL1pMOJrgvhqR05O0lyeLKQ+BNmh61xCtAX36SvBr6uCuFYTejR/PhMTHY6zp42jk n+ikGGDZCEKHMcTbf7nJbgcRBTvv8oFaMXQVe3+tT9mqvsE5AhX6rnt/ktHQ0vL690h6 1DhgebEMI5ONPH8RLRVu9SOyigRmdlPQVr4qqADV8kcN/vH9NhJGimw0gK73cOPHRd6e RlkfVOK4r/jeNBLSk9XcrdAvUJNQvvbmhHsKeVEpBHhwK5HbfOP+559KWVHntm74K1nN Evmg== X-Forwarded-Encrypted: i=1; AJvYcCXG9h1yk9hY7gQquVNkIg6QmjCC1PDlWmDc3jil6kL4W6fAaCjgs1xaD+1Dc23j6nq01hpzSu5dyp+YLzUl4xaR/5eE0nk/uTTGTVfpTbxlTinmF8U= X-Gm-Message-State: AOJu0YwRdIIpqot9WMmqCJoSQvyUWEyBvWaaHEl7eppmlBAPTgv8cT7B 6NI3vO2tbQV0ietvBP3rXP4G4Sy0OvjtVzliBW05K7kNoMPRjeiWLcApczHctss= X-Google-Smtp-Source: AGHT+IGc9t+MTAwYwGAaBX95OSnKFftghFZ3NfLAkZ7AAvwA9zVwqXl0BELY2LWwoeQ2oa+XAXA1ag== X-Received: by 2002:a05:600c:3550:b0:424:a401:f012 with SMTP id 5b1f17b1804b1-429d6269733mr21164045e9.3.1723555537440; Tue, 13 Aug 2024 06:25:37 -0700 (PDT) Received: from localhost.localdomain ([89.47.253.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4290c738d21sm223186625e9.12.2024.08.13.06.25.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Aug 2024 06:25:36 -0700 (PDT) From: James Clark To: irogers@google.com, linux-perf-users@vger.kernel.org Cc: James Clark , John Garry , Will Deacon , Mike Leach , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , "Liang, Kan" , Yang Jihong , Dominique Martinet , Ze Gao , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 6/7] perf test: Make stat test work on DT devices Date: Tue, 13 Aug 2024 14:23:14 +0100 Message-Id: <20240813132323.98728-7-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240813132323.98728-1-james.clark@linaro.org> References: <20240813132323.98728-1-james.clark@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240813_062539_568656_9478D600 X-CRM114-Status: GOOD ( 13.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org PMUs aren't listed in /sys/devices/ on DT devices, so change the search directory to /sys/bus/event_source/devices which works everywhere. Also add armv8_cortex_* as a known PMU type to search for to make the test run on more devices. Signed-off-by: James Clark --- tools/perf/tests/shell/stat.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/perf/tests/shell/stat.sh b/tools/perf/tests/shell/stat.sh index 3f1e67795490..525d0c44fdc6 100755 --- a/tools/perf/tests/shell/stat.sh +++ b/tools/perf/tests/shell/stat.sh @@ -117,16 +117,18 @@ test_cputype() { # Find a known PMU for cputype. pmu="" - for i in cpu cpu_atom armv8_pmuv3_0 + devs="/sys/bus/event_source/devices" + for i in $devs/cpu $devs/cpu_atom $devs/armv8_pmuv3_0 $devs/armv8_cortex_* do - if test -d "/sys/devices/$i" + i_base=$(basename "$i") + if test -d "$i" then - pmu="$i" + pmu="$i_base" break fi - if perf stat -e "$i/instructions/" true > /dev/null 2>&1 + if perf stat -e "$i_base/instructions/" true > /dev/null 2>&1 then - pmu="$i" + pmu="$i_base" break fi done