On Sun, 9 Apr 2023 20:45:39 +0800 Yafang Shao <laoar.shao@xxxxxxxxx> wrote: > > I didn't notice preempt_{disable,enable}_notrace before :( > Seems that is a better solution. I have verified that it really works. Great. > > BTW, why can we attach fentry to preempt_count_sub(), but can't attach > it to migrate_disable() ? > migrate_disable() isn't hidden from ftrace either... You can't? # trace-cmd -p function -l migrate_disable # trace-cmd show <idle>-0 [000] ..s2. 153664.937829: migrate_disable <-bpf_prog_run_clear_cb <idle>-0 [000] ..s2. 153664.937834: migrate_disable <-bpf_prog_run_clear_cb <idle>-0 [000] ..s2. 153664.937835: migrate_disable <-bpf_prog_run_clear_cb <idle>-0 [000] ..s2. 153665.769555: migrate_disable <-bpf_prog_run_clear_cb <idle>-0 [000] ..s2. 153665.772109: migrate_disable <-bpf_prog_run_clear_cb I think bpf prevents it. Perhaps that's another solution: See 35e3815fa8102 ("bpf: Add deny list of btf ids check for tracing programs") -- Steve