Skip to content

Commit d0c9eff

Browse files
cworth-amperegregkh
authored andcommitted
coresight: tmc: add the handle of the event to the path
[ Upstream commit aaa5abc ] 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: 080ee83 ("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 Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 131097f commit d0c9eff

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

drivers/hwtracing/coresight/coresight-etm-perf.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ static void etm_event_start(struct perf_event *event, int flags)
520520
goto out;
521521

522522
path = etm_event_cpu_path(event_data, cpu);
523+
path->handle = handle;
523524
/* We need a sink, no need to continue without one */
524525
sink = coresight_get_sink(path);
525526
if (WARN_ON_ONCE(!sink))

drivers/hwtracing/coresight/coresight-tmc-etr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,8 @@ static int tmc_enable_etr_sink_sysfs(struct coresight_device *csdev)
13341334
struct etr_buf *tmc_etr_get_buffer(struct coresight_device *csdev,
13351335
enum cs_mode mode, void *data)
13361336
{
1337-
struct perf_output_handle *handle = data;
1337+
struct coresight_path *path = data;
1338+
struct perf_output_handle *handle = path->handle;
13381339
struct etr_perf_buffer *etr_perf;
13391340

13401341
switch (mode) {

include/linux/coresight.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,12 +332,14 @@ static struct coresight_dev_list (var) = { \
332332

333333
/**
334334
* struct coresight_path - data needed by enable/disable path
335-
* @path_list: path from source to sink.
336-
* @trace_id: trace_id of the whole path.
335+
* @path_list: path from source to sink.
336+
* @trace_id: trace_id of the whole path.
337+
* @handle: handle of the aux_event.
337338
*/
338339
struct coresight_path {
339-
struct list_head path_list;
340-
u8 trace_id;
340+
struct list_head path_list;
341+
u8 trace_id;
342+
struct perf_output_handle *handle;
341343
};
342344

343345
enum cs_mode {

0 commit comments

Comments
 (0)