License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 17:07:57 +03:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
/*
|
|
|
|
* builtin-test.c
|
|
|
|
*
|
|
|
|
* Builtin regression testing command: ever growing number of sanity tests
|
|
|
|
*/
|
2017-09-11 16:50:26 +03:00
|
|
|
#include <fcntl.h>
|
2017-04-18 16:46:11 +03:00
|
|
|
#include <errno.h>
|
2014-05-10 19:22:30 +04:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
2019-08-30 20:45:20 +03:00
|
|
|
#include <stdlib.h>
|
2017-08-03 22:49:15 +03:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <dirent.h>
|
2017-04-20 01:06:30 +03:00
|
|
|
#include <sys/wait.h>
|
2017-08-03 22:49:15 +03:00
|
|
|
#include <sys/stat.h>
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
#include "builtin.h"
|
2014-10-09 23:16:00 +04:00
|
|
|
#include "hist.h"
|
2013-01-24 23:22:55 +04:00
|
|
|
#include "intlist.h"
|
2012-11-10 04:46:41 +04:00
|
|
|
#include "tests.h"
|
2012-11-10 04:46:51 +04:00
|
|
|
#include "debug.h"
|
|
|
|
#include "color.h"
|
2015-12-15 18:39:39 +03:00
|
|
|
#include <subcmd/parse-options.h>
|
2017-08-03 22:49:15 +03:00
|
|
|
#include "string2.h"
|
2012-11-10 04:46:51 +04:00
|
|
|
#include "symbol.h"
|
2019-07-09 22:27:01 +03:00
|
|
|
#include "util/rlimit.h"
|
2017-04-17 17:39:06 +03:00
|
|
|
#include <linux/kernel.h>
|
2019-06-26 18:06:20 +03:00
|
|
|
#include <linux/string.h>
|
2017-08-03 22:49:15 +03:00
|
|
|
#include <subcmd/exec-cmd.h>
|
2011-01-04 16:55:27 +03:00
|
|
|
|
2016-06-28 14:29:01 +03:00
|
|
|
static bool dont_fork;
|
|
|
|
|
2015-10-05 17:40:19 +03:00
|
|
|
struct test __weak arch_tests[] = {
|
|
|
|
{
|
|
|
|
.func = NULL,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct test generic_tests[] = {
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
{
|
|
|
|
.desc = "vmlinux symtab matches kallsyms",
|
|
|
|
.func = test__vmlinux_matches_kallsyms,
|
|
|
|
},
|
2011-01-04 05:16:20 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Detect openat syscall event",
|
2015-04-16 16:52:53 +03:00
|
|
|
.func = test__openat_syscall_event,
|
2011-01-04 05:16:20 +03:00
|
|
|
},
|
2011-01-04 16:55:27 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Detect openat syscall event on all cpus",
|
2015-04-16 16:52:53 +03:00
|
|
|
.func = test__openat_syscall_event_on_all_cpus,
|
2011-01-04 16:55:27 +03:00
|
|
|
},
|
2011-01-15 15:42:46 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Read samples using the mmap interface",
|
2011-01-15 15:42:46 +03:00
|
|
|
.func = test__basic_mmap,
|
|
|
|
},
|
2017-08-17 01:21:56 +03:00
|
|
|
{
|
|
|
|
.desc = "Test data source output",
|
|
|
|
.func = test__mem,
|
|
|
|
},
|
2011-07-14 13:25:33 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Parse event definition strings",
|
2012-11-10 04:46:51 +04:00
|
|
|
.func = test__parse_events,
|
2011-07-14 13:25:33 +04:00
|
|
|
},
|
2017-03-20 23:17:05 +03:00
|
|
|
{
|
|
|
|
.desc = "Simple expression parser",
|
|
|
|
.func = test__expr,
|
|
|
|
},
|
2011-12-02 17:13:50 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "PERF_RECORD_* events & perf_sample fields",
|
2011-12-02 17:13:50 +04:00
|
|
|
.func = test__PERF_RECORD,
|
|
|
|
},
|
2012-03-15 23:09:17 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Parse perf pmu format",
|
2012-11-10 04:46:50 +04:00
|
|
|
.func = test__pmu,
|
2012-03-15 23:09:17 +04:00
|
|
|
},
|
2020-03-17 14:02:16 +03:00
|
|
|
{
|
|
|
|
.desc = "PMU events",
|
|
|
|
.func = test__pmu_events,
|
perf test: Improve pmu event metric testing
Break pmu-events test into 2 and add a test to verify that all pmu
metric expressions simply parse. Try to parse all metric ids/events,
skip/warn if metrics for the current architecture fail to parse. To
support warning for a skip, and an ability for a subtest to describe why
it skips.
Tested on power9, skylakex, haswell, broadwell, westmere, sandybridge and
ivybridge.
May skip/warn on other architectures if metrics are invalid. In
particular s390 is untested, but its expressions are trivial. The
untested architectures with expressions are power8, cascadelakex,
tremontx, skylake, jaketown, ivytown and variants of haswell and
broadwell.
v3. addresses review comments from John Garry <john.garry@huawei.com>,
Jiri Olsa <jolsa@redhat.com> and Arnaldo Carvalho de Melo
<acme@kernel.org>.
v2. changes the commit message as event parsing errors no longer cause
the test to fail.
Committer notes:
Check the return value of strtod() to fix the build in systems where
that function is declared with attribute warn_unused_result.
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Clarke <pc@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20200513212933.41273-1-irogers@google.com
[ split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-05-14 00:29:33 +03:00
|
|
|
.subtest = {
|
|
|
|
.skip_if_fail = false,
|
|
|
|
.get_nr = test__pmu_events_subtest_get_nr,
|
|
|
|
.get_desc = test__pmu_events_subtest_get_desc,
|
|
|
|
.skip_reason = test__pmu_events_subtest_skip_reason,
|
|
|
|
},
|
|
|
|
|
2020-03-17 14:02:16 +03:00
|
|
|
},
|
2012-07-22 16:14:40 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "DSO data read",
|
2012-11-10 04:46:51 +04:00
|
|
|
.func = test__dso_data,
|
2012-07-22 16:14:40 +04:00
|
|
|
},
|
2014-05-12 16:43:53 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "DSO data cache",
|
2014-05-12 16:43:53 +04:00
|
|
|
.func = test__dso_data_cache,
|
|
|
|
},
|
2014-05-12 16:50:03 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "DSO data reopen",
|
2014-05-12 16:50:03 +04:00
|
|
|
.func = test__dso_data_reopen,
|
|
|
|
},
|
2012-09-06 20:11:18 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Roundtrip evsel->name",
|
2012-11-10 04:46:47 +04:00
|
|
|
.func = test__perf_evsel__roundtrip_name_test,
|
2012-09-06 20:11:18 +04:00
|
|
|
},
|
2012-09-18 18:56:28 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Parse sched tracepoints fields",
|
2012-11-10 04:46:48 +04:00
|
|
|
.func = test__perf_evsel__tp_sched_test,
|
2012-09-18 18:56:28 +04:00
|
|
|
},
|
2012-09-26 20:23:10 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "syscalls:sys_enter_openat event fields",
|
2015-04-16 16:52:53 +03:00
|
|
|
.func = test__syscall_openat_tp_fields,
|
2012-09-26 20:23:10 +04:00
|
|
|
},
|
2012-10-31 02:02:05 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Setup struct perf_event_attr",
|
2012-11-10 04:46:51 +04:00
|
|
|
.func = test__attr,
|
2012-10-31 02:02:05 +04:00
|
|
|
},
|
2012-12-10 12:29:57 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Match and link multiple hists",
|
2012-12-10 12:29:57 +04:00
|
|
|
.func = test__hists_link,
|
|
|
|
},
|
2012-12-14 20:06:13 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "'import perf' in python",
|
2012-12-14 20:06:13 +04:00
|
|
|
.func = test__python_use,
|
|
|
|
},
|
2013-03-10 22:41:10 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Breakpoint overflow signal handler",
|
2013-03-10 22:41:10 +04:00
|
|
|
.func = test__bp_signal,
|
2017-06-01 23:54:50 +03:00
|
|
|
.is_supported = test__bp_signal_is_supported,
|
2013-03-10 22:41:10 +04:00
|
|
|
},
|
2013-03-10 22:41:11 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Breakpoint overflow sampling",
|
2013-03-10 22:41:11 +04:00
|
|
|
.func = test__bp_signal_overflow,
|
2017-06-01 23:54:50 +03:00
|
|
|
.is_supported = test__bp_signal_is_supported,
|
2013-03-10 22:41:11 +04:00
|
|
|
},
|
2018-03-12 16:45:48 +03:00
|
|
|
{
|
|
|
|
.desc = "Breakpoint accounting",
|
|
|
|
.func = test__bp_accounting,
|
2019-10-18 11:55:30 +03:00
|
|
|
.is_supported = test__bp_account_is_supported,
|
2018-03-12 16:45:48 +03:00
|
|
|
},
|
2018-09-12 09:12:29 +03:00
|
|
|
{
|
|
|
|
.desc = "Watchpoint",
|
|
|
|
.func = test__wp,
|
2018-09-28 13:53:35 +03:00
|
|
|
.is_supported = test__wp_is_supported,
|
2018-09-12 09:12:29 +03:00
|
|
|
.subtest = {
|
|
|
|
.skip_if_fail = false,
|
|
|
|
.get_nr = test__wp_subtest_get_nr,
|
|
|
|
.get_desc = test__wp_subtest_get_desc,
|
|
|
|
},
|
|
|
|
},
|
2013-03-15 09:58:11 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Number of exit events of a simple workload",
|
2013-03-15 09:58:11 +04:00
|
|
|
.func = test__task_exit,
|
|
|
|
},
|
2013-03-18 06:41:47 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Software clock events period values",
|
2013-03-18 06:41:47 +04:00
|
|
|
.func = test__sw_clock_freq,
|
|
|
|
},
|
2013-08-07 15:38:45 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Object code reading",
|
2013-08-07 15:38:45 +04:00
|
|
|
.func = test__code_reading,
|
|
|
|
},
|
2013-08-27 12:23:13 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Sample parsing",
|
2013-08-27 12:23:13 +04:00
|
|
|
.func = test__sample_parsing,
|
|
|
|
},
|
2013-08-31 22:50:53 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Use a dummy software event to keep tracking",
|
2013-08-31 22:50:53 +04:00
|
|
|
.func = test__keep_tracking,
|
|
|
|
},
|
2013-09-05 00:18:16 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Parse with no sample_id_all bit set",
|
2013-09-05 00:18:16 +04:00
|
|
|
.func = test__parse_no_sample_id_all,
|
|
|
|
},
|
2014-04-25 07:28:14 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Filter hist entries",
|
2014-04-25 07:28:14 +04:00
|
|
|
.func = test__hists_filter,
|
|
|
|
},
|
2014-03-05 20:20:31 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Lookup mmap thread",
|
2014-03-05 20:20:31 +04:00
|
|
|
.func = test__mmap_thread_lookup,
|
|
|
|
},
|
2014-03-17 17:39:00 +04:00
|
|
|
{
|
2019-11-26 04:29:18 +03:00
|
|
|
.desc = "Share thread maps",
|
|
|
|
.func = test__thread_maps_share,
|
2014-03-17 17:39:00 +04:00
|
|
|
},
|
2014-05-12 09:43:18 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Sort output of hist entries",
|
2014-05-12 09:43:18 +04:00
|
|
|
.func = test__hists_output,
|
|
|
|
},
|
2014-05-23 13:04:42 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Cumulate child hist entries",
|
2014-05-23 13:04:42 +04:00
|
|
|
.func = test__hists_cumulate,
|
|
|
|
},
|
2014-08-15 23:08:36 +04:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Track with sched_switch",
|
2014-08-15 23:08:36 +04:00
|
|
|
.func = test__switch_tracking,
|
|
|
|
},
|
perf tests: Add test for perf_evlist__filter_pollfd()
That will use a synthetic evlist with just what is touched by this new
method to check that it works as expected.
Output in verbose mode:
$ perf test -v pollfd
33: Filter fds with revents mask in a pollfd array :
--- start ---
filtering all but pollfd[2]:
before: 5 [ 5, 4, 3, 2, 1 ]
after: 1 [ 3 ]
filtering all but (pollfd[0], pollfd[3]):
before: 5 [ 5, 4, 3, 2, 1 ]
after: 2 [ 5, 2 ]
test child finished with 0
---- end ----
Filter fds with revents mask in a pollfd array: Ok
$
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-x7c8liszdvc3ocmanf2cet8p@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-08-13 06:34:06 +04:00
|
|
|
{
|
2014-09-04 01:02:59 +04:00
|
|
|
.desc = "Filter fds with revents mask in a fdarray",
|
|
|
|
.func = test__fdarray__filter,
|
perf tests: Add test for perf_evlist__filter_pollfd()
That will use a synthetic evlist with just what is touched by this new
method to check that it works as expected.
Output in verbose mode:
$ perf test -v pollfd
33: Filter fds with revents mask in a pollfd array :
--- start ---
filtering all but pollfd[2]:
before: 5 [ 5, 4, 3, 2, 1 ]
after: 1 [ 3 ]
filtering all but (pollfd[0], pollfd[3]):
before: 5 [ 5, 4, 3, 2, 1 ]
after: 2 [ 5, 2 ]
test child finished with 0
---- end ----
Filter fds with revents mask in a pollfd array: Ok
$
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-x7c8liszdvc3ocmanf2cet8p@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-08-13 06:34:06 +04:00
|
|
|
},
|
perf tests: Add pollfd growing test
[acme@ssdandy linux]$ perf test "Add fd"
34: Add fd to pollfd array, making it autogrow : Ok
[acme@ssdandy linux]$ perf test -v "Add fd"
34: Add fd to pollfd array, making it autogrow :
--- start ---
test child forked, pid 19817
before growing array: 2 [ 1, 2 ]
after 3rd add_pollfd: 3 [ 1, 2, 35 ]
after 4th add_pollfd: 4 [ 1, 2, 35, 88 ]
test child finished with 0
---- end ----
Add fd to pollfd array, making it autogrow: Ok
[acme@ssdandy linux]$
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-smflpyta146bzog7z0effjss@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-08-18 23:49:00 +04:00
|
|
|
{
|
2014-09-04 01:02:59 +04:00
|
|
|
.desc = "Add fd to a fdarray, making it autogrow",
|
|
|
|
.func = test__fdarray__add,
|
perf tests: Add pollfd growing test
[acme@ssdandy linux]$ perf test "Add fd"
34: Add fd to pollfd array, making it autogrow : Ok
[acme@ssdandy linux]$ perf test -v "Add fd"
34: Add fd to pollfd array, making it autogrow :
--- start ---
test child forked, pid 19817
before growing array: 2 [ 1, 2 ]
after 3rd add_pollfd: 3 [ 1, 2, 35 ]
after 4th add_pollfd: 4 [ 1, 2, 35, 88 ]
test child finished with 0
---- end ----
Add fd to pollfd array, making it autogrow: Ok
[acme@ssdandy linux]$
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-smflpyta146bzog7z0effjss@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2014-08-18 23:49:00 +04:00
|
|
|
},
|
perf tools: Add kmod_path__parse function
Provides united way of parsing kernel module path
into several components.
The new kmod_path__parse function and few defines:
int __kmod_path__parse(struct kmod_path *m, const char *path,
bool alloc_name, bool alloc_ext);
#define kmod_path__parse(__m, __p) __kmod_path__parse(__m, __p, false, false)
#define kmod_path__parse_name(__m, __p) __kmod_path__parse(__m, __p, true , false)
#define kmod_path__parse_ext(__m, __p) __kmod_path__parse(__m, __p, false, true)
parse kernel module @path and updates @m argument like:
@comp - true if @path contains supported compression suffix,
false otherwise
@kmod - true if @path contains '.ko' suffix in right position,
false otherwise
@name - if (@alloc_name && @kmod) is true, it contains strdup-ed base name
of the kernel module without suffixes, otherwise strudup-ed
base name of @path
@ext - if (@alloc_ext && @comp) is true, it contains strdup-ed string
the compression suffix
It returns 0 if there's no strdup error, -ENOMEM otherwise.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-9t6eqg8j610r94l743hkntiv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-02-05 17:40:25 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "kmod_path__parse",
|
perf tools: Add kmod_path__parse function
Provides united way of parsing kernel module path
into several components.
The new kmod_path__parse function and few defines:
int __kmod_path__parse(struct kmod_path *m, const char *path,
bool alloc_name, bool alloc_ext);
#define kmod_path__parse(__m, __p) __kmod_path__parse(__m, __p, false, false)
#define kmod_path__parse_name(__m, __p) __kmod_path__parse(__m, __p, true , false)
#define kmod_path__parse_ext(__m, __p) __kmod_path__parse(__m, __p, false, true)
parse kernel module @path and updates @m argument like:
@comp - true if @path contains supported compression suffix,
false otherwise
@kmod - true if @path contains '.ko' suffix in right position,
false otherwise
@name - if (@alloc_name && @kmod) is true, it contains strdup-ed base name
of the kernel module without suffixes, otherwise strudup-ed
base name of @path
@ext - if (@alloc_ext && @comp) is true, it contains strdup-ed string
the compression suffix
It returns 0 if there's no strdup error, -ENOMEM otherwise.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-9t6eqg8j610r94l743hkntiv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-02-05 17:40:25 +03:00
|
|
|
.func = test__kmod_path__parse,
|
|
|
|
},
|
2015-06-26 12:29:08 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Thread map",
|
2015-06-26 12:29:08 +03:00
|
|
|
.func = test__thread_map,
|
|
|
|
},
|
2015-07-08 13:04:02 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "LLVM search and compile",
|
2015-07-08 13:04:02 +03:00
|
|
|
.func = test__llvm,
|
2015-11-17 11:32:48 +03:00
|
|
|
.subtest = {
|
|
|
|
.skip_if_fail = true,
|
|
|
|
.get_nr = test__llvm_subtest_get_nr,
|
|
|
|
.get_desc = test__llvm_subtest_get_desc,
|
|
|
|
},
|
2015-07-08 13:04:02 +03:00
|
|
|
},
|
2015-09-04 11:58:31 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Session topology",
|
2017-08-03 21:16:31 +03:00
|
|
|
.func = test__session_topology,
|
2015-09-04 11:58:31 +03:00
|
|
|
},
|
2015-11-06 16:49:43 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "BPF filter",
|
2015-11-06 16:49:43 +03:00
|
|
|
.func = test__bpf,
|
2015-11-17 11:32:49 +03:00
|
|
|
.subtest = {
|
|
|
|
.skip_if_fail = true,
|
|
|
|
.get_nr = test__bpf_subtest_get_nr,
|
|
|
|
.get_desc = test__bpf_subtest_get_desc,
|
|
|
|
},
|
2015-11-06 16:49:43 +03:00
|
|
|
},
|
2015-10-25 17:51:20 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Synthesize thread map",
|
2015-10-25 17:51:20 +03:00
|
|
|
.func = test__thread_map_synthesize,
|
|
|
|
},
|
2016-12-12 13:35:41 +03:00
|
|
|
{
|
|
|
|
.desc = "Remove thread map",
|
|
|
|
.func = test__thread_map_remove,
|
|
|
|
},
|
2015-10-25 17:51:24 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Synthesize cpu map",
|
2015-10-25 17:51:24 +03:00
|
|
|
.func = test__cpu_map_synthesize,
|
|
|
|
},
|
2015-10-25 17:51:28 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Synthesize stat config",
|
2015-10-25 17:51:28 +03:00
|
|
|
.func = test__synthesize_stat_config,
|
|
|
|
},
|
2015-10-25 17:51:31 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Synthesize stat",
|
2015-10-25 17:51:31 +03:00
|
|
|
.func = test__synthesize_stat,
|
|
|
|
},
|
2015-10-25 17:51:34 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Synthesize stat round",
|
2015-10-25 17:51:34 +03:00
|
|
|
.func = test__synthesize_stat_round,
|
|
|
|
},
|
2015-10-25 17:51:37 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Synthesize attr update",
|
2015-10-25 17:51:37 +03:00
|
|
|
.func = test__event_update,
|
|
|
|
},
|
perf tests: Add test to check for event times
This test creates software event 'cpu-clock' attaches it in several ways
and checks that enabled and running times match.
Committer notes:
Testing it:
[acme@jouet linux]$ perf test -v times
44: Test events times :
--- start ---
test child forked, pid 27170
attaching to spawned child, enable on exec
OK : ena 307328, run 307328
attaching to current thread as enabled
OK : ena 7826, run 7826
attaching to current thread as disabled
OK : ena 738, run 738
attaching to CPU 0 as enabled
SKIP : not enough rights
attaching to CPU 0 as enabled
SKIP : not enough rights
test child finished with -2
---- end ----
Test events times: Skip
[acme@jouet linux]$
[root@jouet ~]# perf test times
44: Test events times : Ok
[root@jouet ~]# perf test -v times
44: Test events times :
--- start ---
test child forked, pid 27306
attaching to spawned child, enable on exec
OK : ena 479290, run 479290
attaching to current thread as enabled
OK : ena 11356, run 11356
attaching to current thread as disabled
OK : ena 987, run 987
attaching to CPU 0 as enabled
OK : ena 3717, run 3717
attaching to CPU 0 as enabled
OK : ena 2323, run 2323
test child finished with 0
---- end ----
Test events times: Ok
[root@jouet ~]#
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1458823940-24583-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-03-24 15:52:20 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Event times",
|
perf tests: Add test to check for event times
This test creates software event 'cpu-clock' attaches it in several ways
and checks that enabled and running times match.
Committer notes:
Testing it:
[acme@jouet linux]$ perf test -v times
44: Test events times :
--- start ---
test child forked, pid 27170
attaching to spawned child, enable on exec
OK : ena 307328, run 307328
attaching to current thread as enabled
OK : ena 7826, run 7826
attaching to current thread as disabled
OK : ena 738, run 738
attaching to CPU 0 as enabled
SKIP : not enough rights
attaching to CPU 0 as enabled
SKIP : not enough rights
test child finished with -2
---- end ----
Test events times: Skip
[acme@jouet linux]$
[root@jouet ~]# perf test times
44: Test events times : Ok
[root@jouet ~]# perf test -v times
44: Test events times :
--- start ---
test child forked, pid 27306
attaching to spawned child, enable on exec
OK : ena 479290, run 479290
attaching to current thread as enabled
OK : ena 11356, run 11356
attaching to current thread as disabled
OK : ena 987, run 987
attaching to CPU 0 as enabled
OK : ena 3717, run 3717
attaching to CPU 0 as enabled
OK : ena 2323, run 2323
test child finished with 0
---- end ----
Test events times: Ok
[root@jouet ~]#
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1458823940-24583-7-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-03-24 15:52:20 +03:00
|
|
|
.func = test__event_times,
|
|
|
|
},
|
2016-05-09 04:47:51 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Read backward ring buffer",
|
2016-05-09 04:47:51 +03:00
|
|
|
.func = test__backward_ring_buffer,
|
|
|
|
},
|
2016-06-28 14:29:04 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Print cpu map",
|
2016-06-28 14:29:04 +03:00
|
|
|
.func = test__cpu_map_print,
|
|
|
|
},
|
2019-11-21 03:15:14 +03:00
|
|
|
{
|
|
|
|
.desc = "Merge cpu map",
|
|
|
|
.func = test__cpu_map_merge,
|
|
|
|
},
|
|
|
|
|
2016-07-12 13:06:05 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Probe SDT events",
|
2016-07-12 13:06:05 +03:00
|
|
|
.func = test__sdt_event,
|
|
|
|
},
|
2016-07-16 19:11:20 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "is_printable_array",
|
2016-07-16 19:11:20 +03:00
|
|
|
.func = test__is_printable_array,
|
|
|
|
},
|
2016-08-01 21:02:32 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "Print bitmap",
|
2016-08-01 21:02:32 +03:00
|
|
|
.func = test__bitmap_print,
|
|
|
|
},
|
2016-11-26 10:03:28 +03:00
|
|
|
{
|
2016-11-29 18:38:14 +03:00
|
|
|
.desc = "perf hooks",
|
2016-11-26 10:03:28 +03:00
|
|
|
.func = test__perf_hooks,
|
|
|
|
},
|
2016-11-26 10:03:34 +03:00
|
|
|
{
|
|
|
|
.desc = "builtin clang support",
|
|
|
|
.func = test__clang,
|
|
|
|
.subtest = {
|
|
|
|
.skip_if_fail = true,
|
|
|
|
.get_nr = test__clang_subtest_get_nr,
|
|
|
|
.get_desc = test__clang_subtest_get_desc,
|
|
|
|
}
|
|
|
|
},
|
2017-01-09 12:51:55 +03:00
|
|
|
{
|
|
|
|
.desc = "unit_number__scnprintf",
|
|
|
|
.func = test__unit_number__scnprint,
|
|
|
|
},
|
2018-03-09 13:14:36 +03:00
|
|
|
{
|
|
|
|
.desc = "mem2node",
|
|
|
|
.func = test__mem2node,
|
|
|
|
},
|
perf tests: Add a test for time-utils
Test time ranges work as expected.
Committer testing:
$ perf test "time utils"
59: time utils : Ok
$ perf test -v "time utils"
59: time utils :
--- start ---
test child forked, pid 31711
parse_nsec_time("0")
0
parse_nsec_time("1")
1000000000
parse_nsec_time("0.000000001")
1
parse_nsec_time("1.000000001")
1000000001
parse_nsec_time("123456.123456")
123456123456000
parse_nsec_time("1234567.123456789")
1234567123456789
parse_nsec_time("18446744073.709551615")
18446744073709551615
perf_time__parse_str("1234567.123456789,1234567.123456789")
start time 1234567123456789, end time 1234567123456789
perf_time__parse_str("1234567.123456789,1234567.123456790")
start time 1234567123456789, end time 1234567123456790
perf_time__parse_str("1234567.123456789,")
start time 1234567123456789, end time 0
perf_time__parse_str(",1234567.123456789")
start time 0, end time 1234567123456789
perf_time__parse_str("0,1234567.123456789")
start time 0, end time 1234567123456789
perf_time__parse_for_ranges("1234567.123456789,1234567.123456790")
start time 1234567123456789, end time 1234567123456790
perf_time__parse_for_ranges("10%/1")
first_sample_time 7654321000000000 last_sample_time 7654321000000100
start time 0: 7654321000000000, end time 0: 7654321000000009
perf_time__parse_for_ranges("10%/2")
first_sample_time 7654321000000000 last_sample_time 7654321000000100
start time 0: 7654321000000010, end time 0: 7654321000000019
perf_time__parse_for_ranges("10%/1,10%/2")
first_sample_time 11223344000000000 last_sample_time 11223344000000100
start time 0: 11223344000000000, end time 0: 11223344000000009
start time 1: 11223344000000010, end time 1: 11223344000000019
perf_time__parse_for_ranges("10%/1,10%/3,10%/10")
first_sample_time 11223344000000000 last_sample_time 11223344000000100
start time 0: 11223344000000000, end time 0: 11223344000000009
start time 1: 11223344000000020, end time 1: 11223344000000029
start time 2: 11223344000000090, end time 2: 11223344000000100
test child finished with 0
---- end ----
time utils: Ok
$
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/20190604130017.31207-19-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-06-04 16:00:16 +03:00
|
|
|
{
|
|
|
|
.desc = "time utils",
|
|
|
|
.func = test__time_utils,
|
|
|
|
},
|
2019-11-27 02:59:13 +03:00
|
|
|
{
|
|
|
|
.desc = "Test jit_write_elf",
|
|
|
|
.func = test__jit_write_elf,
|
|
|
|
},
|
2020-05-05 21:29:43 +03:00
|
|
|
{
|
|
|
|
.desc = "Test libpfm4 support",
|
|
|
|
.func = test__pfm,
|
|
|
|
.subtest = {
|
|
|
|
.skip_if_fail = true,
|
|
|
|
.get_nr = test__pfm_subtest_get_nr,
|
|
|
|
.get_desc = test__pfm_subtest_get_desc,
|
|
|
|
}
|
|
|
|
},
|
2020-04-15 08:40:49 +03:00
|
|
|
{
|
|
|
|
.desc = "Test api io",
|
|
|
|
.func = test__api_io,
|
|
|
|
},
|
2019-05-08 16:20:07 +03:00
|
|
|
{
|
2019-11-26 04:33:02 +03:00
|
|
|
.desc = "maps__merge_in",
|
|
|
|
.func = test__maps__merge_in,
|
2019-05-08 16:20:07 +03:00
|
|
|
},
|
perf tests: Add test for the java demangler
Split from a larger patch that was also fixing a problem with the java
demangler, so, before applying that patch we see:
$ perf test java
65: Demangle Java : FAILED!
$ perf test -v java
65: Demangle Java :
--- start ---
test child forked, pid 307264
FAILED: Ljava/lang/StringLatin1;equals([B[B)Z: bool class java.lang.StringLatin1.equals(byte[], byte[]) != boolean java.lang.StringLatin1.equals(byte[], byte[])
FAILED: Ljava/util/zip/ZipUtils;CENSIZ([BI)J: long class java.util.zip.ZipUtils.CENSIZ(byte[], int) != long java.util.zip.ZipUtils.CENSIZ(byte[], int)
FAILED: Ljava/util/regex/Pattern$BmpCharProperty;match(Ljava/util/regex/Matcher;ILjava/lang/CharSequence;)Z: bool class java.util.regex.Pattern$BmpCharProperty.match(class java.util.regex.Matcher., int, class java.lang., charhar, shortequence) != boolean java.util.regex.Pattern$BmpCharProperty.match(java.util.regex.Matcher, int, java.lang.CharSequence)
FAILED: Ljava/lang/AbstractStringBuilder;appendChars(Ljava/lang/String;II)V: void class java.lang.AbstractStringBuilder.appendChars(class java.lang., shorttring., int, int) != void java.lang.AbstractStringBuilder.appendChars(java.lang.String, int, int)
FAILED: Ljava/lang/Object;<init>()V: void class java.lang.Object<init>() != void java.lang.Object<init>()
test child finished with -1
---- end ----
Demangle Java: FAILED!
$
Next patch should fix this.
Signed-off-by: Nick Gasson <nick.gasson@arm.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20200427061520.24905-4-nick.gasson@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2020-04-27 09:15:16 +03:00
|
|
|
{
|
|
|
|
.desc = "Demangle Java",
|
|
|
|
.func = test__demangle_java,
|
|
|
|
},
|
2020-06-03 00:47:40 +03:00
|
|
|
{
|
|
|
|
.desc = "Parse and process metrics",
|
|
|
|
.func = test__parse_metric,
|
|
|
|
},
|
2020-08-21 19:52:38 +03:00
|
|
|
{
|
|
|
|
.desc = "PE file support",
|
|
|
|
.func = test__pe_file_parsing,
|
|
|
|
},
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
{
|
|
|
|
.func = NULL,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2015-10-05 17:40:19 +03:00
|
|
|
static struct test *tests[] = {
|
|
|
|
generic_tests,
|
|
|
|
arch_tests,
|
|
|
|
};
|
|
|
|
|
2020-05-25 01:42:06 +03:00
|
|
|
static bool perf_test__matches(const char *desc, int curr, int argc, const char *argv[])
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
{
|
2011-11-29 18:52:07 +04:00
|
|
|
int i;
|
|
|
|
|
|
|
|
if (argc == 0)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
for (i = 0; i < argc; ++i) {
|
|
|
|
char *end;
|
|
|
|
long nr = strtoul(argv[i], &end, 10);
|
|
|
|
|
|
|
|
if (*end == '\0') {
|
|
|
|
if (nr == curr + 1)
|
|
|
|
return true;
|
|
|
|
continue;
|
|
|
|
}
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
|
2020-05-25 01:42:06 +03:00
|
|
|
if (strcasestr(desc, argv[i]))
|
2011-11-29 18:52:07 +04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
perf tests: Pass the subtest index to each test routine
Some tests have sub-tests we want to run, so allow passing this.
Wang tried to avoid having to touch all tests, but then, having the
test.func in an anonymous union makes the build fail on older compilers,
like the one in RHEL6, where:
test a = {
.func = foo,
};
fails.
To fix it leave the func pointer in the main structure and pass the subtest
index to all tests, end result function is the same, but we have just one
function pointer, not two, with and without the subtest index as an argument.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-5genj0ficwdmelpoqlds0u4y@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-11-19 18:01:48 +03:00
|
|
|
static int run_test(struct test *test, int subtest)
|
2014-05-10 19:22:30 +04:00
|
|
|
{
|
2016-06-28 14:29:01 +03:00
|
|
|
int status, err = -1, child = dont_fork ? 0 : fork();
|
2014-08-14 06:22:45 +04:00
|
|
|
char sbuf[STRERR_BUFSIZE];
|
2014-05-10 19:22:30 +04:00
|
|
|
|
|
|
|
if (child < 0) {
|
2014-08-14 06:22:45 +04:00
|
|
|
pr_err("failed to fork test: %s\n",
|
tools: Introduce str_error_r()
The tools so far have been using the strerror_r() GNU variant, that
returns a string, be it the buffer passed or something else.
But that, besides being tricky in cases where we expect that the
function using strerror_r() returns the error formatted in a provided
buffer (we have to check if it returned something else and copy that
instead), breaks the build on systems not using glibc, like Alpine
Linux, where musl libc is used.
So, introduce yet another wrapper, str_error_r(), that has the GNU
interface, but uses the portable XSI variant of strerror_r(), so that
users rest asured that the provided buffer is used and it is what is
returned.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-d4t42fnf48ytlk8rjxs822tf@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-06 17:56:20 +03:00
|
|
|
str_error_r(errno, sbuf, sizeof(sbuf)));
|
2014-05-10 19:22:30 +04:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!child) {
|
2016-06-28 14:29:01 +03:00
|
|
|
if (!dont_fork) {
|
|
|
|
pr_debug("test child forked, pid %d\n", getpid());
|
|
|
|
|
2017-02-17 11:17:38 +03:00
|
|
|
if (verbose <= 0) {
|
2016-06-28 14:29:01 +03:00
|
|
|
int nullfd = open("/dev/null", O_WRONLY);
|
|
|
|
|
|
|
|
if (nullfd >= 0) {
|
|
|
|
close(STDERR_FILENO);
|
|
|
|
close(STDOUT_FILENO);
|
|
|
|
|
|
|
|
dup2(nullfd, STDOUT_FILENO);
|
|
|
|
dup2(STDOUT_FILENO, STDERR_FILENO);
|
|
|
|
close(nullfd);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
signal(SIGSEGV, sighandler_dump_stack);
|
|
|
|
signal(SIGFPE, sighandler_dump_stack);
|
2015-11-17 11:32:50 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-03 21:16:31 +03:00
|
|
|
err = test->func(test, subtest);
|
2016-06-28 14:29:01 +03:00
|
|
|
if (!dont_fork)
|
|
|
|
exit(err);
|
2014-05-10 19:22:30 +04:00
|
|
|
}
|
|
|
|
|
2016-06-28 14:29:01 +03:00
|
|
|
if (!dont_fork) {
|
|
|
|
wait(&status);
|
2014-05-10 19:22:30 +04:00
|
|
|
|
2016-06-28 14:29:01 +03:00
|
|
|
if (WIFEXITED(status)) {
|
|
|
|
err = (signed char)WEXITSTATUS(status);
|
|
|
|
pr_debug("test child finished with %d\n", err);
|
|
|
|
} else if (WIFSIGNALED(status)) {
|
|
|
|
err = -1;
|
|
|
|
pr_debug("test child interrupted\n");
|
|
|
|
}
|
2014-05-10 19:22:30 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2015-10-05 17:40:19 +03:00
|
|
|
#define for_each_test(j, t) \
|
|
|
|
for (j = 0; j < ARRAY_SIZE(tests); j++) \
|
|
|
|
for (t = &tests[j][0]; t->func; t++)
|
2015-09-05 22:02:20 +03:00
|
|
|
|
2015-11-17 11:32:48 +03:00
|
|
|
static int test_and_print(struct test *t, bool force_skip, int subtest)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
|
|
|
if (!force_skip) {
|
|
|
|
pr_debug("\n--- start ---\n");
|
|
|
|
err = run_test(t, subtest);
|
|
|
|
pr_debug("---- end ----\n");
|
|
|
|
} else {
|
|
|
|
pr_debug("\n--- force skipped ---\n");
|
|
|
|
err = TEST_SKIP;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!t->subtest.get_nr)
|
|
|
|
pr_debug("%s:", t->desc);
|
|
|
|
else
|
2018-07-26 20:17:33 +03:00
|
|
|
pr_debug("%s subtest %d:", t->desc, subtest + 1);
|
2015-11-17 11:32:48 +03:00
|
|
|
|
|
|
|
switch (err) {
|
|
|
|
case TEST_OK:
|
|
|
|
pr_info(" Ok\n");
|
|
|
|
break;
|
2020-05-14 00:29:33 +03:00
|
|
|
case TEST_SKIP: {
|
|
|
|
const char *skip_reason = NULL;
|
|
|
|
if (t->subtest.skip_reason)
|
|
|
|
skip_reason = t->subtest.skip_reason(subtest);
|
|
|
|
if (skip_reason)
|
|
|
|
color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip (%s)\n", skip_reason);
|
|
|
|
else
|
|
|
|
color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip\n");
|
|
|
|
}
|
2015-11-17 11:32:48 +03:00
|
|
|
break;
|
|
|
|
case TEST_FAIL:
|
|
|
|
default:
|
|
|
|
color_fprintf(stderr, PERF_COLOR_RED, " FAILED!\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2017-08-03 22:49:15 +03:00
|
|
|
static const char *shell_test__description(char *description, size_t size,
|
|
|
|
const char *path, const char *name)
|
|
|
|
{
|
|
|
|
FILE *fp;
|
|
|
|
char filename[PATH_MAX];
|
|
|
|
|
|
|
|
path__join(filename, sizeof(filename), path, name);
|
|
|
|
fp = fopen(filename, "r");
|
|
|
|
if (!fp)
|
|
|
|
return NULL;
|
|
|
|
|
2018-11-22 00:39:18 +03:00
|
|
|
/* Skip shebang */
|
|
|
|
while (fgetc(fp) != '\n');
|
|
|
|
|
2017-08-03 22:49:15 +03:00
|
|
|
description = fgets(description, size, fp);
|
|
|
|
fclose(fp);
|
|
|
|
|
2019-06-26 18:06:20 +03:00
|
|
|
return description ? strim(description + 1) : NULL;
|
2017-08-03 22:49:15 +03:00
|
|
|
}
|
|
|
|
|
2017-12-06 20:45:35 +03:00
|
|
|
#define for_each_shell_test(dir, base, ent) \
|
2017-08-03 22:49:15 +03:00
|
|
|
while ((ent = readdir(dir)) != NULL) \
|
2018-06-29 20:46:58 +03:00
|
|
|
if (!is_directory(base, ent) && ent->d_name[0] != '.')
|
2017-08-03 22:49:15 +03:00
|
|
|
|
|
|
|
static const char *shell_tests__dir(char *path, size_t size)
|
|
|
|
{
|
|
|
|
const char *devel_dirs[] = { "./tools/perf/tests", "./tests", };
|
|
|
|
char *exec_path;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(devel_dirs); ++i) {
|
|
|
|
struct stat st;
|
|
|
|
if (!lstat(devel_dirs[i], &st)) {
|
|
|
|
scnprintf(path, size, "%s/shell", devel_dirs[i]);
|
|
|
|
if (!lstat(devel_dirs[i], &st))
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Then installed path. */
|
|
|
|
exec_path = get_argv_exec_path();
|
|
|
|
scnprintf(path, size, "%s/tests/shell", exec_path);
|
|
|
|
free(exec_path);
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int shell_tests__max_desc_width(void)
|
|
|
|
{
|
|
|
|
DIR *dir;
|
|
|
|
struct dirent *ent;
|
|
|
|
char path_dir[PATH_MAX];
|
|
|
|
const char *path = shell_tests__dir(path_dir, sizeof(path_dir));
|
|
|
|
int width = 0;
|
|
|
|
|
|
|
|
if (path == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
dir = opendir(path);
|
|
|
|
if (!dir)
|
|
|
|
return -1;
|
|
|
|
|
2017-12-06 20:45:35 +03:00
|
|
|
for_each_shell_test(dir, path, ent) {
|
2017-08-03 22:49:15 +03:00
|
|
|
char bf[256];
|
|
|
|
const char *desc = shell_test__description(bf, sizeof(bf), path, ent->d_name);
|
|
|
|
|
|
|
|
if (desc) {
|
|
|
|
int len = strlen(desc);
|
|
|
|
|
|
|
|
if (width < len)
|
|
|
|
width = len;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
closedir(dir);
|
|
|
|
return width;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct shell_test {
|
|
|
|
const char *dir;
|
|
|
|
const char *file;
|
|
|
|
};
|
|
|
|
|
|
|
|
static int shell_test__run(struct test *test, int subdir __maybe_unused)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
char script[PATH_MAX];
|
|
|
|
struct shell_test *st = test->priv;
|
|
|
|
|
|
|
|
path__join(script, sizeof(script), st->dir, st->file);
|
|
|
|
|
|
|
|
err = system(script);
|
|
|
|
if (!err)
|
|
|
|
return TEST_OK;
|
|
|
|
|
|
|
|
return WEXITSTATUS(err) == 2 ? TEST_SKIP : TEST_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int run_shell_tests(int argc, const char *argv[], int i, int width)
|
|
|
|
{
|
|
|
|
DIR *dir;
|
|
|
|
struct dirent *ent;
|
|
|
|
char path_dir[PATH_MAX];
|
|
|
|
struct shell_test st = {
|
|
|
|
.dir = shell_tests__dir(path_dir, sizeof(path_dir)),
|
|
|
|
};
|
|
|
|
|
|
|
|
if (st.dir == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
dir = opendir(st.dir);
|
2020-03-13 03:56:02 +03:00
|
|
|
if (!dir) {
|
|
|
|
pr_err("failed to open shell test directory: %s\n",
|
|
|
|
st.dir);
|
2017-08-03 22:49:15 +03:00
|
|
|
return -1;
|
2020-03-13 03:56:02 +03:00
|
|
|
}
|
2017-08-03 22:49:15 +03:00
|
|
|
|
2017-12-06 20:45:35 +03:00
|
|
|
for_each_shell_test(dir, st.dir, ent) {
|
2017-08-03 22:49:15 +03:00
|
|
|
int curr = i++;
|
|
|
|
char desc[256];
|
|
|
|
struct test test = {
|
|
|
|
.desc = shell_test__description(desc, sizeof(desc), st.dir, ent->d_name),
|
|
|
|
.func = shell_test__run,
|
|
|
|
.priv = &st,
|
|
|
|
};
|
|
|
|
|
2020-05-25 01:42:06 +03:00
|
|
|
if (!perf_test__matches(test.desc, curr, argc, argv))
|
2017-08-03 22:49:15 +03:00
|
|
|
continue;
|
|
|
|
|
|
|
|
st.file = ent->d_name;
|
|
|
|
pr_info("%2d: %-*s:", i, width, test.desc);
|
|
|
|
test_and_print(&test, false, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
closedir(dir);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-01-24 23:22:55 +04:00
|
|
|
static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
|
2011-11-29 18:52:07 +04:00
|
|
|
{
|
2015-09-05 22:02:20 +03:00
|
|
|
struct test *t;
|
2015-10-05 17:40:19 +03:00
|
|
|
unsigned int j;
|
2011-11-29 18:52:07 +04:00
|
|
|
int i = 0;
|
2017-08-03 22:49:15 +03:00
|
|
|
int width = shell_tests__max_desc_width();
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
|
2015-10-05 17:40:19 +03:00
|
|
|
for_each_test(j, t) {
|
2015-09-05 22:02:20 +03:00
|
|
|
int len = strlen(t->desc);
|
2012-10-24 21:44:41 +04:00
|
|
|
|
|
|
|
if (width < len)
|
|
|
|
width = len;
|
|
|
|
}
|
2012-10-31 02:01:43 +04:00
|
|
|
|
2015-10-05 17:40:19 +03:00
|
|
|
for_each_test(j, t) {
|
2011-11-29 18:52:07 +04:00
|
|
|
int curr = i++, err;
|
2020-05-25 01:42:06 +03:00
|
|
|
int subi;
|
2011-11-29 18:52:07 +04:00
|
|
|
|
2020-05-25 01:42:06 +03:00
|
|
|
if (!perf_test__matches(t->desc, curr, argc, argv)) {
|
|
|
|
bool skip = true;
|
|
|
|
int subn;
|
|
|
|
|
|
|
|
if (!t->subtest.get_nr)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
subn = t->subtest.get_nr();
|
|
|
|
|
|
|
|
for (subi = 0; subi < subn; subi++) {
|
|
|
|
if (perf_test__matches(t->subtest.get_desc(subi), curr, argc, argv))
|
|
|
|
skip = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (skip)
|
|
|
|
continue;
|
|
|
|
}
|
2011-11-29 18:52:07 +04:00
|
|
|
|
2017-06-01 23:54:50 +03:00
|
|
|
if (t->is_supported && !t->is_supported()) {
|
|
|
|
pr_debug("%2d: %-*s: Disabled\n", i, width, t->desc);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-09-05 22:02:20 +03:00
|
|
|
pr_info("%2d: %-*s:", i, width, t->desc);
|
2013-01-24 23:22:55 +04:00
|
|
|
|
|
|
|
if (intlist__find(skiplist, i)) {
|
|
|
|
color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip (user override)\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-11-17 11:32:48 +03:00
|
|
|
if (!t->subtest.get_nr) {
|
|
|
|
test_and_print(t, false, -1);
|
|
|
|
} else {
|
|
|
|
int subn = t->subtest.get_nr();
|
|
|
|
/*
|
|
|
|
* minus 2 to align with normal testcases.
|
|
|
|
* For subtest we print additional '.x' in number.
|
|
|
|
* for example:
|
|
|
|
*
|
|
|
|
* 35: Test LLVM searching and compiling :
|
|
|
|
* 35.1: Basic BPF llvm compiling test : Ok
|
|
|
|
*/
|
|
|
|
int subw = width > 2 ? width - 2 : width;
|
|
|
|
bool skip = false;
|
|
|
|
|
|
|
|
if (subn <= 0) {
|
|
|
|
color_fprintf(stderr, PERF_COLOR_YELLOW,
|
|
|
|
" Skip (not compiled in)\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
pr_info("\n");
|
|
|
|
|
|
|
|
for (subi = 0; subi < subn; subi++) {
|
|
|
|
int len = strlen(t->subtest.get_desc(subi));
|
|
|
|
|
|
|
|
if (subw < len)
|
|
|
|
subw = len;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (subi = 0; subi < subn; subi++) {
|
2020-05-25 01:42:06 +03:00
|
|
|
if (!perf_test__matches(t->subtest.get_desc(subi), curr, argc, argv))
|
|
|
|
continue;
|
|
|
|
|
2015-11-17 11:32:48 +03:00
|
|
|
pr_info("%2d.%1d: %-*s:", i, subi + 1, subw,
|
|
|
|
t->subtest.get_desc(subi));
|
2018-07-26 20:17:33 +03:00
|
|
|
err = test_and_print(t, skip, subi);
|
2015-11-17 11:32:48 +03:00
|
|
|
if (err != TEST_OK && t->subtest.skip_if_fail)
|
|
|
|
skip = true;
|
|
|
|
}
|
2012-12-19 18:33:39 +04:00
|
|
|
}
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
}
|
|
|
|
|
2017-08-03 22:49:15 +03:00
|
|
|
return run_shell_tests(argc, argv, i, width);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int perf_test__list_shell(int argc, const char **argv, int i)
|
|
|
|
{
|
|
|
|
DIR *dir;
|
|
|
|
struct dirent *ent;
|
|
|
|
char path_dir[PATH_MAX];
|
|
|
|
const char *path = shell_tests__dir(path_dir, sizeof(path_dir));
|
|
|
|
|
|
|
|
if (path == NULL)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
dir = opendir(path);
|
|
|
|
if (!dir)
|
|
|
|
return -1;
|
|
|
|
|
2017-12-06 20:45:35 +03:00
|
|
|
for_each_shell_test(dir, path, ent) {
|
2017-08-04 17:16:40 +03:00
|
|
|
int curr = i++;
|
2017-08-03 22:49:15 +03:00
|
|
|
char bf[256];
|
2017-08-04 17:16:40 +03:00
|
|
|
struct test t = {
|
|
|
|
.desc = shell_test__description(bf, sizeof(bf), path, ent->d_name),
|
|
|
|
};
|
2017-08-03 22:49:15 +03:00
|
|
|
|
2020-05-25 01:42:06 +03:00
|
|
|
if (!perf_test__matches(t.desc, curr, argc, argv))
|
2017-08-03 22:49:15 +03:00
|
|
|
continue;
|
|
|
|
|
2017-08-04 17:16:40 +03:00
|
|
|
pr_info("%2d: %s\n", i, t.desc);
|
2017-08-03 22:49:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
closedir(dir);
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-11-29 18:52:07 +04:00
|
|
|
static int perf_test__list(int argc, const char **argv)
|
|
|
|
{
|
2015-10-05 17:40:19 +03:00
|
|
|
unsigned int j;
|
2015-09-05 22:02:20 +03:00
|
|
|
struct test *t;
|
2011-11-29 18:52:07 +04:00
|
|
|
int i = 0;
|
|
|
|
|
2015-10-05 17:40:19 +03:00
|
|
|
for_each_test(j, t) {
|
2017-08-04 17:16:40 +03:00
|
|
|
int curr = i++;
|
2017-08-04 17:16:40 +03:00
|
|
|
|
2020-05-25 01:42:06 +03:00
|
|
|
if (!perf_test__matches(t->desc, curr, argc, argv) ||
|
2017-08-04 17:16:40 +03:00
|
|
|
(t->is_supported && !t->is_supported()))
|
2011-11-29 18:52:07 +04:00
|
|
|
continue;
|
|
|
|
|
2017-08-04 17:16:40 +03:00
|
|
|
pr_info("%2d: %s\n", i, t->desc);
|
2018-04-13 10:42:23 +03:00
|
|
|
|
|
|
|
if (t->subtest.get_nr) {
|
|
|
|
int subn = t->subtest.get_nr();
|
|
|
|
int subi;
|
|
|
|
|
|
|
|
for (subi = 0; subi < subn; subi++)
|
|
|
|
pr_info("%2d:%1d: %s\n", i, subi + 1,
|
|
|
|
t->subtest.get_desc(subi));
|
|
|
|
}
|
2011-11-29 18:52:07 +04:00
|
|
|
}
|
|
|
|
|
2017-08-03 22:49:15 +03:00
|
|
|
perf_test__list_shell(argc, argv, i);
|
|
|
|
|
2011-11-29 18:52:07 +04:00
|
|
|
return 0;
|
|
|
|
}
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
|
2017-03-27 17:47:20 +03:00
|
|
|
int cmd_test(int argc, const char **argv)
|
2011-11-29 18:52:07 +04:00
|
|
|
{
|
2015-03-18 16:35:55 +03:00
|
|
|
const char *test_usage[] = {
|
2011-11-29 18:52:07 +04:00
|
|
|
"perf test [<options>] [{list <test-name-fragment>|[<test-name-fragments>|<test-numbers>]}]",
|
|
|
|
NULL,
|
|
|
|
};
|
2013-01-24 23:22:55 +04:00
|
|
|
const char *skip = NULL;
|
2011-11-29 18:52:07 +04:00
|
|
|
const struct option test_options[] = {
|
2013-01-24 23:22:55 +04:00
|
|
|
OPT_STRING('s', "skip", &skip, "tests", "tests to skip"),
|
2012-01-07 21:25:26 +04:00
|
|
|
OPT_INCR('v', "verbose", &verbose,
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
"be more verbose (show symbol address, etc)"),
|
2016-06-28 14:29:01 +03:00
|
|
|
OPT_BOOLEAN('F', "dont-fork", &dont_fork,
|
|
|
|
"Do not fork for testcase"),
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
OPT_END()
|
2011-11-29 18:52:07 +04:00
|
|
|
};
|
2015-03-18 16:35:55 +03:00
|
|
|
const char * const test_subcommands[] = { "list", NULL };
|
2013-01-24 23:22:55 +04:00
|
|
|
struct intlist *skiplist = NULL;
|
2014-10-09 23:16:00 +04:00
|
|
|
int ret = hists__init();
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
return ret;
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
|
2015-03-18 16:35:55 +03:00
|
|
|
argc = parse_options_subcommand(argc, argv, test_options, test_subcommands, test_usage, 0);
|
2011-11-29 18:52:07 +04:00
|
|
|
if (argc >= 1 && !strcmp(argv[0], "list"))
|
2017-08-04 17:16:40 +03:00
|
|
|
return perf_test__list(argc - 1, argv + 1);
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
|
|
|
|
symbol_conf.priv_size = sizeof(int);
|
|
|
|
symbol_conf.sort_by_name = true;
|
|
|
|
symbol_conf.try_vmlinux_path = true;
|
|
|
|
|
2014-08-12 10:40:45 +04:00
|
|
|
if (symbol__init(NULL) < 0)
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
return -1;
|
|
|
|
|
2013-01-24 23:22:55 +04:00
|
|
|
if (skip != NULL)
|
|
|
|
skiplist = intlist__new(skip);
|
2019-07-09 22:27:01 +03:00
|
|
|
/*
|
|
|
|
* Tests that create BPF maps, for instance, need more than the 64K
|
|
|
|
* default:
|
|
|
|
*/
|
|
|
|
rlimit__bump_memlock();
|
2013-01-24 23:22:55 +04:00
|
|
|
|
|
|
|
return __cmd_test(argc, argv, skiplist);
|
perf test: Initial regression testing command
First an example with the first internal test:
[acme@doppio linux-2.6-tip]$ perf test
1: vmlinux symtab matches kallsyms: Ok
So it run just one test, that is "vmlinux symtab matches kallsyms", and it was
successful.
If we run it in verbose mode, we'll see details about errors and extra warnings
for non-fatal problems:
[acme@doppio linux-2.6-tip]$ perf test -v
1: vmlinux symtab matches kallsyms:
--- start ---
Looking at the vmlinux_path (5 entries long)
No build_id in vmlinux, ignoring it
No build_id in /boot/vmlinux, ignoring it
No build_id in /boot/vmlinux-2.6.34-rc4-tip+, ignoring it
Using /lib/modules/2.6.34-rc4-tip+/build/vmlinux for symbols
Maps only in vmlinux:
ffffffff81cb81b1-ffffffff81e1149b 0 [kernel].init.text
ffffffff81e1149c-ffffffff9fffffff 0 [kernel].exit.text
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2
Maps in vmlinux with a different name in kallsyms:
ffffffffff600000-ffffffffff6000ff 0 [kernel].vsyscall_0 in kallsyms as [kernel].0
ffffffffff600100-ffffffffff6003ff 0 [kernel].vsyscall_fn in kallsyms as:
*ffffffffff600100-ffffffffff60012f 0 [kernel].2
ffffffffff600400-ffffffffff6007ff 0 [kernel].vsyscall_1 in kallsyms as [kernel].6
ffffffffff600800-ffffffffffffffff 0 [kernel].vsyscall_2 in kallsyms as [kernel].8
Maps only in kallsyms:
ffffffffff600130-ffffffffff6003ff 0 [kernel].4
---- end ----
vmlinux symtab matches kallsyms: Ok
[acme@doppio linux-2.6-tip]$
In the above case we only know the name of the non contiguous kernel ranges in
the address space when reading the symbol information from the ELF symtab in
vmlinux.
The /proc/kallsyms file lack this, we only notice they are separate because
there are modules after the kernel and after that more kernel functions, so we
need to have a module rbtree backed by the module .ko path to get symtabs in
the vmlinux case.
The tool uses it to match by address to emit appropriate warning, but don't
considers this fatal.
The .init.text and .exit.text ines, of course, aren't in kallsyms, so I left
these cases just as extra info in verbose mode.
The end of the sections also aren't in kallsyms, so we the symbols layer does
another pass and sets the end addresses as the next map start minus one, which
sometimes pads, causing harmless mismatches.
But at least the symbols match, tested it by copying /proc/kallsyms to
/tmp/kallsyms and doing changes to see if they were detected.
This first test also should serve as a first stab at documenting the
symbol library by providing a self contained example that exercises it
together with comments about what is being done.
More tests to check if actions done on a monitored app, like doing mmaps, etc,
makes the kernel generate the expected events should be added next.
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2010-04-30 01:58:32 +04:00
|
|
|
}
|