diff options
author | Riku Voipio <riku.voipio@linaro.org> | 2015-04-16 09:52:53 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-05-29 11:43:41 -0400 |
commit | 43f322b4ab3f203d8eefbdad6e58e1637221e4a7 (patch) | |
tree | bec98764c8084937c6bbb5a6c4f8469b7f03d8b8 | |
parent | 3237f28188c3e41a938781a369652772a23e97a9 (diff) |
perf tests: Switch from open to openat
Multiple perf tests fail on arm64 due to missing open syscall:
2: detect open syscall event : FAILED!
open(2) is a legacy syscall, replaced with openat(2) since 2.6.16. Thus
new architectures in kernel, such as arm64, don't implement these legacy
syscalls.
The patch replaces all sys_enter_open events with sys_enter_openat,
renames the related tests and test output to avoid confusion.
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Reviewed-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1429192375-13706-2-git-send-email-riku.voipio@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/tests/builtin-test.c | 12 | ||||
-rw-r--r-- | tools/perf/tests/open-syscall-all-cpus.c | 12 | ||||
-rw-r--r-- | tools/perf/tests/open-syscall-tp-fields.c | 6 | ||||
-rw-r--r-- | tools/perf/tests/open-syscall.c | 14 | ||||
-rw-r--r-- | tools/perf/tests/parse-events.c | 12 | ||||
-rw-r--r-- | tools/perf/tests/tests.h | 6 |
6 files changed, 31 insertions, 31 deletions
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index b5b87a24a9e7..87b9961646e4 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c | |||
@@ -23,12 +23,12 @@ static struct test { | |||
23 | .func = test__vmlinux_matches_kallsyms, | 23 | .func = test__vmlinux_matches_kallsyms, |
24 | }, | 24 | }, |
25 | { | 25 | { |
26 | .desc = "detect open syscall event", | 26 | .desc = "detect openat syscall event", |
27 | .func = test__open_syscall_event, | 27 | .func = test__openat_syscall_event, |
28 | }, | 28 | }, |
29 | { | 29 | { |
30 | .desc = "detect open syscall event on all cpus", | 30 | .desc = "detect openat syscall event on all cpus", |
31 | .func = test__open_syscall_event_on_all_cpus, | 31 | .func = test__openat_syscall_event_on_all_cpus, |
32 | }, | 32 | }, |
33 | { | 33 | { |
34 | .desc = "read samples using the mmap interface", | 34 | .desc = "read samples using the mmap interface", |
@@ -73,8 +73,8 @@ static struct test { | |||
73 | .func = test__perf_evsel__tp_sched_test, | 73 | .func = test__perf_evsel__tp_sched_test, |
74 | }, | 74 | }, |
75 | { | 75 | { |
76 | .desc = "Generate and check syscalls:sys_enter_open event fields", | 76 | .desc = "Generate and check syscalls:sys_enter_openat event fields", |
77 | .func = test__syscall_open_tp_fields, | 77 | .func = test__syscall_openat_tp_fields, |
78 | }, | 78 | }, |
79 | { | 79 | { |
80 | .desc = "struct perf_event_attr setup", | 80 | .desc = "struct perf_event_attr setup", |
diff --git a/tools/perf/tests/open-syscall-all-cpus.c b/tools/perf/tests/open-syscall-all-cpus.c index 3ec885c48f8f..e34dfdf96b5a 100644 --- a/tools/perf/tests/open-syscall-all-cpus.c +++ b/tools/perf/tests/open-syscall-all-cpus.c | |||
@@ -4,12 +4,12 @@ | |||
4 | #include "cpumap.h" | 4 | #include "cpumap.h" |
5 | #include "debug.h" | 5 | #include "debug.h" |
6 | 6 | ||
7 | int test__open_syscall_event_on_all_cpus(void) | 7 | int test__openat_syscall_event_on_all_cpus(void) |
8 | { | 8 | { |
9 | int err = -1, fd, cpu; | 9 | int err = -1, fd, cpu; |
10 | struct cpu_map *cpus; | 10 | struct cpu_map *cpus; |
11 | struct perf_evsel *evsel; | 11 | struct perf_evsel *evsel; |
12 | unsigned int nr_open_calls = 111, i; | 12 | unsigned int nr_openat_calls = 111, i; |
13 | cpu_set_t cpu_set; | 13 | cpu_set_t cpu_set; |
14 | struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX); | 14 | struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX); |
15 | char sbuf[STRERR_BUFSIZE]; | 15 | char sbuf[STRERR_BUFSIZE]; |
@@ -27,7 +27,7 @@ int test__open_syscall_event_on_all_cpus(void) | |||
27 | 27 | ||
28 | CPU_ZERO(&cpu_set); | 28 | CPU_ZERO(&cpu_set); |
29 | 29 | ||
30 | evsel = perf_evsel__newtp("syscalls", "sys_enter_open"); | 30 | evsel = perf_evsel__newtp("syscalls", "sys_enter_openat"); |
31 | if (evsel == NULL) { | 31 | if (evsel == NULL) { |
32 | if (tracefs_configured()) | 32 | if (tracefs_configured()) |
33 | pr_debug("is tracefs mounted on /sys/kernel/tracing?\n"); | 33 | pr_debug("is tracefs mounted on /sys/kernel/tracing?\n"); |
@@ -46,7 +46,7 @@ int test__open_syscall_event_on_all_cpus(void) | |||
46 | } | 46 | } |
47 | 47 | ||
48 | for (cpu = 0; cpu < cpus->nr; ++cpu) { | 48 | for (cpu = 0; cpu < cpus->nr; ++cpu) { |
49 | unsigned int ncalls = nr_open_calls + cpu; | 49 | unsigned int ncalls = nr_openat_calls + cpu; |
50 | /* | 50 | /* |
51 | * XXX eventually lift this restriction in a way that | 51 | * XXX eventually lift this restriction in a way that |
52 | * keeps perf building on older glibc installations | 52 | * keeps perf building on older glibc installations |
@@ -66,7 +66,7 @@ int test__open_syscall_event_on_all_cpus(void) | |||
66 | goto out_close_fd; | 66 | goto out_close_fd; |
67 | } | 67 | } |
68 | for (i = 0; i < ncalls; ++i) { | 68 | for (i = 0; i < ncalls; ++i) { |
69 | fd = open("/etc/passwd", O_RDONLY); | 69 | fd = openat(0, "/etc/passwd", O_RDONLY); |
70 | close(fd); | 70 | close(fd); |
71 | } | 71 | } |
72 | CPU_CLR(cpus->map[cpu], &cpu_set); | 72 | CPU_CLR(cpus->map[cpu], &cpu_set); |
@@ -96,7 +96,7 @@ int test__open_syscall_event_on_all_cpus(void) | |||
96 | break; | 96 | break; |
97 | } | 97 | } |
98 | 98 | ||
99 | expected = nr_open_calls + cpu; | 99 | expected = nr_openat_calls + cpu; |
100 | if (evsel->counts->cpu[cpu].val != expected) { | 100 | if (evsel->counts->cpu[cpu].val != expected) { |
101 | pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls on cpu %d, got %" PRIu64 "\n", | 101 | pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls on cpu %d, got %" PRIu64 "\n", |
102 | expected, cpus->map[cpu], evsel->counts->cpu[cpu].val); | 102 | expected, cpus->map[cpu], evsel->counts->cpu[cpu].val); |
diff --git a/tools/perf/tests/open-syscall-tp-fields.c b/tools/perf/tests/open-syscall-tp-fields.c index 127dcae0b760..6245221479d7 100644 --- a/tools/perf/tests/open-syscall-tp-fields.c +++ b/tools/perf/tests/open-syscall-tp-fields.c | |||
@@ -5,7 +5,7 @@ | |||
5 | #include "tests.h" | 5 | #include "tests.h" |
6 | #include "debug.h" | 6 | #include "debug.h" |
7 | 7 | ||
8 | int test__syscall_open_tp_fields(void) | 8 | int test__syscall_openat_tp_fields(void) |
9 | { | 9 | { |
10 | struct record_opts opts = { | 10 | struct record_opts opts = { |
11 | .target = { | 11 | .target = { |
@@ -29,7 +29,7 @@ int test__syscall_open_tp_fields(void) | |||
29 | goto out; | 29 | goto out; |
30 | } | 30 | } |
31 | 31 | ||
32 | evsel = perf_evsel__newtp("syscalls", "sys_enter_open"); | 32 | evsel = perf_evsel__newtp("syscalls", "sys_enter_openat"); |
33 | if (evsel == NULL) { | 33 | if (evsel == NULL) { |
34 | pr_debug("%s: perf_evsel__newtp\n", __func__); | 34 | pr_debug("%s: perf_evsel__newtp\n", __func__); |
35 | goto out_delete_evlist; | 35 | goto out_delete_evlist; |
@@ -66,7 +66,7 @@ int test__syscall_open_tp_fields(void) | |||
66 | /* | 66 | /* |
67 | * Generate the event: | 67 | * Generate the event: |
68 | */ | 68 | */ |
69 | open(filename, flags); | 69 | openat(AT_FDCWD, filename, flags); |
70 | 70 | ||
71 | while (1) { | 71 | while (1) { |
72 | int before = nr_events; | 72 | int before = nr_events; |
diff --git a/tools/perf/tests/open-syscall.c b/tools/perf/tests/open-syscall.c index 07aa319bf334..9f9491bb8e48 100644 --- a/tools/perf/tests/open-syscall.c +++ b/tools/perf/tests/open-syscall.c | |||
@@ -3,11 +3,11 @@ | |||
3 | #include "debug.h" | 3 | #include "debug.h" |
4 | #include "tests.h" | 4 | #include "tests.h" |
5 | 5 | ||
6 | int test__open_syscall_event(void) | 6 | int test__openat_syscall_event(void) |
7 | { | 7 | { |
8 | int err = -1, fd; | 8 | int err = -1, fd; |
9 | struct perf_evsel *evsel; | 9 | struct perf_evsel *evsel; |
10 | unsigned int nr_open_calls = 111, i; | 10 | unsigned int nr_openat_calls = 111, i; |
11 | struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX); | 11 | struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX); |
12 | char sbuf[STRERR_BUFSIZE]; | 12 | char sbuf[STRERR_BUFSIZE]; |
13 | 13 | ||
@@ -16,7 +16,7 @@ int test__open_syscall_event(void) | |||
16 | return -1; | 16 | return -1; |
17 | } | 17 | } |
18 | 18 | ||
19 | evsel = perf_evsel__newtp("syscalls", "sys_enter_open"); | 19 | evsel = perf_evsel__newtp("syscalls", "sys_enter_openat"); |
20 | if (evsel == NULL) { | 20 | if (evsel == NULL) { |
21 | if (tracefs_configured()) | 21 | if (tracefs_configured()) |
22 | pr_debug("is tracefs mounted on /sys/kernel/tracing?\n"); | 22 | pr_debug("is tracefs mounted on /sys/kernel/tracing?\n"); |
@@ -34,8 +34,8 @@ int test__open_syscall_event(void) | |||
34 | goto out_evsel_delete; | 34 | goto out_evsel_delete; |
35 | } | 35 | } |
36 | 36 | ||
37 | for (i = 0; i < nr_open_calls; ++i) { | 37 | for (i = 0; i < nr_openat_calls; ++i) { |
38 | fd = open("/etc/passwd", O_RDONLY); | 38 | fd = openat(0, "/etc/passwd", O_RDONLY); |
39 | close(fd); | 39 | close(fd); |
40 | } | 40 | } |
41 | 41 | ||
@@ -44,9 +44,9 @@ int test__open_syscall_event(void) | |||
44 | goto out_close_fd; | 44 | goto out_close_fd; |
45 | } | 45 | } |
46 | 46 | ||
47 | if (evsel->counts->cpu[0].val != nr_open_calls) { | 47 | if (evsel->counts->cpu[0].val != nr_openat_calls) { |
48 | pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls, got %" PRIu64 "\n", | 48 | pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls, got %" PRIu64 "\n", |
49 | nr_open_calls, evsel->counts->cpu[0].val); | 49 | nr_openat_calls, evsel->counts->cpu[0].val); |
50 | goto out_close_fd; | 50 | goto out_close_fd; |
51 | } | 51 | } |
52 | 52 | ||
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 82d2a1636f7f..d76963f7ad3d 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c | |||
@@ -427,7 +427,7 @@ static int test__checkevent_list(struct perf_evlist *evlist) | |||
427 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); | 427 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); |
428 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 428 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
429 | 429 | ||
430 | /* syscalls:sys_enter_open:k */ | 430 | /* syscalls:sys_enter_openat:k */ |
431 | evsel = perf_evsel__next(evsel); | 431 | evsel = perf_evsel__next(evsel); |
432 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type); | 432 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type); |
433 | TEST_ASSERT_VAL("wrong sample_type", | 433 | TEST_ASSERT_VAL("wrong sample_type", |
@@ -665,7 +665,7 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused) | |||
665 | TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->nr_entries); | 665 | TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->nr_entries); |
666 | TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups); | 666 | TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups); |
667 | 667 | ||
668 | /* group1 syscalls:sys_enter_open:H */ | 668 | /* group1 syscalls:sys_enter_openat:H */ |
669 | evsel = leader = perf_evlist__first(evlist); | 669 | evsel = leader = perf_evlist__first(evlist); |
670 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type); | 670 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type); |
671 | TEST_ASSERT_VAL("wrong sample_type", | 671 | TEST_ASSERT_VAL("wrong sample_type", |
@@ -1293,7 +1293,7 @@ struct evlist_test { | |||
1293 | 1293 | ||
1294 | static struct evlist_test test__events[] = { | 1294 | static struct evlist_test test__events[] = { |
1295 | { | 1295 | { |
1296 | .name = "syscalls:sys_enter_open", | 1296 | .name = "syscalls:sys_enter_openat", |
1297 | .check = test__checkevent_tracepoint, | 1297 | .check = test__checkevent_tracepoint, |
1298 | .id = 0, | 1298 | .id = 0, |
1299 | }, | 1299 | }, |
@@ -1353,7 +1353,7 @@ static struct evlist_test test__events[] = { | |||
1353 | .id = 11, | 1353 | .id = 11, |
1354 | }, | 1354 | }, |
1355 | { | 1355 | { |
1356 | .name = "syscalls:sys_enter_open:k", | 1356 | .name = "syscalls:sys_enter_openat:k", |
1357 | .check = test__checkevent_tracepoint_modifier, | 1357 | .check = test__checkevent_tracepoint_modifier, |
1358 | .id = 12, | 1358 | .id = 12, |
1359 | }, | 1359 | }, |
@@ -1408,7 +1408,7 @@ static struct evlist_test test__events[] = { | |||
1408 | .id = 22, | 1408 | .id = 22, |
1409 | }, | 1409 | }, |
1410 | { | 1410 | { |
1411 | .name = "r1,syscalls:sys_enter_open:k,1:1:hp", | 1411 | .name = "r1,syscalls:sys_enter_openat:k,1:1:hp", |
1412 | .check = test__checkevent_list, | 1412 | .check = test__checkevent_list, |
1413 | .id = 23, | 1413 | .id = 23, |
1414 | }, | 1414 | }, |
@@ -1443,7 +1443,7 @@ static struct evlist_test test__events[] = { | |||
1443 | .id = 29, | 1443 | .id = 29, |
1444 | }, | 1444 | }, |
1445 | { | 1445 | { |
1446 | .name = "group1{syscalls:sys_enter_open:H,cycles:kppp},group2{cycles,1:3}:G,instructions:u", | 1446 | .name = "group1{syscalls:sys_enter_openat:H,cycles:kppp},group2{cycles,1:3}:G,instructions:u", |
1447 | .check = test__group3, | 1447 | .check = test__group3, |
1448 | .id = 30, | 1448 | .id = 30, |
1449 | }, | 1449 | }, |
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h index 87bcaf16ae99..8e5038b48ba8 100644 --- a/tools/perf/tests/tests.h +++ b/tools/perf/tests/tests.h | |||
@@ -26,14 +26,14 @@ enum { | |||
26 | 26 | ||
27 | /* Tests */ | 27 | /* Tests */ |
28 | int test__vmlinux_matches_kallsyms(void); | 28 | int test__vmlinux_matches_kallsyms(void); |
29 | int test__open_syscall_event(void); | 29 | int test__openat_syscall_event(void); |
30 | int test__open_syscall_event_on_all_cpus(void); | 30 | int test__openat_syscall_event_on_all_cpus(void); |
31 | int test__basic_mmap(void); | 31 | int test__basic_mmap(void); |
32 | int test__PERF_RECORD(void); | 32 | int test__PERF_RECORD(void); |
33 | int test__rdpmc(void); | 33 | int test__rdpmc(void); |
34 | int test__perf_evsel__roundtrip_name_test(void); | 34 | int test__perf_evsel__roundtrip_name_test(void); |
35 | int test__perf_evsel__tp_sched_test(void); | 35 | int test__perf_evsel__tp_sched_test(void); |
36 | int test__syscall_open_tp_fields(void); | 36 | int test__syscall_openat_tp_fields(void); |
37 | int test__pmu(void); | 37 | int test__pmu(void); |
38 | int test__attr(void); | 38 | int test__attr(void); |
39 | int test__dso_data(void); | 39 | int test__dso_data(void); |