Re: [PATCH v2 09/23] coresight: trbe: Clear TRBSR status at stop sites
From: Leo Yan
Date: Fri Nov 27 2026 - 07:27:18 EST
On Mon, Nov 09, 2026 at 04:51:43PM +0000, James Clark wrote:
[...]
> > > TRBSR_EL1 records the status of the buffer that just stopped. Clearing
> > > it in trbe_enable_hw() postpones cleanup until another run starts. If
> > > AUX output cannot restart, for example when AUX space is exhausted,
> > > that clear never executes. Clear the status in arm_trbe_disable()
> > > after disabling TRBE instead.
> > Why is leaving it set a problem though? That's not mentioned. Maybe
> > there is some later patch that requires it?
> I see Anshuman left a similar comment on V1 and you said there was a race
> condition. But that explanation wasn't added to the commit message, and I'm
> not sure if it exists anyway. A late IRQ after already disabling the buffer
> would just hit the check for a NULL aux handle and not run the handler.
Yes, with patch 05, the handler returns before accessing sink data if
the handle is NULL or the AUX transaction has ended. That early return
leaves TRBSR_EL1.IRQ untouched.
Status register is not only about status. It can assert IRQ singal
until software clears bits. Clearing it in arm_trbe_disable() deasserts
IRQ signal so we don't need to worry any pending interrupt even after
the TRBE buffer has been disabled.
The reported issue [1] seems a good example for why we need to do this
way. I will amend the rationale in commit log for new version.
[1] https://lore.kernel.org/linux-arm-kernel/CAPhsuW665wcpXxE8pfzRMfdxZwh9ogGsvd1aEBFREq61cz4Y5w@xxxxxxxxxxxxxx/