Lines Matching +full:run +full:- +full:control

1 // SPDX-License-Identifier: GPL-2.0
19 * The idle + run duration is specified via separate helpers and that allows
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
53 * @should_run: whether or not to run the task (for the smpboot kthread API)
61 * struct idle_inject_device - idle injection data
64 * @run_duration_us: duration of CPU run time to allow
80 * idle_inject_wakeup - Wake up idle injection threads
91 for_each_cpu_and(cpu, to_cpumask(ii_dev->cpumask), cpu_online_mask) { in idle_inject_wakeup()
93 iit->should_run = 1; in idle_inject_wakeup()
94 wake_up_process(iit->tsk); in idle_inject_wakeup()
99 * idle_inject_timer_fn - idle injection timer function
114 duration_us = READ_ONCE(ii_dev->run_duration_us); in idle_inject_timer_fn()
115 duration_us += READ_ONCE(ii_dev->idle_duration_us); in idle_inject_timer_fn()
125 * idle_inject_fn - idle injection work function
140 * Let the smpboot main loop know that the task should not run again. in idle_inject_fn()
142 iit->should_run = 0; in idle_inject_fn()
144 play_idle_precise(READ_ONCE(ii_dev->idle_duration_us) * NSEC_PER_USEC, in idle_inject_fn()
145 READ_ONCE(ii_dev->latency_us) * NSEC_PER_USEC); in idle_inject_fn()
149 * idle_inject_set_duration - idle and run duration update helper
150 * @run_duration_us: CPU run time to allow in microseconds
158 WRITE_ONCE(ii_dev->run_duration_us, run_duration_us); in idle_inject_set_duration()
159 WRITE_ONCE(ii_dev->idle_duration_us, idle_duration_us); in idle_inject_set_duration()
164 * idle_inject_get_duration - idle and run duration retrieval helper
165 * @run_duration_us: memory location to store the current CPU run time
172 *run_duration_us = READ_ONCE(ii_dev->run_duration_us); in idle_inject_get_duration()
173 *idle_duration_us = READ_ONCE(ii_dev->idle_duration_us); in idle_inject_get_duration()
177 * idle_inject_set_latency - set the maximum latency allowed
183 WRITE_ONCE(ii_dev->latency_us, latency_us); in idle_inject_set_latency()
187 * idle_inject_start - start idle injections
188 * @ii_dev: idle injection control device structure
194 * Return: -EINVAL if the CPU idle or CPU run time is not set or 0 on success.
198 unsigned int idle_duration_us = READ_ONCE(ii_dev->idle_duration_us); in idle_inject_start()
199 unsigned int run_duration_us = READ_ONCE(ii_dev->run_duration_us); in idle_inject_start()
202 return -EINVAL; in idle_inject_start()
205 cpumask_pr_args(to_cpumask(ii_dev->cpumask))); in idle_inject_start()
209 hrtimer_start(&ii_dev->timer, in idle_inject_start()
218 * idle_inject_stop - stops idle injections
219 * @ii_dev: idle injection control device structure
234 cpumask_pr_args(to_cpumask(ii_dev->cpumask))); in idle_inject_stop()
236 hrtimer_cancel(&ii_dev->timer); in idle_inject_stop()
253 for_each_cpu(cpu, to_cpumask(ii_dev->cpumask)) { in idle_inject_stop()
255 iit->should_run = 0; in idle_inject_stop()
257 wait_task_inactive(iit->tsk, TASK_ANY); in idle_inject_stop()
264 * idle_inject_setup - prepare the current task for idle injection
276 * idle_inject_should_run - function helper for the smpboot API
279 * Return: whether or not the thread can run.
286 return iit->should_run; in idle_inject_should_run()
290 * idle_inject_register - initialize idle injection on a set of CPUs
293 * This function creates an idle injection control device structure for the
297 * Return: NULL if memory allocation fails, idle injection control device
309 cpumask_copy(to_cpumask(ii_dev->cpumask), cpumask); in idle_inject_register()
310 hrtimer_init(&ii_dev->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in idle_inject_register()
311 ii_dev->timer.function = idle_inject_timer_fn; in idle_inject_register()
312 ii_dev->latency_us = UINT_MAX; in idle_inject_register()
314 for_each_cpu(cpu, to_cpumask(ii_dev->cpumask)) { in idle_inject_register()
327 for_each_cpu(cpu_rb, to_cpumask(ii_dev->cpumask)) { in idle_inject_register()
339 * idle_inject_unregister - unregister idle injection control device
340 * @ii_dev: idle injection control device to unregister
342 * The function stops idle injection for the given control device,
352 for_each_cpu(cpu, to_cpumask(ii_dev->cpumask)) in idle_inject_unregister()