Re: [PATCH] tcb_clksrc: Use 32 bit tcb as sched_clock
From: Romain Izard
Date: Tue Jan 17 2017 - 09:46:25 EST
On 2017-01-11, David Engraf <david.engraf@xxxxxxxxx> wrote:
> On newer boards the TC can be read as single 32 bit value without locking.
> Thus the clock can be used as reference for sched_clock which is much more
> accurate than the jiffies implementation.
>
> Tested on a Atmel SAMA5D2 board.
>
> Signed-off-by: David Engraf <david.engraf@xxxxxxxxx>
Unfortunately, this leads to the current boot warning:
------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at ../kernel/time/sched_clock.c:179 sched_clock_register+0x4c/0x21c
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 4.9.4-00041-ge780a8100f0d #1
Hardware name: Atmel SAMA5
[<c01103e4>] (unwind_backtrace) from [<c010d0e4>] (show_stack+0x20/0x24)
[<c010d0e4>] (show_stack) from [<c039c130>] (dump_stack+0x24/0x28)
[<c039c130>] (dump_stack) from [<c011f7b0>] (__warn+0xf4/0x10c)
[<c011f7b0>] (__warn) from [<c011f898>] (warn_slowpath_null+0x30/0x38)
[<c011f898>] (warn_slowpath_null) from [<c0c0d2c0>] (sched_clock_register+0x4c/0x21c)
[<c0c0d2c0>] (sched_clock_register) from [<c0c345fc>] (tcb_clksrc_init+0x1c8/0x424)
[<c0c345fc>] (tcb_clksrc_init) from [<c0101cdc>] (do_one_initcall+0x50/0x184)
[<c0101cdc>] (do_one_initcall) from [<c0c00e70>] (kernel_init_freeable+0x13c/0x1e0)
[<c0c00e70>] (kernel_init_freeable) from [<c08303ec>] (kernel_init+0x18/0x124)
[<c08303ec>] (kernel_init) from [<c0108c34>] (ret_from_fork+0x14/0x20)
---[ end trace 3d13186881cd5c91 ]---
"sched_clock_register" expects to be called with interrupts disabled, but
the tcb_clksrc initialization is called as an arch_initcall, which runs too
late in the boot sequence.
Best regards,
--
Romain Izard