Skip to content

Commit

Permalink
static_call: Use RCU in all users of __module_text_address().
Browse files Browse the repository at this point in the history
__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.

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-28-bigeasy@linutronix.de
Signed-off-by: Petr Pavlu <petr.pavlu@suse.com>
  • Loading branch information
Sebastian Andrzej Siewior authored and Petr Pavlu committed Mar 10, 2025
1 parent 7e74a7c commit 3983da3
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions kernel/static_call_inline.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,13 +325,12 @@ static int __static_call_mod_text_reserved(void *start, void *end)
struct module *mod;
int ret;

preempt_disable();
mod = __module_text_address((unsigned long)start);
WARN_ON_ONCE(__module_text_address((unsigned long)end) != mod);
if (!try_module_get(mod))
mod = NULL;
preempt_enable();

scoped_guard(rcu) {
mod = __module_text_address((unsigned long)start);
WARN_ON_ONCE(__module_text_address((unsigned long)end) != mod);
if (!try_module_get(mod))
mod = NULL;
}
if (!mod)
return 0;

Expand Down

0 comments on commit 3983da3

Please sign in to comment.