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

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
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -5,6 +5,11 @@
/* this is how USDT semaphore is actually defined, except volatile modifier */
volatile unsigned short uprobe_ref_ctr __attribute__((unused)) __attribute((section(".probes")));

/* attach point */
static void method(void) {
	return ;
}

void test_attach_probe(void)
{
	DECLARE_LIBBPF_OPTS(bpf_uprobe_opts, uprobe_opts);
@@ -33,7 +38,7 @@ void test_attach_probe(void)
	if (CHECK(base_addr < 0, "get_base_addr",
		  "failed to find base addr: %zd", base_addr))
		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);
	if (!ASSERT_GE(ref_ctr_offset, 0, "ref_ctr_offset"))
@@ -98,7 +103,7 @@ void test_attach_probe(void)
		goto cleanup;

	/* trigger & validate uprobe & uretprobe */
	get_base_addr();
	method();

	if (CHECK(skel->bss->uprobe_res != 3, "check_uprobe_res",
		  "wrong uprobe res: %d\n", skel->bss->uprobe_res))
+14 −0
Original line number Diff line number Diff line
@@ -176,6 +176,18 @@ static int netns_setup_namespaces(const char *verb)
	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 {
	int ifindex_veth_src_fwd;
	int ifindex_veth_dst_fwd;
@@ -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)
{
	netns_setup_namespaces_nofail("delete");

	RUN_TEST(tc_redirect_peer);
	RUN_TEST(tc_redirect_peer_l3);
	RUN_TEST(tc_redirect_neigh);
+3 −3
Original line number Diff line number Diff line
@@ -224,10 +224,10 @@ EOF
		-nodefaults \
		-display none \
		-serial mon:stdio \
		-cpu kvm64 \
		-cpu host \
		-enable-kvm \
		-smp 4 \
		-m 2G \
		-smp 8 \
		-m 4G \
		-drive file="${rootfs_img}",format=raw,index=1,media=disk,if=virtio,cache=none \
		-kernel "${kernel_bzimage}" \
		-append "root=/dev/vda rw console=ttyS0,115200"