Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp171957rdg; Tue, 10 Oct 2023 07:17:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEkQOjGGyTM/MBczwJLvbJhwAi7Jd3MLSIG0ti0NgyVL52degt73WGdj8tyiHunMQ2sAOj8 X-Received: by 2002:a05:6a00:18a3:b0:690:ca4e:662f with SMTP id x35-20020a056a0018a300b00690ca4e662fmr18178183pfh.5.1696947420058; Tue, 10 Oct 2023 07:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696947420; cv=none; d=google.com; s=arc-20160816; b=0x1G7gPuxFQJvPHEK0wz0E3spH2Zrq9ApRjdoFi6NhU8gCKsqOsN9guHlOQWZqIb/0 LQ1w4+bOf6lVTE996frfXMHrCzhjEONlIrcdnpDogFs8WLuxDdKWTniU4F0waUWK6w3+ YFKDo4gZ19OuNQGsNnJDarhaSq53JxRbZRqYYxOD1QoOVS9GyKYfFjEbMpW8kFfExhLv fhwDdIaRK+mtCzrngVLx/6bYz/C2JDaye4guWNgRxkczXBtGpYsY1efr8BeqZv1ENIqP EgjrHhRLOGld6FANuzGidlBQMx4CuSzYNB67Q4hNU0LxdzwGzu9qzTCG3pFbAdOlPMJB zG8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=d3Css4OHpZ4sRp21iPs2ik+NYeCASnyCFZ96Vk2FPyw=; fh=33DBaPorO7URBdsmw1GhTfOcXmmLGlzPWM8Pk62+8H8=; b=Qx1GQfLM0s9ezh9sXrxdu1CfRH3AuzKTkt9uw7auUHOyF4dSomNC1MSUrDDGp5tyxS /q5p+XLA2gtahBNIY/Ky9En90MaV9Rsm2KcU3xafg1Me0o8Sc6Ws/oNAcGehyZ4E+amL MIMBpInLDKAI7kDzOdrtXBJoeskdV2dXP+H5xu7GjNUUQw37dmNn6yIFqwNTLDOupqwf XQLBM8akHDGKtIEVogZNFgl7KjGyZruYn3ZzPvVqC9djQgMqSMkFIzwZH5VTT4NUaI3M 15ysAN1VPshBmYAQpSaq56hLqffhxvXRQRY74zm8Fb3uQM+iwq6JTpsXHY7Ur5EtHNSO qryg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id t185-20020a6381c2000000b00578a2db484esi11589715pgd.248.2023.10.10.07.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 07:17:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 318F28106F52; Tue, 10 Oct 2023 07:16:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232884AbjJJOQl (ORCPT + 99 others); Tue, 10 Oct 2023 10:16:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232907AbjJJOQi (ORCPT ); Tue, 10 Oct 2023 10:16:38 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 06EC5E0; Tue, 10 Oct 2023 07:16:36 -0700 (PDT) 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 6EBC51FB; Tue, 10 Oct 2023 07:17:16 -0700 (PDT) Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2FD073F762; Tue, 10 Oct 2023 07:16:33 -0700 (PDT) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, suzuki.poulose@arm.com Cc: James Clark , Catalin Marinas , Will Deacon , Jonathan Corbet , Russell King , Marc Zyngier , Oliver Upton , James Morse , Zenghui Yu , Mark Rutland , Reiji Watanabe , Zaid Al-Bassam , Geert Uytterhoeven , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev Subject: [PATCH v3 3/3] Documentation: arm64: Document the PMU event counting threshold feature Date: Tue, 10 Oct 2023 15:15:43 +0100 Message-Id: <20231010141551.2262059-4-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010141551.2262059-1-james.clark@arm.com> References: <20231010141551.2262059-1-james.clark@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 10 Oct 2023 07:16:57 -0700 (PDT) X-Spam-Level: ** Add documentation for the new Perf event open parameters and the threshold_max capability file. Signed-off-by: James Clark --- Documentation/arch/arm64/perf.rst | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/Documentation/arch/arm64/perf.rst b/Documentation/arch/arm64/perf.rst index 1f87b57c2332..36b8111a710d 100644 --- a/Documentation/arch/arm64/perf.rst +++ b/Documentation/arch/arm64/perf.rst @@ -164,3 +164,59 @@ and should be used to mask the upper bits as needed. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/arch/arm64/tests/user-events.c .. _tools/lib/perf/tests/test-evsel.c: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/lib/perf/tests/test-evsel.c + +Event Counting Threshold +========================================== + +Overview +-------- + +FEAT_PMUv3_TH (Armv8.8) permits a PMU counter to increment only on +events whose count meets a specified threshold condition. For example if +threshold_compare is set to 2 ('Greater than or equal'), and the +threshold is set to 2, then the PMU counter will now only increment by +when an event would have previously incremented the PMU counter by 2 or +more on a single processor cycle. + +To increment by 1 after passing the threshold condition instead of the +number of events on that cycle, add the 'threshold_count' option to the +commandline. + +How-to +------ + +The threshold, threshold_compare and threshold_count values can be +provided per event: + +.. code-block:: sh + + perf stat -e stall_slot/threshold=2,threshold_compare=2/ \ + -e dtlb_walk/threshold=10,threshold_compare=3,threshold_count/ + +And the following comparison values are supported: + +.. code-block:: + + 0: Not-equal + 1: Equals + 2: Greater-than-or-equal + 3: Less-than + +The maximum supported threshold value can be read from the caps of each +PMU, for example: + +.. code-block:: sh + + cat /sys/bus/event_source/devices/armv8_pmuv3/caps/threshold_max + + 0x000000ff + +If a value higher than this is given, then it will be silently clamped +to the maximum. The highest possible maximum is 4095, as the config +field for threshold is limited to 12 bits, and the Perf tool will refuse +to parse higher values. + +If the PMU doesn't support FEAT_PMUv3_TH, then threshold_max will read +0, and both threshold and threshold_compare will be silently ignored. +threshold_max will also read as 0 on aarch32 guests, even if the host +is running on hardware with the feature. -- 2.34.1