Lines Matching +full:re +full:- +full:attached
1 // SPDX-License-Identifier: GPL-2.0
15 static volatile short nums[] = {-1, -2, -3, -4};
20 } t1 = { 1, -127 };
38 y / 7, bla, &bla, -9, nums[x], in trigger_func()
54 bss = skel->bss; in subtest_basic_usdt()
55 bss->my_pid = getpid(); in subtest_basic_usdt()
61 /* usdt0 won't be auto-attached */ in subtest_basic_usdt()
63 skel->links.usdt0 = bpf_program__attach_usdt(skel->progs.usdt0, in subtest_basic_usdt()
66 if (!ASSERT_OK_PTR(skel->links.usdt0, "usdt0_link")) in subtest_basic_usdt()
71 ASSERT_EQ(bss->usdt0_called, 1, "usdt0_called"); in subtest_basic_usdt()
72 ASSERT_EQ(bss->usdt3_called, 1, "usdt3_called"); in subtest_basic_usdt()
73 ASSERT_EQ(bss->usdt12_called, 1, "usdt12_called"); in subtest_basic_usdt()
75 ASSERT_EQ(bss->usdt0_cookie, 0xcafedeadbeeffeed, "usdt0_cookie"); in subtest_basic_usdt()
76 ASSERT_EQ(bss->usdt0_arg_cnt, 0, "usdt0_arg_cnt"); in subtest_basic_usdt()
77 ASSERT_EQ(bss->usdt0_arg_ret, -ENOENT, "usdt0_arg_ret"); in subtest_basic_usdt()
79 /* auto-attached usdt3 gets default zero cookie value */ in subtest_basic_usdt()
80 ASSERT_EQ(bss->usdt3_cookie, 0, "usdt3_cookie"); in subtest_basic_usdt()
81 ASSERT_EQ(bss->usdt3_arg_cnt, 3, "usdt3_arg_cnt"); in subtest_basic_usdt()
83 ASSERT_EQ(bss->usdt3_arg_rets[0], 0, "usdt3_arg1_ret"); in subtest_basic_usdt()
84 ASSERT_EQ(bss->usdt3_arg_rets[1], 0, "usdt3_arg2_ret"); in subtest_basic_usdt()
85 ASSERT_EQ(bss->usdt3_arg_rets[2], 0, "usdt3_arg3_ret"); in subtest_basic_usdt()
86 ASSERT_EQ(bss->usdt3_args[0], 1, "usdt3_arg1"); in subtest_basic_usdt()
87 ASSERT_EQ(bss->usdt3_args[1], 42, "usdt3_arg2"); in subtest_basic_usdt()
88 ASSERT_EQ(bss->usdt3_args[2], (uintptr_t)&bla, "usdt3_arg3"); in subtest_basic_usdt()
90 /* auto-attached usdt12 gets default zero cookie value */ in subtest_basic_usdt()
91 ASSERT_EQ(bss->usdt12_cookie, 0, "usdt12_cookie"); in subtest_basic_usdt()
92 ASSERT_EQ(bss->usdt12_arg_cnt, 12, "usdt12_arg_cnt"); in subtest_basic_usdt()
94 ASSERT_EQ(bss->usdt12_args[0], 1, "usdt12_arg1"); in subtest_basic_usdt()
95 ASSERT_EQ(bss->usdt12_args[1], 1 + 1, "usdt12_arg2"); in subtest_basic_usdt()
96 ASSERT_EQ(bss->usdt12_args[2], 42, "usdt12_arg3"); in subtest_basic_usdt()
97 ASSERT_EQ(bss->usdt12_args[3], 42 + 1, "usdt12_arg4"); in subtest_basic_usdt()
98 ASSERT_EQ(bss->usdt12_args[4], 5, "usdt12_arg5"); in subtest_basic_usdt()
99 ASSERT_EQ(bss->usdt12_args[5], 42 / 7, "usdt12_arg6"); in subtest_basic_usdt()
100 ASSERT_EQ(bss->usdt12_args[6], bla, "usdt12_arg7"); in subtest_basic_usdt()
101 ASSERT_EQ(bss->usdt12_args[7], (uintptr_t)&bla, "usdt12_arg8"); in subtest_basic_usdt()
102 ASSERT_EQ(bss->usdt12_args[8], -9, "usdt12_arg9"); in subtest_basic_usdt()
103 ASSERT_EQ(bss->usdt12_args[9], nums[1], "usdt12_arg10"); in subtest_basic_usdt()
104 ASSERT_EQ(bss->usdt12_args[10], nums[idx], "usdt12_arg11"); in subtest_basic_usdt()
105 ASSERT_EQ(bss->usdt12_args[11], t1.y, "usdt12_arg12"); in subtest_basic_usdt()
109 * at least 2 different places to be attached to. This verifies that in subtest_basic_usdt()
115 ASSERT_EQ(bss->usdt0_called, 2, "usdt0_called"); in subtest_basic_usdt()
116 ASSERT_EQ(bss->usdt3_called, 2, "usdt3_called"); in subtest_basic_usdt()
117 ASSERT_EQ(bss->usdt12_called, 2, "usdt12_called"); in subtest_basic_usdt()
120 ASSERT_EQ(bss->usdt3_args[0], 2, "usdt3_arg1"); in subtest_basic_usdt()
122 ASSERT_EQ(bss->usdt12_args[0], 2, "usdt12_arg1"); in subtest_basic_usdt()
123 ASSERT_EQ(bss->usdt12_args[1], 2 + 1, "usdt12_arg2"); in subtest_basic_usdt()
124 ASSERT_EQ(bss->usdt12_args[3], 42 + 2, "usdt12_arg4"); in subtest_basic_usdt()
125 ASSERT_EQ(bss->usdt12_args[9], nums[2], "usdt12_arg10"); in subtest_basic_usdt()
127 /* detach and re-attach usdt3 */ in subtest_basic_usdt()
128 bpf_link__destroy(skel->links.usdt3); in subtest_basic_usdt()
131 skel->links.usdt3 = bpf_program__attach_usdt(skel->progs.usdt3, -1 /* any pid */, in subtest_basic_usdt()
133 if (!ASSERT_OK_PTR(skel->links.usdt3, "usdt3_reattach")) in subtest_basic_usdt()
138 ASSERT_EQ(bss->usdt3_called, 3, "usdt3_called"); in subtest_basic_usdt()
140 ASSERT_EQ(bss->usdt3_cookie, 0xBADC00C51E, "usdt3_cookie"); in subtest_basic_usdt()
141 ASSERT_EQ(bss->usdt3_arg_cnt, 3, "usdt3_arg_cnt"); in subtest_basic_usdt()
143 ASSERT_EQ(bss->usdt3_arg_rets[0], 0, "usdt3_arg1_ret"); in subtest_basic_usdt()
144 ASSERT_EQ(bss->usdt3_arg_rets[1], 0, "usdt3_arg2_ret"); in subtest_basic_usdt()
145 ASSERT_EQ(bss->usdt3_arg_rets[2], 0, "usdt3_arg3_ret"); in subtest_basic_usdt()
146 ASSERT_EQ(bss->usdt3_args[0], 3, "usdt3_arg1"); in subtest_basic_usdt()
147 ASSERT_EQ(bss->usdt3_args[1], 42, "usdt3_arg2"); in subtest_basic_usdt()
148 ASSERT_EQ(bss->usdt3_args[2], (uintptr_t)&bla, "usdt3_arg3"); in subtest_basic_usdt()
220 bss = skel->bss; in subtest_multispec_usdt()
221 bss->my_pid = getpid(); in subtest_multispec_usdt()
227 /* usdt_100 is auto-attached and there are 100 inlined call sites, in subtest_multispec_usdt()
228 * let's validate that all of them are properly attached to and in subtest_multispec_usdt()
233 ASSERT_EQ(bss->usdt_100_called, 100, "usdt_100_called"); in subtest_multispec_usdt()
234 ASSERT_EQ(bss->usdt_100_sum, 99 * 100 / 2, "usdt_100_sum"); in subtest_multispec_usdt()
238 * after few detachments and re-attachments we should run out of in subtest_multispec_usdt()
242 bpf_link__destroy(skel->links.usdt_100); in subtest_multispec_usdt()
244 skel->links.usdt_100 = bpf_program__attach_usdt(skel->progs.usdt_100, -1, in subtest_multispec_usdt()
247 if (!ASSERT_OK_PTR(skel->links.usdt_100, "usdt_100_reattach")) in subtest_multispec_usdt()
250 bss->usdt_100_sum = 0; in subtest_multispec_usdt()
253 ASSERT_EQ(bss->usdt_100_called, (i + 1) * 100 + 100, "usdt_100_called"); in subtest_multispec_usdt()
254 ASSERT_EQ(bss->usdt_100_sum, 99 * 100 / 2, "usdt_100_sum"); in subtest_multispec_usdt()
265 bpf_link__destroy(skel->links.usdt_100); in subtest_multispec_usdt()
266 skel->links.usdt_100 = bpf_program__attach_usdt(skel->progs.usdt_100, -1, "/proc/self/exe", in subtest_multispec_usdt()
268 err = -errno; in subtest_multispec_usdt()
269 if (!ASSERT_ERR_PTR(skel->links.usdt_100, "usdt_300_bad_attach")) in subtest_multispec_usdt()
271 ASSERT_EQ(err, -E2BIG, "usdt_300_attach_err"); in subtest_multispec_usdt()
273 /* let's check that there are no "dangling" BPF programs attached due in subtest_multispec_usdt()
276 bss->usdt_100_called = 0; in subtest_multispec_usdt()
277 bss->usdt_100_sum = 0; in subtest_multispec_usdt()
281 ASSERT_EQ(bss->usdt_100_called, 0, "usdt_301_called"); in subtest_multispec_usdt()
282 ASSERT_EQ(bss->usdt_100_sum, 0, "usdt_301_sum"); in subtest_multispec_usdt()
291 skel->links.usdt_100 = bpf_program__attach_usdt(skel->progs.usdt_100, -1, in subtest_multispec_usdt()
294 if (!ASSERT_OK_PTR(skel->links.usdt_100, "usdt_400_attach")) in subtest_multispec_usdt()
299 ASSERT_EQ(bss->usdt_100_called, 400, "usdt_400_called"); in subtest_multispec_usdt()
300 ASSERT_EQ(bss->usdt_100_sum, 400 * 400, "usdt_400_sum"); in subtest_multispec_usdt()
311 f = popen("./urandom_read 1 report-pid", "r"); in urand_spawn()
351 bss = skel->bss; in subtest_urandom_usdt()
352 bss->urand_pid = urand_pid; in subtest_urandom_usdt()
359 l = bpf_program__attach_usdt(skel->progs.urand_read_without_sema, in subtest_urandom_usdt()
364 skel->links.urand_read_without_sema = l; in subtest_urandom_usdt()
366 l = bpf_program__attach_usdt(skel->progs.urand_read_with_sema, in subtest_urandom_usdt()
371 skel->links.urand_read_with_sema = l; in subtest_urandom_usdt()
373 l = bpf_program__attach_usdt(skel->progs.urandlib_read_without_sema, in subtest_urandom_usdt()
378 skel->links.urandlib_read_without_sema = l; in subtest_urandom_usdt()
380 l = bpf_program__attach_usdt(skel->progs.urandlib_read_with_sema, in subtest_urandom_usdt()
385 skel->links.urandlib_read_with_sema = l; in subtest_urandom_usdt()
392 ASSERT_EQ(bss->urand_read_without_sema_call_cnt, 1, "urand_wo_sema_cnt"); in subtest_urandom_usdt()
393 ASSERT_EQ(bss->urand_read_without_sema_buf_sz_sum, 256, "urand_wo_sema_sum"); in subtest_urandom_usdt()
395 ASSERT_EQ(bss->urand_read_with_sema_call_cnt, 1, "urand_w_sema_cnt"); in subtest_urandom_usdt()
396 ASSERT_EQ(bss->urand_read_with_sema_buf_sz_sum, 256, "urand_w_sema_sum"); in subtest_urandom_usdt()
398 ASSERT_EQ(bss->urandlib_read_without_sema_call_cnt, 1, "urandlib_wo_sema_cnt"); in subtest_urandom_usdt()
399 ASSERT_EQ(bss->urandlib_read_without_sema_buf_sz_sum, 256, "urandlib_wo_sema_sum"); in subtest_urandom_usdt()
401 ASSERT_EQ(bss->urandlib_read_with_sema_call_cnt, 1, "urandlib_w_sema_cnt"); in subtest_urandom_usdt()
402 ASSERT_EQ(bss->urandlib_read_with_sema_buf_sz_sum, 256, "urandlib_w_sema_sum"); in subtest_urandom_usdt()