From patchwork Thu Dec 8 08:44:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 31217 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp78150wrr; Thu, 8 Dec 2022 00:47:05 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ObCbFG3t4GUByU0U75fVpuex3lA8n7K4+oVMmEUdDuV49yFb6uSxe2JPSmW57q/cR99S4 X-Received: by 2002:a17:90a:8406:b0:205:d3f8:5241 with SMTP id j6-20020a17090a840600b00205d3f85241mr104958149pjn.188.1670489225229; Thu, 08 Dec 2022 00:47:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670489225; cv=none; d=google.com; s=arc-20160816; b=n0clgXddgsCzJzA6+69iID99uXUa/mAJoJsd39MJgXinGLK+hL1845DJ09bVu3yyvc l7rN4gOriFwHdvVApGjnkIIzhUjb8D1RiNg7F0K2AOkkuSghrJSs9wreUTZM7awLrX1G 0diiGbTibK5kTkDW++4682oI9A2tdA3FhXNJIVCFGgq/3k7er5tZYJnK3qYJSR5/rnSS +OvkD7sGckGnPfXCswyfPRzQWtuHoFrdscxqKzJe681/d6hvrBqJrWoCNkZiZmVnJ4zK LVGx4fPKcygMtzW+QjMuMnTC5mBrwTIyL/hnFNgP8yrlU1Np7yHJ/yemGQMkMFJpdm+S DkhA== 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=ClbInW40T+avacUrRlVmRvYMm7NiPErCXnoT+cU7efk=; b=BSxGPC520K5ZFusxS7l5oYb1asI3infy2RX/YmZAVhUbh/BP4eGJUrqXbY6cPDaZmA JbixBQg9okUNJlydl1Yjo0ZNRZ8hkPdz0RGAvJO5N077bITWNoa54i3iWa+6ew63yxcg YlSXRDDbxALjdKu0r6KodqiUygtu9DfGz2BTYpopxEaeVhmaNoBrKrcaFgRSyQOXrZVi 7/A0Cu8qsetxcn3KMtLtOvacAZq92IipuaDecMnjYOdPL2j7D1qtaJe4TQznwSliJkDI nkJk6ZuTW4TkkbY66nUWzcsystl0kkZXs8dAjTHOt1Bts+qEnG+FCmR6DL1hVbBBmFCq v3aQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b12-20020a630c0c000000b00422c003b4c9si23258255pgl.46.2022.12.08.00.46.50; Thu, 08 Dec 2022 00:47:05 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229873AbiLHIpx (ORCPT + 99 others); Thu, 8 Dec 2022 03:45:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230004AbiLHIpN (ORCPT ); Thu, 8 Dec 2022 03:45:13 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 892A5686B0; Thu, 8 Dec 2022 00:45:06 -0800 (PST) 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 1DC25D6E; Thu, 8 Dec 2022 00:45:13 -0800 (PST) Received: from a077893.blr.arm.com (unknown [10.162.40.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5365F3F73D; Thu, 8 Dec 2022 00:45:01 -0800 (PST) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com Cc: Anshuman Khandual , Catalin Marinas , Will Deacon , Mark Brown , James Clark , Rob Herring , Marc Zyngier , Suzuki Poulose , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , linux-perf-users@vger.kernel.org Subject: [PATCH V6 7/7] drivers: perf: arm_pmu: Enable branch stack sampling event Date: Thu, 8 Dec 2022 14:14:02 +0530 Message-Id: <20221208084402.863310-8-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221208084402.863310-1-anshuman.khandual@arm.com> References: <20221208084402.863310-1-anshuman.khandual@arm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751634909358743644?= X-GMAIL-MSGID: =?utf-8?q?1751634909358743644?= Now that all the required pieces are already in place, just enable the perf branch stack sampling event on supported platforms, removing the gate which blocks it unconditionally in armpmu_event_init(). Instead a quick probe can be initiated first via arm_pmu_branch_stack_supported(). Cc: Catalin Marinas Cc: Mark Rutland Cc: Will Deacon Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Anshuman Khandual Tested-by: James Clark --- drivers/perf/arm_pmu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index 66880a4bb248..52a93b9bcbda 100644 --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c @@ -510,8 +510,7 @@ static int armpmu_event_init(struct perf_event *event) !cpumask_test_cpu(event->cpu, &armpmu->supported_cpus)) return -ENOENT; - /* does not support taken branch sampling */ - if (has_branch_stack(event)) + if (has_branch_stack(event) && !arm_pmu_branch_stack_supported(armpmu)) return -EOPNOTSUPP; if (armpmu->map_event(event) == -ENOENT)