Commit 03e6a7a9 authored by Andrii Nakryiko's avatar Andrii Nakryiko

Merge branch 'selftests/bpf: parallel mode improvement'

Yucong Sun says:

====================

Several patches to improve parallel execution mode, updating vmtest.sh
and fixed two previously dropped patches according to feedback.
====================
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
parents f9d532fc e1ef62a4
...@@ -5,6 +5,11 @@ ...@@ -5,6 +5,11 @@
/* this is how USDT semaphore is actually defined, except volatile modifier */ /* this is how USDT semaphore is actually defined, except volatile modifier */
volatile unsigned short uprobe_ref_ctr __attribute__((unused)) __attribute((section(".probes"))); volatile unsigned short uprobe_ref_ctr __attribute__((unused)) __attribute((section(".probes")));
/* attach point */
static void method(void) {
return ;
}
void test_attach_probe(void) void test_attach_probe(void)
{ {
DECLARE_LIBBPF_OPTS(bpf_uprobe_opts, uprobe_opts); DECLARE_LIBBPF_OPTS(bpf_uprobe_opts, uprobe_opts);
...@@ -33,7 +38,7 @@ void test_attach_probe(void) ...@@ -33,7 +38,7 @@ void test_attach_probe(void)
if (CHECK(base_addr < 0, "get_base_addr", if (CHECK(base_addr < 0, "get_base_addr",
"failed to find base addr: %zd", base_addr)) "failed to find base addr: %zd", base_addr))
return; return;
uprobe_offset = get_uprobe_offset(&get_base_addr, base_addr); uprobe_offset = get_uprobe_offset(&method, base_addr);
ref_ctr_offset = get_rel_offset((uintptr_t)&uprobe_ref_ctr); ref_ctr_offset = get_rel_offset((uintptr_t)&uprobe_ref_ctr);
if (!ASSERT_GE(ref_ctr_offset, 0, "ref_ctr_offset")) if (!ASSERT_GE(ref_ctr_offset, 0, "ref_ctr_offset"))
...@@ -98,7 +103,7 @@ void test_attach_probe(void) ...@@ -98,7 +103,7 @@ void test_attach_probe(void)
goto cleanup; goto cleanup;
/* trigger & validate uprobe & uretprobe */ /* trigger & validate uprobe & uretprobe */
get_base_addr(); method();
if (CHECK(skel->bss->uprobe_res != 3, "check_uprobe_res", if (CHECK(skel->bss->uprobe_res != 3, "check_uprobe_res",
"wrong uprobe res: %d\n", skel->bss->uprobe_res)) "wrong uprobe res: %d\n", skel->bss->uprobe_res))
......
...@@ -176,6 +176,18 @@ static int netns_setup_namespaces(const char *verb) ...@@ -176,6 +176,18 @@ static int netns_setup_namespaces(const char *verb)
return 0; return 0;
} }
static void netns_setup_namespaces_nofail(const char *verb)
{
const char * const *ns = namespaces;
char cmd[128];
while (*ns) {
snprintf(cmd, sizeof(cmd), "ip netns %s %s > /dev/null 2>&1", verb, *ns);
system(cmd);
ns++;
}
}
struct netns_setup_result { struct netns_setup_result {
int ifindex_veth_src_fwd; int ifindex_veth_src_fwd;
int ifindex_veth_dst_fwd; int ifindex_veth_dst_fwd;
...@@ -762,6 +774,8 @@ static void test_tc_redirect_peer_l3(struct netns_setup_result *setup_result) ...@@ -762,6 +774,8 @@ static void test_tc_redirect_peer_l3(struct netns_setup_result *setup_result)
static void *test_tc_redirect_run_tests(void *arg) static void *test_tc_redirect_run_tests(void *arg)
{ {
netns_setup_namespaces_nofail("delete");
RUN_TEST(tc_redirect_peer); RUN_TEST(tc_redirect_peer);
RUN_TEST(tc_redirect_peer_l3); RUN_TEST(tc_redirect_peer_l3);
RUN_TEST(tc_redirect_neigh); RUN_TEST(tc_redirect_neigh);
......
...@@ -224,10 +224,10 @@ EOF ...@@ -224,10 +224,10 @@ EOF
-nodefaults \ -nodefaults \
-display none \ -display none \
-serial mon:stdio \ -serial mon:stdio \
-cpu kvm64 \ -cpu host \
-enable-kvm \ -enable-kvm \
-smp 4 \ -smp 8 \
-m 2G \ -m 4G \
-drive file="${rootfs_img}",format=raw,index=1,media=disk,if=virtio,cache=none \ -drive file="${rootfs_img}",format=raw,index=1,media=disk,if=virtio,cache=none \
-kernel "${kernel_bzimage}" \ -kernel "${kernel_bzimage}" \
-append "root=/dev/vda rw console=ttyS0,115200" -append "root=/dev/vda rw console=ttyS0,115200"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment