• Frederic Weisbecker's avatar
    tick: Start centralizing tick related CPU hotplug operations · 3ad6eb06
    Frederic Weisbecker authored
    During the CPU offlining process, the various timer tick features are
    shut down from scattered places, sometimes from teardown callbacks on
    stop machine, sometimes through explicit calls, sometimes from the
    control CPU after the CPU died. The reason why these shutdown operations
    are spread around is not always clear and it makes the tick lifecycle
    hard to follow.
    
    The tick should be shut down in order from highest to lowest level:
    
    On stop machine from the dying CPU (high-level):
    
     1) Hand-over the timekeeping duty (tick_handover_do_timer())
     2) Cancel the tick implementation called by the clockevent callback
        (tick_cancel_sched_timer())
     3) Shutdown broadcasting (tick_offline_cpu() / tick_broadcast_offline())
    
    On stop machine from the dying CPU (low-level):
    
     4) Shutdown clockevents drivers (CPUHP_AP_*_TIMER_STARTING states)
    
    From the control CPU after the CPU died (low-level):
    
     5) Shutdown/unregister/cleanup clockevents for the dead CPU
        (tick_cleanup_dead_cpu())
    
    Instead the current order is 2, 4 (both from CPU hotplug states), then
    1 and 3 through direct calls. This layout and order don't make much
    sense. The operations 1, 2, 3 should be gathered together and in order.
    
    Sort this situation with creating a new TICK shut-down CPU hotplug state
    and start with introducing the timekeeping duty hand-over there. The
    state must precede hrtimers migration because the tick hrtimer will be
    stopped from it in a further patch.
    Signed-off-by: default avatarFrederic Weisbecker <frederic@kernel.org>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/r/20240225225508.11587-8-frederic@kernel.org
    3ad6eb06
tick.h 9.74 KB