From patchwork Tue Sep 19 09:51:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Clark X-Patchwork-Id: 13391080 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 532D9CD54AD for ; Tue, 19 Sep 2023 09:52:29 +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: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:In-Reply-To:References: List-Owner; bh=wl5GvBe0BqGGNaRYAWppEr1N4R8F4aV+iKWidb7jRM8=; b=nVFOkb5m6JTezZ zEMyZqS+WzsEmh4R18NizMb6yV2lAo/AG0PsRoQtlAVHX06t0SW7D6LLchheIpSOo3BNAVgxlwAq4 Oyp3KphvewlIqkrb592Cv9Ev7fJIOScTf5AqeNl/xXO5gXq6I8BQeudJTR1M9ovnstghoSjiJq5j3 x++fTmrmt90qVb4wh7HDW5Fh2xmV4KwQOK4mgQBHXqEtY91qt6AYlp0OHu9ATieVTu9dk7o0wbgdj 17iQipWkxLNmHb95OD1b6GVjxTCKEQ0VSBt/IbCSYOn73KF8FKmdJ/pBnR7pswKsAg4IVgjA6tWd1 6TyRT5R9OWZnAzApq/0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiXOm-00HYED-0e; Tue, 19 Sep 2023 09:52:04 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qiXOj-00HYDF-0r for linux-arm-kernel@lists.infradead.org; Tue, 19 Sep 2023 09:52:02 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 718FE1FB; Tue, 19 Sep 2023 02:52:34 -0700 (PDT) Received: from e127643.broadband (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8A9193F67D; Tue, 19 Sep 2023 02:51:55 -0700 (PDT) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org Cc: James Clark , Catalin Marinas , Will Deacon , Jonathan Corbet , Mark Rutland , Zaid Al-Bassam , Marc Zyngier , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 0/2] arm64: perf: Add support for event counting threshold Date: Tue, 19 Sep 2023 10:51:27 +0100 Message-Id: <20230919095137.360963-1-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230919_025201_374904_6EF1D327 X-CRM114-Status: UNSURE ( 8.71 ) X-CRM114-Notice: Please train this message. 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 FEAT_PMUv3_TH (Armv8.8) is a new feature that allows conditional counting of PMU events depending on how much the event increments on a single cycle. Two new config fields for perf_event_open have been added, and a PMU cap file for reading the max_threshold. See the first commit message and the docs in the second commit for more details. The change has been validated on the Arm FVP model: # Zero values, works as expected (as before). $ perf stat -e dtlb_walk/threshold=0,threshold_control=0/ -- true 5962 dtlb_walk/threshold=0,threshold_control=0/ # Threshold >= 255 causes count to be 0 because dtlb_walk doesn't # increase by more than 1 per cycle. $ perf stat -e dtlb_walk/threshold=255,threshold_control=5/ -- true 0 dtlb_walk/threshold=255,threshold_control=5/ # Keeping comparison as >= but lowering the threshold to 1 makes the # count return. $ perf stat -e dtlb_walk/threshold=1,threshold_control=5/ -- true 6329 dtlb_walk/threshold=1,threshold_control=5/ James Clark (2): arm64: perf: Add support for event counting threshold Documentation: arm64: Document the PMU event counting threshold feature Documentation/arch/arm64/perf.rst | 58 ++++++++++++++++++++++++++++++ drivers/perf/arm_pmuv3.c | 59 ++++++++++++++++++++++++++++++- include/linux/perf/arm_pmuv3.h | 7 +++- 3 files changed, 122 insertions(+), 2 deletions(-) base-commit: 21b61fe48c2fc43d98ebb67a1f3832e0478fa523