Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp10479409rwd; Thu, 22 Jun 2023 00:03:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7C/oiHdvIlgfIfMNSzlATiFV8W3Le15odw0pcS2BvvPeeAKAyXocooefXaX1XFqBy/Bo5C X-Received: by 2002:a17:90a:bf07:b0:25e:a3ec:1cf5 with SMTP id c7-20020a17090abf0700b0025ea3ec1cf5mr15250043pjs.35.1687417402869; Thu, 22 Jun 2023 00:03:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687417402; cv=none; d=google.com; s=arc-20160816; b=c0+xzHNiAmL1Xma43C/mKAtBtBH/p7DITkP0H/mgEL/BRaQ9J9xHb3Et+mkjU6LeEJ 01lM9PZk9g3EF2YQeGyAgqa19bkfKerZEKoxavbOI9ho9GkIe75ABfQGssnb6ZJCjPh9 rCCV4n3EcZ1QCCuG1v3siwN9gmh2V985dTSJMiYZxfy9pFNUwO623ASz4d+JCGTqFuz/ ega5wLPCWh75SNoaICvS9rZrMMELS47B9ILiaFwTlKjoLupWNlO0vqVB4CzuHm83K9HI w+dUhZsI+Lcg5tT+h4KM0wJHX3reaPO0jkskZuO+aDoxusSrWINkze8QFzdeRQBHYh4o molg== 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=UZBzrKPz3UetWBM2gtQtmtJcvH/DdtOcjOkkJKNq/cM=; b=dHQKJMM9a/hVkk2mW4FsK6os110vqIgk2Sd8K62pSns+XoApckOJ7ZyH21bnkx0cCE NlFb7arJzJp0wyRVjGI8kkB/5b04dABcY3562OGwSweMfnFvyFyuY/Vmg1dsFwaLLMQ7 2B3xJ5ASlJPmWRqp726/w4VvCyUJB+2P20csy06vZ6Wv5ez54fRj7onBUMZNvL8BlAJz 5MoUzab6JrbDEojB+vtdnLnW6iP+L14ICNeTQNCF59Y1ArTRpSx8vcJGthFugklwFWOF /MH+Xo17kXP0TqYl0M/kn5qb4ejUO+a0Fy3KpIth8EML3bIksWIrSZghaCyVzAC65MhG Uqhw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rj3-20020a17090b3e8300b0025ef1357d96si6650734pjb.67.2023.06.22.00.03.11; Thu, 22 Jun 2023 00:03:22 -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 S230244AbjFVGyp (ORCPT + 99 others); Thu, 22 Jun 2023 02:54:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230404AbjFVGyc (ORCPT ); Thu, 22 Jun 2023 02:54:32 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8234019BE; Wed, 21 Jun 2023 23:54:29 -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 390B81042; Wed, 21 Jun 2023 23:55:13 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.40.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 613D43F59C; Wed, 21 Jun 2023 23:54:24 -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 V13 04/10] arm64/perf: Add branch stack support in struct pmu_hw_events Date: Thu, 22 Jun 2023 12:23:45 +0530 Message-Id: <20230622065351.1092893-5-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230622065351.1092893-1-anshuman.khandual@arm.com> References: <20230622065351.1092893-1-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 Acked-by: Mark Rutland 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 ba4204bdcebf..a9c6d395aad7 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 { -- 2.25.1