Skip to content

Commit 4f7bf54

Browse files
committed
tracing: Fix wakeup tracers on failure of acquiring calltime
The functions wakeup_graph_entry() and wakeup_graph_return() both call func_prolog_preempt_disable() that will test if the data->disable is already set and if not, increment it and disable preemption. If it was set, it returns false and the caller exits. The caller of this function must decrement the disable counter, but misses doing so if the calltime fails to be acquired. Instead of exiting out when calltime is NULL, change the logic to do the work if it is not NULL and still do the clean up at the end of the function if it is NULL. Cc: stable@vger.kernel.org Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Link: https://lore.kernel.org/20251008114835.027b878a@gandalf.local.home Fixes: a485ea9 ("tracing: Fix irqsoff and wakeup latency tracers when using function graph") Reported-by: Sasha Levin <sashal@kernel.org> Closes: https://lore.kernel.org/linux-trace-kernel/20251006175848.1906912-1-sashal@kernel.org/ Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent f0c029d commit 4f7bf54

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

kernel/trace/trace_sched_wakeup.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,10 @@ static int wakeup_graph_entry(struct ftrace_graph_ent *trace,
138138
return 0;
139139

140140
calltime = fgraph_reserve_data(gops->idx, sizeof(*calltime));
141-
if (!calltime)
142-
return 0;
143-
144-
*calltime = trace_clock_local();
145-
146-
ret = __trace_graph_entry(tr, trace, trace_ctx);
141+
if (calltime) {
142+
*calltime = trace_clock_local();
143+
ret = __trace_graph_entry(tr, trace, trace_ctx);
144+
}
147145
local_dec(&data->disabled);
148146
preempt_enable_notrace();
149147

@@ -169,12 +167,10 @@ static void wakeup_graph_return(struct ftrace_graph_ret *trace,
169167
rettime = trace_clock_local();
170168

171169
calltime = fgraph_retrieve_data(gops->idx, &size);
172-
if (!calltime)
173-
return;
170+
if (calltime)
171+
__trace_graph_return(tr, trace, trace_ctx, *calltime, rettime);
174172

175-
__trace_graph_return(tr, trace, trace_ctx, *calltime, rettime);
176173
local_dec(&data->disabled);
177-
178174
preempt_enable_notrace();
179175
return;
180176
}

0 commit comments

Comments
 (0)