From patchwork Wed May 31 04:04:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 101220 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2630184vqr; Tue, 30 May 2023 21:26:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6TXr8U87kLxbNWAg7swRC7efk/TdI+LQM5gftsI3WqpFMxW2pha/6FVQzGh6AyOQPufx70 X-Received: by 2002:a17:903:2450:b0:1af:ac49:e048 with SMTP id l16-20020a170903245000b001afac49e048mr4630471pls.25.1685507176497; Tue, 30 May 2023 21:26:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685507176; cv=none; d=google.com; s=arc-20160816; b=TkVELS2x9PxhNx8usqwi0Nw5spVN4YWDMcyV30YR293YMMTocyzGbAHnLNrhrgsbFz J7Ejsf6exthnvATAwWKy7QcFN7csD9sh9R19gc6BYUCViKj4nW46UFhU6pGl/d2KhhWa 0hoNZqgnGCccgoZjp5Jq3iVFQY3FSEbODkeWoQbrveI8pInEr2aWJFtThzHMsaR4ImYw 00/hFyjye0s35jRPQ6avAwqzODgA226U2Fbw8DmerVj/fWUsonmGWcuDEK8Khvw+KRoB xAuQK08rS2BMpmc6UgnjwWwpOvjomHNPErOqlJiPA0p/Cf+xPc6HbejHx3gTUQi+Ad8r wXVg== 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=Ywjsl8KNCiO/ijMrpusMohOs5baNdn6nwSqUjMhOk1Y=; b=D8YHJScgCcMvy16Ei+dh0WYHBLPN7HLJZoM3w/qOGgVwaWpE00G/1tjSu61utfBccg Vl3WCLbXVDDR9lv9d/S6ojsp+h1EkXG2jNYJNyS/qs8W3qUEnvUOdUrTIS4pG0So+n9V XRcFCpbGF6DkeLAIg647fYCVxjzdIOD8Hxz4fNtWxg57Xb3eRaE5Bule2qkHLO33YcYu Tkg+jkayo9EPYFBLzH7W0AYgfV9jmq1Bn7zYZN8oCvU2Hv/oGqhHjZnA7S5rLynXISfZ s7CwQ7vhvIe2CIeLDN1xPWo1TVi82ImmDEetpFu3e8z1r0vYdDaZvSxagTvH/1kAVyYe zsZQ== 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 1-20020a170902ee4100b001b0395e10ebsi196275plo.377.2023.05.30.21.26.03; Tue, 30 May 2023 21:26:16 -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; 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 S234235AbjEaEF6 (ORCPT + 99 others); Wed, 31 May 2023 00:05:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234232AbjEaEFc (ORCPT ); Wed, 31 May 2023 00:05:32 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 81175E44; Tue, 30 May 2023 21:05:20 -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 6939015BF; Tue, 30 May 2023 21:06:05 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.73.163]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DDE783F6C4; Tue, 30 May 2023 21:05:14 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com Cc: Anshuman Khandual , 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 V11 04/10] arm64/perf: Add branch stack support in struct pmu_hw_events Date: Wed, 31 May 2023 09:34:22 +0530 Message-Id: <20230531040428.501523-5-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230531040428.501523-1-anshuman.khandual@arm.com> References: <20230531040428.501523-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,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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767382373210615024?= X-GMAIL-MSGID: =?utf-8?q?1767382373210615024?= 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 Tested-by: James Clark Signed-off-by: Anshuman Khandual Acked-by: Mark Rutland --- 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 0da745eaf426..694b241e456c 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 {