From patchwork Mon Jul 31 10:19:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 128604 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp1948066vqg; Mon, 31 Jul 2023 04:29:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlHGTjRFupGY7pNOpu/XmV2ea0+iT3bMi0S13wSnnnkzysKXPdNXDPL0KPMaxQjfkT2cG6n4 X-Received: by 2002:aa7:dcc6:0:b0:51e:2a1b:6de with SMTP id w6-20020aa7dcc6000000b0051e2a1b06demr6763178edu.40.1690802986501; Mon, 31 Jul 2023 04:29:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690802986; cv=none; d=google.com; s=arc-20160816; b=MD9U55feYy5PMbena9dJw37rYHRem2xFi2CkMaK4EcdYy2O6HlLYz6oKz9DwkhY2gF VMGil+uawIz7z40EbChp6+MguLE62X0XfmrWAIbils0hKVSGf2Tww64+iT80Z5vIb4Bl NsqS6QJQCq+bFvhVVX3AyGMrXhR2ofrRV7FlCQMyQSzvrKH5UQn5UBrBSU6dM8H/c3Ke XlVUIVgcQZkCzv8hnTJa4YYsRRSKKXZ0eIKhKEYEXZ0awtguozh4YPet815g38O2qnEf AggrL9AUmGDfrjJ5u9IrIwxmDn5Ir1qPH1bH1YeMwXZZkPBR6Gc1XfxRYDCq1coDnjO1 UPbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=mUvVENE9Gsx+H3JT+ddrJSzNgoAMWPAc5e0sCxh3bgo=; fh=fetFs0Yad7BxYBJvP0FJcaZ3r5Df+BfZPgF+sxngufI=; b=SV9fX9baWKwAaXdLHUrVbPNgrJoiOT9ZIIOzlkRYwbhIUS/DRpClpkV1LtduonN2d9 03d5chroOm2iw4F8DP36r2J5Lzn6lmLjTZUxQcxRbtvRVkmzqzWJZk+qH35MYzsxDTRq u+hx6P4TpoBnWFJ7Ne62y3p+aMFwp/JNzZp8TcF/saesUVBPZK2rlT3WbE7hfa3CHvHw PN/GX61EZ8F4t2M6vLNle6t7YHen5YhX9wV8iXBDyUCv0EINq6OaGqPpLGWSCjuJBeVN pGM8EbsABkkIDwrJkwRmOtjZ8yL/LWfrMCDxFKScMzmw8v6bRmmyxmeKdwYB0xx04Tme s5bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ocGV9Pex; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="/fJi71ys"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020aa7c0ce000000b00521ab8e67dbsi6400873edp.226.2023.07.31.04.29.15; Mon, 31 Jul 2023 04:29:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ocGV9Pex; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b="/fJi71ys"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232415AbjGaKTp (ORCPT + 99 others); Mon, 31 Jul 2023 06:19:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231933AbjGaKTf (ORCPT ); Mon, 31 Jul 2023 06:19:35 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E00D1B3; Mon, 31 Jul 2023 03:19:33 -0700 (PDT) Date: Mon, 31 Jul 2023 10:19:31 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690798772; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mUvVENE9Gsx+H3JT+ddrJSzNgoAMWPAc5e0sCxh3bgo=; b=ocGV9PexRhKMtEhPVFITCxB7xmiT/qIT1J9h0WV48NTtwIrC/S6wl0IXWL3jwNccmqbFSx i/oajtz7/id/TCOLNfZwb7qu+V4mSRXZJuvuf/mf07zzVCFbd0c9wTH42XIAzCmqdF9su1 MEKGVFJH9QE1cwBi7lbqn8l4ycf67ljIl59j8KoEENqG66ZzQEUT+YuuIcG5yv13ytJFbE yJ9Xo8OlFOkzau8EDygj1GgZ2dSq9xFZlzE/hfz/03wOE+dh7L2wK+dp0l5zTOtQu4wDki edZPjc9I7tPA/VNDwmlCGwBkaQ02gkcY4ikJ3hKWtDCNYlSDdzqiKEF/565x9w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690798772; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mUvVENE9Gsx+H3JT+ddrJSzNgoAMWPAc5e0sCxh3bgo=; b=/fJi71ysUZY5ROLS67VYEG+QAnkIjFrGYoyT1Uf26ahCtD90cY2NXJ6U5N9r+fCdAvu8lA hNwP4u4HfEXl7OCw== From: "tip-bot2 for James Clark" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability Cc: Ian Rogers , James Clark , "Peter Zijlstra (Intel)" , Anshuman Khandual , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230724134500.970496-2-james.clark@arm.com> References: <20230724134500.970496-2-james.clark@arm.com> MIME-Version: 1.0 Message-ID: <169079877184.28540.10430162346785754837.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772310672351752525 X-GMAIL-MSGID: 1772935431884441132 The following commit has been merged into the perf/core branch of tip: Commit-ID: 5c816728651ae425954542fed64d21d40cb75a9f Gitweb: https://git.kernel.org/tip/5c816728651ae425954542fed64d21d40cb75a9f Author: James Clark AuthorDate: Mon, 24 Jul 2023 14:44:56 +01:00 Committer: Peter Zijlstra CommitterDate: Wed, 26 Jul 2023 12:28:46 +02:00 arm_pmu: Add PERF_PMU_CAP_EXTENDED_HW_TYPE capability This capability gives us the ability to open PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events on a specific PMU for free. All the implementation is contained in the Perf core and tool code so no change to the Arm PMU driver is needed. The following basic use case now results in Perf opening the event on all PMUs rather than picking only one in an unpredictable way: $ perf stat -e cycles -- taskset --cpu-list 0,1 stress -c 2 Performance counter stats for 'taskset --cpu-list 0,1 stress -c 2': 963279620 armv8_cortex_a57/cycles/ (99.19%) 752745657 armv8_cortex_a53/cycles/ (94.80%) Fixes: 55bcf6ef314a ("perf: Extend PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE") Suggested-by: Ian Rogers Signed-off-by: James Clark Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Anshuman Khandual Acked-by: Ian Rogers Link: https://lore.kernel.org/r/20230724134500.970496-2-james.clark@arm.com --- drivers/perf/arm_pmu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index f6ccb2c..2e79201 100644 --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c @@ -880,8 +880,13 @@ struct arm_pmu *armpmu_alloc(void) * configuration (e.g. big.LITTLE). This is not an uncore PMU, * and we have taken ctx sharing into account (e.g. with our * pmu::filter callback and pmu::event_init group validation). + * + * PERF_PMU_CAP_EXTENDED_HW_TYPE is required to open + * PERF_TYPE_HARDWARE and PERF_TYPE_HW_CACHE events on a + * specific PMU. */ - .capabilities = PERF_PMU_CAP_HETEROGENEOUS_CPUS | PERF_PMU_CAP_EXTENDED_REGS, + .capabilities = PERF_PMU_CAP_HETEROGENEOUS_CPUS | PERF_PMU_CAP_EXTENDED_REGS | + PERF_PMU_CAP_EXTENDED_HW_TYPE, }; pmu->attr_groups[ARMPMU_ATTR_GROUP_COMMON] =