On Mon, Apr 10, 2023 at 1:25 AM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > > 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") > Right, it is because of the BTF_ID(). I think we should introduce migrate_{disable,enable}_notrace instead. Because actually we only don't want it to attach migrate_{disable,enable} used in bpf prog enter and exit, while it is safe to attach it at other places. -- Regards Yafang