Lines Matching full:task

72 	struct task_struct *g, *task;  in klp_complete_transition()  local
109 for_each_process_thread(g, task) { in klp_complete_transition()
110 WARN_ON_ONCE(test_tsk_thread_flag(task, TIF_PATCH_PENDING)); in klp_complete_transition()
111 task->patch_state = KLP_UNDEFINED; in klp_complete_transition()
116 task = idle_task(cpu); in klp_complete_transition()
117 WARN_ON_ONCE(test_tsk_thread_flag(task, TIF_PATCH_PENDING)); in klp_complete_transition()
118 task->patch_state = KLP_UNDEFINED; in klp_complete_transition()
156 * Switch the patched state of the task to the set of functions in the target
159 * NOTE: If task is not 'current', the caller must ensure the task is inactive.
162 void klp_update_patch_state(struct task_struct *task) in klp_update_patch_state() argument
182 if (test_and_clear_tsk_thread_flag(task, TIF_PATCH_PENDING)) in klp_update_patch_state()
183 task->patch_state = READ_ONCE(klp_target_state); in klp_update_patch_state()
238 * Determine whether it's safe to transition the task to the target patch state
241 static int klp_check_stack(struct task_struct *task, const char **oldname) in klp_check_stack() argument
248 ret = stack_trace_save_tsk_reliable(task, entries, ARRAY_SIZE(entries)); in klp_check_stack()
268 static int klp_check_and_switch_task(struct task_struct *task, void *arg) in klp_check_and_switch_task() argument
272 if (task_curr(task) && task != current) in klp_check_and_switch_task()
275 ret = klp_check_stack(task, arg); in klp_check_and_switch_task()
279 clear_tsk_thread_flag(task, TIF_PATCH_PENDING); in klp_check_and_switch_task()
280 task->patch_state = klp_target_state; in klp_check_and_switch_task()
285 * Try to safely switch a task to the target patch state. If it's currently
289 static bool klp_try_switch_task(struct task_struct *task) in klp_try_switch_task() argument
294 /* check if this task has already switched over */ in klp_try_switch_task()
295 if (task->patch_state == klp_target_state) in klp_try_switch_task()
307 * functions. If all goes well, switch the task to the target patch in klp_try_switch_task()
310 ret = task_call_func(task, klp_check_and_switch_task, &old_name); in klp_try_switch_task()
317 __func__, task->comm, task->pid); in klp_try_switch_task()
321 __func__, task->comm, task->pid); in klp_try_switch_task()
325 __func__, task->comm, task->pid, old_name); in klp_try_switch_task()
330 __func__, ret, task->comm, task->pid); in klp_try_switch_task()
343 struct task_struct *g, *task; in klp_send_signals() local
349 for_each_process_thread(g, task) { in klp_send_signals()
350 if (!klp_patch_pending(task)) in klp_send_signals()
356 * Meanwhile the task could migrate itself and the action in klp_send_signals()
359 if (task->flags & PF_KTHREAD) { in klp_send_signals()
364 wake_up_state(task, TASK_INTERRUPTIBLE); in klp_send_signals()
370 set_notify_signal(task); in klp_send_signals()
379 * to-be-unpatched functions. If such functions are found, the task can't be
387 struct task_struct *g, *task; in klp_try_complete_transition() local
397 * is deemed unreliable, the task can't be switched yet. in klp_try_complete_transition()
403 for_each_process_thread(g, task) in klp_try_complete_transition()
404 if (!klp_try_switch_task(task)) in klp_try_complete_transition()
413 task = idle_task(cpu); in klp_try_complete_transition()
415 if (!klp_try_switch_task(task)) { in klp_try_complete_transition()
417 /* Make idle task go through the main loop. */ in klp_try_complete_transition()
420 } else if (task->patch_state != klp_target_state) { in klp_try_complete_transition()
422 clear_tsk_thread_flag(task, TIF_PATCH_PENDING); in klp_try_complete_transition()
423 task->patch_state = klp_target_state; in klp_try_complete_transition()
464 struct task_struct *g, *task; in klp_start_transition() local
479 for_each_process_thread(g, task) in klp_start_transition()
480 if (task->patch_state != klp_target_state) in klp_start_transition()
481 set_tsk_thread_flag(task, TIF_PATCH_PENDING); in klp_start_transition()
490 task = idle_task(cpu); in klp_start_transition()
491 if (task->patch_state != klp_target_state) in klp_start_transition()
492 set_tsk_thread_flag(task, TIF_PATCH_PENDING); in klp_start_transition()
505 struct task_struct *g, *task; in klp_init_transition() local
529 for_each_process_thread(g, task) { in klp_init_transition()
530 WARN_ON_ONCE(task->patch_state != KLP_UNDEFINED); in klp_init_transition()
531 task->patch_state = initial_state; in klp_init_transition()
539 task = idle_task(cpu); in klp_init_transition()
540 WARN_ON_ONCE(task->patch_state != KLP_UNDEFINED); in klp_init_transition()
541 task->patch_state = initial_state; in klp_init_transition()
545 * Enforce the order of the task->patch_state initializations and the in klp_init_transition()
547 * see a func in transition with a task->patch_state of KLP_UNDEFINED. in klp_init_transition()
551 * set a task->patch_state to KLP_UNDEFINED. in klp_init_transition()
580 struct task_struct *g, *task; in klp_reverse_transition() local
597 for_each_process_thread(g, task) in klp_reverse_transition()
598 clear_tsk_thread_flag(task, TIF_PATCH_PENDING); in klp_reverse_transition()
617 * the task flag up to date with the parent here. in klp_copy_process()
636 * NOTE: klp_update_patch_state(task) requires the task to be inactive or
644 struct task_struct *g, *task; in klp_force_transition() local
650 for_each_process_thread(g, task) in klp_force_transition()
651 klp_update_patch_state(task); in klp_force_transition()