Lines Matching +full:local +full:- +full:timer +full:- +full:stop

1 // SPDX-License-Identifier: GPL-2.0
6 * Copyright(C) 2005-2006, Thomas Gleixner <tglx@linutronix.de>
7 * Copyright(C) 2005-2007, Red Hat, Inc., Ingo Molnar
8 * Copyright(C) 2006-2007, Timesys Corp., Thomas Gleixner
24 #include "tick-internal.h"
38 * tick_do_timer_cpu is a timer core internal variable which holds the CPU NR
58 static int tick_do_timer_boot_cpu __read_mostly = -1;
70 * tick_is_oneshot_available - check for a oneshot capable event device
76 if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT))
78 if (!(dev->features & CLOCK_EVT_FEAT_C3STOP))
111 ktime_t next = dev->next_event;
117 * update_process_times() -> run_local_timers() ->
120 if (IS_ENABLED(CONFIG_TICK_ONESHOT) && dev->event_handler != tick_handle_periodic)
159 if ((dev->features & CLOCK_EVT_FEAT_PERIODIC) &&
194 if (!td->evtdev) {
211 } else if (tick_do_timer_boot_cpu != -1 && !tick_nohz_full_cpu(cpu)) {
212 tick_do_timer_boot_cpu = -1;
229 td->mode = TICKDEV_MODE_PERIODIC;
231 handler = td->evtdev->event_handler;
232 next_event = td->evtdev->next_event;
233 td->evtdev->event_handler = clockevents_handle_noop;
236 td->evtdev = newdev;
242 if (!cpumask_equal(newdev->cpumask, cpumask))
243 irq_set_affinity(newdev->irq, cpumask);
255 if (td->mode == TICKDEV_MODE_PERIODIC)
266 clockevents_exchange_device(td->evtdev, newdev);
268 if (newdev->features & CLOCK_EVT_FEAT_ONESHOT)
275 if (!cpumask_test_cpu(cpu, newdev->cpumask))
277 if (cpumask_equal(newdev->cpumask, cpumask_of(cpu)))
280 if (newdev->irq >= 0 && !irq_can_set_affinity(newdev->irq))
282 /* Prefer an existing cpu local device */
283 if (curdev && cpumask_equal(curdev->cpumask, cpumask_of(cpu)))
292 if (!(newdev->features & CLOCK_EVT_FEAT_ONESHOT)) {
293 if (curdev && (curdev->features & CLOCK_EVT_FEAT_ONESHOT))
300 * Use the higher rated one, but prefer a CPU local device with a lower
301 * rating than a non-CPU local device
304 newdev->rating > curdev->rating ||
305 !cpumask_equal(curdev->cpumask, newdev->cpumask);
333 curdev = td->evtdev;
338 if (!try_module_get(newdev->owner))
352 if (newdev->features & CLOCK_EVT_FEAT_ONESHOT)
364 * tick_broadcast_oneshot_control - Enter/exit broadcast oneshot mode
367 * The system enters/leaves a state, where affected devices might stop
368 * Returns 0 on success, -EBUSY if the cpu is used to broadcast wakeups.
371 * required here because the local clock event device cannot go away
378 if (!(td->evtdev->features & CLOCK_EVT_FEAT_C3STOP))
391 * Stop the tick and transfer the timekeeping job away from a dying cpu.
397 * safely hand over its duty. Also all online CPUs are in stop
407 /* Remove CPU from timer broadcasting */
423 struct clock_event_device *dev = td->evtdev;
425 td->mode = TICKDEV_MODE_PERIODIC;
433 dev->event_handler = clockevents_handle_noop;
434 td->evtdev = NULL;
440 * tick_suspend_local - Suspend the local tick device
442 * Called from the local cpu for freeze with interrupts disabled.
450 clockevents_shutdown(td->evtdev);
454 * tick_resume_local - Resume the local tick device
456 * Called from the local CPU for unfreeze or XEN resume magic.
465 clockevents_tick_resume(td->evtdev);
467 if (td->mode == TICKDEV_MODE_PERIODIC)
468 tick_setup_periodic(td->evtdev, 0);
482 * tick_suspend - Suspend the tick and the broadcast device
497 * tick_resume - Resume the tick and the broadcast device
515 * tick_freeze - Suspend the local tick and (possibly) timekeeping.
518 * suspend timekeeping. Otherwise suspend the local tick.
542 * tick_unfreeze - Resume the local tick and (possibly) timekeeping.
545 * timekeeping. Otherwise resume the local tick.
565 tick_freeze_depth--;
572 * tick_init - initialize the tick control