Lines Matching +full:waking +full:- +full:up
1 // SPDX-License-Identifier: GPL-2.0
25 * After all of them have been woken up, a timer is set to start the next idle
28 * The timer interrupt handler will wake up the idle injection kthreads for
34 * It is up to the user of this framework to provide a lock for higher-level
51 * struct idle_inject_thread - task on/off switch structure
61 * struct idle_inject_device - idle injection data
78 * update() - This callback is invoked just before waking up CPUs to inject
79 * idle. If it returns false, CPUs are not woken up to inject idle in the given
96 * idle_inject_wakeup - Wake up idle injection threads
100 * and running on an online CPU will be woken up.
107 for_each_cpu_and(cpu, to_cpumask(ii_dev->cpumask), cpu_online_mask) { in idle_inject_wakeup()
109 iit->should_run = 1; in idle_inject_wakeup()
110 wake_up_process(iit->tsk); in idle_inject_wakeup()
115 * idle_inject_timer_fn - idle injection timer function
118 * This function is called when the idle injection timer expires. It wakes up
130 if (!ii_dev->update || (ii_dev->update && ii_dev->update())) in idle_inject_timer_fn()
133 duration_us = READ_ONCE(ii_dev->run_duration_us); in idle_inject_timer_fn()
134 duration_us += READ_ONCE(ii_dev->idle_duration_us); in idle_inject_timer_fn()
142 * idle_inject_fn - idle injection work function
159 iit->should_run = 0; in idle_inject_fn()
161 play_idle_precise(READ_ONCE(ii_dev->idle_duration_us) * NSEC_PER_USEC, in idle_inject_fn()
162 READ_ONCE(ii_dev->latency_us) * NSEC_PER_USEC); in idle_inject_fn()
166 * idle_inject_set_duration - idle and run duration update helper
176 WRITE_ONCE(ii_dev->run_duration_us, run_duration_us); in idle_inject_set_duration()
177 WRITE_ONCE(ii_dev->idle_duration_us, idle_duration_us); in idle_inject_set_duration()
185 * idle_inject_get_duration - idle and run duration retrieval helper
194 *run_duration_us = READ_ONCE(ii_dev->run_duration_us); in idle_inject_get_duration()
195 *idle_duration_us = READ_ONCE(ii_dev->idle_duration_us); in idle_inject_get_duration()
200 * idle_inject_set_latency - set the maximum latency allowed
207 WRITE_ONCE(ii_dev->latency_us, latency_us); in idle_inject_set_latency()
212 * idle_inject_start - start idle injections
215 * The function starts idle injection by first waking up all of the idle
217 * sets up a timer to start the next idle injection period.
219 * Return: -EINVAL if the CPU idle or CPU run time is not set or 0 on success.
223 unsigned int idle_duration_us = READ_ONCE(ii_dev->idle_duration_us); in idle_inject_start()
224 unsigned int run_duration_us = READ_ONCE(ii_dev->run_duration_us); in idle_inject_start()
227 return -EINVAL; in idle_inject_start()
230 cpumask_pr_args(to_cpumask(ii_dev->cpumask))); in idle_inject_start()
234 hrtimer_start(&ii_dev->timer, in idle_inject_start()
244 * idle_inject_stop - stops idle injections
260 cpumask_pr_args(to_cpumask(ii_dev->cpumask))); in idle_inject_stop()
262 hrtimer_cancel(&ii_dev->timer); in idle_inject_stop()
279 for_each_cpu(cpu, to_cpumask(ii_dev->cpumask)) { in idle_inject_stop()
281 iit->should_run = 0; in idle_inject_stop()
283 wait_task_inactive(iit->tsk, TASK_ANY); in idle_inject_stop()
291 * idle_inject_setup - prepare the current task for idle injection
303 * idle_inject_should_run - function helper for the smpboot API
313 return iit->should_run; in idle_inject_should_run()
317 * idle_inject_register_full - initialize idle injection on a set of CPUs
319 * @update: This callback is called just before waking up CPUs to inject
341 cpumask_copy(to_cpumask(ii_dev->cpumask), cpumask); in idle_inject_register_full()
342 hrtimer_init(&ii_dev->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in idle_inject_register_full()
343 ii_dev->timer.function = idle_inject_timer_fn; in idle_inject_register_full()
344 ii_dev->latency_us = UINT_MAX; in idle_inject_register_full()
345 ii_dev->update = update; in idle_inject_register_full()
347 for_each_cpu(cpu, to_cpumask(ii_dev->cpumask)) { in idle_inject_register_full()
360 for_each_cpu(cpu_rb, to_cpumask(ii_dev->cpumask)) { in idle_inject_register_full()
373 * idle_inject_register - initialize idle injection on a set of CPUs
390 * idle_inject_unregister - unregister idle injection control device
403 for_each_cpu(cpu, to_cpumask(ii_dev->cpumask)) in idle_inject_unregister()