From patchwork Wed Aug 28 14:07:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13781348 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 0F200C5B548 for ; Wed, 28 Aug 2024 14:14:08 +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=Rv2kj5M9p62D/Y2m17YPEShwSv M9tn33NzlK/1w23A8IVmPggaCqI440BqPVaPS70wT61UUmk+zfMPFeJSmcAhBVYK29h/KWehxP5ss QIlldKNGYVQJMzg/puSlHx58qSDtGURFHo+jQxcFpo6B6y+EKRTcmyZtgM7wB6pUKgW43gIWEy71S 8KpPJZ3mXxXsU4R8pu8h0dePm1BW33/gOFiqatgcIOttBdljVlV2ecNL8uIOYZE57z4vxqDUW7Pr8 EF7exb1tE4t1gzlsNT+AiK2KLTUVnFBQ5fugUfnDEkOur+JpF6SenKvaLOklTtMHefMYHsSzx/SRL YKwG5hCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjJQt-0000000FhKu-1tQo; Wed, 28 Aug 2024 14:13:59 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjJMe-0000000Fg5l-30Vg for linux-arm-kernel@lists.infradead.org; Wed, 28 Aug 2024 14:09:38 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-53345604960so7368450e87.3 for ; Wed, 28 Aug 2024 07:09:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724854175; x=1725458975; 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=U9DK+ukj/avfj1lZKDiaT3kxlnL9YhKYv6ciA4d0J51BhKga+Eu/ZZSj/C4u5RvMqX XWsSq72Sz7sWI/BCuztc2uae0zS+hY97n+G+U5AmQh/zgPj60RLSwSV+bY0ENiUxrCJi HbuSltVwM/JyM6p1YklV+pnsavCZqQaIdZYhqgDTKRZdxMoNuyL8+YgcV0DRUvK4OjZ1 pv1D4/83OySqPnO3ihps1NdUt4PGlP5czPTMZxPU8QmJBFnDyWEj/t/cFPntxIHzhNmD +ldsvcRUr0D8bsUeE0hauWMXenWxKM0nm6z2nMS3UDwpENTJSz4fW2rtBZoWZ91NhHn7 0QAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724854175; x=1725458975; 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=nHRIsJgF2GIX490WWxfY6gop2/sGyPLYAyqISO9LAjKNP0sTaisHIJmM+QFWzppi4Y YeRLiYncI1pRWQbsBPovnHVLoIw7Tr1J7JstI9GK3iskYzNlHvTHZLOG37DhDqoom4NB tXG9S4XCw5OYFbJzZWjTILeF7rAyvlTyR/oiYSLGc7fgXF+i6O6+4R32r8sNwpHv18Bk 3Xbb47rVHM+/UFee8C2MHZXGuFNGgC7FsVL09WFbsL1jB9pMr62MMUzAjBk38DhbaFgO uhzaQIziWKxfSvFxvN6hi3toNAyC/yEmvQJs+4vtRsIktH2nBuPK2jV3Ik3mLQOzv0Dd ZTrw== X-Forwarded-Encrypted: i=1; AJvYcCXhUvSpqmoVuuUWRtxcCF04p0xqv2IVI6KOHHpEsUxE141coY6HR/NW9XUjcAYlNb9gX74iO9icEanGryk2MZTH@lists.infradead.org X-Gm-Message-State: AOJu0YyBozGMZGeNrSBklFGarhS9FDc2LcZQE4U/DkPMui0113IXPFih Er/hARCvLFAgwHz2/YeRlcFHdEGkA3J98jeOcF+XQW3nC8Fhb510PPe0RZz8C/Y= X-Google-Smtp-Source: AGHT+IFgmIslD8aeXezPJ8omK9Ym59j23rdPHAVaCBU3pdKjqfegi/dglTnAMLH6nBwoXlF35NdpKw== X-Received: by 2002:a05:6512:3e08:b0:52c:825e:3b1c with SMTP id 2adb3069b0e04-53438783f89mr11126822e87.26.1724854174372; Wed, 28 Aug 2024 07:09:34 -0700 (PDT) Received: from localhost.localdomain ([89.47.253.130]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a86e5832855sm251302666b.130.2024.08.28.07.09.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 07:09:33 -0700 (PDT) From: James Clark To: irogers@google.com, linux-perf-users@vger.kernel.org, kan.liang@linux.intel.com, ak@linux.intel.com 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 , Weilin Wang , Dominique Martinet , Athira Rajeev , Colin Ian King , Yang Jihong , Ze Gao , Yanteng Si , Jing Zhang , Sun Haiyong , Yicong Yang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 6/7] perf test: Make stat test work on DT devices Date: Wed, 28 Aug 2024 15:07:20 +0100 Message-Id: <20240828140736.156703-7-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828140736.156703-1-james.clark@linaro.org> References: <20240828140736.156703-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-20240828_070936_779256_D6BF5C26 X-CRM114-Status: GOOD ( 13.70 ) 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