Skip to content

Commit

Permalink
tools/nvmeblk.bt: force nvme_core module BTF to be loaded
Browse files Browse the repository at this point in the history
bpftrace list_modules() does not yet support loading BTFs for
modules on ProbeType::kprobe and it is not clear if it will. To load
the BTF for modules so we can get structures for it which might be
private (and could conflict with other modules own structures) one
has to use a probe type which does load the BTF for the corresponding
module.

Since we already are adding a kprobe on nvme_setup_cmd() just use
the kretfunc probe on the same routine and have it do nothing.

This fixes the use case of nvmeblk.bt when we nvme_core is a module.

Signed-off-by: Luis Chamberlain <[email protected]>
  • Loading branch information
dkruces committed Nov 15, 2023
1 parent a72ad75 commit d1d7262
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/nvmeblk.bt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ BEGIN
printf("%-9s %-10s %-8s %-6s %-16s %-16s\n", "DISK", "LBA", "LEN", "OP", "COMM", "ALIGN");
}

kretfunc:nvme_core:nvme_setup_cmd
{
/* we add an empty kretfuncs probe to load module BTF */
}

kprobe:nvme_setup_cmd
{
$req = (struct request *)arg1;
Expand Down

0 comments on commit d1d7262

Please sign in to comment.