全部博文(51)
分类: LINUX
2021-01-28 13:55:30
-m, --module=MODNAME|PATH Specify module name in which perf-probe searches probe points or lines. If a path of module file is passed, perf-probe treat it as an offline module (this means you can add a probe on a module which has not been loaded yet). |
root@jianlin-100:/home/jianlin# lsmod |grep -i vxlan root@jianlin-100:/home/jianlin# root@jianlin-100:/home/jianlin# perf probe -m /lib/modules/5.11.0-rc2+/kernel/drivers/net/vxlan.ko -a vxlan_xmit:85 Added new event: probe:vxlan_xmit_L85 (on vxlan_xmit:85 in vxlan) You can now use it in all perf tools, such as: perf record -e probe:vxlan_xmit_L85 -aR sleep 1 root@jianlin-100:/home/jianlin# perf probe -l probe:vxlan_xmit_L85 (on vxlan_xmit+1596 in vxlan) |
root@jianlin-100:/home/jianlin# lsmod |grep -i vxlan root@jianlin-100:/home/jianlin# root@jianlin-100:/home/jianlin# perf probe -m /lib/modules/5.11.0-rc2+/kernel/drivers/net/vxlan.ko 'vxlan_xmit%return $retval' Failed to write event: Invalid argument Error: Failed to add events. root@jianlin-100:/home/jianlin# root@jianlin-100:/home/jianlin# cat /sys/kernel/debug/tracing/error_log [169096.405945] trace_kprobe: error: Failed to register probe event Command: r:probe/vxlan_xmit__return vxlan:vxlan_xmit+0 $retval ^ |
root@jianlin-100:/home/jianlin# modprobe vxlan root@jianlin-100:/home/jianlin# root@jianlin-100:/home/jianlin# perf probe -m /lib/modules/5.11.0-rc2+/kernel/drivers/net/vxlan.ko 'vxlan_xmit%return $retval' Added new event: probe:vxlan_xmit__return (on vxlan_xmit%return in vxlan with $retval) You can now use it in all perf tools, such as: perf record -e probe:vxlan_xmit__return -aR sleep 1 root@jianlin-100:/home/jianlin# root@jianlin-100:/home/jianlin# lsmod |grep -i vxlan vxlan 77824 0 ip6_udp_tunnel 16384 1 vxlan udp_tunnel 24576 1 vxlan |
If register_kretprobe()returns an error -EINVAL. This means that __register_trace_kprobe return -EINVAL, --- ret = __register_trace_kprobe(tk); if (ret == -ENOENT && !trace_kprobe_module_exist(tk)) { pr_warn("This probe might be able to register after target module is loaded. Continue.\n"); ret = 0; } --- As code show, cannot enable kretprobe for an unloaded module. |
Fixes: 59158ec4aef7 ("tracing/kprobes: Check the probe on unloaded module correctly")