Linux:ftrace: 为什么有些函数没有在available_filter_functions

2022/1/5 7:06:04

本文主要是介绍Linux:ftrace: 为什么有些函数没有在available_filter_functions,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

文章目录

  • 例如:__run_hrtimer
  • 汇编

例如:__run_hrtimer

这个函数其实有被用到,在函数__hrtimer_run_queues 中,有调用__run_hrtimer
但是在available_filter_functions 文件中就是没有

<sbc2048-fwp-a:root>/sys/kernel/debug/tracing:
# grep __run_hrtimer av*
<sbc2048-fwp-a:root>/sys/kernel/debug/tracing:

汇编

看看汇编,发现确实没有调用,原因可能就是void 函数被inline 优化了。

(gdb) disass __hrtimer_run_queues
Dump of assembler code for function __hrtimer_run_queues:
   0xffffffff8117d200 <+0>:     callq  0xffffffff81a01900 <__fentry__>
   0xffffffff8117d205 <+5>:     push   %r15
   0xffffffff8117d207 <+7>:     push   %r14
   0xffffffff8117d209 <+9>:     push   %r13
   0xffffffff8117d20b <+11>:    push   %r12
   0xffffffff8117d20d <+13>:    push   %rbp
   0xffffffff8117d20e <+14>:    push   %rbx
   0xffffffff8117d20f <+15>:    sub    $0x28,%rsp
   0xffffffff8117d213 <+19>:    mov    %rsi,0x10(%rsp)
   0xffffffff8117d218 <+24>:    mov    %rdx,(%rsp)
   0xffffffff8117d21c <+28>:    mov    %gs:0x28,%rax
   0xffffffff8117d225 <+37>:    mov    %rax,0x20(%rsp)
   0xffffffff8117d22a <+42>:    xor    %eax,%eax
   0xffffffff8117d22c <+44>:    and    0x8(%rdi),%ecx   rdi cpu_base, lockdep_assert_held(&cpu_base->lock);
   0xffffffff8117d22f <+47>:    je     0xffffffff8117d455 <__hrtimer_run_queues+597>   /// stack check failure
   0xffffffff8117d235 <+53>:    mov    %ecx,%eax
   0xffffffff8117d237 <+55>:    mov    %rdi,%r13
   0xffffffff8117d23a <+58>:    tzcnt  %rax,%rax
   0xffffffff8117d23f <+63>:    mov    %eax,%ebp
   0xffffffff8117d241 <+65>:    btr    %eax,%ecx
   0xffffffff8117d244 <+68>:    mov    %eax,%r12d
   0xffffffff8117d247 <+71>:    add    $0x1,%rbp
   0xffffffff8117d24b <+75>:    mov    %ecx,0xc(%rsp)
   0xffffffff8117d24f <+79>:    shl    $0x6,%rbp
   0xffffffff8117d253 <+83>:    add    %rdi,%rbp
   0xffffffff8117d256 <+86>:    je     0xffffffff8117d455 <__hrtimer_run_queues+597>
   0xffffffff8117d25c <+92>:    shl    $0x6,%r12
   0xffffffff8117d260 <+96>:    mov    0x28(%rbp),%rbx
   0xffffffff8117d264 <+100>:   mov    0x10(%rsp),%rax
   0xffffffff8117d269 <+105>:   add    %r13,%r12
   0xffffffff8117d26c <+108>:   add    0x78(%r12),%rax
   0xffffffff8117d271 <+113>:   mov    %rax,0x18(%rsp)
   0xffffffff8117d276 <+118>:   test   %rbx,%rbx
   0xffffffff8117d279 <+121>:   je     0xffffffff8117d41e <__hrtimer_run_queues+542>
   0xffffffff8117d27f <+127>:   cmp    0x20(%rbx),%rax
   0xffffffff8117d283 <+131>:   jge    0xffffffff8117d2c2 <__hrtimer_run_queues+194>
   0xffffffff8117d285 <+133>:   jmpq   0xffffffff8117d41e <__hrtimer_run_queues+542>
   0xffffffff8117d28a <+138>:   addl   $0x1,0x10(%rbp)
   0xffffffff8117d28e <+142>:   addl   $0x1,0x10(%rbp)
   0xffffffff8117d292 <+146>:   cmp    %rbx,0x58(%r12)
   0xffffffff8117d297 <+151>:   jne    0xffffffff8117d343 <__hrtimer_run_queues+323>
   0xffffffff8117d29d <+157>:   movq   $0x0,0x58(%r12)
   0xffffffff8117d2a6 <+166>:   mov    0x28(%rbp),%rbx
   0xffffffff8117d2aa <+170>:   test   %rbx,%rbx
   0xffffffff8117d2ad <+173>:   je     0xffffffff8117d41e <__hrtimer_run_queues+542>
   0xffffffff8117d2b3 <+179>:   mov    0x20(%rbx),%rax
   0xffffffff8117d2b7 <+183>:   cmp    %rax,0x18(%rsp)
   0xffffffff8117d2bc <+188>:   jl     0xffffffff8117d41e <__hrtimer_run_queues+542>
   0xffffffff8117d2c2 <+194>:   nopl   0x0(%rax,%rax,1)
   0xffffffff8117d2c7 <+199>:   mov    %rbx,0x58(%r12)
   0xffffffff8117d2cc <+204>:   addl   $0x1,0x10(%rbp)
   0xffffffff8117d2d0 <+208>:   addl   $0x1,0x10(%rbp)
   0xffffffff8117d2d4 <+212>:   mov    %rbp,%rsi
   0xffffffff8117d2d7 <+215>:   mov    %rbx,%rdi
   0xffffffff8117d2da <+218>:   xor    %ecx,%ecx
   0xffffffff8117d2dc <+220>:   xor    %edx,%edx
   0xffffffff8117d2de <+222>:   callq  0xffffffff8117cd40 <__remove_hrtimer>
   0xffffffff8117d2e3 <+227>:   mov    (%rsp),%rsi
   0xffffffff8117d2e7 <+231>:   mov    %r13,%rdi
   0xffffffff8117d2ea <+234>:   mov    0x28(%rbx),%r14
   0xffffffff8117d2ee <+238>:   callq  0xffffffff8197f1d0 <_raw_spin_unlock_irqrestore>
   0xffffffff8117d2f3 <+243>:   nopl   0x0(%rax,%rax,1)
   0xffffffff8117d2f8 <+248>:   mov    %rbx,%rdi
   0xffffffff8117d2fb <+251>:   callq  0xffffffff81c015f0 <__x86_indirect_thunk_r14>
   0xffffffff8117d300 <+256>:   mov    %eax,%r14d
   0xffffffff8117d303 <+259>:   nopl   0x0(%rax,%rax,1)
   0xffffffff8117d308 <+264>:   mov    %r13,%rdi
   0xffffffff8117d30b <+267>:   callq  0xffffffff8197f560 <_raw_spin_lock_irq>
   0xffffffff8117d310 <+272>:   test   %r14d,%r14d
   0xffffffff8117d313 <+275>:   je     0xffffffff8117d28a <__hrtimer_run_queues+138>
   0xffffffff8117d319 <+281>:   testb  $0x1,0x38(%rbx)
   0xffffffff8117d31d <+285>:   jne    0xffffffff8117d28a <__hrtimer_run_queues+138>
   0xffffffff8117d323 <+291>:   xor    %edx,%edx
   0xffffffff8117d325 <+293>:   mov    %rbp,%rsi
   0xffffffff8117d328 <+296>:   mov    %rbx,%rdi
   0xffffffff8117d32b <+299>:   callq  0xffffffff8117ce80 <enqueue_hrtimer>
   0xffffffff8117d330 <+304>:   addl   $0x1,0x10(%rbp)
   0xffffffff8117d334 <+308>:   addl   $0x1,0x10(%rbp)
   0xffffffff8117d338 <+312>:   cmp    %rbx,0x58(%r12)
   0xffffffff8117d33d <+317>:   je     0xffffffff8117d29d <__hrtimer_run_queues+157>
   0xffffffff8117d343 <+323>:   ud2
   0xffffffff8117d345 <+325>:   jmpq   0xffffffff8117d29d <__hrtimer_run_queues+157>
   0xffffffff8117d34a <+330>:   mov    %gs:0x7ee9224f(%rip),%eax        # 0xf5a0 <cpu_number>
   0xffffffff8117d351 <+337>:   mov    %eax,%eax
   0xffffffff8117d353 <+339>:   bt     %rax,0x16ab7e5(%rip)        # 0xffffffff82828b40 <__cpu_online_mask>
   0xffffffff8117d35b <+347>:   jae    0xffffffff8117d2c7 <__hrtimer_run_queues+199>
   0xffffffff8117d361 <+353>:   mov    0x165f5a0(%rip),%r14        # 0xffffffff827dc908 <__tracepoint_hrtimer_cancel+40>
   0xffffffff8117d368 <+360>:   test   %r14,%r14
   0xffffffff8117d36b <+363>:   je     0xffffffff8117d388 <__hrtimer_run_queues+392>
   0xffffffff8117d36d <+365>:   mov    (%r14),%rax
   0xffffffff8117d370 <+368>:   mov    0x8(%r14),%rdi
   0xffffffff8117d374 <+372>:   add    $0x18,%r14
   0xffffffff8117d378 <+376>:   mov    %rbx,%rsi
   0xffffffff8117d37b <+379>:   callq  0xffffffff81c01450 <__x86_indirect_thunk_rax>
   0xffffffff8117d380 <+384>:   mov    (%r14),%rax
   0xffffffff8117d383 <+387>:   test   %rax,%rax
   0xffffffff8117d386 <+390>:   jne    0xffffffff8117d370 <__hrtimer_run_queues+368>
   0xffffffff8117d388 <+392>:   jmpq   0xffffffff8117d2c7 <__hrtimer_run_queues+199>
   0xffffffff8117d38d <+397>:   mov    %gs:0x7ee9220c(%rip),%eax        # 0xf5a0 <cpu_number>
   0xffffffff8117d394 <+404>:   mov    %eax,%eax
   0xffffffff8117d396 <+406>:   bt     %rax,0x16ab7a2(%rip)        # 0xffffffff82828b40 <__cpu_online_mask>
   0xffffffff8117d39e <+414>:   jae    0xffffffff8117d308 <__hrtimer_run_queues+264>
   0xffffffff8117d3a4 <+420>:   mov    0x165f59d(%rip),%rax        # 0xffffffff827dc948 <__tracepoint_hrtimer_expire_exit+40>
   0xffffffff8117d3ab <+427>:   test   %rax,%rax
   0xffffffff8117d3ae <+430>:   je     0xffffffff8117d3ce <__hrtimer_run_queues+462>
   0xffffffff8117d3b0 <+432>:   mov    (%rax),%rdx
   0xffffffff8117d3b3 <+435>:   mov    %rax,%r15
   0xffffffff8117d3b6 <+438>:   mov    0x8(%r15),%rdi
   0xffffffff8117d3ba <+442>:   add    $0x18,%r15
   0xffffffff8117d3be <+446>:   mov    %rbx,%rsi
   0xffffffff8117d3c1 <+449>:   callq  0xffffffff81c014b0 <__x86_indirect_thunk_rdx>
   0xffffffff8117d3c6 <+454>:   mov    (%r15),%rdx
   0xffffffff8117d3c9 <+457>:   test   %rdx,%rdx
   0xffffffff8117d3cc <+460>:   jne    0xffffffff8117d3b6 <__hrtimer_run_queues+438>
   0xffffffff8117d3ce <+462>:   jmpq   0xffffffff8117d308 <__hrtimer_run_queues+264>
   0xffffffff8117d3d3 <+467>:   mov    %gs:0x7ee921c6(%rip),%eax        # 0xf5a0 <cpu_number>
   0xffffffff8117d3da <+474>:   mov    %eax,%eax
   0xffffffff8117d3dc <+476>:   bt     %rax,0x16ab75c(%rip)        # 0xffffffff82828b40 <__cpu_online_mask>
   0xffffffff8117d3e4 <+484>:   jae    0xffffffff8117d2f8 <__hrtimer_run_queues+248>
   0xffffffff8117d3ea <+490>:   mov    0x165f597(%rip),%rax        # 0xffffffff827dc988 <__tracepoint_hrtimer_expire_entry+40>
   0xffffffff8117d3f1 <+497>:   test   %rax,%rax
   0xffffffff8117d3f4 <+500>:   je     0xffffffff8117d419 <__hrtimer_run_queues+537>
   0xffffffff8117d3f6 <+502>:   mov    (%rax),%rcx
   0xffffffff8117d3f9 <+505>:   mov    %rax,%r15
   0xffffffff8117d3fc <+508>:   mov    0x8(%r15),%rdi
   0xffffffff8117d400 <+512>:   add    $0x18,%r15
   0xffffffff8117d404 <+516>:   lea    0x18(%rsp),%rdx
   0xffffffff8117d409 <+521>:   mov    %rbx,%rsi
   0xffffffff8117d40c <+524>:   callq  0xffffffff81c01490 <__x86_indirect_thunk_rcx>
   0xffffffff8117d411 <+529>:   mov    (%r15),%rcx
   0xffffffff8117d414 <+532>:   test   %rcx,%rcx
   0xffffffff8117d417 <+535>:   jne    0xffffffff8117d3fc <__hrtimer_run_queues+508>
   0xffffffff8117d419 <+537>:   jmpq   0xffffffff8117d2f8 <__hrtimer_run_queues+248>
   0xffffffff8117d41e <+542>:   mov    0xc(%rsp),%eax
   0xffffffff8117d422 <+546>:   test   %eax,%eax
   0xffffffff8117d424 <+548>:   je     0xffffffff8117d455 <__hrtimer_run_queues+597>
   0xffffffff8117d426 <+550>:   mov    0xc(%rsp),%ecx
   0xffffffff8117d42a <+554>:   mov    $0xfffffffe,%eax
   0xffffffff8117d42f <+559>:   mov    %rcx,%rsi
   0xffffffff8117d432 <+562>:   tzcnt  %rcx,%rcx
   0xffffffff8117d437 <+567>:   mov    %ecx,%ebp
   0xffffffff8117d439 <+569>:   rol    %cl,%eax
   0xffffffff8117d43b <+571>:   mov    %ecx,%r12d
   0xffffffff8117d43e <+574>:   add    $0x1,%rbp
   0xffffffff8117d442 <+578>:   and    %eax,%esi
   0xffffffff8117d444 <+580>:   shl    $0x6,%rbp
   0xffffffff8117d448 <+584>:   mov    %esi,0xc(%rsp)
   0xffffffff8117d44c <+588>:   add    %r13,%rbp
   0xffffffff8117d44f <+591>:   jne    0xffffffff8117d25c <__hrtimer_run_queues+92>
   0xffffffff8117d455 <+597>:   mov    0x20(%rsp),%rax
   0xffffffff8117d45a <+602>:   xor    %gs:0x28,%rax
   0xffffffff8117d463 <+611>:   jne    0xffffffff8117d474 <__hrtimer_run_queues+628>
   0xffffffff8117d465 <+613>:   add    $0x28,%rsp
   0xffffffff8117d469 <+617>:   pop    %rbx
   0xffffffff8117d46a <+618>:   pop    %rbp
   0xffffffff8117d46b <+619>:   pop    %r12
   0xffffffff8117d46d <+621>:   pop    %r13
   0xffffffff8117d46f <+623>:   pop    %r14
   0xffffffff8117d471 <+625>:   pop    %r15
   0xffffffff8117d473 <+627>:   retq
   0xffffffff8117d474 <+628>:   callq  0xffffffff810ebdb0 <__stack_chk_fail>



这篇关于Linux:ftrace: 为什么有些函数没有在available_filter_functions的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程