From: Leo Yan <leo.yan@arm.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Mike Leach <mike.leach@arm.com>,
James Clark <james.clark@linaro.org>,
Vlad Poenaru <vlad.wing@gmail.com>, Amir Ayupov <aaupov@fb.com>,
Suyash Mahar <smahar@meta.com>, Song Liu <song@kernel.org>,
coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] coresight: perf: End AUX output when an event is throttled
Date: Tue, 24 Nov 2026 15:35:08 +0000 [thread overview]
Message-ID: <20261124153508.GA7209@e132581.arm.com> (raw)
In-Reply-To: <09e172d0-3ef5-44ef-a966-7db3b8a4af9a@arm.com>
On Tue, Nov 24, 2026 at 01:06:04PM +0000, Suzuki K Poulose wrote:
> > Check AUX handle ownership before updating the buffer or ending AUX
> > output. Drop the post-update check because the full stop runs with
> > local IRQs disabled, which prevents the TRBE IRQ from closing the
> > handle during the stop.
...
> > + if (mode & PERF_EF_UPDATE) {
> > /* update trace information */
> > - if (!sink_ops(sink)->update_buffer)
> > - return;
> > -
> > - size = sink_ops(sink)->update_buffer(sink, handle,
> > - event_data->snk_config);
> > - /*
> > - * Make sure the handle is still valid as the
> > - * sink could have closed it from an IRQ.
> > - * The sink driver must handle the race with
> > - * update_buffer() and IRQ. Thus either we
> > - * should get a valid handle and valid size
> > - * (which may be 0).
> > - *
> > - * But we should never get a non-zero size with
> > - * an invalid handle.
> > - */
> > - if (READ_ONCE(handle->event))
> > - perf_aux_output_end(handle, size);
> > - else
> > - WARN_ON(size);
> > + if (sink_ops(sink)->update_buffer)
> > + size = sink_ops(sink)->update_buffer(sink, handle,
> > + event_data->snk_config);
>
> Could we retain the READ_ONCE() check to handle the TRBE case here ? This
> looks like introducing a regression. Something like :
>
> if (!READ_ONCE(handle->event)) {
> WARN_ON(size);
> goto out;
> }
>
>
> > }
>
>
> Otherwise looks good to me
etm_event_stop() runs with local IRQ disabled, so the TRBE IRQ handler
cannot close the AUX handle during the stop. If the handler closed it
earlier, the ownership check before update_buffer() catches that case.
The second READ_ONCE(handle->event) check is redundant and is safe to
be removed.
Thanks,
Leo
next prev parent reply other threads:[~2026-11-24 16:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 12:00 [PATCH] coresight: perf: End AUX output when an event is throttled Leo Yan
2026-11-24 13:06 ` Suzuki K Poulose
2026-11-24 15:35 ` Leo Yan [this message]
2026-11-24 15:41 ` 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=20261124153508.GA7209@e132581.arm.com \
--to=leo.yan@arm.com \
--cc=aaupov@fb.com \
--cc=coresight@lists.linaro.org \
--cc=james.clark@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.leach@arm.com \
--cc=smahar@meta.com \
--cc=song@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=vlad.wing@gmail.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