函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\livepatch\transition.c Create Date:2022-07-27 11:31:53
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Try to switch all remaining tasks to the target patch state by walking the* stacks of sleeping tasks and looking for any to-be-patched or* to-be-unpatched functions. If such functions are found, the task can't be* switched yet.

函数原型:void klp_try_complete_transition(void)

返回类型:void

参数:

393  bool complete = true
395  WARN_ON_ONCE(klp_target_state == ask patch states )
406  read_lock( & tasklist_lock)
407  Careful: this is a double loop, 'break' won't work as expected. (g, task)
408  如果非Try to safely switch a task to the target patch state. If it's currently* running, or it's sleeping on a to-be-patched or to-be-unpatched function, or* if the stack is unreliable, return false.complete = false
410  read_unlock( & tasklist_lock)
415  get_online_cpus()
416  遍历可用CPU(cpu)
417  task等于dle_task - return the idle task for a given CPU.*@cpu: the processor in question.* Return: The idle task for the CPU @cpu.
418  如果cpu_online(cpu)则
421  否则如果patch_state不等于klp_target_state
427  put_online_cpus()
429  如果非complete
430  如果klp_signals_cnt且非klp_signals_cntSIGNALS_TIMEOUT的模则Sends a fake signal to all non-kthread tasks with TIF_PATCH_PENDING set.* Kthreads with TIF_PATCH_PENDING set are woken up.
432  klp_signals_cnt自加
439  在延迟工作队列中放置任务
441  返回
445  patch等于klp_transition_patch
446  The transition to the target patch state is complete. Clean up the data* structures.
453  如果非enabledklp_free_patch_async(patch)
455  否则如果replaceklp_free_replaced_patches_async(patch)
调用者
名称描述
__klp_enable_patch
klp_transition_work_fnThis work can be performed periodically to finish patching or unpatching any* "straggler" tasks which failed to transition in the first attempt.
__klp_disable_patchSysfs Interface* /sys/kernel/livepatch* /sys/kernel/livepatch/* /sys/kernel/livepatch//enabled* /sys/kernel/livepatch//transition* /sys/kernel/livepatch//force* /sys/kernel/livepatch//*