From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AF054606A320 for ; Tue, 1 Dec 2026 11:34:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=FNnd1lkW; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=akqkzLA9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type: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-Unsubscribe-Post: List-Owner; bh=LHfGZFrhu9N7VLF8ywYXnCL7Nye+hR7RYxYWfPXfzog=; b=FNnd1lkWbo8y9p sgmxkFwXwQcLxD8nLGoKFPLpb8MO869l9FJMpVN5Q8A+OYsg9EZZdSelAqOaKL1pR6gomJCeXoLG2 kS76+V78hz1BnLQSyFk/yF+BZ9Sm5wlB1ZO31kk410hsN95g8T6vun9aFT2NV0EK00Rhkg//vWt/9 FRojdb+B/Wagf9qNU5Jf3ItawVKWD0t9X5jYtpBH2HimH5aA9U/5hJyXV3ZCC7tCj1mmJmtmOrGZI lJDxlNdjOhH4iJEk8vPtnzY7rIyzfp1fO86knzzymgarJVhoXO+mtNnvL9bXChNE+VmmxkPJlY+xX EYoqab4mWv+9AAHB6XwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYM7q-00000007cB8-2uIz; Tue, 01 Dec 2026 11:34:22 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYM7o-00000007c9a-1ZoG for linux-arm-kernel@lists.infradead.org; Tue, 01 Dec 2026 11:34:21 +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 8DFD91570; Tue, 1 Dec 2026 03:34:14 -0800 (PST) Received: from [10.2.197.99] (ewhatever.cambridge.arm.com [10.2.197.99]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6F4173F7D8; Tue, 1 Dec 2026 03:34:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796124857; bh=x78Hqjfx1tQvadX6VzKmQj+pVW7SJ4brBZ4bVOEMnjE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=akqkzLA94d+vzKkl1ugxswSzx1+D/PHVzb4vmdqeqzOSYqHXv4qBCTjHcsjEcQNnU yL/WJMT8FmvPTF9keo6WkcekmtRLDhVeYHrSIkITPHPw6cLVy7afFpeye/OYXkvBhz kapCFzhluHwckfsc7kZf5oC9i2GtJkgP7WbmA93s= Message-ID: <867ebb31-d17d-46a8-8318-c8ceaf01c4b6@arm.com> Date: Tue, 1 Dec 2026 11:34:13 +0000 X-Archived-By: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 17/23] coresight: trbe: Calculate trace size across buffer wrap To: Leo Yan , Mike Leach , James Clark , Alexander Shishkin , Anshuman Khandual , Tamas Petz , Tamas Zsoldos , Suyash Mahar , Amir Ayupov Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org References: <20261016-trbe_enable_disable_irq_handle_refactor-v2-0-3f57cf3199b1@arm.com> <20261016-trbe_enable_disable_irq_handle_refactor-v2-17-3f57cf3199b1@arm.com> Content-Language: en-US From: Suzuki K Poulose In-Reply-To: <20261016-trbe_enable_disable_irq_handle_refactor-v2-17-3f57cf3199b1@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261201_033420_546741_BD970820 X-CRM114-Status: GOOD ( 10.37 ) X-Spam-Score: -4.4 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-12.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 On 16/10/2026 17:55, Leo Yan wrote: > trbe_get_trace_size() assumes that the TRBE write pointer is always ahead > of the perf AUX head. That is not true after a WRAP event, where the write > pointer can move back to the start of the programmed TRBE span. > > Calculate the size in two parts for WRAP: the bytes from the current AUX > head to TRBLIMITR_EL1, plus any bytes from TRBBASER_EL1 to the current > TRBPTR_EL1. Keep the non-WRAP path strict and reject an unexpected write > pointer below the AUX head. > > For CPUs affected by the overwrite-fill-mode or write-out-of-range errata, > continue to ignore TRBPTR_EL1 on WRAP and account data only up to > TRBLIMITR_EL1, since bytes beyond the programmed limit are uncertain. > > Apply this fallback before validating the write pointer so a WRAP report > with a pointer outside the programmed range still publishes the trace > from the AUX head to the programmed limit. > > Signed-off-by: Leo Yan Reviewed-by: Suzuki K Poulose