From patchwork Wed Mar 15 05:14:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anshuman Khandual X-Patchwork-Id: 69988 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp2152970wrd; Tue, 14 Mar 2023 22:46:50 -0700 (PDT) X-Google-Smtp-Source: AK7set9/wTQs59BTGv3Tj84FhGtp+e9wk9rlIvYbOxO8nOgiMzFrDWuT5+prumqA80nZ2c8z1JBW X-Received: by 2002:a05:6a20:65a9:b0:d3:f695:1cd9 with SMTP id p41-20020a056a2065a900b000d3f6951cd9mr11417770pzh.58.1678859210005; Tue, 14 Mar 2023 22:46:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678859209; cv=none; d=google.com; s=arc-20160816; b=fLib8z/2RkVDN45nS/uDEStrFJeRuoq+8RCE6WFn7jiMLBlfFWa0UlATJwrBi1MbLZ zRVfwNzdfGQji23kECsF8ECXnJ4RHsyQka7FYDeygs5U9sF+cJ4jDRWW72TRFtk+7IQ5 sotFRBIo8dZQKTsCPCsOUILOYKRhMjuKcvKUg64YaIu/LQlP3NCysxnfhXmsfu468zg6 Knof3mnvZW9UvqYjIYcTidTvAGjU/aU9hzOQny+nX/ZqSzUkRfdtgwmk5iUyf9tqmyWl 71RceY6pZQE7E6rx1R4xrkAR7NcsmKrQ1fb8itNJDfK/xaOGKg0JpFbuv87o8nwfTvgg LVUA== 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=kM0JXH6lJ20xyZwW9BpIig/E7bw3xi9DbKzmFjDAG+CtIY4dopZNEQ8VZmMW9WHEYQ CKX8CunSZ/IYONPKkvtw/xVdt7urWgeJXVOOyupfs3o7/WC2iBAUAVC94J8O/AOFMQuh kpK1dbloEm8qfARUygPhA7sUd10fwFcGN8y5QjYd2mlJsfrAh59rlglPkraVYm1qGSuQ zkMUibXkmwjieY4cCVDFQXK/7K5lbf1bBwgJ6jLblQB4gHafYc5+ie+g3J62yIqc5Lgm PHyWtvPhNvnCzlXFcgb2KFIZkppqL01Z0PoV2Vr/oQBFiwfUT/aYghxwkkTnvMtULIaw KZfg== 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 t189-20020a635fc6000000b0050323873b64si4026121pgb.514.2023.03.14.22.46.34; Tue, 14 Mar 2023 22:46:49 -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 S231414AbjCOFTz (ORCPT + 99 others); Wed, 15 Mar 2023 01:19:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231384AbjCOFTe (ORCPT ); Wed, 15 Mar 2023 01:19:34 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2530962302; Tue, 14 Mar 2023 22:15:51 -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 00C0B4B3; Tue, 14 Mar 2023 22:16:02 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.41.10]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id BADF23F67D; Tue, 14 Mar 2023 22:15:13 -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 V9 04/10] arm64/perf: Add branch stack support in struct pmu_hw_events Date: Wed, 15 Mar 2023 10:44:38 +0530 Message-Id: <20230315051444.1683170-5-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230315051444.1683170-1-anshuman.khandual@arm.com> References: <20230315051444.1683170-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?1760411474769348044?= X-GMAIL-MSGID: =?utf-8?q?1760411474769348044?= 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 {