[PATCH 1/1] time/sched_clock: move sched_clock_register() out of .init section
Maxim Kochetkov
fido_max at inbox.ru
Mon Apr 7 00:25:32 PDT 2025
07.04.2025 09:26, Thomas Gleixner wrote:
> On Fri, Apr 04 2025 at 08:05, Maxim Kochetkov wrote:
>> The sched_clock_register() is widely used by clocksource timer
>> drivers. The __init prefix forces them to be initialized using
>> macro TIMER_OF_DECLARE with __init prefixed function.
>
> No, it does not. It requires that they are built in, not more.
Thank you for review.
Let me explain some more. I'm trying to solve similar problem, as
described at
https://patchwork.kernel.org/project/linux-arm-kernel/patch/20240312192519.1602493-1-samuel.holland@sifive.com/#25759271
I have both PLIC and clocksource module configured as Y (not m) in
Kconfig. So both of them are included in kernel Image binary. But I
still unable to probe clocksource device because it depends of PLIC irq.
And PLIC probes much later than TIMER_OF_DECLARE part of the clocksource
driver. I tried to convert clocksource driver to regular platform device
and it works fine except warning:
WARNING: modpost: vmlinux: section mismatch in reference:
dw_apb_timer_probe+0x136 (section: .text.unlikely) ->
sched_clock_register (section: .init.text)
Dropping __init from sched_clock_register() helps to solve this issue.
Is there any real point to keep __init in sched_clock_register()? I see
no issues to call this function at any time later after kernel boot.
Is there better way to solve this issue?
>> So lets drop __init prefix to allow platform device drivers to use
>> sched_clock_register().
>
> s/So let's//
>
> "So let's" means nothing.
>
> Also this has nothing to do with platform device drivers. It's all about
> modules and nothing else.
Anyway, this patch opens opportunity to compile clocksource drivers as
modules and probe them much later.
Thanks.
More information about the linux-riscv
mailing list