Spdk/scripts/bpf/intr-wakeups.bt
John Levon 70f3606bfc add USDT tracepoints for interrupt wakeups
With these we can write a simple bpftrace script to identify work being done,
and in particular what woke us up from sleeping.

Signed-off-by: John Levon <john.levon@nutanix.com>
Change-Id: I8997d847625ee4558092dbd753e6fc1b17beca92
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9424
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
2022-03-21 11:07:05 +00:00

61 lines
1.5 KiB
Plaintext

/*
* Trace reasons for SPDK to wake up in interrupt mode.
*
* You'll probably need bpftrace from https://github.com/fbs/el7-bpf-specs
*
* Usage:
* scripts/bpftrace.sh `pidof spdk_tgt` [all]
* all: show every event, not just the first after waking up
*/
tracepoint:sched:sched_switch /comm == "reactor_0"/
{
if (str($1) == "all") {
printf("%llums: %s is off-cpu\n", elapsed / 1000000, comm);
}
@off = 1;
}
/*
* We explicitly filter out the framework-level handlers here in favour of the
* more specific tracepoints below.
*/
usdt:__EXE__:spdk:interrupt_fd_process /
@off == 1 &&
strncmp(str(arg1), "event_queue_run_batch", 40) != 0 &&
strncmp(str(arg1), "interrupt_timerfd_process", 40) != 0 &&
strncmp(str(arg1), "thread_interrupt_msg_process", 40) != 0 &&
strncmp(str(arg1), "thread_process_interrupts", 40) != 0
/
{
printf("%llums:%s: fd:%d %s(%p)\n", elapsed / 1000000, probe, arg2, usym(arg3), arg4);
if (str($1) != "all") {
@off = 0;
}
}
usdt:__EXE__:spdk:timerfd_exec /@off == 1/
{
printf("%llums:%s: %s(%p)\n", elapsed / 1000000, probe, usym(arg1), arg2);
if (str($1) != "all") {
@off = 0;
}
}
usdt:__EXE__:spdk:msg_exec /@off == 1/
{
printf("%llums:%s: %s(%p)\n", elapsed / 1000000, probe, usym(arg1), arg2);
if (str($1) != "all") {
@off = 0;
}
}
usdt:__EXE__:spdk:event_exec /@off == 1/
{
printf("%llums:%s: %s(%p, %p)\n", elapsed / 1000000, probe, usym(arg1),
arg2, arg3);
if (str($1) != "all") {
@off = 0;
}
}