Loading
ftrace: Correct preemption accounting for function tracing.
stable inclusion from stable-v6.6.80 commit ac35a1db03278290faa607d02de2670b9bd72574 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IBXANC Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=ac35a1db03278290faa607d02de2670b9bd72574 -------------------------------- commit 57b76bedc5c52c66968183b5ef57234894c25ce7 upstream. The function tracer should record the preemption level at the point when the function is invoked. If the tracing subsystem decrement the preemption counter it needs to correct this before feeding the data into the trace buffer. This was broken in the commit cited below while shifting the preempt-disabled section. Use tracing_gen_ctx_dec() which properly subtracts one from the preemption counter on a preemptible kernel. Cc: stable@vger.kernel.org Cc: Wander Lairson Costa <wander@redhat.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/20250220140749.pfw8qoNZ@linutronix.de Fixes: ce5e4803 ("ftrace: disable preemption when recursion locked") Signed-off-by:Sebastian Andrzej Siewior <bigeasy@linutronix.de> Tested-by:
Wander Lairson Costa <wander@redhat.com> Signed-off-by:
Steven Rostedt (Google) <rostedt@goodmis.org> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org> (cherry picked from commit ac35a1db03278290faa607d02de2670b9bd72574) Signed-off-by:
Wentao Guan <guanwentao@uniontech.com>