From patchwork Wed May 17 02:24:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 95008 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp839491vqo; Tue, 16 May 2023 19:56:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7C9PFvRKQkdaoG898WtDdvjfQji+5ozC7cLxZfFRcdIrYukACJ1dVteYgXaeWVKD0Pee/m X-Received: by 2002:a05:6a20:5488:b0:100:fc8d:feaf with SMTP id i8-20020a056a20548800b00100fc8dfeafmr43628953pzk.21.1684292169803; Tue, 16 May 2023 19:56:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684292169; cv=none; d=google.com; s=arc-20160816; b=npd68qhBUM9B5bBo6igufgI+kgMiXiYwoWKebmso47W8JNpJwbmeRnB5FmWxVdWuFp /Go9TBNPGhBgus9pnsZHN3AqXnL1GhiqQgYpANEDW2acSbY2k67nX1BZmAXfVAaj+hSG TFXp2ChF74WID8fW3qwi1nVn0uy4NcSAOYFZefZGBfhZwfaL/LVvTlOlCqSforks8oOb yxgj5YrhZ/P++sAwRc0p/FYgeh3LkYk0tx6aOc96wy1HZK90OQ+Lo8cqQxK/cQ9949ls KnSt39FJyFORed5qpRLIX4W/j3PKJWkfTU82RHPt52d8YOQLrts2qdTytN2MmVeRC9Nc luKw== 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=jd1CClrkuyTwmPY/mXbnZOlXelB1bE9jdEQDQdFyXYE=; b=Yl3+5cZLTPCb3gXZaVhnHaBwhpQ8gbNmwu9Dvjku6qmAjnV0/gxDTyrFP5bAoHlLo8 65UHQIhgwRil7ir/fw2y2PENirhK3tjyp9JB73eSqlBOEO25/mBGhnTtJbD79okVjlB1 oQbDmM3OKJR4kM5hZi1TQZWOHHVNeRPWLSitn3EVe+VBzjBkia/kpj8kks08jfB3BJ/1 Y0AqzyBFvpfDiQjHpDjAJ/WWMjlXLFG/Tb/VGxyTAuGMD7BOj2BEOWWCwm781QVSmSfN sl42WG3evzhyQRNSeR2n3ikioNBV+caojrKaKyEFOtqrTrzk2HCpzf3L5Ki+1Gb2ouf/ z7FQ== 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 l71-20020a63914a000000b005308b2910c5si14116311pge.338.2023.05.16.19.55.57; Tue, 16 May 2023 19:56:09 -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 S232005AbjEQCZG (ORCPT + 99 others); Tue, 16 May 2023 22:25:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231966AbjEQCY5 (ORCPT ); Tue, 16 May 2023 22:24:57 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8CD3D1FD4; Tue, 16 May 2023 19:24:45 -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 191CA1FB; Tue, 16 May 2023 19:25:30 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.70.237]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 19CF03F793; Tue, 16 May 2023 19:24:39 -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 V10 04/10] arm64/perf: Add branch stack support in struct pmu_hw_events Date: Wed, 17 May 2023 07:54:04 +0530 Message-Id: <20230517022410.722287-5-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230517022410.722287-1-anshuman.khandual@arm.com> References: <20230517022410.722287-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?1766108346454621297?= X-GMAIL-MSGID: =?utf-8?q?1766108346454621297?= 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 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 {