[PATCH v3 00/28] module: Use RCU instead of RCU-sched.

Sebastian Andrzej Siewior posted 28 patches 11 months, 2 weeks ago
arch/arm/kernel/module-plts.c            |   4 +-
arch/arm64/kernel/ftrace.c               |   7 +-
arch/loongarch/kernel/ftrace_dyn.c       |   9 +-
arch/loongarch/kernel/unwind_orc.c       |   4 +-
arch/powerpc/kernel/trace/ftrace.c       |   6 +-
arch/powerpc/kernel/trace/ftrace_64_pg.c |   6 +-
arch/x86/kernel/callthunks.c             |   3 +-
arch/x86/kernel/unwind_orc.c             |   4 +-
include/linux/kallsyms.h                 |   3 +-
include/linux/module.h                   |   2 +-
kernel/cfi.c                             |   5 +-
kernel/jump_label.c                      |  31 ++++---
kernel/kprobes.c                         |   4 +-
kernel/livepatch/core.c                  |   4 +-
kernel/module/internal.h                 |  11 ---
kernel/module/kallsyms.c                 |  73 ++++++----------
kernel/module/main.c                     | 103 ++++++++---------------
kernel/module/tracking.c                 |   2 -
kernel/module/tree_lookup.c              |   8 +-
kernel/module/version.c                  |  14 +--
kernel/static_call_inline.c              |  13 ++-
kernel/trace/bpf_trace.c                 |  19 ++---
kernel/trace/trace_kprobe.c              |   9 +-
lib/bug.c                                |  22 ++---
24 files changed, 136 insertions(+), 230 deletions(-)
[PATCH v3 00/28] module: Use RCU instead of RCU-sched.
Posted by Sebastian Andrzej Siewior 11 months, 2 weeks ago
Hi,

This is an updated version of the initial post after PeterZ made me
aware that there are users outside of the module directory.
The goal is replace the mix auf rcu_read_lock(), rcu_read_lock_sched()
and preempt_disable() with just rcu_read_lock().

I've split it into smaller chunks which can be applied/ reviewed
independently.

v2…v3: https://lore.kernel.org/all/20241220174731.514432-1-bigeasy@linutronix.de/
  - Converted cfi to use RCU.
  - Use scoped_guard() in LoongArch's ftrace code after Steven suggested
    it.

v1…v2: https://lore.kernel.org/all/20241205215102.hRywUW2A@linutronix.de/
  - Split into smaller patches.
  - Converted all users.

Sebastian Andrzej Siewior (28):
  module: Extend the preempt disabled section in
    dereference_symbol_descriptor().
  module: Begin to move from RCU-sched to RCU.
  module: Use proper RCU assignment in add_kallsyms().
  module: Use RCU in find_kallsyms_symbol().
  module: Use RCU in module_get_kallsym().
  module: Use RCU in find_module_all().
  module: Use RCU in __find_kallsyms_symbol_value().
  module: Use RCU in module_kallsyms_on_each_symbol().
  module: Remove module_assert_mutex_or_preempt() from
    try_add_tainted_module().
  module: Use RCU in find_symbol().
  module: Use RCU in __is_module_percpu_address().
  module: Allow __module_address() to be called from RCU section.
  module: Use RCU in search_module_extables().
  module: Use RCU in all users of __module_address().
  module: Use RCU in all users of __module_text_address().
  ARM: module: Use RCU in all users of __module_text_address().
  arm64: module: Use RCU in all users of __module_text_address().
  LoongArch/orc: Use RCU in all users of __module_address().
  LoongArch: ftrace: Use RCU in all users of __module_text_address().
  powerpc/ftrace: Use RCU in all users of __module_text_address().
  cfi: Use RCU while invoking __module_address().
  x86: Use RCU in all users of __module_address().
  jump_label: Use RCU in all users of __module_address().
  jump_label: Use RCU in all users of __module_text_address().
  bpf: Use RCU in all users of __module_text_address().
  kprobes: Use RCU in all users of __module_text_address().
  static_call: Use RCU in all users of __module_text_address().
  bug: Use RCU instead RCU-sched to protect module_bug_list.

 arch/arm/kernel/module-plts.c            |   4 +-
 arch/arm64/kernel/ftrace.c               |   7 +-
 arch/loongarch/kernel/ftrace_dyn.c       |   9 +-
 arch/loongarch/kernel/unwind_orc.c       |   4 +-
 arch/powerpc/kernel/trace/ftrace.c       |   6 +-
 arch/powerpc/kernel/trace/ftrace_64_pg.c |   6 +-
 arch/x86/kernel/callthunks.c             |   3 +-
 arch/x86/kernel/unwind_orc.c             |   4 +-
 include/linux/kallsyms.h                 |   3 +-
 include/linux/module.h                   |   2 +-
 kernel/cfi.c                             |   5 +-
 kernel/jump_label.c                      |  31 ++++---
 kernel/kprobes.c                         |   4 +-
 kernel/livepatch/core.c                  |   4 +-
 kernel/module/internal.h                 |  11 ---
 kernel/module/kallsyms.c                 |  73 ++++++----------
 kernel/module/main.c                     | 103 ++++++++---------------
 kernel/module/tracking.c                 |   2 -
 kernel/module/tree_lookup.c              |   8 +-
 kernel/module/version.c                  |  14 +--
 kernel/static_call_inline.c              |  13 ++-
 kernel/trace/bpf_trace.c                 |  19 ++---
 kernel/trace/trace_kprobe.c              |   9 +-
 lib/bug.c                                |  22 ++---
 24 files changed, 136 insertions(+), 230 deletions(-)

Sebastian
Re: [PATCH v3 00/28] module: Use RCU instead of RCU-sched.
Posted by Petr Pavlu 11 months, 1 week ago
On 1/8/25 10:04, Sebastian Andrzej Siewior wrote:
> This is an updated version of the initial post after PeterZ made me
> aware that there are users outside of the module directory.
> The goal is replace the mix auf rcu_read_lock(), rcu_read_lock_sched()
> and preempt_disable() with just rcu_read_lock().

Thanks for this cleanup. I've queued the fix in patch #1 on
modules-fixes. For the rest, I plan to give folks more time to look at
the changes as this affects a number of subsystems. If there are no
other concerns, I'd then add the series on modules-next.

-- 
Cheers,
Petr
Re: [PATCH v3 00/28] module: Use RCU instead of RCU-sched.
Posted by Sebastian Andrzej Siewior 10 months, 4 weeks ago
On 2025-01-13 12:09:27 [+0100], Petr Pavlu wrote:
> Thanks for this cleanup. I've queued the fix in patch #1 on
> modules-fixes. For the rest, I plan to give folks more time to look at
> the changes as this affects a number of subsystems. If there are no
> other concerns, I'd then add the series on modules-next.

#26 (kprobes) clashes with the changes that have been merged upstream.
Do you want me to resend the whole series or just #26? The other patches
apply cleanly so far.

Sebastian
Re: [PATCH v3 00/28] module: Use RCU instead of RCU-sched.
Posted by Petr Pavlu 10 months, 3 weeks ago
On 1/24/25 18:49, Sebastian Andrzej Siewior wrote:
> On 2025-01-13 12:09:27 [+0100], Petr Pavlu wrote:
>> Thanks for this cleanup. I've queued the fix in patch #1 on
>> modules-fixes. For the rest, I plan to give folks more time to look at
>> the changes as this affects a number of subsystems. If there are no
>> other concerns, I'd then add the series on modules-next.
> 
> #26 (kprobes) clashes with the changes that have been merged upstream.
> Do you want me to resend the whole series or just #26? The other patches
> apply cleanly so far.

I think sending only the updated patch #26 should be sufficient in this
case, it's only a small adjustment. Please preferably post it as a reply
to the email with that specific patch.

-- 
Thanks,
Petr
Re: [PATCH v3 00/28] module: Use RCU instead of RCU-sched.
Posted by Sebastian Andrzej Siewior 10 months, 3 weeks ago
On 2025-01-27 13:22:17 [+0100], Petr Pavlu wrote:
> On 1/24/25 18:49, Sebastian Andrzej Siewior wrote:
> > On 2025-01-13 12:09:27 [+0100], Petr Pavlu wrote:
> >> Thanks for this cleanup. I've queued the fix in patch #1 on
> >> modules-fixes. For the rest, I plan to give folks more time to look at
> >> the changes as this affects a number of subsystems. If there are no
> >> other concerns, I'd then add the series on modules-next.
> > 
> > #26 (kprobes) clashes with the changes that have been merged upstream.
> > Do you want me to resend the whole series or just #26? The other patches
> > apply cleanly so far.
> 
> I think sending only the updated patch #26 should be sufficient in this
> case, it's only a small adjustment. Please preferably post it as a reply
> to the email with that specific patch.

I just sent two updates:

 [PATCH v3.5 25/28] bpf: Use RCU in all users of __module_text_address().
 [PATCH v3.5 26/28] kprobes: Use RCU in all users of __module_text_address().

Sebastian
Re: [PATCH v3 00/28] module: Use RCU instead of RCU-sched.
Posted by Petr Pavlu 10 months, 3 weeks ago
On 1/29/25 09:52, Sebastian Andrzej Siewior wrote:
> On 2025-01-27 13:22:17 [+0100], Petr Pavlu wrote:
>> On 1/24/25 18:49, Sebastian Andrzej Siewior wrote:
>>> On 2025-01-13 12:09:27 [+0100], Petr Pavlu wrote:
>>>> Thanks for this cleanup. I've queued the fix in patch #1 on
>>>> modules-fixes. For the rest, I plan to give folks more time to look at
>>>> the changes as this affects a number of subsystems. If there are no
>>>> other concerns, I'd then add the series on modules-next.
>>>
>>> #26 (kprobes) clashes with the changes that have been merged upstream.
>>> Do you want me to resend the whole series or just #26? The other patches
>>> apply cleanly so far.
>>
>> I think sending only the updated patch #26 should be sufficient in this
>> case, it's only a small adjustment. Please preferably post it as a reply
>> to the email with that specific patch.
> 
> I just sent two updates:
> 
>  [PATCH v3.5 25/28] bpf: Use RCU in all users of __module_text_address().
>  [PATCH v3.5 26/28] kprobes: Use RCU in all users of __module_text_address().

I've now queued the series and its two updated patches #25 and #26 on
modules-next (for 6.15-rc1).

-- 
Thanks,
Petr
Re: [PATCH v3 00/28] module: Use RCU instead of RCU-sched.
Posted by Sebastian Andrzej Siewior 11 months, 1 week ago
On 2025-01-13 12:09:27 [+0100], Petr Pavlu wrote:
> Thanks for this cleanup. I've queued the fix in patch #1 on
> modules-fixes. For the rest, I plan to give folks more time to look at
> the changes as this affects a number of subsystems. If there are no
> other concerns, I'd then add the series on modules-next.
Good, thanks for the update.

Sebastian