Lines Matching refs:task
94 struct task_struct *g, *task; in klp_complete_transition() local
131 for_each_process_thread(g, task) { in klp_complete_transition()
132 WARN_ON_ONCE(test_tsk_thread_flag(task, TIF_PATCH_PENDING)); in klp_complete_transition()
133 task->patch_state = KLP_TRANSITION_IDLE; in klp_complete_transition()
138 task = idle_task(cpu); in klp_complete_transition()
139 WARN_ON_ONCE(test_tsk_thread_flag(task, TIF_PATCH_PENDING)); in klp_complete_transition()
140 task->patch_state = KLP_TRANSITION_IDLE; in klp_complete_transition()
184 void klp_update_patch_state(struct task_struct *task) in klp_update_patch_state() argument
204 if (test_and_clear_tsk_thread_flag(task, TIF_PATCH_PENDING)) in klp_update_patch_state()
205 task->patch_state = READ_ONCE(klp_target_state); in klp_update_patch_state()
263 static int klp_check_stack(struct task_struct *task, const char **oldname) in klp_check_stack() argument
273 ret = stack_trace_save_tsk_reliable(task, entries, MAX_STACK_ENTRIES); in klp_check_stack()
293 static int klp_check_and_switch_task(struct task_struct *task, void *arg) in klp_check_and_switch_task() argument
297 if (task_curr(task) && task != current) in klp_check_and_switch_task()
300 ret = klp_check_stack(task, arg); in klp_check_and_switch_task()
304 clear_tsk_thread_flag(task, TIF_PATCH_PENDING); in klp_check_and_switch_task()
305 task->patch_state = klp_target_state; in klp_check_and_switch_task()
314 static bool klp_try_switch_task(struct task_struct *task) in klp_try_switch_task() argument
320 if (task->patch_state == klp_target_state) in klp_try_switch_task()
335 if (task == current) in klp_try_switch_task()
338 ret = task_call_func(task, klp_check_and_switch_task, &old_name); in klp_try_switch_task()
346 __func__, task->comm, task->pid); in klp_try_switch_task()
350 __func__, task->comm, task->pid); in klp_try_switch_task()
354 __func__, task->comm, task->pid, old_name); in klp_try_switch_task()
359 __func__, ret, task->comm, task->pid); in klp_try_switch_task()
410 struct task_struct *g, *task; in klp_send_signals() local
416 for_each_process_thread(g, task) { in klp_send_signals()
417 if (!klp_patch_pending(task)) in klp_send_signals()
426 if (task->flags & PF_KTHREAD) { in klp_send_signals()
431 wake_up_state(task, TASK_INTERRUPTIBLE); in klp_send_signals()
437 set_notify_signal(task); in klp_send_signals()
454 struct task_struct *g, *task; in klp_try_complete_transition() local
470 for_each_process_thread(g, task) in klp_try_complete_transition()
471 if (!klp_try_switch_task(task)) in klp_try_complete_transition()
480 task = idle_task(cpu); in klp_try_complete_transition()
482 if (!klp_try_switch_task(task)) { in klp_try_complete_transition()
487 } else if (task->patch_state != klp_target_state) { in klp_try_complete_transition()
489 clear_tsk_thread_flag(task, TIF_PATCH_PENDING); in klp_try_complete_transition()
490 task->patch_state = klp_target_state; in klp_try_complete_transition()
532 struct task_struct *g, *task; in klp_start_transition() local
547 for_each_process_thread(g, task) in klp_start_transition()
548 if (task->patch_state != klp_target_state) in klp_start_transition()
549 set_tsk_thread_flag(task, TIF_PATCH_PENDING); in klp_start_transition()
558 task = idle_task(cpu); in klp_start_transition()
559 if (task->patch_state != klp_target_state) in klp_start_transition()
560 set_tsk_thread_flag(task, TIF_PATCH_PENDING); in klp_start_transition()
575 struct task_struct *g, *task; in klp_init_transition() local
599 for_each_process_thread(g, task) { in klp_init_transition()
600 WARN_ON_ONCE(task->patch_state != KLP_TRANSITION_IDLE); in klp_init_transition()
601 task->patch_state = initial_state; in klp_init_transition()
609 task = idle_task(cpu); in klp_init_transition()
610 WARN_ON_ONCE(task->patch_state != KLP_TRANSITION_IDLE); in klp_init_transition()
611 task->patch_state = initial_state; in klp_init_transition()
651 struct task_struct *g, *task; in klp_reverse_transition() local
664 for_each_process_thread(g, task) in klp_reverse_transition()
665 clear_tsk_thread_flag(task, TIF_PATCH_PENDING); in klp_reverse_transition()
730 struct task_struct *g, *task; in klp_force_transition() local
736 for_each_process_thread(g, task) in klp_force_transition()
737 klp_update_patch_state(task); in klp_force_transition()