Re: kprobe on local function

From: Steven Rostedt
Date: Wed Jan 22 2025 - 17:29:37 EST


On Wed, 22 Jan 2025 08:59:39 +0100
Nam Cao <namcao@xxxxxxxxxxxxx> wrote:

> Hi,
>
> I installed a kretprobe on the function "rt_mutex_slowunlock". Although the
> function is called, the probe is never hit.
>

How did you install the kretprobe?

> The reason is because there are 3 copies of rt_mutex_slowunlock() in
> vmlinux (at least for x86 defconfig + CONFIG_PREEMPT_RT). But probe point
> is only installed in 1 copy.
>
> Is this considered a bug? Or is kprobe not intended to be used for local
> function? Should we modify kprobe to support such cases?

It's not a bug, but just the way the compiler works.

Have you tried "perf probe" to install the probes? That uses dwarf info to
find all the functions.

-- Steve