sched_clock_init() used be called early during boot when interrupts were
still disabled. After the recent changes to utilize sched clock early the
sched_clock_init() call happens when interrupts are already enabled, which
triggers the following warning:
WARNING: CPU: 0 PID: 0 at kernel/time/sched_clock.c:180 sched_clock_register+0x44/0x278
[<
c001a13c>] (warn_slowpath_null) from [<
c052367c>] (sched_clock_register+0x44/0x278)
[<
c052367c>] (sched_clock_register) from [<
c05238d8>] (generic_sched_clock_init+0x28/0x88)
[<
c05238d8>] (generic_sched_clock_init) from [<
c0521a00>] (sched_clock_init+0x54/0x74)
[<
c0521a00>] (sched_clock_init) from [<
c0519c18>] (start_kernel+0x310/0x3e4)
[<
c0519c18>] (start_kernel) from [<
00000000>] ( (null))
Disable IRQs for the duration of generic_sched_clock_init().
Fixes: 857baa87b642 ("sched/clock: Enable sched clock early")
Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: steven.sistare@oracle.com
Cc: daniel.m.jordan@oracle.com
Link: https://lkml.kernel.org/r/20180730135252.24599-1-pasha.tatashin@oracle.com
void __init sched_clock_init(void)
{
static_branch_inc(&sched_clock_running);
void __init sched_clock_init(void)
{
static_branch_inc(&sched_clock_running);
generic_sched_clock_init();
generic_sched_clock_init();
}
u64 sched_clock_cpu(int cpu)
}
u64 sched_clock_cpu(int cpu)