Introduce perf check subcommand
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v15 Latest7 patches 3 repliesIn review
- v147 patches 3 repliesSuperseded
- v137 patches 6 repliesSuperseded
Earlier versions · 12
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v12 | 4 patches | 7 replies | Superseded | |
| v11 | 4 patches | 12 replies | Superseded | |
| v10 | 4 patches | 4 replies | Superseded | |
| v9 | 4 patches | 2 replies | Superseded | |
| v8 | 4 patches | 6 replies | Superseded | |
| v7 | 4 patches | 8 replies | Superseded | |
| v6 | 4 patches | 8 replies | Superseded | |
| v5 | 4 patches | 4 replies | Superseded | |
| v4 | 4 patches | 2 replies | Superseded | |
| v3 | 4 patches | 2 replies | Superseded | |
| v2 | 4 patches | 3 replies | Superseded | |
| v1 | 4 patches | 4 replies | Superseded |
Changes in v15 from the cover letter
+ rebase on commit 98ad0b7 ("perf check: Introduce 'check' subcommand")
+ patch #1 and patch #2 are exactly same, as applied in perf-tools-next/tmp.perf-tools-next
Patches in v15 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | libsubcmd: Don't free the usage stringtools/ tools/ tools/ +4 more | +20 | 0 replies | |
| 2/7 | perf check: Introduce 'check' subcommandtools/ tools/ tools/ +2 more | +281 | 0 replies | |
| 3/7 | perf version: Update --build-options to use 'supported_features' arraytools/ | +8 | 0 replies | |
| 4/7 | tools/perf/tests: Update test_task_analyzer.sh to use perf check featuretools/ | +2 | 0 replies | |
| 5/7 | tools/perf/tests: Update probe_vfs_getname.sh script to use perf check featuretools/ tools/ tools/ | +10 | 0 replies | |
| 6/7 | perf: Fix inconsistencies in feature namestools/ tools/ | +4 | 0 replies | |
| 7/7 | perf: Add more features to supported_features listtools/ tools/ | +78 | 3 replies |
Reviews trailers per patch
5 of 7 patches have a Reviewed-by or Acked-by.
| Patch | Namhyung Kim | Arnaldo Carvalho de Melo | Athira Rajeev |
|---|---|---|---|
| 1/7 | A-b | T-b | |
| 2/7 | T-b | R-b | |
| 3/7 | A-b | R-b | |
| 4/7 | A-b | R-b | |
| 5/7 | A-b | ||
| 6/7 | |||
| 7/7 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v15 0/7] Introduce perf check subcommand
The Problem
===========
Currently the presence of a feature is checked with a combination of perf version --build-options and greps, such as:
perf version --build-options | grep " on .* HAVE_FEATURE"
This relies on the output of perf version, and is a common pattern in tests.
Proposed solution
=================
As suggested by contributors in:
https://lore.kernel.org/linux-perf-users/[email protected]/
Introduce a subcommand "perf check feature", with which scripts can test for presence of a feature or multiple features, such as:
perf check feature HAVE_LIBTRACEEVENT (feature macro)
or
perf check feature libtraceevent (feature name)
or
perf check feature LibTraceEvent (case-insensitive)
or
perf check feature libtraceevent,bpf (multiple features)
The usage of "perf version --build-options | grep" has been replaced in two tests, with "perf check feature" command
Also, to not duplicate the same feature list at multiple places, a new global 'supported_features' array has been introduced in builtin.h, so both commands 'perf check feature' and 'perf version --build-options' use the same array
'supported_features' feature is an array of 'struct feature_support', which also has the name of the feature, macro used to test it's presence, and a is_builtin member, which will be 0 if feature not built-in, and 1 if built-in
Architectures Tested
====================
* x86_64
* ppc64le
Commands ran for testing (Fedora & RHEL):
sudo dnf install -y libtraceevent-devel
make clean
make -j$(nproc)
./perf check feature libtraceevent,bpf; echo Return Code: $? ./perf check feature libtraceevent; echo Return Code: $?
sudo ./perf test -v "task-analyzer"
sudo ./perf test -v "probe libc's inet_pton & backtrace it with ping" sudo ./perf test -v "Use vfs_getname probe to get syscall args filenames"
sudo dnf remove -y libtraceevent-devel
make clean
make NO_LIBTRACEEVENT=1 -j$(nproc)
./perf check feature libtraceevent,bpf; echo Return Code: $? ./perf check feature libtraceevent; echo Return Code: $?
sudo ./perf test -v "task-analyzer"
sudo ./perf test -v "probe libc's inet_pton & backtrace it with ping" sudo ./perf test -v "Use vfs_getname probe to get syscall args filenames"
Expected output of above commands (only the './perf check feature' command outputs):
...
libtraceevent: [ on ] # HAVE_LIBTRACEEVENT
bpf: [ on ] # HAVE_LIBBPF_SUPPORT
Return Code: 0
libtraceevent: [ on ] # HAVE_LIBTRACEEVENT
Return Code: 0
...
libtraceevent: [ OFF ] # HAVE_LIBTRACEEVENT
bpf: [ on ] # HAVE_LIBBPF_SUPPORT
Return Code: 1
libtraceevent: [ OFF ] # HAVE_LIBTRACEEVENT
Return Code: 1
Git tree
========
Git tree with this patch series applied for testing:
https://github.com/adi-g15-ibm/linux/tree/perf-check-feature-v15
Changelog
=========
v15:
+ rebase on commit 98ad0b7 ("perf check: Introduce 'check' subcommand")
+ patch #1 and patch #2 are exactly same, as applied in perf-tools-next/tmp.perf-tools-next
v14:
+ rebase on commit 39c24341 ("perf sched timehist: Fixed timestamp ...")
v13:
+ patch #1: add fix for parse_options_subcommand not setting usage string
+ patch #2: if unknown feature name passed, print "please use 'perf version --build-options' to see which ones are available"
+ patch #6: fix inconsistency in feature names (dwarf-unwind-support & get_cpuid)
+ patch #7: add more features to feature_list
v12
+ patch #1: fix comment to mention argv[0] instead of argv[1]
+ patch #2: fix alignment
v11
+ patch #1: fix build error due to const *const instead of const*
v10
+ patch #1: use 'strdup' instead of 'malloc+memcpy'
+ patch #1: replace '-q' with '--quiet' in doc
+ patch #1: add usage for perf check
V9
+ make 'feature' a subcommand instead of an option
+ make feature name/macro check case-insensitive
+ rename 'FEATURE_SUPPORT' as 'FEATURE_STATUS'
+ rebase on upstream perf-tools-next
V8
+ handle return value of 'malloc' in patch #1
+ fix error due to strncpy depending on source string's length
V7
+ modified patch #1 to fix compile issue, and add feature to allow multiple comma-separated features
V6
+ rebased to perf-tools-next/perf-tools-next
+ modified patch #1 to include FEATURE_SUPPORT("bpf_skeletons", HAVE_BPF_SKEL)
V5
+ invert return value of 'has_support', but return value of perf check --feature according to shell convention
V4
+ invert return value of perf check --feature
V3
+ simplified has_support code in builtin-check.c (patch #1)
+ modified patch #3 and patch #4 according to change in return value in patch #1
V2
+ improved the patch series with suggestions from Namhyung
+ fix incorrect return value, added -q option, and moved array definition to perf-check.c
V1
+ changed subcommand name to 'perf check --feature'
+ added documentation for perf check
+ support both macro (eg. HAVE_LIBTRACEEVENT), and name (eg. libtraceevent) as input to 'perf check --feature'
+ change subject and descriptions of all patch mentioning perf check instead of perf build
V0: Previous patch series: https://lore.kernel.org/linux-perf-users/[email protected]/
Aditya Gupta (6):
tools/lib/subcmd: Don't free the usage string
perf check: Introduce 'check' subcommand
perf version: Update --build-options to use 'supported_features' array tools/perf/tests: Update test_task_analyzer.sh to use perf check
feature
perf: Fix inconsistencies in feature names
perf: Add more features to supported_features list
Athira Rajeev (1):
tools/perf/tests: Update probe_vfs_getname.sh script to use perf check
feature
tools/lib/subcmd/parse-options.c | 8 +- tools/perf/Build | 1 + tools/perf/Documentation/perf-check.txt | 106 +++++++++ tools/perf/builtin-check.c | 205 ++++++++++++++++++ tools/perf/builtin-kmem.c | 2 + tools/perf/builtin-kvm.c | 3 + tools/perf/builtin-kwork.c | 3 + tools/perf/builtin-lock.c | 3 + tools/perf/builtin-mem.c | 3 + tools/perf/builtin-sched.c | 3 + tools/perf/builtin-version.c | 43 +--- tools/perf/builtin.h | 17 ++ tools/perf/perf.c | 1 + .../perf/tests/shell/lib/probe_vfs_getname.sh | 4 +- .../shell/record+probe_libc_inet_pton.sh | 5 +- .../shell/record+script_probe_vfs_getname.sh | 5 +- tools/perf/tests/shell/test_task_analyzer.sh | 4 +- 17 files changed, 370 insertions(+), 46 deletions(-) create mode 100644 tools/perf/Documentation/perf-check.txt create mode 100644 tools/perf/builtin-check.c
--
2.45.2