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 04:58:32 +07:00
|
|
|
/*
|
|
|
|
* builtin-test.c
|
|
|
|
*
|
|
|
|
* Builtin regression testing command: ever growing number of sanity tests
|
|
|
|
*/
|
2017-04-18 20:46:11 +07:00
|
|
|
#include <errno.h>
|
2014-05-10 22:22:30 +07:00
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.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 04:58:32 +07:00
|
|
|
#include "builtin.h"
|
2014-10-10 02:16:00 +07:00
|
|
|
#include "hist.h"
|
2013-01-25 02:22:55 +07:00
|
|
|
#include "intlist.h"
|
2012-11-10 07:46:41 +07:00
|
|
|
#include "tests.h"
|
2012-11-10 07:46:51 +07:00
|
|
|
#include "debug.h"
|
|
|
|
#include "color.h"
|
2015-12-15 22:39:39 +07:00
|
|
|
#include <subcmd/parse-options.h>
|
2012-11-10 07:46:51 +07:00
|
|
|
#include "symbol.h"
|
2017-04-17 21:39:06 +07:00
|
|
|
#include <linux/kernel.h>
|
2011-01-04 20:55:27 +07:00
|
|
|
|
2016-06-28 18:29:01 +07:00
|
|
|
static bool dont_fork;
|
|
|
|
|
2015-10-05 21:40:19 +07: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 04:58:32 +07:00
|
|
|
{
|
|
|
|
.desc = "vmlinux symtab matches kallsyms",
|
|
|
|
.func = test__vmlinux_matches_kallsyms,
|
|
|
|
},
|
2011-01-04 09:16:20 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Detect openat syscall event",
|
2015-04-16 20:52:53 +07:00
|
|
|
.func = test__openat_syscall_event,
|
2011-01-04 09:16:20 +07:00
|
|
|
},
|
2011-01-04 20:55:27 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Detect openat syscall event on all cpus",
|
2015-04-16 20:52:53 +07:00
|
|
|
.func = test__openat_syscall_event_on_all_cpus,
|
2011-01-04 20:55:27 +07:00
|
|
|
},
|
2011-01-15 19:42:46 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Read samples using the mmap interface",
|
2011-01-15 19:42:46 +07:00
|
|
|
.func = test__basic_mmap,
|
|
|
|
},
|
2011-07-14 16:25:33 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Parse event definition strings",
|
2012-11-10 07:46:51 +07:00
|
|
|
.func = test__parse_events,
|
2011-07-14 16:25:33 +07:00
|
|
|
},
|
2017-03-21 03:17:05 +07:00
|
|
|
{
|
|
|
|
.desc = "Simple expression parser",
|
|
|
|
.func = test__expr,
|
|
|
|
},
|
2011-12-02 20:13:50 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "PERF_RECORD_* events & perf_sample fields",
|
2011-12-02 20:13:50 +07:00
|
|
|
.func = test__PERF_RECORD,
|
|
|
|
},
|
2012-03-16 02:09:17 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Parse perf pmu format",
|
2012-11-10 07:46:50 +07:00
|
|
|
.func = test__pmu,
|
2012-03-16 02:09:17 +07:00
|
|
|
},
|
2012-07-22 19:14:40 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "DSO data read",
|
2012-11-10 07:46:51 +07:00
|
|
|
.func = test__dso_data,
|
2012-07-22 19:14:40 +07:00
|
|
|
},
|
2014-05-12 19:43:53 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "DSO data cache",
|
2014-05-12 19:43:53 +07:00
|
|
|
.func = test__dso_data_cache,
|
|
|
|
},
|
2014-05-12 19:50:03 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "DSO data reopen",
|
2014-05-12 19:50:03 +07:00
|
|
|
.func = test__dso_data_reopen,
|
|
|
|
},
|
2012-09-06 23:11:18 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Roundtrip evsel->name",
|
2012-11-10 07:46:47 +07:00
|
|
|
.func = test__perf_evsel__roundtrip_name_test,
|
2012-09-06 23:11:18 +07:00
|
|
|
},
|
2012-09-18 21:56:28 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Parse sched tracepoints fields",
|
2012-11-10 07:46:48 +07:00
|
|
|
.func = test__perf_evsel__tp_sched_test,
|
2012-09-18 21:56:28 +07:00
|
|
|
},
|
2012-09-26 23:23:10 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "syscalls:sys_enter_openat event fields",
|
2015-04-16 20:52:53 +07:00
|
|
|
.func = test__syscall_openat_tp_fields,
|
2012-09-26 23:23:10 +07:00
|
|
|
},
|
2012-10-31 05:02:05 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Setup struct perf_event_attr",
|
2012-11-10 07:46:51 +07:00
|
|
|
.func = test__attr,
|
2012-10-31 05:02:05 +07:00
|
|
|
},
|
2012-12-10 15:29:57 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Match and link multiple hists",
|
2012-12-10 15:29:57 +07:00
|
|
|
.func = test__hists_link,
|
|
|
|
},
|
2012-12-14 23:06:13 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "'import perf' in python",
|
2012-12-14 23:06:13 +07:00
|
|
|
.func = test__python_use,
|
|
|
|
},
|
2013-03-11 01:41:10 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Breakpoint overflow signal handler",
|
2013-03-11 01:41:10 +07:00
|
|
|
.func = test__bp_signal,
|
|
|
|
},
|
2013-03-11 01:41:11 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Breakpoint overflow sampling",
|
2013-03-11 01:41:11 +07:00
|
|
|
.func = test__bp_signal_overflow,
|
|
|
|
},
|
2013-03-15 12:58:11 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Number of exit events of a simple workload",
|
2013-03-15 12:58:11 +07:00
|
|
|
.func = test__task_exit,
|
|
|
|
},
|
2013-03-18 09:41:47 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Software clock events period values",
|
2013-03-18 09:41:47 +07:00
|
|
|
.func = test__sw_clock_freq,
|
|
|
|
},
|
2013-08-07 18:38:45 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Object code reading",
|
2013-08-07 18:38:45 +07:00
|
|
|
.func = test__code_reading,
|
|
|
|
},
|
2013-08-27 15:23:13 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Sample parsing",
|
2013-08-27 15:23:13 +07:00
|
|
|
.func = test__sample_parsing,
|
|
|
|
},
|
2013-09-01 01:50:53 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Use a dummy software event to keep tracking",
|
2013-09-01 01:50:53 +07:00
|
|
|
.func = test__keep_tracking,
|
|
|
|
},
|
2013-09-05 03:18:16 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Parse with no sample_id_all bit set",
|
2013-09-05 03:18:16 +07:00
|
|
|
.func = test__parse_no_sample_id_all,
|
|
|
|
},
|
2014-04-25 10:28:14 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Filter hist entries",
|
2014-04-25 10:28:14 +07:00
|
|
|
.func = test__hists_filter,
|
|
|
|
},
|
2014-03-05 23:20:31 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Lookup mmap thread",
|
2014-03-05 23:20:31 +07:00
|
|
|
.func = test__mmap_thread_lookup,
|
|
|
|
},
|
2014-03-17 20:39:00 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Share thread mg",
|
2014-03-17 20:39:00 +07:00
|
|
|
.func = test__thread_mg_share,
|
|
|
|
},
|
2014-05-12 12:43:18 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Sort output of hist entries",
|
2014-05-12 12:43:18 +07:00
|
|
|
.func = test__hists_output,
|
|
|
|
},
|
2014-05-23 16:04:42 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Cumulate child hist entries",
|
2014-05-23 16:04:42 +07:00
|
|
|
.func = test__hists_cumulate,
|
|
|
|
},
|
2014-08-16 02:08:36 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Track with sched_switch",
|
2014-08-16 02:08:36 +07: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 09:34:06 +07:00
|
|
|
{
|
2014-09-04 04:02:59 +07: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 09:34:06 +07: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-19 02:49:00 +07:00
|
|
|
{
|
2014-09-04 04:02:59 +07: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-19 02:49:00 +07: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 21:40:25 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07: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 21:40:25 +07:00
|
|
|
.func = test__kmod_path__parse,
|
|
|
|
},
|
2015-06-26 16:29:08 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Thread map",
|
2015-06-26 16:29:08 +07:00
|
|
|
.func = test__thread_map,
|
|
|
|
},
|
2015-07-08 17:04:02 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "LLVM search and compile",
|
2015-07-08 17:04:02 +07:00
|
|
|
.func = test__llvm,
|
2015-11-17 15:32:48 +07:00
|
|
|
.subtest = {
|
|
|
|
.skip_if_fail = true,
|
|
|
|
.get_nr = test__llvm_subtest_get_nr,
|
|
|
|
.get_desc = test__llvm_subtest_get_desc,
|
|
|
|
},
|
2015-07-08 17:04:02 +07:00
|
|
|
},
|
2015-09-04 15:58:31 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Session topology",
|
2015-09-04 15:58:31 +07:00
|
|
|
.func = test_session_topology,
|
|
|
|
},
|
2015-11-06 20:49:43 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "BPF filter",
|
2015-11-06 20:49:43 +07:00
|
|
|
.func = test__bpf,
|
2015-11-17 15:32:49 +07:00
|
|
|
.subtest = {
|
|
|
|
.skip_if_fail = true,
|
|
|
|
.get_nr = test__bpf_subtest_get_nr,
|
|
|
|
.get_desc = test__bpf_subtest_get_desc,
|
|
|
|
},
|
2015-11-06 20:49:43 +07:00
|
|
|
},
|
2015-10-25 21:51:20 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Synthesize thread map",
|
2015-10-25 21:51:20 +07:00
|
|
|
.func = test__thread_map_synthesize,
|
|
|
|
},
|
2016-12-12 17:35:41 +07:00
|
|
|
{
|
|
|
|
.desc = "Remove thread map",
|
|
|
|
.func = test__thread_map_remove,
|
|
|
|
},
|
2015-10-25 21:51:24 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Synthesize cpu map",
|
2015-10-25 21:51:24 +07:00
|
|
|
.func = test__cpu_map_synthesize,
|
|
|
|
},
|
2015-10-25 21:51:28 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Synthesize stat config",
|
2015-10-25 21:51:28 +07:00
|
|
|
.func = test__synthesize_stat_config,
|
|
|
|
},
|
2015-10-25 21:51:31 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Synthesize stat",
|
2015-10-25 21:51:31 +07:00
|
|
|
.func = test__synthesize_stat,
|
|
|
|
},
|
2015-10-25 21:51:34 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Synthesize stat round",
|
2015-10-25 21:51:34 +07:00
|
|
|
.func = test__synthesize_stat_round,
|
|
|
|
},
|
2015-10-25 21:51:37 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Synthesize attr update",
|
2015-10-25 21:51:37 +07: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 19:52:20 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07: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 19:52:20 +07:00
|
|
|
.func = test__event_times,
|
|
|
|
},
|
2016-05-09 08:47:51 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Read backward ring buffer",
|
2016-05-09 08:47:51 +07:00
|
|
|
.func = test__backward_ring_buffer,
|
|
|
|
},
|
2016-06-28 18:29:04 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Print cpu map",
|
2016-06-28 18:29:04 +07:00
|
|
|
.func = test__cpu_map_print,
|
|
|
|
},
|
2016-07-12 17:06:05 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Probe SDT events",
|
2016-07-12 17:06:05 +07:00
|
|
|
.func = test__sdt_event,
|
|
|
|
},
|
2016-07-16 23:11:20 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "is_printable_array",
|
2016-07-16 23:11:20 +07:00
|
|
|
.func = test__is_printable_array,
|
|
|
|
},
|
2016-08-02 01:02:32 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "Print bitmap",
|
2016-08-02 01:02:32 +07:00
|
|
|
.func = test__bitmap_print,
|
|
|
|
},
|
2016-11-26 14:03:28 +07:00
|
|
|
{
|
2016-11-29 22:38:14 +07:00
|
|
|
.desc = "perf hooks",
|
2016-11-26 14:03:28 +07:00
|
|
|
.func = test__perf_hooks,
|
|
|
|
},
|
2016-11-26 14:03:34 +07: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 16:51:55 +07:00
|
|
|
{
|
|
|
|
.desc = "unit_number__scnprintf",
|
|
|
|
.func = test__unit_number__scnprint,
|
|
|
|
},
|
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 04:58:32 +07:00
|
|
|
{
|
|
|
|
.func = NULL,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2015-10-05 21:40:19 +07:00
|
|
|
static struct test *tests[] = {
|
|
|
|
generic_tests,
|
|
|
|
arch_tests,
|
|
|
|
};
|
|
|
|
|
2015-09-06 02:02:20 +07:00
|
|
|
static bool perf_test__matches(struct test *test, 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 04:58:32 +07:00
|
|
|
{
|
2011-11-29 21:52:07 +07: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 04:58:32 +07:00
|
|
|
|
2015-11-07 03:03:38 +07:00
|
|
|
if (strcasestr(test->desc, argv[i]))
|
2011-11-29 21:52:07 +07: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 22:01:48 +07:00
|
|
|
static int run_test(struct test *test, int subtest)
|
2014-05-10 22:22:30 +07:00
|
|
|
{
|
2016-06-28 18:29:01 +07:00
|
|
|
int status, err = -1, child = dont_fork ? 0 : fork();
|
2014-08-14 09:22:45 +07:00
|
|
|
char sbuf[STRERR_BUFSIZE];
|
2014-05-10 22:22:30 +07:00
|
|
|
|
|
|
|
if (child < 0) {
|
2014-08-14 09:22:45 +07: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 21:56:20 +07:00
|
|
|
str_error_r(errno, sbuf, sizeof(sbuf)));
|
2014-05-10 22:22:30 +07:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!child) {
|
2016-06-28 18:29:01 +07:00
|
|
|
if (!dont_fork) {
|
|
|
|
pr_debug("test child forked, pid %d\n", getpid());
|
|
|
|
|
2017-02-17 15:17:38 +07:00
|
|
|
if (verbose <= 0) {
|
2016-06-28 18:29:01 +07: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 15:32:50 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 22:01:48 +07:00
|
|
|
err = test->func(subtest);
|
2016-06-28 18:29:01 +07:00
|
|
|
if (!dont_fork)
|
|
|
|
exit(err);
|
2014-05-10 22:22:30 +07:00
|
|
|
}
|
|
|
|
|
2016-06-28 18:29:01 +07:00
|
|
|
if (!dont_fork) {
|
|
|
|
wait(&status);
|
2014-05-10 22:22:30 +07:00
|
|
|
|
2016-06-28 18:29:01 +07: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 22:22:30 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2015-10-05 21:40:19 +07: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-06 02:02:20 +07:00
|
|
|
|
2015-11-17 15:32:48 +07: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
|
|
|
|
pr_debug("%s subtest %d:", t->desc, subtest);
|
|
|
|
|
|
|
|
switch (err) {
|
|
|
|
case TEST_OK:
|
|
|
|
pr_info(" Ok\n");
|
|
|
|
break;
|
|
|
|
case TEST_SKIP:
|
|
|
|
color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip\n");
|
|
|
|
break;
|
|
|
|
case TEST_FAIL:
|
|
|
|
default:
|
|
|
|
color_fprintf(stderr, PERF_COLOR_RED, " FAILED!\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2013-01-25 02:22:55 +07:00
|
|
|
static int __cmd_test(int argc, const char *argv[], struct intlist *skiplist)
|
2011-11-29 21:52:07 +07:00
|
|
|
{
|
2015-09-06 02:02:20 +07:00
|
|
|
struct test *t;
|
2015-10-05 21:40:19 +07:00
|
|
|
unsigned int j;
|
2011-11-29 21:52:07 +07:00
|
|
|
int i = 0;
|
2012-10-25 00:44:41 +07:00
|
|
|
int width = 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 04:58:32 +07:00
|
|
|
|
2015-10-05 21:40:19 +07:00
|
|
|
for_each_test(j, t) {
|
2015-09-06 02:02:20 +07:00
|
|
|
int len = strlen(t->desc);
|
2012-10-25 00:44:41 +07:00
|
|
|
|
|
|
|
if (width < len)
|
|
|
|
width = len;
|
|
|
|
}
|
2012-10-31 05:01:43 +07:00
|
|
|
|
2015-10-05 21:40:19 +07:00
|
|
|
for_each_test(j, t) {
|
2011-11-29 21:52:07 +07:00
|
|
|
int curr = i++, err;
|
|
|
|
|
2015-09-06 02:02:20 +07:00
|
|
|
if (!perf_test__matches(t, curr, argc, argv))
|
2011-11-29 21:52:07 +07:00
|
|
|
continue;
|
|
|
|
|
2015-09-06 02:02:20 +07:00
|
|
|
pr_info("%2d: %-*s:", i, width, t->desc);
|
2013-01-25 02:22:55 +07:00
|
|
|
|
|
|
|
if (intlist__find(skiplist, i)) {
|
|
|
|
color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip (user override)\n");
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2015-11-17 15:32:48 +07: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;
|
|
|
|
int subi;
|
|
|
|
|
|
|
|
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++) {
|
|
|
|
pr_info("%2d.%1d: %-*s:", i, subi + 1, subw,
|
|
|
|
t->subtest.get_desc(subi));
|
|
|
|
err = test_and_print(t, skip, subi);
|
|
|
|
if (err != TEST_OK && t->subtest.skip_if_fail)
|
|
|
|
skip = true;
|
|
|
|
}
|
2012-12-19 21:33:39 +07: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 04:58:32 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-11-29 21:52:07 +07:00
|
|
|
static int perf_test__list(int argc, const char **argv)
|
|
|
|
{
|
2015-10-05 21:40:19 +07:00
|
|
|
unsigned int j;
|
2015-09-06 02:02:20 +07:00
|
|
|
struct test *t;
|
2011-11-29 21:52:07 +07:00
|
|
|
int i = 0;
|
|
|
|
|
2015-10-05 21:40:19 +07:00
|
|
|
for_each_test(j, t) {
|
2015-09-06 02:02:20 +07:00
|
|
|
if (argc > 1 && !strstr(t->desc, argv[1]))
|
2011-11-29 21:52:07 +07:00
|
|
|
continue;
|
|
|
|
|
2015-09-06 02:02:20 +07:00
|
|
|
pr_info("%2d: %s\n", ++i, t->desc);
|
2011-11-29 21:52:07 +07: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 04:58:32 +07:00
|
|
|
|
2017-03-27 21:47:20 +07:00
|
|
|
int cmd_test(int argc, const char **argv)
|
2011-11-29 21:52:07 +07:00
|
|
|
{
|
2015-03-18 20:35:55 +07:00
|
|
|
const char *test_usage[] = {
|
2011-11-29 21:52:07 +07:00
|
|
|
"perf test [<options>] [{list <test-name-fragment>|[<test-name-fragments>|<test-numbers>]}]",
|
|
|
|
NULL,
|
|
|
|
};
|
2013-01-25 02:22:55 +07:00
|
|
|
const char *skip = NULL;
|
2011-11-29 21:52:07 +07:00
|
|
|
const struct option test_options[] = {
|
2013-01-25 02:22:55 +07:00
|
|
|
OPT_STRING('s', "skip", &skip, "tests", "tests to skip"),
|
2012-01-08 00:25:26 +07: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 04:58:32 +07:00
|
|
|
"be more verbose (show symbol address, etc)"),
|
2016-06-28 18:29:01 +07: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 04:58:32 +07:00
|
|
|
OPT_END()
|
2011-11-29 21:52:07 +07:00
|
|
|
};
|
2015-03-18 20:35:55 +07:00
|
|
|
const char * const test_subcommands[] = { "list", NULL };
|
2013-01-25 02:22:55 +07:00
|
|
|
struct intlist *skiplist = NULL;
|
2014-10-10 02:16:00 +07: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 04:58:32 +07:00
|
|
|
|
2015-03-18 20:35:55 +07:00
|
|
|
argc = parse_options_subcommand(argc, argv, test_options, test_subcommands, test_usage, 0);
|
2011-11-29 21:52:07 +07:00
|
|
|
if (argc >= 1 && !strcmp(argv[0], "list"))
|
|
|
|
return perf_test__list(argc, 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 04:58:32 +07:00
|
|
|
|
|
|
|
symbol_conf.priv_size = sizeof(int);
|
|
|
|
symbol_conf.sort_by_name = true;
|
|
|
|
symbol_conf.try_vmlinux_path = true;
|
|
|
|
|
2014-08-12 13:40:45 +07: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 04:58:32 +07:00
|
|
|
return -1;
|
|
|
|
|
2013-01-25 02:22:55 +07:00
|
|
|
if (skip != NULL)
|
|
|
|
skiplist = intlist__new(skip);
|
|
|
|
|
|
|
|
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 04:58:32 +07:00
|
|
|
}
|