diff options
| author | Khem Raj <raj.khem@gmail.com> | 2020-04-13 10:38:41 -0700 |
|---|---|---|
| committer | Andrei Gherzan <andrei@gherzan.ro> | 2020-04-15 11:35:23 +0100 |
| commit | 3b2ded5ae78434d1f5e87b501b0bc3806c4d5451 (patch) | |
| tree | 3be92862135b6ec0ea3c196e536743d30f7d170a | |
| parent | 8d163dd844c3737d1557395c1eb512ebac86bdc0 (diff) | |
| download | meta-raspberrypi-3b2ded5ae78434d1f5e87b501b0bc3806c4d5451.tar.gz | |
linux-raspberrypi_5.4.bb: Backport the patch to use CHECK macro instead of RET_IF
Revert couple of regressions for selftest
Fixes
| /usr/src/debug/kernel-selftest/1.0-r0/kernel-selftest-1.0/tools/testing/selftests/bpf/test_select_reuseport.c:671: undefined reference to `RET_IF'
Signed-off-by: Khem Raj <raj.khem@gmail.com>
4 files changed, 142 insertions, 18 deletions
diff --git a/recipes-kernel/linux/files/0001-Revert-selftests-bpf-Skip-perf-hw-events-test-if-the.patch b/recipes-kernel/linux/files/0001-Revert-selftests-bpf-Skip-perf-hw-events-test-if-the.patch new file mode 100644 index 0000000..59183dc --- /dev/null +++ b/recipes-kernel/linux/files/0001-Revert-selftests-bpf-Skip-perf-hw-events-test-if-the.patch | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | From a7783676c60dd90a6f4c26bcb9be03dc5703b74e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 13 Apr 2020 11:25:32 -0700 | ||
| 4 | Subject: [PATCH 1/2] Revert "selftests/bpf: Skip perf hw events test if the | ||
| 5 | setup disabled it" | ||
| 6 | |||
| 7 | This reverts commit da43712a7262891317883d4b3a909fb18dac4b1d. | ||
| 8 | --- | ||
| 9 | .../selftests/bpf/prog_tests/stacktrace_build_id_nmi.c | 8 ++------ | ||
| 10 | 1 file changed, 2 insertions(+), 6 deletions(-) | ||
| 11 | |||
| 12 | diff --git a/tools/testing/selftests/bpf/prog_tests/stacktrace_build_id_nmi.c b/tools/testing/selftests/bpf/prog_tests/stacktrace_build_id_nmi.c | ||
| 13 | index 1735faf17536..f62aa0eb959b 100644 | ||
| 14 | --- a/tools/testing/selftests/bpf/prog_tests/stacktrace_build_id_nmi.c | ||
| 15 | +++ b/tools/testing/selftests/bpf/prog_tests/stacktrace_build_id_nmi.c | ||
| 16 | @@ -49,12 +49,8 @@ void test_stacktrace_build_id_nmi(void) | ||
| 17 | pmu_fd = syscall(__NR_perf_event_open, &attr, -1 /* pid */, | ||
| 18 | 0 /* cpu 0 */, -1 /* group id */, | ||
| 19 | 0 /* flags */); | ||
| 20 | - if (pmu_fd < 0 && errno == ENOENT) { | ||
| 21 | - printf("%s:SKIP:no PERF_COUNT_HW_CPU_CYCLES\n", __func__); | ||
| 22 | - test__skip(); | ||
| 23 | - goto cleanup; | ||
| 24 | - } | ||
| 25 | - if (CHECK(pmu_fd < 0, "perf_event_open", "err %d errno %d\n", | ||
| 26 | + if (CHECK(pmu_fd < 0, "perf_event_open", | ||
| 27 | + "err %d errno %d. Does the test host support PERF_COUNT_HW_CPU_CYCLES?\n", | ||
| 28 | pmu_fd, errno)) | ||
| 29 | goto close_prog; | ||
| 30 | |||
| 31 | -- | ||
| 32 | 2.26.0 | ||
| 33 | |||
diff --git a/recipes-kernel/linux/files/0001-selftest-bpf-Use-CHECK-macro-instead-of-RET_IF.patch b/recipes-kernel/linux/files/0001-selftest-bpf-Use-CHECK-macro-instead-of-RET_IF.patch index 7d96514..1828934 100644 --- a/recipes-kernel/linux/files/0001-selftest-bpf-Use-CHECK-macro-instead-of-RET_IF.patch +++ b/recipes-kernel/linux/files/0001-selftest-bpf-Use-CHECK-macro-instead-of-RET_IF.patch | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | From 552084d4da41833a97d19d12f5ee5c3ba02e400a Mon Sep 17 00:00:00 2001 | 1 | From 4cd12df48b83cef9cc7d6b80b128afbf68746718 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sat, 14 Mar 2020 07:31:34 -0700 | 3 | Date: Sat, 14 Mar 2020 07:31:34 -0700 |
| 4 | Subject: [PATCH V2] selftest/bpf: Use CHECK macro instead of RET_IF | 4 | Subject: [PATCH] selftest/bpf: Use CHECK macro instead of RET_IF |
| 5 | 5 | ||
| 6 | backporting 634efb750435d0a489dc58477d4fcb88b2692942 causes build | 6 | backporting 634efb750435d0a489dc58477d4fcb88b2692942 causes build |
| 7 | failures because RET_IF is defined in 7ee0d4e97b889c0478af9c1a6e5af658b181423f | 7 | failures because RET_IF is defined in 7ee0d4e97b889c0478af9c1a6e5af658b181423f |
| @@ -11,36 +11,30 @@ Upstream-Status: Submitted | |||
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 12 | Cc: Jakub Sitnicki <jakub@cloudflare.com> | 12 | Cc: Jakub Sitnicki <jakub@cloudflare.com> |
| 13 | Cc: Alexei Starovoitov <ast@kernel.org> | 13 | Cc: Alexei Starovoitov <ast@kernel.org> |
| 14 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
| 14 | --- | 15 | --- |
| 15 | v2: Add return on check to get complete logic of RET_IF | 16 | tools/testing/selftests/bpf/test_select_reuseport.c | 4 ++-- |
| 16 | 17 | 1 file changed, 2 insertions(+), 2 deletions(-) | |
| 17 | tools/testing/selftests/bpf/test_select_reuseport.c | 10 ++++++---- | ||
| 18 | 1 file changed, 6 insertions(+), 4 deletions(-) | ||
| 19 | 18 | ||
| 20 | diff --git a/tools/testing/selftests/bpf/test_select_reuseport.c b/tools/testing/selftests/bpf/test_select_reuseport.c | 19 | diff --git a/tools/testing/selftests/bpf/test_select_reuseport.c b/tools/testing/selftests/bpf/test_select_reuseport.c |
| 21 | index cdbbdab2725f..093ef8547abb 100644 | 20 | index 079d0f5a2909..7e4c91f2238d 100644 |
| 22 | --- a/tools/testing/selftests/bpf/test_select_reuseport.c | 21 | --- a/tools/testing/selftests/bpf/test_select_reuseport.c |
| 23 | +++ b/tools/testing/selftests/bpf/test_select_reuseport.c | 22 | +++ b/tools/testing/selftests/bpf/test_select_reuseport.c |
| 24 | @@ -616,13 +616,15 @@ static void cleanup_per_test(void) | 23 | @@ -668,12 +668,12 @@ static void cleanup_per_test(void) |
| 25 | 24 | ||
| 26 | for (i = 0; i < NR_RESULTS; i++) { | 25 | for (i = 0; i < NR_RESULTS; i++) { |
| 27 | err = bpf_map_update_elem(result_map, &i, &zero, BPF_ANY); | 26 | err = bpf_map_update_elem(result_map, &i, &zero, BPF_ANY); |
| 28 | - RET_IF(err, "reset elem in result_map", | 27 | - RET_IF(err, "reset elem in result_map", |
| 29 | - "i:%u err:%d errno:%d\n", i, err, errno); | 28 | + CHECK(err, "reset elem in result_map", |
| 30 | + if (CHECK(err, "reset elem in result_map", | 29 | "i:%u err:%d errno:%d\n", i, err, errno); |
| 31 | + "i:%u err:%d errno:%d\n", i, err, errno)) | ||
| 32 | + return; | ||
| 33 | } | 30 | } |
| 34 | 31 | ||
| 35 | err = bpf_map_update_elem(linum_map, &zero, &zero, BPF_ANY); | 32 | err = bpf_map_update_elem(linum_map, &zero, &zero, BPF_ANY); |
| 36 | - RET_IF(err, "reset line number in linum_map", "err:%d errno:%d\n", | 33 | - RET_IF(err, "reset line number in linum_map", "err:%d errno:%d\n", |
| 37 | - err, errno); | 34 | + CHECK(err, "reset line number in linum_map", "err:%d errno:%d\n", |
| 38 | + if (CHECK(err, "reset line number in linum_map", "err:%d errno:%d\n", | 35 | err, errno); |
| 39 | + err, errno)) | ||
| 40 | + return; | ||
| 41 | 36 | ||
| 42 | for (i = 0; i < REUSEPORT_ARRAY_SIZE; i++) | 37 | for (i = 0; i < REUSEPORT_ARRAY_SIZE; i++) |
| 43 | close(sk_fds[i]); | ||
| 44 | -- | 38 | -- |
| 45 | 2.25.1 | 39 | 2.26.0 |
| 46 | 40 | ||
diff --git a/recipes-kernel/linux/files/0002-Revert-selftests-bpf-Fix-perf_buffer-test-on-systems.patch b/recipes-kernel/linux/files/0002-Revert-selftests-bpf-Fix-perf_buffer-test-on-systems.patch new file mode 100644 index 0000000..d18b942 --- /dev/null +++ b/recipes-kernel/linux/files/0002-Revert-selftests-bpf-Fix-perf_buffer-test-on-systems.patch | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | From 366487b86a8c87954fb4ab7bd88ab49a929a32f6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Mon, 13 Apr 2020 11:25:58 -0700 | ||
| 4 | Subject: [PATCH 2/2] Revert "selftests/bpf: Fix perf_buffer test on systems w/ | ||
| 5 | offline CPUs" | ||
| 6 | |||
| 7 | This reverts commit 77bb53cb094828a31cd3c5b402899810f63073c1. | ||
| 8 | --- | ||
| 9 | .../selftests/bpf/prog_tests/perf_buffer.c | 29 ++++--------------- | ||
| 10 | 1 file changed, 5 insertions(+), 24 deletions(-) | ||
| 11 | |||
| 12 | diff --git a/tools/testing/selftests/bpf/prog_tests/perf_buffer.c b/tools/testing/selftests/bpf/prog_tests/perf_buffer.c | ||
| 13 | index cf6c87936c69..3003fddc0613 100644 | ||
| 14 | --- a/tools/testing/selftests/bpf/prog_tests/perf_buffer.c | ||
| 15 | +++ b/tools/testing/selftests/bpf/prog_tests/perf_buffer.c | ||
| 16 | @@ -4,7 +4,6 @@ | ||
| 17 | #include <sched.h> | ||
| 18 | #include <sys/socket.h> | ||
| 19 | #include <test_progs.h> | ||
| 20 | -#include "libbpf_internal.h" | ||
| 21 | |||
| 22 | static void on_sample(void *ctx, int cpu, void *data, __u32 size) | ||
| 23 | { | ||
| 24 | @@ -20,7 +19,7 @@ static void on_sample(void *ctx, int cpu, void *data, __u32 size) | ||
| 25 | |||
| 26 | void test_perf_buffer(void) | ||
| 27 | { | ||
| 28 | - int err, prog_fd, on_len, nr_on_cpus = 0, nr_cpus, i, duration = 0; | ||
| 29 | + int err, prog_fd, nr_cpus, i, duration = 0; | ||
| 30 | const char *prog_name = "kprobe/sys_nanosleep"; | ||
| 31 | const char *file = "./test_perf_buffer.o"; | ||
| 32 | struct perf_buffer_opts pb_opts = {}; | ||
| 33 | @@ -30,27 +29,15 @@ void test_perf_buffer(void) | ||
| 34 | struct bpf_object *obj; | ||
| 35 | struct perf_buffer *pb; | ||
| 36 | struct bpf_link *link; | ||
| 37 | - bool *online; | ||
| 38 | |||
| 39 | nr_cpus = libbpf_num_possible_cpus(); | ||
| 40 | if (CHECK(nr_cpus < 0, "nr_cpus", "err %d\n", nr_cpus)) | ||
| 41 | return; | ||
| 42 | |||
| 43 | - err = parse_cpu_mask_file("/sys/devices/system/cpu/online", | ||
| 44 | - &online, &on_len); | ||
| 45 | - if (CHECK(err, "nr_on_cpus", "err %d\n", err)) | ||
| 46 | - return; | ||
| 47 | - | ||
| 48 | - for (i = 0; i < on_len; i++) | ||
| 49 | - if (online[i]) | ||
| 50 | - nr_on_cpus++; | ||
| 51 | - | ||
| 52 | /* load program */ | ||
| 53 | err = bpf_prog_load(file, BPF_PROG_TYPE_KPROBE, &obj, &prog_fd); | ||
| 54 | - if (CHECK(err, "obj_load", "err %d errno %d\n", err, errno)) { | ||
| 55 | - obj = NULL; | ||
| 56 | - goto out_close; | ||
| 57 | - } | ||
| 58 | + if (CHECK(err, "obj_load", "err %d errno %d\n", err, errno)) | ||
| 59 | + return; | ||
| 60 | |||
| 61 | prog = bpf_object__find_program_by_title(obj, prog_name); | ||
| 62 | if (CHECK(!prog, "find_probe", "prog '%s' not found\n", prog_name)) | ||
| 63 | @@ -77,11 +64,6 @@ void test_perf_buffer(void) | ||
| 64 | /* trigger kprobe on every CPU */ | ||
| 65 | CPU_ZERO(&cpu_seen); | ||
| 66 | for (i = 0; i < nr_cpus; i++) { | ||
| 67 | - if (i >= on_len || !online[i]) { | ||
| 68 | - printf("skipping offline CPU #%d\n", i); | ||
| 69 | - continue; | ||
| 70 | - } | ||
| 71 | - | ||
| 72 | CPU_ZERO(&cpu_set); | ||
| 73 | CPU_SET(i, &cpu_set); | ||
| 74 | |||
| 75 | @@ -99,8 +81,8 @@ void test_perf_buffer(void) | ||
| 76 | if (CHECK(err < 0, "perf_buffer__poll", "err %d\n", err)) | ||
| 77 | goto out_free_pb; | ||
| 78 | |||
| 79 | - if (CHECK(CPU_COUNT(&cpu_seen) != nr_on_cpus, "seen_cpu_cnt", | ||
| 80 | - "expect %d, seen %d\n", nr_on_cpus, CPU_COUNT(&cpu_seen))) | ||
| 81 | + if (CHECK(CPU_COUNT(&cpu_seen) != nr_cpus, "seen_cpu_cnt", | ||
| 82 | + "expect %d, seen %d\n", nr_cpus, CPU_COUNT(&cpu_seen))) | ||
| 83 | goto out_free_pb; | ||
| 84 | |||
| 85 | out_free_pb: | ||
| 86 | @@ -109,5 +91,4 @@ void test_perf_buffer(void) | ||
| 87 | bpf_link__destroy(link); | ||
| 88 | out_close: | ||
| 89 | bpf_object__close(obj); | ||
| 90 | - free(online); | ||
| 91 | } | ||
| 92 | -- | ||
| 93 | 2.26.0 | ||
| 94 | |||
diff --git a/recipes-kernel/linux/linux-raspberrypi_5.4.bb b/recipes-kernel/linux/linux-raspberrypi_5.4.bb index ec15b94..4a61f8d 100644 --- a/recipes-kernel/linux/linux-raspberrypi_5.4.bb +++ b/recipes-kernel/linux/linux-raspberrypi_5.4.bb | |||
| @@ -6,5 +6,8 @@ SRCREV = "5c08b6e79a8bfa1e59bb0004a1c94ed902a6d615" | |||
| 6 | require linux-raspberrypi_5.4.inc | 6 | require linux-raspberrypi_5.4.inc |
| 7 | 7 | ||
| 8 | SRC_URI += "file://0001-perf-Make-perf-able-to-build-with-latest-libbfd.patch \ | 8 | SRC_URI += "file://0001-perf-Make-perf-able-to-build-with-latest-libbfd.patch \ |
| 9 | file://0001-Revert-selftests-bpf-Skip-perf-hw-events-test-if-the.patch \ | ||
| 10 | file://0002-Revert-selftests-bpf-Fix-perf_buffer-test-on-systems.patch \ | ||
| 11 | file://0001-selftest-bpf-Use-CHECK-macro-instead-of-RET_IF.patch \ | ||
| 9 | file://powersave.cfg \ | 12 | file://powersave.cfg \ |
| 10 | " | 13 | " |
