From: Leo Yan <leo.yan@arm.com>
To: Mike Leach <mike.leach@linaro.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>,
James Clark <james.clark@linaro.org>,
Jonathan Corbet <corbet@lwn.net>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 5/6] coresight: perf: Update buffer on AUX pause
Date: Tue, 1 Apr 2025 16:08:57 +0100 [thread overview]
Message-ID: <20250401150857.GD115840@e132581.arm.com> (raw)
In-Reply-To: <CAJ9a7ViUOZEyvqe-KGc-UdhmkqXpPdSeBWjk-=u1tAjFKu5Y+A@mail.gmail.com>
On Tue, Apr 01, 2025 at 03:35:44PM +0100, Mike Leach wrote:
[...]
> > > -static void etm_event_pause(struct coresight_device *csdev,
> > > +static void etm_event_pause(struct perf_event *event,
> > > + struct coresight_device *csdev,
> > > struct etm_ctxt *ctxt)
> > > {
> > > + int cpu = smp_processor_id();
> > > + struct coresight_device *sink;
> > > + struct perf_output_handle *handle = &ctxt->handle;
> > > + struct coresight_path *path;
> > > + unsigned long size;
> > > +
> > > if (!ctxt->event_data)
> > > return;
> > >
> > > /* Stop tracer */
> > > coresight_pause_source(csdev);
> > > +
> > > + path = etm_event_cpu_path(ctxt->event_data, cpu);
> > > + sink = coresight_get_sink(path);
> > > + if (WARN_ON_ONCE(!sink))
> > > + return;
> > > +
> > > + /*
> > > + * The per CPU sink has own interrupt handling, it might have
> > > + * race condition with updating buffer on AUX trace pause if
> > > + * it is invoked from NMI. To avoid the race condition,
> > > + * disallows updating buffer for the per CPU sink case.
> > > + */
> > > + if (coresight_is_percpu_sink(sink))
> > > + return;
> > > +
> > > + if (WARN_ON_ONCE(handle->event != event))
> > > + return;
> > > +
> > > + if (!sink_ops(sink)->update_buffer)
> > > + return;
> > > +
> > > + size = sink_ops(sink)->update_buffer(sink, handle,
> > > + ctxt->event_data->snk_config);
> >
> > I believe we keep the sink disabled/stopped in update_buffer. We need to
> > turn it back ON after the "buffer update". May be we could use a flag
> > to update_buffer() to indicate this is "pause" triggered update.
Thanks for pointing out, Suzuki.
I will fix it in next spin.
> The sink is stopped to read data, but also important is the
> enable/disable refcount. The only time that "update_buffer" will read
> is if the sink has a refcount == 1. These are ultimately controlled by
> enable/disable path - which will not occur during pause/resume
> operations.
Hi Mike,
My understanding is: if a sink is shared by multiple CPUs, e.g. a Perf
session with CPU mode or system wide mode, then we cannot arbitrarily
disable sink and update buffer, otherwise, it might cause hardware
lockup issue.
For per-thread mode, the refcount == 1, we can take chance to update
buffer, right?
Thanks,
Leo
next prev parent reply other threads:[~2025-04-01 15:09 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-11 17:04 [PATCH v3 0/6] Arm CoreSight: Support AUX pause and resume Leo Yan
2025-03-11 17:04 ` [PATCH v3 1/6] coresight: etm4x: Extract the trace unit controlling Leo Yan
2025-04-01 8:59 ` Mike Leach
2025-03-11 17:04 ` [PATCH v3 2/6] coresight: Introduce pause and resume APIs for source Leo Yan
2025-04-01 10:01 ` Mike Leach
2025-03-11 17:04 ` [PATCH v3 3/6] coresight: etm4x: Hook pause and resume callbacks Leo Yan
2025-04-01 10:30 ` Mike Leach
2025-03-11 17:04 ` [PATCH v3 4/6] coresight: perf: Support AUX trace pause and resume Leo Yan
2025-04-01 12:50 ` Mike Leach
2025-04-01 15:00 ` Leo Yan
2025-04-02 8:45 ` Mike Leach
2025-04-02 12:31 ` Leo Yan
2025-04-02 12:56 ` Mike Leach
2025-03-11 17:04 ` [PATCH v3 5/6] coresight: perf: Update buffer on AUX pause Leo Yan
2025-04-01 12:51 ` Suzuki K Poulose
2025-04-01 14:35 ` Mike Leach
2025-04-01 15:08 ` Leo Yan [this message]
2025-03-11 17:04 ` [PATCH v3 6/6] Documentation: coresight: Document AUX pause and resume Leo Yan
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=20250401150857.GD115840@e132581.arm.com \
--to=leo.yan@arm.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=corbet@lwn.net \
--cc=coresight@lists.linaro.org \
--cc=james.clark@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.leach@linaro.org \
--cc=suzuki.poulose@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