From patchwork Thu Dec 8 08:43:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 31216 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp77790wrr; Thu, 8 Dec 2022 00:46:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf6m08kFe8MvGPCqiN8dlengg+JhHA/Ag08Bnv9Ey+5LWviEcu2J6/vFl35hJZi+f4BFR8VR X-Received: by 2002:a17:902:e8d5:b0:186:a636:b135 with SMTP id v21-20020a170902e8d500b00186a636b135mr89111477plg.93.1670489167602; Thu, 08 Dec 2022 00:46:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670489167; cv=none; d=google.com; s=arc-20160816; b=Evp21YJqEnZPwXMK2zmmQ6ytSjudGs52uFMHNYZNbVyueaEa81z4863GGHOXq/cNHn FXX4Wyboi5Xl5m56xuqCzjaHbZc3ZtDSH1xuv5EQe2xk8Y0aS+gRL40Tw6vUtoaq4cEf SadRnOHw7yGTawsow4WfjA/plEv8qsMxXHP4rYcfb/aT46yRIMlS8XRVavXXLWGB/5h1 gilNhY24qF0PMvELsQHP4gVWMTDowQPzcY88P0OZGEZTFBe+w4lWOzhQ3up92kSqEmzM kC9yzCXqJKK2wrDdeJEFTZgQx0MSHVxptfuWVpVbukbhSKya+bnsdFyJb4tE6hnCGpcz Mi8g== 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=X5ZUrzXpOrtKoGkQgqD+hhSAeqhgtwrD1wN2KIPZa9Q=; b=k1/tTSDCSeONSifqxk3Q14wAjPpY4GcB+aoT86+IziQDFlrHEBiDbS52jgMy9xb/hL q8veaDDFo+WlON6SUBd/4fEn+5lyUPd1CImLmh3JNeZveqSgO5LM60vmrL7aNOzELuVY cIyx1pesfqnZyqPVsf+UV4f8N+9FcW6yxxZpewkGwyYKSmMrF3Rpg255AoNaEyBPOncO aaEBVZTGRBf0cfO92cNLtk/tnDV1gRwlnSr7AK6jFXTUoW4ZSb73nGqeOVVyyikOyeUD uqRh5q816PPvR0M+ew4qNrt3gBit6BayI/hyKIx2EGcPVVtK/OC7rPrKpf+vBbnSCExk Y42Q== 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 q4-20020a63f944000000b00476837b4138si18130643pgk.800.2022.12.08.00.45.54; Thu, 08 Dec 2022 00:46:07 -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 S230033AbiLHIpQ (ORCPT + 99 others); Thu, 8 Dec 2022 03:45:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230014AbiLHIou (ORCPT ); Thu, 8 Dec 2022 03:44:50 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4914026553; Thu, 8 Dec 2022 00:44:49 -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 C825523A; Thu, 8 Dec 2022 00:44:55 -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 E3CDA3F73D; Thu, 8 Dec 2022 00:44:43 -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 4/7] arm64/perf: Add branch stack support in struct pmu_hw_events Date: Thu, 8 Dec 2022 14:13:59 +0530 Message-Id: <20221208084402.863310-5-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?1751634849172352197?= X-GMAIL-MSGID: =?utf-8?q?1751634849172352197?= This adds branch records buffer pointer in 'struct pmu_hw_events' which can be used to capture branch records during PMU interrupt. This percpu pointer here needs to be allocated first before usage. Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- include/linux/perf/arm_pmu.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index 8c4f42189904..871289fe4774 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h @@ -44,6 +44,13 @@ static_assert((PERF_EVENT_FLAG_ARCH & ARMPMU_EVT_47BIT) == ARMPMU_EVT_47BIT); }, \ } +#define MAX_BRANCH_RECORDS 64 + +struct branch_records { + struct perf_branch_stack branch_stack; + struct perf_branch_entry branch_entries[MAX_BRANCH_RECORDS]; +}; + /* The events for a given PMU register set. */ struct pmu_hw_events { /* @@ -70,6 +77,8 @@ struct pmu_hw_events { struct arm_pmu *percpu_pmu; int irq; + + struct branch_records *branches; }; enum armpmu_attr_groups {