Commit 0a663b7
tracing: Fix syscall events activation by ensuring refcount hits zero
When multiple syscall events are specified in the kernel command line
(e.g., trace_event=syscalls:sys_enter_openat,syscalls:sys_enter_close),
they are often not captured after boot, even though they appear enabled
in the tracing/set_event file.
The issue stems from how syscall events are initialized. Syscall
tracepoints require the global reference count (sys_tracepoint_refcount)
to transition from 0 to 1 to trigger the registration of the syscall
work (TIF_SYSCALL_TRACEPOINT) for tasks, including the init process (pid 1).
The current implementation of early_enable_events() with disable_first=true
used an interleaved sequence of "Disable A -> Enable A -> Disable B -> Enable B".
If multiple syscalls are enabled, the refcount never drops to zero,
preventing the 0->1 transition that triggers actual registration.
Fix this by splitting early_enable_events() into two distinct phases:
1. Disable all events specified in the buffer.
2. Enable all events specified in the buffer.
This ensures the refcount hits zero before re-enabling, allowing syscall
events to be properly activated during early boot.
The code is also refactored to use a helper function to avoid logic
duplication between the disable and enable phases.
Cc: [email protected]
Cc: Masami Hiramatsu <[email protected]>
Cc: Mathieu Desnoyers <[email protected]>
Link: https://patch.msgid.link/[email protected]
Fixes: ce1039b ("tracing: Fix enabling of syscall events on the command line")
Signed-off-by: Huiwen He <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>1 parent b96d0c5 commit 0a663b7
1 file changed
Lines changed: 37 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4668 | 4668 | | |
4669 | 4669 | | |
4670 | 4670 | | |
4671 | | - | |
4672 | | - | |
| 4671 | + | |
| 4672 | + | |
| 4673 | + | |
| 4674 | + | |
| 4675 | + | |
4673 | 4676 | | |
4674 | 4677 | | |
4675 | | - | |
4676 | | - | |
4677 | | - | |
4678 | | - | |
4679 | | - | |
4680 | | - | |
4681 | | - | |
4682 | 4678 | | |
| 4679 | + | |
4683 | 4680 | | |
4684 | | - | |
4685 | | - | |
| 4681 | + | |
| 4682 | + | |
| 4683 | + | |
| 4684 | + | |
4686 | 4685 | | |
4687 | | - | |
4688 | | - | |
4689 | | - | |
4690 | | - | |
| 4686 | + | |
4691 | 4687 | | |
4692 | 4688 | | |
4693 | 4689 | | |
| |||
4696 | 4692 | | |
4697 | 4693 | | |
4698 | 4694 | | |
| 4695 | + | |
| 4696 | + | |
| 4697 | + | |
| 4698 | + | |
| 4699 | + | |
| 4700 | + | |
| 4701 | + | |
| 4702 | + | |
| 4703 | + | |
| 4704 | + | |
| 4705 | + | |
| 4706 | + | |
| 4707 | + | |
| 4708 | + | |
| 4709 | + | |
| 4710 | + | |
| 4711 | + | |
| 4712 | + | |
| 4713 | + | |
| 4714 | + | |
| 4715 | + | |
| 4716 | + | |
| 4717 | + | |
| 4718 | + | |
| 4719 | + | |
| 4720 | + | |
4699 | 4721 | | |
4700 | 4722 | | |
4701 | 4723 | | |
| |||
0 commit comments