Have etm_event_pause() retrieve the active path from the event context instead of passing the path from etm_event_stop(). Move the stop path lookup after the pause dispatch so each operation resolves its own path.
This prepares etm_event_stop() to coordinate hardware access before looking up the active context.
Assisted-by: Codex:gpt-6 Signed-off-by: Leo Yan leo.yan@arm.com --- drivers/hwtracing/coresight/coresight-etm-perf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index f66c99b26e1862ab04105704276c901b21728207..8f803914e9abfb18e080ff68371ad8b32042f180 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -694,10 +694,10 @@ static void etm_event_update_buffer(struct perf_event *event, perf_aux_output_end(handle, 0); }
-static void etm_event_pause(struct coresight_path *path, - struct perf_event *event, +static void etm_event_pause(struct perf_event *event, struct etm_ctxt *ctxt) { + struct coresight_path *path = etm_event_get_ctxt_path(ctxt); struct perf_output_handle *handle = &ctxt->handle; struct coresight_device *source, *sink; struct etm_event_data *event_data; @@ -735,7 +735,7 @@ static void etm_event_stop(struct perf_event *event, int mode) struct coresight_device *source, *sink; struct etm_ctxt *ctxt = this_cpu_ptr(&etm_ctxt); struct perf_output_handle *handle = &ctxt->handle; - struct coresight_path *path = etm_event_get_ctxt_path(ctxt); + struct coresight_path *path; struct hw_perf_event *hwc = &event->hw; struct etm_event_data *event_data;
@@ -744,7 +744,9 @@ static void etm_event_stop(struct perf_event *event, int mode) return;
if (mode & PERF_EF_PAUSE) - return etm_event_pause(path, event, ctxt); + return etm_event_pause(event, ctxt); + + path = etm_event_get_ctxt_path(ctxt);
/* * With no path enabled, there is no hardware to stop or trace data