Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf test session topology: Fix data path

Commit 2d4f27999b88 ("perf data: Add global path holder") missed path
conversion in tests/topology.c, causing the "Session topology" testcase
to "hang" (waits forever for input from stdin) when doing "ssh $VM perf
test".

Can be reproduced by running "cat | perf test topo", and crashed by
replacing cat with true:

$ true | perf test -v topo
40: Session topology :
--- start ---
test child forked, pid 3638
templ file: /tmp/perf-test-QPvAch
incompatible file format
incompatible file format (rerun with -v to learn more)
free(): invalid pointer
test child interrupted
---- end ----
Session topology: FAILED!

Committer testing:

Reproduced the above result before the patch and after it is back
working:

# true | perf test -v topo
41: Session topology :
--- start ---
test child forked, pid 19374
templ file: /tmp/perf-test-YOTEQg
CPU 0, core 0, socket 0
CPU 1, core 1, socket 0
CPU 2, core 2, socket 0
CPU 3, core 3, socket 0
CPU 4, core 0, socket 0
CPU 5, core 1, socket 0
CPU 6, core 2, socket 0
CPU 7, core 3, socket 0
test child finished with 0
---- end ----
Session topology: Ok
#

Fixes: 2d4f27999b88 ("perf data: Add global path holder")
Signed-off-by: Tommi Rantala <tommi.t.rantala@nokia.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Mamatha Inamdar <mamatha4@linux.vnet.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Link: http://lore.kernel.org/lkml/20200423115341.562782-1-tommi.t.rantala@nokia.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Tommi Rantala and committed by
Arnaldo Carvalho de Melo
dbd660e6 197ba86f

+4 -8
+4 -8
tools/perf/tests/topology.c
··· 33 33 { 34 34 struct perf_session *session; 35 35 struct perf_data data = { 36 - .file = { 37 - .path = path, 38 - }, 39 - .mode = PERF_DATA_MODE_WRITE, 36 + .path = path, 37 + .mode = PERF_DATA_MODE_WRITE, 40 38 }; 41 39 42 40 session = perf_session__new(&data, false, NULL); ··· 61 63 { 62 64 struct perf_session *session; 63 65 struct perf_data data = { 64 - .file = { 65 - .path = path, 66 - }, 67 - .mode = PERF_DATA_MODE_READ, 66 + .path = path, 67 + .mode = PERF_DATA_MODE_READ, 68 68 }; 69 69 int i; 70 70