Re: sched/isolation: tick_take_do_timer_from_boot() calls smp_call_function_single() with irqs disabled

Nicholas Piggin
2024-05-27T11:01:58Z

On Mon May 27, 2024 at 5:27 AM AEST, Oleg Nesterov wrote:
> The more I grep the more I confused.
>
> On 05/25, Thomas Gleixner wrote:
> >
> > Right. It does not happen because the kernel starts with jiffies as
> > clocksource except on S390. The jiffies clocksource is not qualified to
> > switch over to NOHZ mode for obvious reasons.
>
> Not obvious for those who never looked at this code ;)
>
> OK, clocksource_jiffies doesn't have CLOCK_SOURCE_VALID_FOR_HRES,

jiffies clocksource requires a timer to run it I suppose.

[snip]

> > So up to this point the tick is never stopped neither on housekeeping
> > nor on NOHZ FULL CPUs:
> >
> > tick_nohz_full_update_tick()
> > if (!tick_sched_flag_test(ts, TS_FLAG_NOHZ))
> > return;
>
> OK... But tick_nohz_idle_update_tick() doesn't check TS_FLAG_NOHZ and
> the tick_nohz_full_cpu() check can't help at boot time.
>
> And I still don't understand why we can rely on can_stop_idle_tick() even
> in tick_nohz_idle_stop_tick().

AFAIKS timer_expires_base would be 0 unless tick_nohz_next_event()
were called, but that is only called from places that checked
can_stop_idle_tick() or is already a tick_nohz_full() CPU.

And timer tick CPU can't be unplugged with nohz full.

Thanks,
Nick