lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87wmbvvfqd.ffs@tglx>
Date: Mon, 07 Apr 2025 23:11:54 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Maxim Kochetkov <fido_max@...ox.ru>, linux-kernel@...r.kernel.org,
 linux-riscv@...ts.infradead.org, peterz@...radead.org, elver@...gle.com,
 namcao@...utronix.de, samuel.holland@...ive.com,
 daniel.lezcano@...aro.org, apatel@...tanamicro.com
Subject: Re: [PATCH 1/1] time/sched_clock: move sched_clock_register() out
 of .init section

On Mon, Apr 07 2025 at 10:25, Maxim Kochetkov wrote:
> 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.

Which is not a problem as all built-in drivers probe _before_ the init
section is discarded.

> 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)

Of course. The warning is because you invoke sched_clock_register()
from dw_apb_timer_probe(), which is regular text. See

drivers/clocksource/ingenic-ost.c
drivers/clocksource/timer-cadence-ttc.c

how to implement a builtin platform driver, which does not suffer from
that problem despite invoking sched_clock_register() from their init
functions.

> Dropping __init from sched_clock_register() helps to solve this issue.

It solves it at the wrong point for a builtin platform driver

> Anyway, this patch opens opportunity to compile clocksource drivers as 
> modules and probe them much later.

That's an orthogonal issue and needs to be discussed seperately from the
problem at hand.

Thanks,

        tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ