Skip to content

Commit ccf74e7

Browse files
Sebastian Andrzej Siewiorpetrpavlu
authored andcommitted
powerpc/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: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Naveen N Rao <naveen@kernel.org> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: linux-trace-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Shrikanth Hegde <sshegde@linux.ibm.com> Link: https://lore.kernel.org/r/20250108090457.512198-21-bigeasy@linutronix.de Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
1 parent 18d83c3 commit ccf74e7

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

arch/powerpc/kernel/trace/ftrace.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,8 @@ static unsigned long ftrace_lookup_module_stub(unsigned long ip, unsigned long a
115115
{
116116
struct module *mod = NULL;
117117

118-
preempt_disable();
119-
mod = __module_text_address(ip);
120-
preempt_enable();
121-
118+
scoped_guard(rcu)
119+
mod = __module_text_address(ip);
122120
if (!mod)
123121
pr_err("No module loaded at addr=%lx\n", ip);
124122

arch/powerpc/kernel/trace/ftrace_64_pg.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,8 @@ static struct module *ftrace_lookup_module(struct dyn_ftrace *rec)
120120
{
121121
struct module *mod;
122122

123-
preempt_disable();
124-
mod = __module_text_address(rec->ip);
125-
preempt_enable();
126-
123+
scoped_guard(rcu)
124+
mod = __module_text_address(rec->ip);
127125
if (!mod)
128126
pr_err("No module loaded at addr=%lx\n", rec->ip);
129127

0 commit comments

Comments
 (0)