libbpf-tools: Fix klockstat when CONFIG_DEBUG_LOCK_ALLOC is set
When CONFIG_DEBUG_LOCK_ALLOC is set ([0]), mutex_lock, mutex_lock_interruptible
and mutex_lock_killable become macro defines and gone from ksyms. Let's use
the *_nested functions as tracing targets instead.
[0]:
@@ -534,6 +534,21 @@ int main(int argc, char **argv)
obj->rodata->targ_pid = env.tid;
obj->rodata->targ_lock = lock_addr;
+ if (fentry_exists("mutex_lock_nested", NULL)) {
+ bpf_program__set_attach_target(obj->progs.mutex_lock, 0,
+ "mutex_lock_nested");
+ bpf_program__set_attach_target(obj->progs.mutex_lock_exit, 0,
+ "mutex_lock_nested");
+ bpf_program__set_attach_target(obj->progs.mutex_lock_interruptible, 0,
+ "mutex_lock_interruptible_nested");
+ bpf_program__set_attach_target(obj->progs.mutex_lock_interruptible_exit, 0,
+ "mutex_lock_interruptible_nested");
+ bpf_program__set_attach_target(obj->progs.mutex_lock_killable, 0,
+ "mutex_lock_killable_nested");
+ bpf_program__set_attach_target(obj->progs.mutex_lock_killable_exit, 0,
+ "mutex_lock_killable_nested");
+ }
+
err = klockstat_bpf__load(obj);
if (err) {
warn("failed to load BPF object\n");
