From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796124859; b=uTUiT324nDF5AZoel0wFBHGalOwQstEIpgkbzetjnTOztMCLgSW1d7/WdpXc1zbyZTkY i9nl1iO9zgdt5x2CK1NhcYZ/Bd8/6orh6mWQ+kmzXce+cheiw/RU7RzDMFSq9FYF55wW5 VNpC2QJ0O9CdsGyHrFH7f8Omo3DS2+jf2ZBvI7fKoajdivPLwyPwvIoVSvA7+zx/lOv+5 bqJMBGLkuvlCNO9iBawkVlf6/fO5jofBDGqlyAJcz/sRgX13RtlaLWut+DFJqJ9kFSsrm rcwXe0GK5xamYE+JEqEuL3mX0yv5FHRN1uby++6mg+VeEFLHT/U+xPXMe4W//MMZx2A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796124859; h=DMARC-Filter:Received:Received:DKIM-Signature:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:Content-Language: From:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=LHfGZFrhu9N7VLF8ywYXnCL7Nye+hR7RYxYWfPXfzog=; b=3GNAI7ceyGg20eallb6r3E8ic9Cs3dDGNhngC5DSgLx0wWvy0ZhQvqI8Hjiyo+u/DiLr CMj9SdPo5CbOfQgvbTb/7uuOhY7lFbBx3GoDEqaNI3FVB+ZphGf5lchfksYurEOyLz/sG vMxie3z/kX2zPnMKCdFudSp85skmd/E48isdNLTXbYWNIAiI7I/DYSyR+isaoUC6FL7aK MOfcBdYrXgMtB5SlZx3hmZJio0oUAMOSoU4ZsYRL/f2JkUf5cvTvM2NtMMOmt4xFbMIPs KRTW4KBvxSyHW3GMZJhEETjUj/AUQwA+Pf9+ylrLi0MKP5dCZSNZD1FugvxgFsrIk2Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=akqkzLA9; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 75DD2606A31A for ; Tue, 1 Dec 2026 11:34:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 75DD2606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=akqkzLA9 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-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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