All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] perf cs-etm: Pass -1 as pid value for machine__set_current_tid()
@ 2021-11-13 14:35 ` Leo Yan
  0 siblings, 0 replies; 8+ messages in thread
From: Leo Yan @ 2021-11-13 14:35 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Namhyung Kim, Mathieu Poirier,
	Suzuki K Poulose, Mike Leach, John Garry, Will Deacon,
	Ingo Molnar, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	linux-arm-kernel, coresight, linux-perf-users, linux-kernel
  Cc: Leo Yan

Currently, cs-etm passes the tid value for both tid and pid parameters
when calling machine__set_current_tid(), this can lead to confusion for
thread handling.  E.g. we arbitrarily pass the same value for pid and
tid, perf tool will be misled to consider it is a main thread (see
thread__main_thread()).

On the other hand, Perf tool only can retrieve tid from Arm CoreSight
context packet, and we have no chance to know pid (it maps to kernel's
task_struct::tgid) from hardware tracing data.  For this reason, this
patch passes -1 as pid for function machine__set_current_tid().

Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
 tools/perf/util/cs-etm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index f323adb1af85..eed1a5930072 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -1118,7 +1118,7 @@ int cs_etm__etmq_set_tid(struct cs_etm_queue *etmq,
 	if (cs_etm__get_cpu(trace_chan_id, &cpu) < 0)
 		return err;
 
-	err = machine__set_current_tid(etm->machine, cpu, tid, tid);
+	err = machine__set_current_tid(etm->machine, cpu, -1, tid);
 	if (err)
 		return err;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-11-23  3:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-13 14:35 [PATCH v1] perf cs-etm: Pass -1 as pid value for machine__set_current_tid() Leo Yan
2021-11-13 14:35 ` Leo Yan
2021-11-18 17:14 ` Mathieu Poirier
2021-11-18 17:14   ` Mathieu Poirier
2021-11-19  0:33   ` Leo Yan
2021-11-19  0:33     ` Leo Yan
2021-11-23  3:14   ` Leo Yan
2021-11-23  3:14     ` Leo Yan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.