2

I am trying to monitor the function pci_bus_write_config_byte. I have a kernel module that I know for certain calls that function.

echo "pci_bus_write_config_byte" > set_ftrace_filter

Then I did cat trace_pipe and loaded the module, but nothing is displayed on the terminal.

Am I missing something? Is there a "turn ftrace on" variable I am missing?

Farhan Yusufzai
  • 211
  • 4
  • 7

1 Answers1

3

Yes, you need to turn on tracing. See my blog on here on this topic.

[root@mylinux1 tracing]# pwd
/sys/kernel/debug/tracing
[root@mylinux1 tracing]# echo pci_bus_write_config_byte > set_ftrace_filter
[root@mylinux1 tracing]# echo function > current_tracer 
[root@mylinux1 tracing]# echo 1 > tracing_on 

Checkout more detailed info on ftrace,perf at Brendan Gregg's blog

VenkatC
  • 2,150
  • 15
  • 12
  • I turned on tracing, but that didn't do anything. `# echo SyS_read >set_graph_function ; # echo function_graph > current_tracer ; # echo 1 > tracing_on` Then I cat trace or trace_pipe, nothing is displayed out. I am specifically trying to track the `pci_bus_write_config_byte` function, but I get the same result. – Farhan Yusufzai Mar 13 '17 at 03:16
  • See my updated answer. You'll see any output, only when that function get's called. you can test with other simple syscalls, by echoing them into `set_ftrace_filter` – VenkatC Mar 13 '17 at 11:27
  • Makes sense, so I did exactly that. I'm also testing systemtap which works quite well. It seems to be the superior system, similar'ish to dtrace. – Farhan Yusufzai Mar 13 '17 at 16:01
  • 1
    What kernel version is this? As SyS_read isn't available anymore on x86 kernels. It's now something like: __x64_sys_read. And tracing_on should be on by default unless you did something to turn it off. – nevets May 27 '19 at 23:50
  • same issue with me. On 5.4 LTS kernel and fed up of ftrace. The function that I am trying to trace indeed gets called because I get dmesg logs from it. But ftrace does not capture it. – Naveen Feb 09 '22 at 08:01