From patchwork Thu Jan 5 03:10:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 39288 Return-Path: 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 + 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 ); 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 ; 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 To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mark.rutland@arm.com Cc: Anshuman Khandual , Catalin Marinas , Will Deacon 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 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?1754150660991998600?= X-GMAIL-MSGID: =?utf-8?q?1754150660991998600?= 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 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 {