Lines Matching +full:no +full:- +full:tick +full:- +full:in +full:- +full:suspend

1 // SPDX-License-Identifier: GPL-2.0
3 * This file contains the base functions to manage periodic tick
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
23 #include "tick-internal.h"
26 * Tick devices
30 * Tick next event: keeps track of the tick time. It's updated by the
31 * CPU which handles the tick and protected by jiffies_lock. There is
32 * no requirement to write hold the jiffies seqcount for it.
45 * 2) Hand off the duty in the NOHZ idle case by setting the value to
57 static int tick_do_timer_boot_cpu __read_mostly = -1;
69 * tick_is_oneshot_available - check for a oneshot capable event device
75 if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT)) in tick_is_oneshot_available()
77 if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) in tick_is_oneshot_available()
83 * Periodic tick
91 /* Keep track of the next tick event */ in tick_periodic()
110 ktime_t next = dev->next_event; in tick_handle_periodic()
117 * update_process_times() -> run_local_timers() -> in tick_handle_periodic()
120 if (dev->event_handler != tick_handle_periodic) in tick_handle_periodic()
136 * Have to be careful here. If we're in oneshot mode, in tick_handle_periodic()
137 * before we call tick_periodic() in a loop, we need in tick_handle_periodic()
139 * Otherwise we could get trapped in an infinite in tick_handle_periodic()
150 * Setup the device for a periodic tick
160 if ((dev->features & CLOCK_EVT_FEAT_PERIODIC) && in tick_setup_periodic()
203 * Setup the tick device
215 if (!td->evtdev) { in tick_setup_device()
217 * If no cpu took the do_timer update, assign it to in tick_setup_device()
226 * The boot CPU may be nohz_full, in which case set in tick_setup_device()
234 } else if (tick_do_timer_boot_cpu != -1 && in tick_setup_device()
237 tick_do_timer_boot_cpu = -1; in tick_setup_device()
243 * Startup in periodic mode first. in tick_setup_device()
245 td->mode = TICKDEV_MODE_PERIODIC; in tick_setup_device()
247 handler = td->evtdev->event_handler; in tick_setup_device()
248 next_event = td->evtdev->next_event; in tick_setup_device()
249 td->evtdev->event_handler = clockevents_handle_noop; in tick_setup_device()
252 td->evtdev = newdev; in tick_setup_device()
258 if (!cpumask_equal(newdev->cpumask, cpumask)) in tick_setup_device()
259 irq_set_affinity(newdev->irq, cpumask); in tick_setup_device()
264 * This allows us to handle this x86 misfeature in a generic in tick_setup_device()
271 if (td->mode == TICKDEV_MODE_PERIODIC) in tick_setup_device()
282 clockevents_exchange_device(td->evtdev, newdev); in tick_install_replacement()
284 if (newdev->features & CLOCK_EVT_FEAT_ONESHOT) in tick_install_replacement()
291 if (!cpumask_test_cpu(cpu, newdev->cpumask)) in tick_check_percpu()
293 if (cpumask_equal(newdev->cpumask, cpumask_of(cpu))) in tick_check_percpu()
296 if (newdev->irq >= 0 && !irq_can_set_affinity(newdev->irq)) in tick_check_percpu()
299 if (curdev && cpumask_equal(curdev->cpumask, cpumask_of(cpu))) in tick_check_percpu()
308 if (!(newdev->features & CLOCK_EVT_FEAT_ONESHOT)) { in tick_check_preferred()
309 if (curdev && (curdev->features & CLOCK_EVT_FEAT_ONESHOT)) in tick_check_preferred()
317 * rating than a non-CPU local device in tick_check_preferred()
320 newdev->rating > curdev->rating || in tick_check_preferred()
321 !cpumask_equal(curdev->cpumask, newdev->cpumask); in tick_check_preferred()
349 curdev = td->evtdev; in tick_check_new_device()
354 if (!try_module_get(newdev->owner)) in tick_check_new_device()
368 if (newdev->features & CLOCK_EVT_FEAT_ONESHOT) in tick_check_new_device()
380 * tick_broadcast_oneshot_control - Enter/exit broadcast oneshot mode
384 * Returns 0 on success, -EBUSY if the cpu is used to broadcast wakeups.
394 if (!(td->evtdev->features & CLOCK_EVT_FEAT_C3STOP)) in tick_broadcast_oneshot_control()
405 * Called with interrupts disabled. No locking required. If
424 struct clock_event_device *dev = td->evtdev; in tick_shutdown()
426 td->mode = TICKDEV_MODE_PERIODIC; in tick_shutdown()
434 dev->event_handler = clockevents_handle_noop; in tick_shutdown()
435 td->evtdev = NULL; in tick_shutdown()
441 * tick_suspend_local - Suspend the local tick device
445 * No locks required. Nothing can change the per cpu device.
451 clockevents_shutdown(td->evtdev); in tick_suspend_local()
455 * tick_resume_local - Resume the local tick device
459 * No locks required. Nothing can change the per cpu device.
466 clockevents_tick_resume(td->evtdev); in tick_resume_local()
468 if (td->mode == TICKDEV_MODE_PERIODIC) in tick_resume_local()
469 tick_setup_periodic(td->evtdev, 0); in tick_resume_local()
483 * tick_suspend - Suspend the tick and the broadcast device
489 * No locks required. Nothing can change the per cpu device.
498 * tick_resume - Resume the tick and the broadcast device
503 * No locks required. Nothing can change the per cpu device.
516 * tick_freeze - Suspend the local tick and (possibly) timekeeping.
519 * suspend timekeeping. Otherwise suspend the local tick.
543 * tick_unfreeze - Resume the local tick and (possibly) timekeeping.
546 * timekeeping. Otherwise resume the local tick.
566 tick_freeze_depth--; in tick_unfreeze()
573 * tick_init - initialize the tick control