On Wed, 16 Jul 2025 14:26:09 -0400 Steven Rostedt <rost...@goodmis.org> wrote:
> Now before the task gets back to user space, ftrace requests the > deferred trace. To do so, it must set the pending bit and its bit, > but it must also clear the perf bit as it should not call perf's > callback again. After ftrace clears the bits, it is possible that the first perf program will request again and this time it will get another callback with the same cookie. But at least it has a request between the last callback and the next one. That is, it would have: [Task enters kernel] request -> add cookie request -> add cookie [..] callback -> add trace + cookie [ftrace clears bits] request -> add cookie callback -> add trace + cookie [Task exits back to user space] Which shouldn't be too confusing. But if we just do the fetch_or and it didn't request a new trace, it would have: [Task enters kernel] request -> add cookie request -> add cookie [..] callback -> add trace + cookie [ftrace clears bits] callback -> add trace + cookie [Task exits back to user space] Where there's two callbacks written to the perf buffer for the same request. Maybe this isn't a problem, but I was trying to avoid adding multiple requests due to other tracers affecting the state. -- Steve