From patchwork Wed Aug 9 10:39:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 13347685 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 4133BEB64DD for ; Wed, 9 Aug 2023 10:45:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=p3HJKuPg8VFh2BtIec7CCOMl4A4hPFF/ciQee4Up3e4=; b=KxTa3xeM/OJFbs swerbB0lcLO0Fm2KGQieMSB4JCZSpxqNyR56VtmF93XWe6dpaEvYSIQEX5/rG9TqzDnY/3RJwy58a 9dVdk1c7VxPqtvg7UUwR0GF4gkeQ0K3B1iqWPG8PO67qbLN7lb5ZHsYQPl+upXCNgwFXtM3p2TagR pCFR1hCmdyiKN1Txmlg1g/YZMyFR/dGNcwcV70c7dNVgO4/nu8+rq5Mr5/vsknJ3ZpCx7dVvqPuEB YfN4i+qCLqt5GltvBpCu1AsFWhSZ/J3tNJcLHQBWeJzseRwrg7tZVGYt1rkqgEqaUVdAm5vFeQ17o KQOeb8bTxqT3zDh29duQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTggE-004eri-0O; Wed, 09 Aug 2023 10:44:42 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTggB-004epH-1z for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 10:44:41 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E662663121; Wed, 9 Aug 2023 10:44:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD997C433C7; Wed, 9 Aug 2023 10:44:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1691577878; bh=1p+ZaaiirH1QJYwhEVbbjQXfkOCiHm/fkZERm1Saqe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XPtpyVnYrK7EJmyWBM/LOZjrDMyXJ4dLrcnneY2JKjLpB9x7YYefDRCaOr/isjHpj cNS0nFwxxbEkZGsHuybRZEErEgeoecVQhhkYhx+OEmqPjxrp9L+cC+5Si3ONrfLH+W nwSiNZjw44edjK4b9wrdZI+8yXYitlZiOmTB8AYA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Haixin Yu , Jing Zhang , Adrian Hunter , Alexander Shishkin , Ian Rogers , Ingo Molnar , James Clark , Jiri Olsa , John Garry , Leo Yan , Mark Rutland , Mike Leach , Namhyung Kim , Peter Zijlstra , Will Deacon , linux-arm-kernel@lists.infradead.org, Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 6.4 026/165] perf pmu arm64: Fix reading the PMU cpu slots in sysfs Date: Wed, 9 Aug 2023 12:39:17 +0200 Message-ID: <20230809103643.673268041@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230809103642.720851262@linuxfoundation.org> References: <20230809103642.720851262@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230809_034439_739666_520B308F X-CRM114-Status: GOOD ( 14.08 ) 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 From: Haixin Yu [ Upstream commit 9754353d0ab123d71bf572a483ecc8b330ef36a3 ] Commit f8ad6018ce3c065a ("perf pmu: Remove duplication around EVENT_SOURCE_DEVICE_PATH") uses sysfs__read_ull() to read a full sysfs path, which will never succeeds as it already comes with the sysfs mount point in it, which sysfs__read_ull() will add again. Fix it by reading the file using filename__read_ull(), that will not add the sysfs mount point. Fixes: f8ad6018ce3c065a ("perf pmu: Remove duplication around EVENT_SOURCE_DEVICE_PATH") Signed-off-by: Haixin Yu Tested-by: Jing Zhang Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Ian Rogers Cc: Ingo Molnar Cc: James Clark Cc: Jiri Olsa Cc: John Garry Cc: Leo Yan Cc: Mark Rutland Cc: Mike Leach Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Will Deacon Cc: linux-arm-kernel@lists.infradead.org Link: https://lore.kernel.org/r/ZL4G7rWXkfv-Ectq@B-Q60VQ05P-2326.local Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- tools/perf/arch/arm64/util/pmu.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/perf/arch/arm64/util/pmu.c b/tools/perf/arch/arm64/util/pmu.c index ef1ed645097c6..ce0d1c7578348 100644 --- a/tools/perf/arch/arm64/util/pmu.c +++ b/tools/perf/arch/arm64/util/pmu.c @@ -56,10 +56,11 @@ double perf_pmu__cpu_slots_per_cycle(void) perf_pmu__pathname_scnprintf(path, sizeof(path), pmu->name, "caps/slots"); /* - * The value of slots is not greater than 32 bits, but sysfs__read_int - * can't read value with 0x prefix, so use sysfs__read_ull instead. + * The value of slots is not greater than 32 bits, but + * filename__read_int can't read value with 0x prefix, + * so use filename__read_ull instead. */ - sysfs__read_ull(path, &slots); + filename__read_ull(path, &slots); } return slots ? (double)slots : NAN;