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
44 * 2) Hand off the duty in the NOHZ idle case by setting the value to
56 static int tick_do_timer_boot_cpu __read_mostly = -1;
68 * tick_is_oneshot_available - check for a oneshot capable event device
74 if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT)) in tick_is_oneshot_available()
76 if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) in tick_is_oneshot_available()
82 * Periodic tick
90 /* Keep track of the next tick event */ in tick_periodic()
109 ktime_t next = dev->next_event; in tick_handle_periodic()
116 * update_process_times() -> run_local_timers() -> in tick_handle_periodic()
119 if (dev->event_handler != tick_handle_periodic) in tick_handle_periodic()
135 * Have to be careful here. If we're in oneshot mode, in tick_handle_periodic()
136 * before we call tick_periodic() in a loop, we need in tick_handle_periodic()
138 * Otherwise we could get trapped in an infinite in tick_handle_periodic()
149 * Setup the device for a periodic tick
159 if ((dev->features & CLOCK_EVT_FEAT_PERIODIC) && in tick_setup_periodic()
202 * Setup the tick device
214 if (!td->evtdev) { in tick_setup_device()
216 * 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()
359 if (!try_module_get(newdev->owner)) in tick_check_new_device()
373 if (newdev->features & CLOCK_EVT_FEAT_ONESHOT) in tick_check_new_device()
385 * tick_broadcast_oneshot_control - Enter/exit broadcast oneshot mode
389 * Returns 0 on success, -EBUSY if the cpu is used to broadcast wakeups.
399 if (!(td->evtdev->features & CLOCK_EVT_FEAT_C3STOP)) in tick_broadcast_oneshot_control()
433 struct clock_event_device *dev = td->evtdev; in tick_shutdown()
435 td->mode = TICKDEV_MODE_PERIODIC; in tick_shutdown()
443 dev->event_handler = clockevents_handle_noop; in tick_shutdown()
444 td->evtdev = NULL; in tick_shutdown()
450 * tick_suspend_local - Suspend the local tick device
454 * No locks required. Nothing can change the per cpu device.
460 clockevents_shutdown(td->evtdev); in tick_suspend_local()
464 * tick_resume_local - Resume the local tick device
468 * No locks required. Nothing can change the per cpu device.
475 clockevents_tick_resume(td->evtdev); in tick_resume_local()
477 if (td->mode == TICKDEV_MODE_PERIODIC) in tick_resume_local()
478 tick_setup_periodic(td->evtdev, 0); in tick_resume_local()
485 * tick_suspend - Suspend the tick and the broadcast device
491 * No locks required. Nothing can change the per cpu device.
500 * tick_resume - Resume the tick and the broadcast device
505 * No locks required. Nothing can change the per cpu device.
518 * tick_freeze - Suspend the local tick and (possibly) timekeeping.
521 * suspend timekeeping. Otherwise suspend the local tick.
545 * tick_unfreeze - Resume the local tick and (possibly) timekeeping.
548 * timekeeping. Otherwise resume the local tick.
568 tick_freeze_depth--; in tick_unfreeze()
575 * tick_init - initialize the tick control