Re: [tip:x86/timers] sched/clock: Enable sched clock early
From: Peter Zijlstra
Date: Mon Jul 30 2018 - 08:36:40 EST
On Tue, Jul 24, 2018 at 10:41:19PM -0400, Pavel Tatashin wrote:
> If we need it, we can surround the sched_clock_register() with
> local_irq_disable/local_irq_enable:
>
> diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
> index cbc72c2c1fca..5015b165b55b 100644
> --- a/kernel/time/sched_clock.c
> +++ b/kernel/time/sched_clock.c
> @@ -243,8 +243,11 @@ void __init generic_sched_clock_init(void)
> * If no sched_clock() function has been provided at that point,
> * make it the final one one.
> */
> - if (cd.actual_read_sched_clock == jiffy_sched_clock_read)
> + if (cd.actual_read_sched_clock == jiffy_sched_clock_read) {
> + local_irq_disable();
> sched_clock_register(jiffy_sched_clock_read, BITS_PER_LONG, HZ);
> + local_irq_enable();
> + }
>
> update_sched_clock();
I'm thinking maybe disable IRQs for that entire function, instead of
just the register call.