From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9073EC25B74 for ; Tue, 21 May 2024 13:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SV6DAJ0uJiN2a4afEcetAwAgoGvmWTiY7BmqxucHnQ0=; b=2BiahEqUCR/7do z0mHt7jBt7E2WtQ9LhreDhKXzxpm2evFKH8RWk9Xqy94IEqO2MV6wjeD9A3xJx/X8FCtjwkSmVdA2 e0RUmmGqFQTpFN3hwe4+YOkvEiV6IIjHHUCupMxrMppMtyGwldoCu6jIvoPEnLShVrHseKWT2Sv5+ ezUiu/PxjKEiIxToc4oi2Dtp+ku5fMCREzmchHtpEKTeeOHHWCZuLZwK8HipH54+6cqSP3caJ7jvC uUAefx0lD6P+ClaDPNM3HDOwiQWCUwy+xw44qYBidqWWZPdwrTFuSDGABKl6stgQvBg3Uv+ra38rt zIEva+/WqnGvnAQeEUAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9PnY-000000002WK-2MCA; Tue, 21 May 2024 13:45:00 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s9PnV-000000002VG-2NBl for linux-arm-kernel@lists.infradead.org; Tue, 21 May 2024 13:44:58 +0000 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 F2DACDA7; Tue, 21 May 2024 06:45:17 -0700 (PDT) Received: from J2N7QTR9R3 (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DB4663F641; Tue, 21 May 2024 06:44:51 -0700 (PDT) Date: Tue, 21 May 2024 14:44:49 +0100 From: Mark Rutland To: Anshuman Khandual Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, will@kernel.org, catalin.marinas@arm.com, 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: Re: [PATCH V17 3/9] drivers: perf: arm_pmu: Add infrastructure for branch stack sampling Message-ID: References: <20240405024639.1179064-1-anshuman.khandual@arm.com> <20240405024639.1179064-4-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240405024639.1179064-4-anshuman.khandual@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240521_064457_667473_9660C247 X-CRM114-Status: GOOD ( 25.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Apr 05, 2024 at 08:16:33AM +0530, Anshuman Khandual wrote: > In order to support the Branch Record Buffer Extension (BRBE), we need to > extend the arm_pmu framework with some basic infrastructure for the branch > stack sampling which arm_pmu drivers can opt-in using a new feature flag > called 'has_branch_stack'. Subsequent patches will use this to add support > for BRBE in the PMUv3 driver. Please, just use ther *exact* wording I asked for last time: | In order to support the Branch Record Buffer Extension (BRBE), we need to | extend the arm_pmu framework with some basic infrastructure for branch stack | sampling which arm_pmu drivers can opt-in to using. Subsequent patches will | use this to add support for BRBE in the PMUv3 driver. At this point in the commit message, the 'has_branch_stack' flag doesn't matter, and dropping the 'to' after 'opt-in' makes this painful to read. > Branch stack sampling support i.e capturing branch records during execution > in core perf, rides along with normal HW events being scheduled on the PMU. > This prepares ARMV8 PMU framework for branch stack support on relevant PMUs > with required HW implementation. Please delete this paragraph. > With BRBE, the hardware records branches into a hardware FIFO, which will > be sampled by software when perf events overflow. A task may be context- > switched an arbitrary number of times between overflows, and to avoid > losing samples we need to save the current records when a task is context- > switched out. To do these we'll need to use the pmu::sched_task() callback, > and we'll also need to allocate some per-task storage space via event flag > PERF_ATTACH_TASK_DATA. [...] > /* The events for a given PMU register set. */ > struct pmu_hw_events { > /* > @@ -66,6 +78,17 @@ struct pmu_hw_events { > struct arm_pmu *percpu_pmu; > > int irq; > + > + struct branch_records *branches; > + > + /* Active context for task events */ > + void *branch_context; > + > + /* Active events requesting branch records */ > + unsigned int branch_users; > + > + /* Active branch sample type filters */ > + unsigned long branch_sample_type; > }; At this point in the series I understand why we have the 'branches' and 'branch_users' fields, but the 'branch_context' and 'branch_sample_type' fields haven't been introduced and are not obvious. What exactly is branch_context, and why is that a 'void *' ? I can understand if that's a PMU-specific structure to track the active branch records, but if so I don't understand why 'branch_sample_type' isn't folded into that. Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel