Commit 18d83c36 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Petr Pavlu
Browse files

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: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250108090457.512198-20-bigeasy@linutronix.de


Signed-off-by: default avatarPetr Pavlu <petr.pavlu@suse.com>
parent f99d27d9
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -85,14 +85,13 @@ static bool ftrace_find_callable_addr(struct dyn_ftrace *rec, struct module *mod
	 * dealing with an out-of-range condition, we can assume it
	 * is due to a module being loaded far away from the kernel.
	 *
	 * NOTE: __module_text_address() must be called with preemption
	 * disabled, but we can rely on ftrace_lock to ensure that 'mod'
	 * NOTE: __module_text_address() must be called within a RCU read
	 * section, but we can rely on ftrace_lock to ensure that 'mod'
	 * retains its validity throughout the remainder of this code.
	 */
	if (!mod) {
		preempt_disable();
		scoped_guard(rcu)
			mod = __module_text_address(pc);
		preempt_enable();
	}

	if (WARN_ON(!mod))