From patchwork Mon Jan 23 12:59:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 47138 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1593977wrn; Mon, 23 Jan 2023 05:01:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXt7iOumcO73YYXXgFT2fRoF219Jz/4gIoYnB//YG4fCWcLdm1l8EI+dd9foS2hU2owj4Kxq X-Received: by 2002:aa7:9003:0:b0:58b:c873:54e4 with SMTP id m3-20020aa79003000000b0058bc87354e4mr23409223pfo.34.1674478884225; Mon, 23 Jan 2023 05:01:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674478884; cv=none; d=google.com; s=arc-20160816; b=f+b6wsB+5pwGV3AEjTR58vewSpfiwauGY5URi7FSyD0sk9QD9Lsaf/AuHsRe8c++1F oSua+a87nbUfECD10UpfP78pMNcHfhd+pnU4uDqpvtneitfHrF4gIwb6JBoIsEqHVMft 5WC/MupQZBi8YmYUxag9qtL/+ib5LvbT0F4IlI/3MEbbv8xjq9OdAwGEpfp6BILTrSwi DCgN2yDfTXflcWkaDr7zVHhlVW9uk4iICf3xB6vIfUCyXtisRLAPZoODTJSYbUqVQieF YW9jGHajQSWjdTu1ZmfHkFU8AmgnQq9TLhiWSieyxtrquREW7vy9kjH0tqY/l+vK54i5 MhCQ== 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=7JrK3LTPRnfYhqGzAzK3FROuv+AxnvdyFMcZAppx3z4=; b=fsNXZldPCV7XRr29gGGpI20ir7D18vbiePH+8+xfdX36oclA9vvtE9f5c7hJH5a5hG 5b267yA0YdbOfx1QD7mOBrXS/YsXPzk7o6OZMbem3A2A3YM3PdHLqTAbYidmr4mfAwzQ x1nsC5ZIqmJmj3MtZIhSMWcyAvOe2h0LWCrGjmV1SKzCmP+G08ChpzacUNYOBOYEr1Km munCZFfFt7KgLznLWUv9V5U4aiF7peGYWNFZcyzjb+NWEwmc1ArQ51JQK9kSu/9rrgQA xUfdBcCx+AVdyXP0gxpjfOg0Nz8ufj/zcwZEhLKjg6JS5F9Hl4jaz2w8ct4FrsNWVPHC YZEg== 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 v27-20020aa799db000000b0058bb792cdeesi31596565pfi.317.2023.01.23.05.01.10; Mon, 23 Jan 2023 05:01:24 -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 S232041AbjAWNAv (ORCPT + 99 others); Mon, 23 Jan 2023 08:00:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232068AbjAWNAn (ORCPT ); Mon, 23 Jan 2023 08:00:43 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D8055241DC; Mon, 23 Jan 2023 05:00:33 -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 5D65F143D; Mon, 23 Jan 2023 05:01:15 -0800 (PST) Received: from a077893.arm.com (unknown [10.163.50.146]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 14F033F64C; Mon, 23 Jan 2023 05:00:28 -0800 (PST) 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 V8 4/6] arm64/perf: Add branch stack support in struct pmu_hw_events Date: Mon, 23 Jan 2023 18:29:54 +0530 Message-Id: <20230123125956.1350336-5-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123125956.1350336-1-anshuman.khandual@arm.com> References: <20230123125956.1350336-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?1755818370354364625?= X-GMAIL-MSGID: =?utf-8?q?1755818370354364625?= 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 78cb1c895ab9..bd6dc6d0bd44 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 {