Hi,

I have an issue with kretprobes on a GCE instance. The VM has only one
CPU and the kernel is configured without preempt:

/sys/devices/system/cpu/possible
0

# cat /boot/config-4.4.0-66-generic |grep CONFIG_PREEMPT
CONFIG_PREEMPT_NOTIFIERS=y
# CONFIG_PREEMPT_NONE is not set
CONFIG_PREEMPT_VOLUNTARY=y
# CONFIG_PREEMPT is not set

In this case, my understanding was there could be only one active
kretprobe (maxactive=1):

        /* Pre-allocate memory for max kretprobe instances */
        if (rp->maxactive <= 0) {
#ifdef CONFIG_PREEMPT
                rp->maxactive = max_t(unsigned int, 10, 2*num_possible_cpus());
#else
                rp->maxactive = num_possible_cpus();
#endif
        }

However, some kretprobes get lost. I added a bpf_trace_printk at the
very beginning of both kprobe__tcp_v4_connect and
kretprobe__tcp_v4_connect and I get the following log in trace_pipe:

scope-19720 [000] d...   497.513538: : kprobe__tcp_v4_connect -
pid_tgid 84662395358472
scope-19720 [000] d...   497.513703: : kretprobe__tcp_v4_connect -
pid_tgid 84662395358472
 curl-19834 [000] d...   497.516090: : kprobe__tcp_v4_connect -
pid_tgid 85186381368698
scope-19720 [000] d...   497.516345: : kprobe__tcp_v4_connect -
pid_tgid 84662395358472
scope-19821 [000] d...   497.519377: : kprobe__tcp_v4_connect -
pid_tgid 84662395358573
scope-19821 [000] d...   497.521792: : kprobe__tcp_v4_connect -
pid_tgid 84662395358573
 curl-19834 [000] d...   497.529933: : kretprobe__tcp_v4_connect -
pid_tgid 85186381368698
scope-19790 [000] d...   497.624384: : kprobe__tcp_v4_connect -
pid_tgid 84658100391246
scope-19790 [000] dN..   497.624592: : kretprobe__tcp_v4_connect -
pid_tgid 84658100391246

Most of the time it works fine, but here above there is a succession
of 4 kprobes with only one kretprobe (pid 85186381368698).

Is there an explanation for the lost kretprobes? I don't see the
function tcp_v4_connect sleeping.

Is there a way to define a ebpf-kretprobe with a higher maxactive?

Cheers,
Alban
_______________________________________________
iovisor-dev mailing list
[email protected]
https://lists.iovisor.org/mailman/listinfo/iovisor-dev

Reply via email to