Skip to content

Commit 18d83c3

Browse files
Sebastian Andrzej Siewiorpetrpavlu
authored andcommitted
LoongArch: ftrace: Use RCU in all users of __module_text_address().
__module_text_address() can be invoked within a RCU section, there is no requirement to have preemption disabled. Replace the preempt_disable() section around __module_text_address() with RCU. Cc: Huacai Chen <chenhuacai@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: WANG Xuerui <kernel@xen0n.name> Cc: linux-trace-kernel@vger.kernel.org Cc: loongarch@lists.linux.dev Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20250108090457.512198-20-bigeasy@linutronix.de Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
1 parent f99d27d commit 18d83c3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

arch/loongarch/kernel/ftrace_dyn.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,13 @@ static bool ftrace_find_callable_addr(struct dyn_ftrace *rec, struct module *mod
8585
* dealing with an out-of-range condition, we can assume it
8686
* is due to a module being loaded far away from the kernel.
8787
*
88-
* NOTE: __module_text_address() must be called with preemption
89-
* disabled, but we can rely on ftrace_lock to ensure that 'mod'
88+
* NOTE: __module_text_address() must be called within a RCU read
89+
* section, but we can rely on ftrace_lock to ensure that 'mod'
9090
* retains its validity throughout the remainder of this code.
9191
*/
9292
if (!mod) {
93-
preempt_disable();
94-
mod = __module_text_address(pc);
95-
preempt_enable();
93+
scoped_guard(rcu)
94+
mod = __module_text_address(pc);
9695
}
9796

9897
if (WARN_ON(!mod))

0 commit comments

Comments
 (0)