From 4aa0d846693d24603c90c66f053dd5fcf24c0f2b Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Mon, 28 Sep 2026 11:26:05 -0700 Subject: [PATCH] perf test uprobe_from_different_cu: Scope probe name to PID 'perf probe' names the event after the function and binary, so concurrent runs, as with 'perf test -r3', all add probe_testfile:foo and all but one fail with 'event "foo" already exists'. Name the event foo_$$. Reviewed-by: Namhyung Kim Assisted-by: Antigravity:gemini-3.1-pro Signed-off-by: Ian Rogers Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/shell/test_uprobe_from_different_cu.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/perf/tests/shell/test_uprobe_from_different_cu.sh b/tools/perf/tests/shell/test_uprobe_from_different_cu.sh index 83505093257d..33bf36c4037e 100755 --- a/tools/perf/tests/shell/test_uprobe_from_different_cu.sh +++ b/tools/perf/tests/shell/test_uprobe_from_different_cu.sh @@ -17,12 +17,15 @@ fi temp_dir=$(mktemp -d /tmp/perf-uprobe-different-cu-sh.XXXXXXXXXX) +# Scope to the pid, otherwise every run adds the same probe_testfile:foo. +probe_name="foo_$$" + cleanup() { trap - EXIT TERM INT if [[ "${temp_dir}" =~ ^/tmp/perf-uprobe-different-cu-sh.*$ ]]; then echo "--- Cleaning up ---" - perf probe -x ${temp_dir}/testfile -d foo || true + perf probe -x ${temp_dir}/testfile -d ${probe_name} || true rm -f "${temp_dir}/"* rmdir "${temp_dir}" fi @@ -83,6 +86,6 @@ gcc -g -Og -c ${temp_dir}/testfile-main.c -o ${temp_dir}/testfile-main.o gcc -g -Og -o ${temp_dir}/testfile ${temp_dir}/testfile-foo.o ${temp_dir}/testfile-main.o perf probe -x ${temp_dir}/testfile --funcs foo | grep "foo" -perf probe -x ${temp_dir}/testfile foo +perf probe -x ${temp_dir}/testfile ${probe_name}=foo cleanup