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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8ED7BC7EE25 for ; Fri, 9 Jun 2023 04:47:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229890AbjFIErc (ORCPT ); Fri, 9 Jun 2023 00:47:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbjFIErb (ORCPT ); Fri, 9 Jun 2023 00:47:31 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BD69330ED; Thu, 8 Jun 2023 21:47:29 -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 B5BEFAB6; Thu, 8 Jun 2023 21:48:14 -0700 (PDT) Received: from [10.163.44.201] (unknown [10.163.44.201]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B22F53F587; Thu, 8 Jun 2023 21:47:23 -0700 (PDT) Message-ID: Date: Fri, 9 Jun 2023 10:17:19 +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 V11 06/10] arm64/perf: Enable branch stack events via FEAT_BRBE 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: <20230531040428.501523-1-anshuman.khandual@arm.com> <20230531040428.501523-7-anshuman.khandual@arm.com> From: Anshuman Khandual In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org 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.