[PATCH V2 0/8] perf tools: Fix test "perf probe of function from different CU"
Chaitanya S Prakash
ChaitanyaS.Prakash at arm.com
Sun Apr 7 23:22:22 PDT 2024
From: Chaitanya S Prakash <chaitanyas.prakash at arm.com>
Defconfig doesn't provide all the necessary configs required for the
test "perf probe of function from different CU" to run successfully on
all platforms. Therefore the required configs have been added to
config fragments to resolve this issue. On further investigation it was
seen that the Perf treated all files beginning with "/tmp/perf-" as a
map file despite them always ending in ".map", this caused the test to
fail when Perf was built with NO_DWARF=1. As the file was parsed as a
map file, the probe...--funcs command output garbage values instead of
listing the functions in the binary. After fixing the issue an
additional check to test the output of the probe...--funcs command has
been added.
Additionally, various functions within the codebase have been refactored
and restructured. The definition of str_has_suffix() has been adopted
from tools/bpf/bpftool/gen.c and added to tools/lib/string.c in an
attempt to make the function more generic. The implementation has been
retained but the return values have been modified to resemble that of
str_has_prefix(), i.e., return strlen(suffix) on success and 0 on
failure. In light of the new addition, "ends_with()", a locally defined
function used for checking if a string had a given suffix has been
deleted and str_has_suffix() has replaced its usage. A call to
strtailcmp() has also been replaced as str_has_suffix() seemed more
suited for that particular use case.
Finally str_has_prefix() is adopted from the kernel and is added to
tools/lib/string.c, following which strstarts() is deleted and its use
has been replaced with str_has_prefix().
This patch series has been tested on 6.9-rc2 mainline kernel, both on
arm64 and x86 platforms.
Changes in V2:
- Add str_has_suffix() and str_has_prefix() to tools/lib/string.c
- Delete ends_with() and replace its usage with str_has_suffix()
- Replace an instance of strtailcmp() with str_has_suffix()
- Delete strstarts() from tools/include/linux/string.h and replace its
usage with str_has_prefix()
Cc: Josh Poimboeuf <jpoimboe at kernel.org>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Suzuki K Poulose <suzuki.poulose at arm.com>
Cc: Mike Leach <mike.leach at linaro.org>
Cc: James Clark <james.clark at arm.com>
Cc: John Garry <john.g.garry at oracle.com>
Cc: Will Deacon <will at kernel.org>
Cc: Leo Yan <leo.yan at linaro.org>
Cc: Ingo Molnar <mingo at redhat.com>
Cc: Arnaldo Carvalho de Melo <acme at kernel.org>
Cc: Namhyung Kim <namhyung at kernel.org>
Cc: Mark Rutland <mark.rutland at arm.com>
Cc: Alexander Shishkin <alexander.shishkin at linux.intel.com>
Cc: Jiri Olsa <jolsa at kernel.org>
Cc: Ian Rogers <irogers at google.com>
Cc: Adrian Hunter <adrian.hunter at intel.com>
Cc: Chenyuan Mi <cymi20 at fudan.edu.cn>
Cc: Masami Hiramatsu <mhiramat at kernel.org>
Cc: Ravi Bangoria <ravi.bangoria at amd.com>
Cc: Ahelenia Ziemiańska <nabijaczleweli at nabijaczleweli.xyz>
Cc: Colin Ian King <colin.i.king at gmail.com>
Cc: Changbin Du <changbin.du at huawei.com>
Cc: Kan Liang <kan.liang at linux.intel.com>
Cc: Athira Rajeev <atrajeev at linux.vnet.ibm.com>
Cc: Tiezhu Yang <yangtiezhu at loongson.cn>
Cc: Alexey Dobriyan <adobriyan at gmail.com>
Cc: Georg Müller <georgmueller at gmx.net>
Cc: Liam Howlett <liam.howlett at oracle.com>
Cc: bpf at vger.kernel.org
Cc: coresight at lists.linaro.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-kernel at vger.kernel.org
Cc: linux-perf-users at vger.kernel.org
Chaitanya S Prakash (8):
tools lib: adopt str_has_suffix() from bpftool/gen.c
perf util: Delete ends_with() and replace its use with
str_has_suffix()
perf util: Replace an instance of strtailcmp() by str_has_suffix()
tools lib: Adopt str_has_prefix() from kernel
tools: Delete strstarts() and replace its usage with str_has_prefix()
perf tools: Enable configs required for
test_uprobe_from_different_cu.sh
perf tools: Only treat files as map files when they have the extension
.map
perf test: Check output of the probe ... --funcs command
tools/include/linux/string.h | 12 ++----
tools/lib/string.c | 42 +++++++++++++++++++
tools/lib/subcmd/help.c | 2 +-
tools/lib/subcmd/parse-options.c | 18 ++++----
tools/objtool/check.c | 2 +-
tools/perf/arch/arm/util/pmu.c | 4 +-
tools/perf/arch/x86/annotate/instructions.c | 14 +++----
tools/perf/arch/x86/util/env.c | 2 +-
tools/perf/builtin-c2c.c | 4 +-
tools/perf/builtin-config.c | 2 +-
tools/perf/builtin-daemon.c | 2 +-
tools/perf/builtin-ftrace.c | 2 +-
tools/perf/builtin-help.c | 6 +--
tools/perf/builtin-kmem.c | 2 +-
tools/perf/builtin-kvm.c | 14 +++----
tools/perf/builtin-kwork.c | 10 ++---
tools/perf/builtin-lock.c | 6 +--
tools/perf/builtin-mem.c | 4 +-
tools/perf/builtin-sched.c | 6 +--
tools/perf/builtin-script.c | 30 ++++---------
tools/perf/builtin-stat.c | 4 +-
tools/perf/builtin-timechart.c | 2 +-
tools/perf/builtin-trace.c | 6 +--
tools/perf/perf.c | 12 +++---
tools/perf/tests/config-fragments/config | 3 ++
.../shell/test_uprobe_from_different_cu.sh | 2 +-
tools/perf/tests/symbols.c | 2 +-
tools/perf/ui/browser.c | 2 +-
tools/perf/ui/browsers/scripts.c | 2 +-
tools/perf/ui/stdio/hist.c | 2 +-
tools/perf/util/amd-sample-raw.c | 4 +-
tools/perf/util/annotate.c | 2 +-
tools/perf/util/callchain.c | 2 +-
tools/perf/util/config.c | 12 +++---
tools/perf/util/map.c | 8 ++--
tools/perf/util/pmus.c | 2 +-
tools/perf/util/probe-event.c | 2 +-
tools/perf/util/sample-raw.c | 2 +-
tools/perf/util/symbol-elf.c | 4 +-
tools/perf/util/symbol.c | 4 +-
40 files changed, 146 insertions(+), 117 deletions(-)
--
2.30.2
More information about the linux-arm-kernel
mailing list