Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1770578rwb; Thu, 29 Sep 2022 01:54:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5XMoB3bOx+J5n2b4h5d8Zd44Z0EINAorqV+dlf9G4aX2+gyMEADVC7CKX9tg1VRx3zg/ma X-Received: by 2002:a17:907:d08:b0:72f:b107:c07a with SMTP id gn8-20020a1709070d0800b0072fb107c07amr1812579ejc.340.1664441653470; Thu, 29 Sep 2022 01:54:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664441653; cv=none; d=google.com; s=arc-20160816; b=doGZvCLz3VBm06lxRvExiVVpJiSvlzCyPEsvCf/lSVcioox5GR/+K9DMybI0Fvcmy2 PS0MglHAiOma8v61mfgZArn3CSyh88K+bJSe5VniZrf72FAjPze0d4EhKHykErk/d8XL UZQ8Q/MryooM9XvAMICNVYdD8DYXMSMHaWh4dkZRPx/Es2o7W8/8K9k+Nky8v0Bv+JAj 8txFBivs3ez4omudBrGIbxO9ICJPVKLAF68Lz2ZnyY7uPoO4ZEmcUze5A1XHuAxWEhK5 MjMzDNu6TMW4uZSWgoByNcuZ2YdfWTURUM8GYvRyKhlWvDzXNOy1QucQJ6s+rw+4G67W sQaw== 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=4fhKZMlURwN67MwWj6Wdiq/FgIyYEgBZ4ThuA9cc0DY=; b=XgKJSZJ0brBnRFUap+u5AVFXQg6YJLSfeSWH/oS1SSmwIgK3/SSN1tjJ/6xFHSwV7j bACtsEsLUMYgdnaB++Fdyv3ZU6V3+xyExxKxz3gKf5SN7hqV6SgfuGhWsU3RmGuDM0fF VDad5vryAtE0D3IDrH2vtH4XdPJWqmtinNoUyJcnuZAXfV0BFeVtccqt8Tw30oGLkAxQ jqEXpyuB8dG+WCZRSgz/TEOuQ0Kn7D/8/fTjEToev1uMqe5m/XFRfpIgUgb282P5LMfg LTVbXR59PnDmsq2yFAzVI3yzsf2wl3oIN8UyJl/iR5ZmBnj+GYVQQY1iYYodnkBC6z9H hrmQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hq8-20020a1709073f0800b00782627f37d6si8674617ejc.778.2022.09.29.01.53.47; Thu, 29 Sep 2022 01:54:13 -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 S235250AbiI2H7c (ORCPT + 99 others); Thu, 29 Sep 2022 03:59:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235185AbiI2H7X (ORCPT ); Thu, 29 Sep 2022 03:59:23 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F171213AF3D; Thu, 29 Sep 2022 00:59:20 -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 B9C48139F; Thu, 29 Sep 2022 00:59:26 -0700 (PDT) Received: from a077893.blr.arm.com (unknown [10.162.42.7]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 47CC73F73D; Thu, 29 Sep 2022 00:59:16 -0700 (PDT) From: Anshuman Khandual To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-arm-kernel@lists.infradead.org, peterz@infradead.org, acme@kernel.org, mark.rutland@arm.com, will@kernel.org, catalin.marinas@arm.com Cc: Anshuman Khandual Subject: [PATCH V3 3/7] arm64/perf: Update struct pmu_hw_events for BRBE Date: Thu, 29 Sep 2022 13:28:53 +0530 Message-Id: <20220929075857.158358-4-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220929075857.158358-1-anshuman.khandual@arm.com> References: <20220929075857.158358-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: X-Mailing-List: linux-kernel@vger.kernel.org A single perf event instance BRBE related contexts and data will be tracked in struct pmu_hw_events. Hence update the structure to accommodate required details related to BRBE. Cc: Will Deacon Cc: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- drivers/perf/arm_pmu.c | 1 + include/linux/perf/arm_pmu.h | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index 59d3980b8ca2..16fda9a1229f 100644 --- a/drivers/perf/arm_pmu.c +++ b/drivers/perf/arm_pmu.c @@ -905,6 +905,7 @@ static struct arm_pmu *__armpmu_alloc(gfp_t flags) events = per_cpu_ptr(pmu->hw_events, cpu); raw_spin_lock_init(&events->pmu_lock); + events->branches = kmalloc(sizeof(struct brbe_records), flags); events->percpu_pmu = pmu; } diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h index 3d427ac0ca45..ffce43ceb670 100644 --- a/include/linux/perf/arm_pmu.h +++ b/include/linux/perf/arm_pmu.h @@ -43,6 +43,16 @@ }, \ } +/* + * Maximum branch records in BRBE + */ +#define BRBE_MAX_ENTRIES 64 + +struct brbe_records { + struct perf_branch_stack brbe_stack; + struct perf_branch_entry brbe_entries[BRBE_MAX_ENTRIES]; +}; + /* The events for a given PMU register set. */ struct pmu_hw_events { /* @@ -69,6 +79,22 @@ struct pmu_hw_events { struct arm_pmu *percpu_pmu; int irq; + + /* Detected BRBE attributes */ + bool v1p1; + int brbe_cc; + int brbe_nr; + + /* Evaluated BRBE configuration */ + u64 brbfcr; + u64 brbcr; + + /* Tracked BRBE context */ + unsigned int brbe_users; + void *brbe_context; + + /* Captured BRBE buffer - copied as is into perf_sample_data */ + struct brbe_records *branches; }; enum armpmu_attr_groups { -- 2.25.1