Systemtap kernel backtraces not working on 4.14.14
Avi Kivity
avi@scylladb.com
Wed Jan 24 08:49:00 GMT 2018
I have a centos installation with 4.14.14 installed. Since the systemtap
that came in the box wouldn't work with that kernel, I built git HEAD. A
script that calls print_syms() used to display a backtrace, but now only
shows systemtap kmod symbols and one entry from the kernel proper:
 at:      8483  to: rcu_sched
 0xffffffffa0335150 : 0xffffffffa0335150
[stap_fc3e91a0b756c0a804d73b3d051959b6__1891+0xd150/0x0]
 0xffffffffa0336476 : 0xffffffffa0336476
[stap_fc3e91a0b756c0a804d73b3d051959b6__1891+0xe476/0x0]
 0xffffffffa0336eb4 : 0xffffffffa0336eb4
[stap_fc3e91a0b756c0a804d73b3d051959b6__1891+0xeeb4/0x0]
 0xffffffffa0339ecc : 0xffffffffa0339ecc
[stap_fc3e91a0b756c0a804d73b3d051959b6__1891+0x11ecc/0x0]
 0xffffffffa0328014 : 0xffffffffa0328014
[stap_fc3e91a0b756c0a804d73b3d051959b6__1891+0x14/0x0]
 0xffffffff817db0a5 : __schedule+0x395/0x880 [kernel]
 0x0 : 0x0
Here is the script:
global mon, trace, header, nr_trace, start_system_time
# mon[tid()] = 1Â Â Â if it's a reactor thread that we're tracing
# mon[tid()] = 0Â Â Â Â Â Â Â if we don't care about this thread
# trace[tid(), idx]Â Â Â Â multiline trace of recent events in rid()
# header[tid(), idx]Â Â Â header for trace above
# nr_trace[tid()]Â Â Â Â Â Â number of lines in trace
probe syscall.io_submit {
   if (cpu() != 7) { next }
   t = tid()
   mon[t] = 1
   start_system_time[t] = task_stime()
   ts = sprintf("%d", t)
   start_stopwatch(ts)
}
function add_trace(task_id, other_label, other_name) {
   ts = sprintf("%d", task_id)
   idx = nr_trace[task_id]++
   header[task_id, idx] = sprintf("at: %10d %s: %s",
read_stopwatch_us(ts), other_label, other_name)
   trace[task_id, idx] = backtrace()
}
probe scheduler.ctxswitch {
   if (cpu() != 7) { next }
   from = prev_tid
   to = next_tid
   if (mon[from]) {
       add_trace(from, "from", next_task_name)
   }
   if (mon[to]) {
       add_trace(to, " to", prev_task_name)
   }
}
probe syscall.io_submit.return {
   if (cpu() != 7) { next }
   t = tid()
   mon[t] = 0
   ts = sprintf("%d", t)
   tm = read_stopwatch_ms(ts)
   systime = cputime_to_msecs(task_stime() - start_system_time[t])
   if (t in nr_trace) {
       nr = nr_trace[t]
       if (tm >= 10) {
           printf("wall %6d ms sys %6d ms\n", tm, systime)
           for (idx = 0; idx != nr; ++idx) {
              printf(" %s\n", header[t, idx])
              print_syms(trace[t, idx])
           }
       }
       for (idx = 0; idx != nr; ++idx) {
          delete trace[t, idx]
          delete header[t, idx]
       }
       delete nr_trace[t]
   }
   delete_stopwatch(ts)
}
Is there something in the kernel configuration I need to turn on
(.config taken from elrepo's -ml kernel)? Or a missing dependency while
building systemtap? Maybe systemtap can't cope with retpolines?
More information about the Systemtap
mailing list