lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251209152906.GW724103@e132581.arm.com>
Date: Tue, 9 Dec 2025 15:29:06 +0000
From: Leo Yan <leo.yan@....com>
To: Anshuman Khandual <anshuman.khandual@....com>
Cc: Suzuki K Poulose <suzuki.poulose@....com>,
	Mike Leach <mike.leach@...aro.org>,
	James Clark <james.clark@...aro.org>,
	Yeoreum Yun <yeoreum.yun@....com>, Will Deacon <will@...nel.org>,
	Mark Rutland <mark.rutland@....com>,
	Tamas Petz <tamas.petz@....com>,
	Tamas Zsoldos <tamas.zsoldos@....com>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	Namhyung Kim <namhyung@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
	Ian Rogers <irogers@...gle.com>,
	Adrian Hunter <adrian.hunter@...el.com>, coresight@...ts.linaro.org,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	linux-perf-users@...r.kernel.org
Subject: Re: [PATCH 05/19] coresight: trbe: Refactor status clearing

On Thu, Dec 04, 2025 at 06:27:27PM +0530, Anshuman Khandual wrote:
> On 01/12/25 4:51 PM, Leo Yan wrote:
> > If the driver does not clear the status when disabling the trace buffer
> > unit, stale state will carry over to the next enable, though the driver
> > clears it again on enable.
> 
> There is no problem now ! Because trbe_enable_hw() calls clr_trbe_status().
> 
> > 
> > Explicitly clear status after the trace is disabled in the interrupt
> > handling and when a perf session ends.  Keep the status for spurious
> > interrupts for continuous tracing.
> 
> But is not that the behaviour already without this change ?
> 
> clr_trbe_status() in trbe_enable_hw() ensures that no TRBE session can be
> started without first clearing the existing status. Still wondering what
> is the purpose of this change ?

It is about the driver's sanity.

The driver should clear the status immediately when the trace unit is
disabled, rather than waiting until the next enable.  This avoids
unexpected behaviour, such as a spurious TRBE interrupt.

Consider an edge case: if TRBE is being disabled at the same moment it
is about to raise an interrupt, arm_trbe_update_buffer() may miss the
IRQ bit due to latency.  If arm_trbe_disable() does not clear that bit,
arm_trbe_irq_handler() will still run after the perf event has been
stopped.  The interrupt handler then retrieves the trbe_buf pointer
from the perf output handle, which is dangerous because the perf
session has already ended.

Thanks,
Leo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ