]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
selfetest/bpf: Make some tests serial
authorYucong Sun <sunyucong@gmail.com>
Wed, 6 Oct 2021 18:56:19 +0000 (11:56 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 8 Oct 2021 22:17:00 +0000 (15:17 -0700)
Change tests that often fails in parallel execution mode to serial.

Signed-off-by: Yucong Sun <sunyucong@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211006185619.364369-15-fallentree@fb.com
38 files changed:
tools/testing/selftests/bpf/prog_tests/bpf_iter_setsockopt.c
tools/testing/selftests/bpf/prog_tests/bpf_obj_id.c
tools/testing/selftests/bpf/prog_tests/cg_storage_multi.c
tools/testing/selftests/bpf/prog_tests/cgroup_attach_autodetach.c
tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c
tools/testing/selftests/bpf/prog_tests/cgroup_attach_override.c
tools/testing/selftests/bpf/prog_tests/cgroup_link.c
tools/testing/selftests/bpf/prog_tests/check_mtu.c
tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c
tools/testing/selftests/bpf/prog_tests/flow_dissector_load_bytes.c
tools/testing/selftests/bpf/prog_tests/flow_dissector_reattach.c
tools/testing/selftests/bpf/prog_tests/get_branch_snapshot.c
tools/testing/selftests/bpf/prog_tests/kfree_skb.c
tools/testing/selftests/bpf/prog_tests/migrate_reuseport.c
tools/testing/selftests/bpf/prog_tests/modify_return.c
tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
tools/testing/selftests/bpf/prog_tests/perf_buffer.c
tools/testing/selftests/bpf/prog_tests/perf_link.c
tools/testing/selftests/bpf/prog_tests/probe_user.c
tools/testing/selftests/bpf/prog_tests/raw_tp_writable_test_run.c
tools/testing/selftests/bpf/prog_tests/select_reuseport.c
tools/testing/selftests/bpf/prog_tests/send_signal_sched_switch.c
tools/testing/selftests/bpf/prog_tests/sk_storage_tracing.c
tools/testing/selftests/bpf/prog_tests/snprintf_btf.c
tools/testing/selftests/bpf/prog_tests/sock_fields.c
tools/testing/selftests/bpf/prog_tests/sockmap_listen.c
tools/testing/selftests/bpf/prog_tests/timer.c
tools/testing/selftests/bpf/prog_tests/timer_mim.c
tools/testing/selftests/bpf/prog_tests/tp_attach_query.c
tools/testing/selftests/bpf/prog_tests/trace_printk.c
tools/testing/selftests/bpf/prog_tests/trace_vprintk.c
tools/testing/selftests/bpf/prog_tests/trampoline_count.c
tools/testing/selftests/bpf/prog_tests/xdp_attach.c
tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c
tools/testing/selftests/bpf/prog_tests/xdp_devmap_attach.c
tools/testing/selftests/bpf/prog_tests/xdp_info.c
tools/testing/selftests/bpf/prog_tests/xdp_link.c

index 85babb0487b3140f7dcb359339d461a05d5b26cb..b52ff8ce34db82ab8f7d95d27e4d7b91a3fcee41 100644 (file)
@@ -179,7 +179,7 @@ done:
        free_fds(est_fds, nr_est);
 }
 
-void test_bpf_iter_setsockopt(void)
+void serial_test_bpf_iter_setsockopt(void)
 {
        struct bpf_iter_setsockopt *iter_skel = NULL;
        struct bpf_cubic *cubic_skel = NULL;
index 284d5921c3458b82688ec92bd48b673ecb4e50ee..eb8eeebe69359eca6c983c63b48ac8cb84f49c24 100644 (file)
@@ -3,7 +3,7 @@
 
 #define nr_iters 2
 
-void test_bpf_obj_id(void)
+void serial_test_bpf_obj_id(void)
 {
        const __u64 array_magic_value = 0xfaceb00c;
        const __u32 array_key = 0;
index 876be0ecb654f72b7415cfb1c4de80f6f2d493a6..621c5722219182a165a56bf6833ad6483949b785 100644 (file)
@@ -363,7 +363,7 @@ close_bpf_object:
        cg_storage_multi_shared__destroy(obj);
 }
 
-void test_cg_storage_multi(void)
+void serial_test_cg_storage_multi(void)
 {
        int parent_cgroup_fd = -1, child_cgroup_fd = -1;
 
index 70e94e783070bd1908bcbd54ce3aa88862d6f10f..5de485c7370fd95d1dc3f37df8bc3f14086d1553 100644 (file)
@@ -21,7 +21,7 @@ static int prog_load(void)
                               bpf_log_buf, BPF_LOG_BUF_SIZE);
 }
 
-void test_cgroup_attach_autodetach(void)
+void serial_test_cgroup_attach_autodetach(void)
 {
        __u32 duration = 0, prog_cnt = 4, attach_flags;
        int allow_prog[2] = {-1};
index 20bb8831dda67b01cb90615922884840abe08e30..731bea84d8edd05bc0f809ceae3f04703309b796 100644 (file)
@@ -74,7 +74,7 @@ static int prog_load_cnt(int verdict, int val)
        return ret;
 }
 
-void test_cgroup_attach_multi(void)
+void serial_test_cgroup_attach_multi(void)
 {
        __u32 prog_ids[4], prog_cnt = 0, attach_flags, saved_prog_id;
        int cg1 = 0, cg2 = 0, cg3 = 0, cg4 = 0, cg5 = 0, key = 0;
index 9e96f8d87fea49b25dfa14712bc10216c56a4bba..10d3c33821a7b45694f609030ef53c7ee4e59bfd 100644 (file)
@@ -23,7 +23,7 @@ static int prog_load(int verdict)
                               bpf_log_buf, BPF_LOG_BUF_SIZE);
 }
 
-void test_cgroup_attach_override(void)
+void serial_test_cgroup_attach_override(void)
 {
        int drop_prog = -1, allow_prog = -1, foo = -1, bar = -1;
        __u32 duration = 0;
index 9091524131d65636f964496813e0263f796aa887..9e6e6aad347c7b5eeb1f516b2d9d7119efba87a2 100644 (file)
@@ -24,7 +24,7 @@ int ping_and_check(int exp_calls, int exp_alt_calls)
        return 0;
 }
 
-void test_cgroup_link(void)
+void serial_test_cgroup_link(void)
 {
        struct {
                const char *path;
index 012068f33a0a81c536cbf85acbc6c44533d84a4d..f73e6e36b74ddb8b260ef1d260e20eac26fe89c4 100644 (file)
@@ -195,7 +195,7 @@ cleanup:
        test_check_mtu__destroy(skel);
 }
 
-void test_check_mtu(void)
+void serial_test_check_mtu(void)
 {
        __u32 mtu_lo;
 
index 2839f4270a26ee989395139b7730807c89f46753..9cff14a23bb7209ab70d26bff6be99a7811ffc65 100644 (file)
@@ -380,7 +380,8 @@ static void test_func_map_prog_compatibility(void)
                                     "./test_attach_probe.o");
 }
 
-void test_fexit_bpf2bpf(void)
+/* NOTE: affect other tests, must run in serial mode */
+void serial_test_fexit_bpf2bpf(void)
 {
        if (test__start_subtest("target_no_callees"))
                test_target_no_callees();
index 0e8a4d2f023d0453f3b5baf787f201f0fd486dc7..6093728497c7094ff4ea3fc0cc5d6e889c363b82 100644 (file)
@@ -2,7 +2,7 @@
 #include <test_progs.h>
 #include <network_helpers.h>
 
-void test_flow_dissector_load_bytes(void)
+void serial_test_flow_dissector_load_bytes(void)
 {
        struct bpf_flow_keys flow_keys;
        __u32 duration = 0, retval, size;
index 3931ede5c53404e47d9390f045fd0935425b36d2..f0c6c226aba8c7cc34ed4fa2a75b7cb641630557 100644 (file)
@@ -628,7 +628,7 @@ out_close:
        }
 }
 
-void test_flow_dissector_reattach(void)
+void serial_test_flow_dissector_reattach(void)
 {
        int err, new_net, saved_net;
 
index e4f92feb7b32c899b7832387126cd53649307c22..d6d70a359aeb5be99d4724a4522b17275da62205 100644 (file)
@@ -73,7 +73,7 @@ static void close_perf_events(void)
        free(pfd_array);
 }
 
-void test_get_branch_snapshot(void)
+void serial_test_get_branch_snapshot(void)
 {
        struct get_branch_snapshot *skel = NULL;
        int err;
index ddfb6bf97152435475f5fbbcb174cc5c7434838c..032a322d51f2a2d227ce99dfea51e933c2c55903 100644 (file)
@@ -48,7 +48,8 @@ static void on_sample(void *ctx, int cpu, void *data, __u32 size)
        *(bool *)ctx = true;
 }
 
-void test_kfree_skb(void)
+/* TODO: fix kernel panic caused by this test in parallel mode */
+void serial_test_kfree_skb(void)
 {
        struct __sk_buff skb = {};
        struct bpf_prog_test_run_attr tattr = {
index 59adb4715394fa99391e1868dc9014b76e9da612..7589c03fd26be727f07b46c3622c8ab5967d5291 100644 (file)
@@ -541,7 +541,7 @@ close_servers:
        }
 }
 
-void test_migrate_reuseport(void)
+void serial_test_migrate_reuseport(void)
 {
        struct test_migrate_reuseport *skel;
        int i;
index 97fec70c600be0a9cec6bd9730eb925dcb46265d..b772fe30ce9bf448cefa7d9460cbad8d1621597f 100644 (file)
@@ -53,7 +53,8 @@ cleanup:
        modify_return__destroy(skel);
 }
 
-void test_modify_return(void)
+/* TODO: conflict with get_func_ip_test */
+void serial_test_modify_return(void)
 {
        run_test(0 /* input_retval */,
                 1 /* want_side_effect */,
index 2535788e135f08132811aa8b4c25d86e15648849..24d493482ffc752c80321916e8c5f6588707485a 100644 (file)
@@ -78,7 +78,8 @@ static void test_ns_current_pid_tgid_new_ns(void)
                return;
 }
 
-void test_ns_current_pid_tgid(void)
+/* TODO: use a different tracepoint */
+void serial_test_ns_current_pid_tgid(void)
 {
        if (test__start_subtest("ns_current_pid_tgid_root_ns"))
                test_current_pid_tgid(NULL);
index 6490e9673002ffd0216b410e372d4ee6b69694b0..6979aff4aab22ca89ccf0e1c6f8a4d47249a5253 100644 (file)
@@ -43,7 +43,7 @@ int trigger_on_cpu(int cpu)
        return 0;
 }
 
-void test_perf_buffer(void)
+void serial_test_perf_buffer(void)
 {
        int err, on_len, nr_on_cpus = 0, nr_cpus, i;
        struct perf_buffer_opts pb_opts = {};
index b1abd0c4660738a3c29df1817ac20356b32a0f63..ede07344f264ee8b3c9189e37e787c146e7b2149 100644 (file)
@@ -23,7 +23,8 @@ static void burn_cpu(void)
                ++j;
 }
 
-void test_perf_link(void)
+/* TODO: often fails in concurrent mode */
+void serial_test_perf_link(void)
 {
        struct test_perf_link *skel = NULL;
        struct perf_event_attr attr;
index 52fe157e2a90266afbf4ddfe9896bdf13014d52c..abf890d066eb4b04f1a578d6acd46164f51f52c8 100644 (file)
@@ -1,7 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <test_progs.h>
 
-void test_probe_user(void)
+/* TODO: corrupts other tests uses connect() */
+void serial_test_probe_user(void)
 {
        const char *prog_name = "handle_sys_connect";
        const char *obj_file = "./test_probe_user.o";
index 5c45424cac5f81ebe9ae71fbac561638b2d12064..ddefa1192e5d51d1013a2bd0cede4fae373fb44f 100644 (file)
@@ -3,7 +3,8 @@
 #include <test_progs.h>
 #include <linux/nbd.h>
 
-void test_raw_tp_writable_test_run(void)
+/* NOTE: conflict with other tests. */
+void serial_test_raw_tp_writable_test_run(void)
 {
        __u32 duration = 0;
        char error[4096];
index d40e9156c48d1815d03aa2b9bf561b6ae81ae03c..3cfc910ab3c1bd0b8d1297288b992c5038a1e779 100644 (file)
@@ -858,7 +858,7 @@ out:
        cleanup();
 }
 
-void test_select_reuseport(void)
+void serial_test_select_reuseport(void)
 {
        saved_tcp_fo = read_int_sysctl(TCP_FO_SYSCTL);
        if (saved_tcp_fo < 0)
index 189a34a7addbdefd466fe8ee84190060dd90291d..15dacfcfaa6dd375b9f488b4390e8b9edc0e111e 100644 (file)
@@ -25,7 +25,8 @@ static void *worker(void *p)
        return NULL;
 }
 
-void test_send_signal_sched_switch(void)
+/* NOTE: cause events loss */
+void serial_test_send_signal_sched_switch(void)
 {
        struct test_send_signal_kern *skel;
        pthread_t threads[THREAD_COUNT];
index 2b392590e8ca4898bc6188e9bb452da2c24abc22..547ae53cde74645398a0f3d92123c56d0e59f77f 100644 (file)
@@ -105,7 +105,7 @@ out:
                close(listen_fd);
 }
 
-void test_sk_storage_tracing(void)
+void serial_test_sk_storage_tracing(void)
 {
        struct test_sk_storage_trace_itself *skel_itself;
        int err;
index 76e1f5fe18fac3eb501e5022c43ae62ba678f6fc..dd41b826be309015cd6c149c2e4cf66535ab3e08 100644 (file)
@@ -6,7 +6,7 @@
 /* Demonstrate that bpf_snprintf_btf succeeds and that various data types
  * are formatted correctly.
  */
-void test_snprintf_btf(void)
+void serial_test_snprintf_btf(void)
 {
        struct netif_receive_skb *skel;
        struct netif_receive_skb__bss *bss;
index 577d619fb07ed900d7cbf8f7c1e40694c920a3a5..fae40db4d81f579a63b818b23d03a929a56ffd72 100644 (file)
@@ -329,7 +329,7 @@ done:
                close(listen_fd);
 }
 
-void test_sock_fields(void)
+void serial_test_sock_fields(void)
 {
        struct bpf_link *egress_link = NULL, *ingress_link = NULL;
        int parent_cg_fd = -1, child_cg_fd = -1;
index 5c5979046523e2a30398bb11745ac53b345bbe01..102c73a00402b4f6ce78d3da89947cb25b48d05c 100644 (file)
@@ -2037,7 +2037,7 @@ static void run_tests(struct test_sockmap_listen *skel, struct bpf_map *map,
        test_udp_unix_redir(skel, map, family);
 }
 
-void test_sockmap_listen(void)
+void serial_test_sockmap_listen(void)
 {
        struct test_sockmap_listen *skel;
 
index 25f40e1b99670bfbacbb2ee3e2d97212e92aeaf1..0f4e49e622cdfff3bfac2d2d4c793bc48ce3af84 100644 (file)
@@ -39,7 +39,8 @@ static int timer(struct timer *timer_skel)
        return 0;
 }
 
-void test_timer(void)
+/* TODO: use pid filtering */
+void serial_test_timer(void)
 {
        struct timer *timer_skel = NULL;
        int err;
index ced8f6cf347cdfc0203f0ac9e1adbe054581367a..949a0617869df5ffd5d0c6962cbbc5bae5d900dc 100644 (file)
@@ -52,7 +52,7 @@ static int timer_mim(struct timer_mim *timer_skel)
        return 0;
 }
 
-void test_timer_mim(void)
+void serial_test_timer_mim(void)
 {
        struct timer_mim_reject *timer_reject_skel = NULL;
        libbpf_print_fn_t old_print_fn = NULL;
index fb095e5cd9afd1dbcb9ca09631689525c54d616b..8652d0a46c87ab6ecce086fa0a7427f042dd9f39 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <test_progs.h>
 
-void test_tp_attach_query(void)
+void serial_test_tp_attach_query(void)
 {
        const int num_progs = 3;
        int i, j, bytes, efd, err, prog_fd[num_progs], pmu_fd[num_progs];
index e47835f0a6748f9a61c260359818a6e419ff5708..3f7a7141265eedfe038e7c671b7147db665e294e 100644 (file)
@@ -8,7 +8,7 @@
 #define TRACEBUF       "/sys/kernel/debug/tracing/trace_pipe"
 #define SEARCHMSG      "testing,testing"
 
-void test_trace_printk(void)
+void serial_test_trace_printk(void)
 {
        int err = 0, iter = 0, found = 0;
        struct trace_printk__bss *bss;
index 61a24e62e1a0fa5b30b7ee8c23b9fb0958b14eca..46101270cb1abaa8e87fa36788723d110c5dc0ad 100644 (file)
@@ -8,7 +8,7 @@
 #define TRACEBUF       "/sys/kernel/debug/tracing/trace_pipe"
 #define SEARCHMSG      "1,2,3,4,5,6,7,8,9,10"
 
-void test_trace_vprintk(void)
+void serial_test_trace_vprintk(void)
 {
        int err = 0, iter = 0, found = 0;
        struct trace_vprintk__bss *bss;
index d7f5a931d7f384aabd0452e51cb53e6841e4aa20..fc146671b20a3a514a06d7d2b041fb66fd9e281c 100644 (file)
@@ -41,7 +41,8 @@ static struct bpf_link *load(struct bpf_object *obj, const char *name)
        return bpf_program__attach_trace(prog);
 }
 
-void test_trampoline_count(void)
+/* TODO: use different target function to run in concurrent mode */
+void serial_test_trampoline_count(void)
 {
        const char *fentry_name = "fentry/__set_task_comm";
        const char *fexit_name = "fexit/__set_task_comm";
index 15ef3531483ef3d5bfb91cc7cf7d044b71f941f8..4c4057262cd8db4b457365f254091ee949f26c46 100644 (file)
@@ -4,7 +4,7 @@
 #define IFINDEX_LO 1
 #define XDP_FLAGS_REPLACE              (1U << 4)
 
-void test_xdp_attach(void)
+void serial_test_xdp_attach(void)
 {
        __u32 duration = 0, id1, id2, id0 = 0, len;
        struct bpf_object *obj1, *obj2, *obj3;
index ad3ba81b40480c06db4bd94b4d7cc833ca2b7ff8..faa22b84f2eeb1825e8534bb7a26fd9e00e30f4f 100644 (file)
@@ -519,7 +519,7 @@ static struct bond_test_case bond_test_cases[] = {
        { "xdp_bonding_xor_layer34", BOND_MODE_XOR, BOND_XMIT_POLICY_LAYER34, },
 };
 
-void test_xdp_bonding(void)
+void serial_test_xdp_bonding(void)
 {
        libbpf_print_fn_t old_print_fn;
        struct skeletons skeletons = {};
index 8755effd80b0bea82166ae9649497e131b67fcab..fd812bd43600abd58f0331d37e6117c752233518 100644 (file)
@@ -7,7 +7,7 @@
 
 #define IFINDEX_LO     1
 
-void test_xdp_cpumap_attach(void)
+void serial_test_xdp_cpumap_attach(void)
 {
        struct test_xdp_with_cpumap_helpers *skel;
        struct bpf_prog_info info = {};
index c72af030ff1014aea541ca128428fa80182a758e..d4e9a9972a67eca6c450a67888923c01d6893aef 100644 (file)
@@ -72,7 +72,7 @@ void test_neg_xdp_devmap_helpers(void)
 }
 
 
-void test_xdp_devmap_attach(void)
+void serial_test_xdp_devmap_attach(void)
 {
        if (test__start_subtest("DEVMAP with programs in entries"))
                test_xdp_with_devmap_helpers();
index d2d7a283d72f9d53f9c1f95fb10cdba0c1c3d452..4e2a4fd56f675903e8d1d71f2271a37467a1677c 100644 (file)
@@ -4,7 +4,7 @@
 
 #define IFINDEX_LO 1
 
-void test_xdp_info(void)
+void serial_test_xdp_info(void)
 {
        __u32 len = sizeof(struct bpf_prog_info), duration = 0, prog_id;
        const char *file = "./xdp_dummy.o";
index 46eed0a33c23a1f9957df3259b5d53fcce7d7ab8..983ab0b47d30aa4c1707340cc883b13f91dc0d57 100644 (file)
@@ -6,7 +6,7 @@
 
 #define IFINDEX_LO 1
 
-void test_xdp_link(void)
+void serial_test_xdp_link(void)
 {
        __u32 duration = 0, id1, id2, id0 = 0, prog_fd1, prog_fd2, err;
        DECLARE_LIBBPF_OPTS(bpf_xdp_set_link_opts, opts, .old_fd = -1);