Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2442535rda; Wed, 25 Oct 2023 02:58:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExqBYczYTglzvUYYC0+VCNtuLw04HqCB8ynz2j8r/usdQ0etm/6oARQ2Rm5/nQAzMVVm8k X-Received: by 2002:a05:620a:24d3:b0:774:3963:41a5 with SMTP id m19-20020a05620a24d300b00774396341a5mr14834204qkn.13.1698227888188; Wed, 25 Oct 2023 02:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698227888; cv=none; d=google.com; s=arc-20160816; b=sE/0D26YeHOXkgr4XboHvpNI1FzsINN54jPE3e1uHGwQE2aQWOhx7g8TlUeJfBR+E2 /T0YHuAh6lBOk6Jj+iuZzGaevuVq9YwP0LJN5J+fSAFTYNL2eB09q7CToR1eBfgTide1 qHPTk5SmPnSs9Tgzm1xRdq4cVNKWtKDZEUrtwMhh13uhVdxpGNKtg6pLqgycFVUs4oJK Y3Mpu551oGcUevuh+oiLt1ksPzZYSk65yMVjH0kyfkdJ+mUo1wsH0ss8Irv7yAnNPPip a6sWbCPJx/N0l2cazORYMaUsVHvXVUsfZe9PnHYGcCinv0JQLVxKtsCqUMqgifuBdSMM kKyQ== 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=+qglQRbI7SZnWv9+AJu3XwNhf3sPyrDJ9LvrHcehM2c=; b=EfdxBSBwD75Jp6ARwIJDZ0jbCdFC1AApf+ywDXTSg5sX+NXxbzgN+MVljVeMUT/9Rg tl6my7kluGYt1xvS56fmZ/kFtxNr3F+XF2xJjlXgf5g/k3mWtJjZc8hO0GkE8zUPHHj8 tZt+nPEXC0bWNH52M7PXjo8YWqlg5ACfu2vVBk4RkozX84rTNhbCkjNEuK40kIUIVkjX 7ENL7GVlZyABDaOqX/WOY9RUv1rFpJdYE99MpJA9mfIwZmdK65xiABaOKv3emGEWx6U5 l7+7QkfTBzof8a9lcg4FMRd+xZugQl1MI6TMTKrmHonROMWKAoxW8er3fS+9zgWS5iqc Q2ew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id j62-20020a252341000000b00da04fb81279si2869552ybj.15.2023.10.25.02.58.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 02:58:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 95AFF801B1B1; Wed, 25 Oct 2023 02:58:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234338AbjJYJ57 (ORCPT + 99 others); Wed, 25 Oct 2023 05:57:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234449AbjJYJ54 (ORCPT ); Wed, 25 Oct 2023 05:57:56 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 509A211F; Wed, 25 Oct 2023 02:57:52 -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 931242F4; Wed, 25 Oct 2023 02:58:33 -0700 (PDT) Received: from e127643.arm.com (unknown [10.57.70.16]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AA6B83F738; Wed, 25 Oct 2023 02:57:49 -0700 (PDT) From: James Clark To: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, suzuki.poulose@arm.com, oliver.upton@linux.dev Cc: kvmarm@lists.linux.dev, James Clark , Catalin Marinas , Will Deacon , Jonathan Corbet , Russell King , Mark Rutland , Marc Zyngier , Zaid Al-Bassam , Reiji Watanabe , Geert Uytterhoeven , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 3/3] Documentation: arm64: Document the PMU event counting threshold feature Date: Wed, 25 Oct 2023 10:57:05 +0100 Message-Id: <20231025095710.1559601-4-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231025095710.1559601-1-james.clark@arm.com> References: <20231025095710.1559601-1-james.clark@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 25 Oct 2023 02:58:06 -0700 (PDT) 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