Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2049397rwd; Fri, 9 Jun 2023 06:06:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ66Mc5hAcL3Gd9btwmf6CASTKnIiknkkVqC5Z8MX7u2A/9V6Jf5qxL2vCV36Rcl5nBhF2jl X-Received: by 2002:a17:90b:3ec3:b0:253:38bf:9757 with SMTP id rm3-20020a17090b3ec300b0025338bf9757mr849507pjb.43.1686315987624; Fri, 09 Jun 2023 06:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686315987; cv=none; d=google.com; s=arc-20160816; b=dxGFpn7irDRwF2xdoGP4rnR5E5WBY+AcZH04ZyEWQFmYqb+4qKTlRvdhpiADNGePVo Ps+Vb7e5m5J98iGp1dwJtYBT9idTmuNuvX9j4e36vktXysrJWu36utoJr+jhnfHyni7C Lf+6UtLB53zeqTVgQO/7CsNe/fmk/ZMduddiwjFVOFm9edNV+VSLTD6nx9DjU/+lh+Nm 28Sis0C02pfgtlptiKDgEi+USipqhvx3SZG4nAi5mtRpDuOwuU5re1zNhcmFt7TEhYs3 CFsar8+rh1e9KRz9YBv7aRJHwhHGooEBjQzmZDR5F1L1TQlp6PojkuhMIUCFjbCO5861 13sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=2X9DoFmHTV8jXLtpF0Z/aH5tUZve6JzZ9amJAcJRWJc=; b=sbuhmb/vHquS/B9X/yqI98OrT3IYOdTd+3JhBLXoW3pEuxxcGAw4dXQqok3UMJdzZe GCshsWeWAI5+3qY0k6HVtrokwKDcXerylanbuSOhIM7vvdmKJIZKh2oWIuMRuG2rdefk 6qpW7btRzVeueygM8qAbuLE7w/zcQ0fFQayI1U0J2XX7Jakt4pVZueOG+2DXBh/LI43y ad5f7BObi/4A2vA1+qXP/YaCZ6HupklwrD3LQ06n+UwtrknpyIF08wSDuNzzyjNmiIso 6oteh2QjMnPFYlO6IHlIuokddUkMc2yMJfMtTHRrNPmz+rNwGBHeT8HUqYiN4wpgiLoe C6cg== 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 t13-20020a654b8d000000b00543d32f92ecsi2539800pgq.472.2023.06.09.06.05.48; Fri, 09 Jun 2023 06:06:27 -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 S240645AbjFIMmm (ORCPT + 99 others); Fri, 9 Jun 2023 08:42:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231244AbjFIMmk (ORCPT ); Fri, 9 Jun 2023 08:42:40 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4D3AF210A; Fri, 9 Jun 2023 05:42:39 -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 67B61AB6; Fri, 9 Jun 2023 05:43:24 -0700 (PDT) Received: from FVFF77S0Q05N.cambridge.arm.com (FVFF77S0Q05N.cambridge.arm.com [10.1.38.153]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2D34D3F6C4; Fri, 9 Jun 2023 05:42:37 -0700 (PDT) Date: Fri, 9 Jun 2023 13:42:34 +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 V11 06/10] arm64/perf: Enable branch stack events via FEAT_BRBE Message-ID: References: <20230531040428.501523-1-anshuman.khandual@arm.com> <20230531040428.501523-7-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 On Fri, Jun 09, 2023 at 10:17:19AM +0530, Anshuman Khandual wrote: > On 6/5/23 19:13, Mark Rutland wrote: > >> +/* > >> + * A branch record with BRBINFx_EL1.LASTFAILED set, implies that all > >> + * preceding consecutive branch records, that were in a transaction > >> + * (i.e their BRBINFx_EL1.TX set) have been aborted. > >> + * > >> + * Similarly BRBFCR_EL1.LASTFAILED set, indicate that all preceding > >> + * consecutive branch records up to the last record, which were in a > >> + * transaction (i.e their BRBINFx_EL1.TX set) have been aborted. > >> + * > >> + * --------------------------------- ------------------- > >> + * | 00 | BRBSRC | BRBTGT | BRBINF | | TX = 1 | LF = 0 | [TX success] > >> + * --------------------------------- ------------------- > >> + * | 01 | BRBSRC | BRBTGT | BRBINF | | TX = 1 | LF = 0 | [TX success] > >> + * --------------------------------- ------------------- > >> + * | 02 | BRBSRC | BRBTGT | BRBINF | | TX = 0 | LF = 0 | > >> + * --------------------------------- ------------------- > >> + * | 03 | BRBSRC | BRBTGT | BRBINF | | TX = 1 | LF = 0 | [TX failed] > >> + * --------------------------------- ------------------- > >> + * | 04 | BRBSRC | BRBTGT | BRBINF | | TX = 1 | LF = 0 | [TX failed] > >> + * --------------------------------- ------------------- > >> + * | 05 | BRBSRC | BRBTGT | BRBINF | | TX = 0 | LF = 1 | > >> + * --------------------------------- ------------------- > >> + * | .. | BRBSRC | BRBTGT | BRBINF | | TX = 0 | LF = 0 | > >> + * --------------------------------- ------------------- > >> + * | 61 | BRBSRC | BRBTGT | BRBINF | | TX = 1 | LF = 0 | [TX failed] > >> + * --------------------------------- ------------------- > >> + * | 62 | BRBSRC | BRBTGT | BRBINF | | TX = 1 | LF = 0 | [TX failed] > >> + * --------------------------------- ------------------- > >> + * | 63 | BRBSRC | BRBTGT | BRBINF | | TX = 1 | LF = 0 | [TX failed] > >> + * --------------------------------- ------------------- > >> + * > >> + * BRBFCR_EL1.LASTFAILED == 1 > >> + * > >> + * BRBFCR_EL1.LASTFAILED fails all those consecutive, in transaction > >> + * branches records near the end of the BRBE buffer. > >> + * > >> + * Architecture does not guarantee a non transaction (TX = 0) branch > >> + * record between two different transactions. So it is possible that > >> + * a subsequent lastfailed record (TX = 0, LF = 1) might erroneously > >> + * mark more than required transactions as aborted. > >> + */ > > Linux doesn't currently support TME (and IIUC no-one has built it), so can't we > > delete the transaction handling for now? We can add a comment with somehing like: > > > > /* > > * TODO: add transaction handling for TME. > > */ > > > > Assuming no-one has built TME, we might also be able to get an architectural > > fix to disambiguate the boundary between two transactions, and avoid the > > problem described above. > > > > [...] > > > > OR can leave this unchanged for now. Then update it if and when the relevant > architectural fix comes in. The current TME branch records handling here, is > as per the current architectural specification. My rationale for deleting it is that it cannot be used and cannot be tested, since the kernel doesn't support TME, and there are no TME implementations out there. If and when we support TME in the kernel, this is very likely to have bit-rotted. I'd be happy to link to the current version, e.g. /* * TODO: add transaction handling for FEAT_TME. See: * * https://lore.kernel.org/linux-arm-kernel/20230531040428.501523-7-anshuman.khandual@arm.com/ */ I do appreciate that time and effort has gone into writing this, but IMO it's more distracting than helpful at present, and deleting it makes this easier to review and maintain. Thanks, Mark.