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 1C0FEEB64D8 for ; Thu, 22 Jun 2023 02:08:08 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yLj22Yyy3fx/v97HlNi3BfLslJEzwjei6bQhh8r1n90=; b=bsAO09gOt6Nqd5 JIUWTyT3tUz+z0EF06oXg89me+/5SehTBQfap6PmcUfa1U6m97vKsMloJ1lLIDyRIXgiEJz+QoRpH bWJHSJOg9ySXajEEF22/A8w6LvEUULDKZ0+7EtVuMSydozzDY2V3Pie4qKz43WuM0ySlugTVwYpT+ 182S901iVYSPl6PRDA5fLpmznOPPCh/TeIslTEYCaw/BEj8vHAQ0Ooz95NjOb5Yldo+Bh7G+2pWw4 JTNxXarv7ot+QLs9eaRN+F8Jo/fLGBdzS+wmYrILSo07msX5bzwHkQGLCmSQ2xF4MHbcechs/7JlI /VBkSaUG4AyBjup5PgXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qC9jg-00GW1m-2q; Thu, 22 Jun 2023 02:07:48 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qC9jd-00GW0e-35 for linux-arm-kernel@lists.infradead.org; Thu, 22 Jun 2023 02:07:47 +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 694EE1063; Wed, 21 Jun 2023 19:08:26 -0700 (PDT) Received: from [10.162.40.20] (unknown [10.162.40.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 356A33F64C; Wed, 21 Jun 2023 19:07:37 -0700 (PDT) Message-ID: <4dc97e9f-e103-9120-373d-8f4f472e8332@arm.com> Date: Thu, 22 Jun 2023 07:37:35 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH V12 08/10] arm64/perf: Add struct brbe_regset helper functions Content-Language: en-US To: Mark Rutland 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 References: <20230615133239.442736-1-anshuman.khandual@arm.com> <20230615133239.442736-9-anshuman.khandual@arm.com> From: Anshuman Khandual In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_190746_095109_E9C7DC34 X-CRM114-Status: GOOD ( 26.59 ) 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 6/21/23 18:45, Mark Rutland wrote: > Hi Anshuman, > > Thanks, this is looking much better; I just a have a couple of minor comments. > > With those fixed up: > > Acked-by: Mark Rutland > > Mark. > > On Thu, Jun 15, 2023 at 07:02:37PM +0530, Anshuman Khandual wrote: >> The primary abstraction level for fetching branch records from BRBE HW has >> been changed as 'struct brbe_regset', which contains storage for all three >> BRBE registers i.e BRBSRC, BRBTGT, BRBINF. Whether branch record processing >> happens in the task sched out path, or in the PMU IRQ handling path, these >> registers need to be extracted from the HW. Afterwards both live and stored >> sets need to be stitched together to create final branch records set. This >> adds required helper functions for such operations. >> >> Cc: Catalin Marinas >> Cc: Will Deacon >> Cc: Mark Rutland >> Cc: linux-arm-kernel@lists.infradead.org >> Cc: linux-kernel@vger.kernel.org >> Tested-by: James Clark >> Signed-off-by: Anshuman Khandual >> --- >> drivers/perf/arm_brbe.c | 127 ++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 127 insertions(+) >> >> diff --git a/drivers/perf/arm_brbe.c b/drivers/perf/arm_brbe.c >> index 4729cb49282b..f6693699fade 100644 >> --- a/drivers/perf/arm_brbe.c >> +++ b/drivers/perf/arm_brbe.c >> @@ -44,6 +44,133 @@ static void select_brbe_bank(int bank) >> isb(); >> } >> >> +static bool __read_brbe_regset(struct brbe_regset *entry, int idx) >> +{ >> + entry->brbinf = get_brbinf_reg(idx); >> + >> + /* >> + * There are no valid entries anymore on the buffer. >> + * Abort the branch record processing to save some >> + * cycles and also reduce the capture/process load >> + * for the user space as well. >> + */ > > This comment refers to the process of handling multiple entries, though it's > only handling one entry, and I don't think we need to mention saving cycles here. > > Could we please delete this comment entirely? The comment above > capture_brbe_regset() already explains that we read until the first invalid > entry. Sure, will drop the comment. > >> + if (brbe_invalid(entry->brbinf)) >> + return false; >> + >> + entry->brbsrc = get_brbsrc_reg(idx); >> + entry->brbtgt = get_brbtgt_reg(idx); >> + return true; >> +} >> + >> +/* >> + * This scans over BRBE register banks and captures individual branch records >> + * [BRBSRC, BRBTGT, BRBINF] into a pre-allocated 'struct brbe_regset' buffer, >> + * until an invalid one gets encountered. The caller for this function needs >> + * to ensure BRBE is an appropriate state before the records can be captured. >> + */ > > Could we simplify this to: > > /* > * Read all BRBE entries in HW until the first invalid entry. > * > * The caller must ensure that the BRBE is not concurrently modifying these > * entries. > */ Okay, will change the comment as suggested. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel