Message ID | 20230105031039.207972-5-anshuman.khandual@arm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp94338wrt; Wed, 4 Jan 2023 19:13:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXtfK5EH72wxV/Fsij8WROxWp745AdH1ucO7j/z3k7vsJ+5BUaj/Q8cijX1DYG6D8kMo7SCK X-Received: by 2002:a05:6a20:2d23:b0:b2:6a7a:6072 with SMTP id g35-20020a056a202d2300b000b26a7a6072mr58744806pzl.14.1672888432626; Wed, 04 Jan 2023 19:13:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672888432; cv=none; d=google.com; s=arc-20160816; b=txuVZ0dpMXsoXtj4msFQLGPrw2ox+CQoOvjmqkoGHd60i5J3jdyxBabNpKBnLftXL4 x+r3vsMU1LKPjp4bHD02kO941QkX56MpSFGpZPUZhOXIEa+FEDvHKGk3A3ZVYPKb9Syc 1AhtAK1528hAl6kLitHvbamKNSC9zGvFI7O/Baw+Xh558o28zdAAwuD9BTV1Xo21JJxp lZimi0xdruZ3pgVArYh2BOBlr5sQglboZ66d/j5k32F68yOOZ1xgVoBhPdUOe8u2CgL1 KgCSe4Tba11V/4YeAZ20Dk0NoWGpSCNhM8vsOS2s1vijmwFXGi3/wqDyz0scKwgCH75P c1eA== 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=j27pY/ZDXvD1a6r2/4m4G60BTUxIKEFLeD9AgbSpsDs=; b=wYPTDFYVPumJBBTd0po5YxzHruOLPIcsF01FMLaLhdbqhAOwzeDCGJPbyYhHcEriyZ wFgYp4yGjw7VGM+Xq5o934OyWdcSixqtfXOg7xrR/f6ERErDJlH0ObiinJkhBESBH9zu 0OU0CD67W0bgINlo8vd5qYe5UQg9o3Hpi+aEhOH/S25LNeKy7yiwlTZb+TpyfBb3SY8w mWBdIuOq+GVD2REMScM0C8gHHYfuzpxZgCAxd3OFy4RnzX+IUY8YHDTmJm7Pp4NxGlNl FaTdEMfjMzTk2IETddgPacyQQRnvOJgvIbc8bDso8AG/6Q2q0L1ZDOgWwLqdFtDslegI WoPw== 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 bk13-20020a056a02028d00b004a173aaa720si12742896pgb.62.2023.01.04.19.13.39; Wed, 04 Jan 2023 19:13:52 -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 S229793AbjAEDLR (ORCPT <rfc822;tmhikaru@gmail.com> + 99 others); Wed, 4 Jan 2023 22:11:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229979AbjAEDLG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 4 Jan 2023 22:11:06 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8705843A3B for <linux-kernel@vger.kernel.org>; Wed, 4 Jan 2023 19:11:05 -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 1659216F2; Wed, 4 Jan 2023 19:11:47 -0800 (PST) Received: from a077893.blr.arm.com (unknown [10.162.43.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id EF7273F663; Wed, 4 Jan 2023 19:11:02 -0800 (PST) From: Anshuman Khandual <anshuman.khandual@arm.com> To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com Cc: Anshuman Khandual <anshuman.khandual@arm.com>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org> Subject: [PATCH V7 4/6] arm64/perf: Add branch stack support in struct pmu_hw_events Date: Thu, 5 Jan 2023 08:40:37 +0530 Message-Id: <20230105031039.207972-5-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230105031039.207972-1-anshuman.khandual@arm.com> References: <20230105031039.207972-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 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754150660991998600?= X-GMAIL-MSGID: =?utf-8?q?1754150660991998600?= |
Series |
arm64/perf: Enable branch stack sampling
|
|
Commit Message
Anshuman Khandual
Jan. 5, 2023, 3:10 a.m. UTC
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 <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
include/linux/perf/arm_pmu.h | 9 +++++++++
1 file changed, 9 insertions(+)
Comments
On Thu, Jan 05, 2023 at 08:40:37AM +0530, Anshuman Khandual wrote: > 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 <catalin.marinas@arm.com> > Cc: Will Deacon <will@kernel.org> > Cc: Mark Rutland <mark.rutland@arm.com> > Cc: linux-arm-kernel@lists.infradead.org > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> This looks fine, but it's difficult to review this without seeing how its lifetime is managed, and it feels like this should be folded into a subsequent patch which manages that. Thanks, Mark. > --- > 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 64e1b2594025..9184f9b33740 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 >
diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index 64e1b2594025..9184f9b33740 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 {