mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Leo Yan <leo.yan@arm.com>, Mike Leach <mike.leach@arm.com>,
	James Clark <james.clark@linaro.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Anshuman Khandual <anshuman.khandual@arm.com>,
	Tamas Petz <tamas.petz@arm.com>,
	Tamas Zsoldos <tamas.zsoldos@arm.com>,
	Suyash Mahar <smahar@meta.com>, Amir Ayupov <aaupov@fb.com>
Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, coresight@lists.linaro.org
Subject: Re: [PATCH v2 14/23] coresight: trbe: Treat access not allowed stops as fatal
Date: Fri, 27 Nov 2026 09:27:04 +0000	[thread overview]
Message-ID: <c502714b-7268-4a77-bda1-3f9540665950@arm.com> (raw)
In-Reply-To: <e44a9c55-4fe5-438b-80b5-f2ebf09dc1d6@arm.com>

On 26/11/2026 15:06, Suzuki K Poulose wrote:
> On 16/10/2026 17:55, Leo Yan wrote:
>> Arm ARM (ARM DDI 0487 M.b), the rule R_RRCNN in "D6.11 UNPREDICTABLE
>> behavior" permits a buffer management event when the effective SCR_EL3
>> security state does not match the owning Security state. This can stop
>> collection with IRQ=1, S=1, EC=0 and BSC=0 while leaving the other
>> status fields unchanged.
>>
>> With EA and WRAP clear, trbe_get_fault_act() currently returns SPURIOUS
>> for this status. The spurious handler re-enables TRBE without clearing
>> S, so collection can remain stopped. A retained WRAP indication can
>> instead cause the status to be treated as a normal buffer wrap.
>>
>> Recognize this architecturally permitted stopped status as an access
>> not allowed error and return FATAL so the fatal handling reports
>> truncated trace. Check the syndrome before WRAP and do not exclude
>> TRG, since both fields are left unchanged by this stop. Check the saved
>> IRQ bit to preserve updates without a pending interrupt.
>>
>> Signed-off-by: Leo Yan <leo.yan@arm.com>
>> ---
>>   drivers/hwtracing/coresight/coresight-trbe.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/ 
>> hwtracing/coresight/coresight-trbe.c
>> index 
>> 4aeed1a17c4bf1653fb41731ac15f31feec7ed2e..1c585b6123df2f20d08747678d836742ce9564cc 100644
>> --- a/drivers/hwtracing/coresight/coresight-trbe.c
>> +++ b/drivers/hwtracing/coresight/coresight-trbe.c
>> @@ -708,6 +708,14 @@ static enum trbe_fault_action 
>> trbe_get_fault_act(struct perf_output_handle *hand
>>           goto out_fatal;
>>       }
>> +    /* An access not allowed stop can leave WRAP and TRG unchanged. */
>> +    if (is_trbe_irq(trbsr) && !is_trbe_running(trbsr) &&
>> +        ec == TRBSR_EL1_EC_OTHER &&
>> +        bsc == TRBSR_EL1_BSC_NOT_STOPPED) {
>> +        err_str = "Trace buffer access not allowed";
>> +        goto out_fatal;
>> +    }
> 
> It would be good to have the conditions in the commit description
> listed here for reference. Also additionally, I wouldn't mind adding
> a wrapper to cover this case or even adding an alias for
> 
> #define TRBSR_EL1_BSC_NOT_STOPPED TRBSR_EL1_BSC_NO_ACCESS

I see that Will has already merged the TRBSR_EL1_BSC_* definitions.
For now, we could leave it as they are, but add a comment as
indicated above

Suzuki


> 
> 
> Suzuki
> 
>> +
>>       if (is_trbe_wrap(trbsr))
>>           return TRBE_FAULT_ACT_WRAP;
>>
> 


  reply	other threads:[~2026-11-27  9:27 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 16:54 [PATCH v2 00/23] coresight: trbe: Refactor buffer and IRQ handling Leo Yan
2026-10-16 16:54 ` [PATCH v2 01/23] arm64/sysreg: Define TRBSR_EL1.EC event classes Leo Yan
2026-11-10 15:28   ` James Clark
2026-11-26 10:24   ` Suzuki K Poulose
2026-11-26 15:24     ` Will Deacon
2026-11-26 16:44       ` Suzuki K Poulose
2026-11-26 15:07   ` Suzuki K Poulose
2026-10-16 16:55 ` [PATCH v2 02/23] coresight: trbe: Make watermark range check overflow safe in __trbe_normal_offset() Leo Yan
2026-11-10 15:28   ` James Clark
2026-11-26 15:07   ` Suzuki K Poulose
2026-10-16 16:55 ` [PATCH v2 03/23] coresight: trbe: Use helpers for checking errata Leo Yan
2026-11-10 15:29   ` James Clark
2026-11-26 15:07   ` Suzuki K Poulose
2026-11-26 15:07   ` Suzuki K Poulose
2026-10-16 16:55 ` [PATCH v2 04/23] coresight: trbe: Check the buffer association before IRQ validation Leo Yan
2026-11-10 15:29   ` James Clark
2026-11-26 15:08   ` Suzuki K Poulose
2026-10-16 16:55 ` [PATCH v2 05/23] coresight: trbe: Validate perf handle before using sink data Leo Yan
2026-11-10 15:29   ` James Clark
2026-11-26 15:08   ` Suzuki K Poulose
2026-10-16 16:55 ` [PATCH v2 06/23] coresight: trbe: Drop redundant disable from enable path Leo Yan
2026-11-09 16:27   ` James Clark
2026-11-11 16:21     ` Leo Yan
2026-11-26 15:08   ` Suzuki K Poulose
2026-10-16 16:55 ` [PATCH v2 07/23] coresight: trbe: Publish the session after successful enable Leo Yan
2026-11-10 15:30   ` James Clark
2026-11-26 15:08   ` Suzuki K Poulose
2026-10-16 16:55 ` [PATCH v2 08/23] coresight: trbe: Clear stale external abort status Leo Yan
2026-11-10 15:30   ` James Clark
2026-11-26 11:19   ` Suzuki K Poulose
2026-11-27 15:49     ` Leo Yan
2026-11-26 15:09   ` Suzuki K Poulose
2026-10-16 16:55 ` [PATCH v2 09/23] coresight: trbe: Clear TRBSR status at stop sites Leo Yan
2026-11-09 16:40   ` James Clark
2026-11-09 16:51     ` James Clark
2026-11-27 12:27       ` Leo Yan
2026-11-09 22:51   ` Suzuki K Poulose
2026-11-10  8:48     ` Leo Yan
2026-11-10 15:25       ` Suzuki K Poulose
2026-10-16 16:55 ` [PATCH v2 10/23] coresight: trbe: Drop redundant disables Leo Yan
2026-11-10 15:31   ` James Clark
2026-11-27 10:32   ` Suzuki K Poulose
2026-10-16 16:55 ` [PATCH v2 11/23] coresight: trbe: Assign the perf handle in enable and disable Leo Yan
2026-11-10 15:31   ` James Clark
2026-11-27 15:19   ` Suzuki K Poulose
2026-10-16 16:55 ` [PATCH v2 12/23] coresight: trbe: Decode TRBSR status codes Leo Yan
2026-11-10 15:32   ` James Clark
2026-11-27 15:20   ` Suzuki K Poulose
2026-10-16 16:55 ` [PATCH v2 13/23] coresight: trbe: Simplify wrap status handling Leo Yan
2026-11-10 15:32   ` James Clark
2026-11-27 15:20   ` Suzuki K Poulose
2026-10-16 16:55 ` [PATCH v2 14/23] coresight: trbe: Treat access not allowed stops as fatal Leo Yan
2026-11-10 15:33   ` James Clark
2026-11-26 15:06   ` Suzuki K Poulose
2026-11-27  9:27     ` Suzuki K Poulose [this message]
2026-10-16 16:55 ` [PATCH v2 15/23] coresight: trbe: Report truncated trace on buffer update errors Leo Yan
2026-11-10 15:33   ` James Clark
2026-11-11 10:47   ` Suzuki K Poulose
2026-11-11 16:05     ` Leo Yan
2026-11-27  9:27       ` Suzuki K Poulose
2026-10-16 16:55 ` [PATCH v2 16/23] coresight: trbe: Always classify TRBSR when updating buffer Leo Yan
2026-11-10 15:34   ` James Clark
2026-11-26 15:00   ` Suzuki K Poulose
2026-11-27 15:43     ` Leo Yan
2026-10-16 16:55 ` [PATCH v2 17/23] coresight: trbe: Calculate trace size across buffer wrap Leo Yan
2026-11-10 15:34   ` James Clark
2026-10-16 16:55 ` [PATCH v2 18/23] coresight: trbe: Keep the perf handle in per-CPU data Leo Yan
2026-11-10 15:34   ` James Clark
2026-10-16 16:55 ` [PATCH v2 19/23] coresight: trbe: Reload the AUX buffer on overflow restart Leo Yan
2026-11-10 15:12   ` James Clark
2026-11-11 17:46     ` Leo Yan
2026-11-11 18:25       ` James Clark
2026-10-16 16:55 ` [PATCH v2 20/23] coresight: trbe: Add fault action argument to trbe_handle_overflow() Leo Yan
2026-11-10 15:34   ` James Clark
2026-10-16 16:55 ` [PATCH v2 21/23] coresight: trbe: Read TRBSR after prohibiting and flushing trace Leo Yan
2026-11-10 15:24   ` James Clark
2026-10-16 16:55 ` [PATCH v2 22/23] coresight: trbe: Restart trace source for stopped buffers Leo Yan
2026-11-10 15:35   ` James Clark
2026-10-16 16:55 ` [PATCH v2 23/23] coresight: trbe: Report trace gaps with PARTIAL instead of COLLISION Leo Yan
2026-11-10 15:35   ` James Clark
2026-11-26 17:56 ` [PATCH v2 00/23] coresight: trbe: Refactor buffer and IRQ handling Will Deacon
2026-11-27  9:25   ` Suzuki K Poulose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c502714b-7268-4a77-bda1-3f9540665950@arm.com \
    --to=suzuki.poulose@arm.com \
    --cc=aaupov@fb.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=anshuman.khandual@arm.com \
    --cc=coresight@lists.linaro.org \
    --cc=james.clark@linaro.org \
    --cc=leo.yan@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.leach@arm.com \
    --cc=smahar@meta.com \
    --cc=tamas.petz@arm.com \
    --cc=tamas.zsoldos@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®