From patchwork Thu Aug 22 13:24:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13773441 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 56310C3DA4A for ; Thu, 22 Aug 2024 13:32:55 +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=OeNgOcetoZEWr7lAapnTRFebdS Lv1++NGSXcNsiGgSp+dKj/aVDE8lcZwqXfgys1xJv10h7GTxOpuTq3ZGwwHspk+XgW/AETTJSzkaP D8Ey3bcY7Trgg5kXP6XGydjcLOhF/Jkd5Z58eeYX7eKHfWgZ9OiKZzIdUONox1tXlLylChkwtxykC j6oySRACm2jtrBU7NdtB8Ad0dmyi8Bvjuje0dqgopwczgTZVsJ2pBhJ3AiCbCp+hiNDT3PX+Awn2b cq4rHLeEMFMl3+DPXHW4VseT/COGcyGuikP11AMV3VJN7A7fmcZph7E3B6rPCgX9aF9j9H+B9RJOG N60reoHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sh7vf-0000000Cxi9-1mQw; Thu, 22 Aug 2024 13:32:43 +0000 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sh7qa-0000000Cvzh-11PN for linux-arm-kernel@lists.infradead.org; Thu, 22 Aug 2024 13:27:29 +0000 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a86883231b4so110485566b.3 for ; Thu, 22 Aug 2024 06:27:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1724333246; x=1724938046; 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=Ewp4q56eo9m3DGL9poa/q0PU9cllr7zkFnHsRxPR9dU+YJBwzXrL2dyvHVFvSAknzl ijPN+j6OVI8pnpVcXctnskyptgJJJu48BzbtVwSVkcw4KYf0yw7fs3Btq3mHRyKsTay+ QLAao1gPnoQsD5M85WOcZl4knb/8CM3AxSI0X0dvYl7WOtWSeTACwq8+Ht3ln1/H33rg Wp2E7TpivsUT+2VHqrppwHUgY7gd0PtB1TRI/WGWrTr5Zyxl4ZeLt7azrwChccoSEvH8 blj42pwOYHcgSGSnOCZR8rXP0AFz3Y34IdFPQUUbNY5yRP95zjjWqa2ThjBeVe29EKxq bXjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724333246; x=1724938046; 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=XstDttfjptpcLdfukdoSp/Tf2E2I7whkGCse4cdrBGeDRp8XRBJWnNa2ENw1X8xZU+ woXuc1c0S1OPDOkav7/u/4LLO4+WihYlW9RU97LIAeAzz5a9n3maHm6JHekgivKmuCaW 97dCuWSXQomGpFtfQK/o7Pk71NTppkEs7/u3VKnsMXaWdch2fcHYUu935erKJZNBWgJR H44uQ2U70KFRHi0JOX9dO1jgDawlb4vlhrC702+h0+fSqwolVyml4i/VrLjRP91R6546 M+PYhTc5blHDEf2EVZVi7j+9ILw8j24MZ3aVQ2YKiP7D5DqO2I/L9/N3JSwoJj1K5LfO PAfg== X-Forwarded-Encrypted: i=1; AJvYcCVI8i3K5/lestEWIvR+xs5wIJ5MHhYCG3pJo/xn355ovzGgMwBQ+lHe2y8S6X/1tey7QhdTyMx1tDelfyMW1xKp@lists.infradead.org X-Gm-Message-State: AOJu0YwGhBWpqhlWXNz6ceb+wzQZjbAu9Gq67erVKC/qkXgh/pzEsmqg bTCH6/z0h2jbsEwPMzfyedB4oK/k9TUu+42+gIhyWRRE0SpJ3M3DDsAOm93gjxo= X-Google-Smtp-Source: AGHT+IEIfESCaj20LeN3wdme4WvUm4ln3fDZaFGdKWeURVQl4E5qCNlJvP6ZZ2sqICCWJjg5IMrzYw== X-Received: by 2002:a17:907:1c1f:b0:a86:86d7:2890 with SMTP id a640c23a62f3a-a8691c5bb94mr201014166b.50.1724333246080; Thu, 22 Aug 2024 06:27:26 -0700 (PDT) Received: from localhost.localdomain ([89.47.253.130]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a868f4365a9sm119497766b.125.2024.08.22.06.27.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Aug 2024 06:27:25 -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" , Weilin Wang , Dominique Martinet , Colin Ian King , Yang Jihong , Athira Rajeev , Ze Gao , Andi Kleen , Jing Zhang , Sun Haiyong , Yicong Yang , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 6/7] perf test: Make stat test work on DT devices Date: Thu, 22 Aug 2024 14:24:50 +0100 Message-Id: <20240822132506.1468090-7-james.clark@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822132506.1468090-1-james.clark@linaro.org> References: <20240822132506.1468090-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-20240822_062728_307124_65FF68F5 X-CRM114-Status: GOOD ( 13.89 ) 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