]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
coresight: tmc: add the handle of the event to the path
authorCarl Worth <carl@os.amperecomputing.com>
Thu, 25 Sep 2025 10:42:31 +0000 (18:42 +0800)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Mon, 10 Nov 2025 10:07:35 +0000 (10:07 +0000)
The handle is essential for retrieving the AUX_EVENT of each CPU and is
required in perf mode. It has been added to the coresight_path so that
dependent devices can access it from the path when needed.

The existing bug can be reproduced with:
perf record -e cs_etm//k -C 0-9 dd if=/dev/zero of=/dev/null

Showing an oops as follows:
Unable to handle kernel paging request at virtual address 000f6e84934ed19e

Call trace:
 tmc_etr_get_buffer+0x30/0x80 [coresight_tmc] (P)
 catu_enable_hw+0xbc/0x3d0 [coresight_catu]
 catu_enable+0x70/0xe0 [coresight_catu]
 coresight_enable_path+0xb0/0x258 [coresight]

Fixes: 080ee83cc361 ("Coresight: Change functions to accept the coresight_path")
Signed-off-by: Carl Worth <carl@os.amperecomputing.com>
Reviewed-by: Leo Yan <leo.yan@arm.com>
Co-developed-by: Jie Gan <jie.gan@oss.qualcomm.com>
Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20250925-fix_helper_data-v2-1-edd8a07c1646@oss.qualcomm.com
drivers/hwtracing/coresight/coresight-etm-perf.c
drivers/hwtracing/coresight/coresight-tmc-etr.c
include/linux/coresight.h

index f677c08233ba1a28b277674662c6e6db904873dd..5c256af6e54af0cef8ea5d2e94a6d30056395e39 100644 (file)
@@ -520,6 +520,7 @@ static void etm_event_start(struct perf_event *event, int flags)
                goto out;
 
        path = etm_event_cpu_path(event_data, cpu);
+       path->handle = handle;
        /* We need a sink, no need to continue without one */
        sink = coresight_get_sink(path);
        if (WARN_ON_ONCE(!sink))
index 800be06598c1b7a5e17eac1a926797bb2cad2e97..60b0e0a6da057505e8b8daa9a852967ddb98bd73 100644 (file)
@@ -1334,7 +1334,8 @@ out:
 struct etr_buf *tmc_etr_get_buffer(struct coresight_device *csdev,
                                   enum cs_mode mode, void *data)
 {
-       struct perf_output_handle *handle = data;
+       struct coresight_path *path = data;
+       struct perf_output_handle *handle = path->handle;
        struct etr_perf_buffer *etr_perf;
 
        switch (mode) {
index 6de59ce8ef8ca45c29e2f09c1b979eb7686b685f..2626105e3719196ee442a52b104d42108ec07e7f 100644 (file)
@@ -332,12 +332,14 @@ static struct coresight_dev_list (var) = {                                \
 
 /**
  * struct coresight_path - data needed by enable/disable path
- * @path_list:              path from source to sink.
- * @trace_id:          trace_id of the whole path.
+ * @path_list:         path from source to sink.
+ * @trace_id:          trace_id of the whole path.
+ * @handle:            handle of the aux_event.
  */
 struct coresight_path {
-       struct list_head        path_list;
-       u8                      trace_id;
+       struct list_head                path_list;
+       u8                              trace_id;
+       struct perf_output_handle       *handle;
 };
 
 enum cs_mode {