Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kpatch load/unload patch transition has stalled #1409

Open
oceansue opened this issue Aug 24, 2024 · 1 comment
Open

kpatch load/unload patch transition has stalled #1409

oceansue opened this issue Aug 24, 2024 · 1 comment
Labels

Comments

@oceansue
Copy link

Description

I have encountered an issue with kpatch where it experiences stalling or timeouts when performing load/unload operations on modules,。

Upon reviewing the kpatch code, I noticed that the method used to check the system interface at /sys/kernel/livepatch/livepatch_diff/transition involved a sleep 1 interval, which seemed to be inefficient or unsuitable for my current working environment. This method appeared to contribute to the stalling or timeouts observed.

To address this, I modified the method in kpatch that checks this interface. My changes have resulted in a significant improvement in the efficiency of module load/unload operations. I believe this modification could be beneficial for others facing similar issues, especially on new architectures.

Environment

  • OS: [kylin os]
  • Kernel:4.19 and 5.10
  • kpatch version: 6115a1a

Additional Information

Attachments

Before Applying the Patch

  • load module
[root@localhost kpatch]# ./kpatch load ../kpatch-build/livepatch-diff.ko
loading patch module: ../kpatch-build/livepatch-diff.ko
waiting (up to 15 seconds) for patch transition to complete...
patch transition has stalled!
signaling stalled process(es):
waiting (up to 60 seconds) for patch transition to complete...

Stalled processes:
module livepatch_diff did not complete its transition, unloading...
disabling patch module: livepatch_diff
waiting (up to 15 seconds) for patch transition to complete...
transition complete (2 seconds)
unloading patch module: livepatch_diff
kpatch: error: failed to load module livepatch_diff (transition stalled)
[root@localhost kpatch]# 
  • unload module
[root@localhost kpatch]# ./kpatch unload ../kpatch-build/livepatch-diff.ko
disabling patch module: livepatch_diff
waiting (up to 15 seconds) for patch transition to complete...
patch transition has stalled!
signaling stalled process(es):
waiting (up to 60 seconds) for patch transition to complete...
kpatch: transition stalled for livepatch_diff
[root@localhost kpatch]# 

By observing the dmesg logs, it can be seen that the module transition time is over 1500 seconds, of course, this time is not fixed, and sometimes it might complete the load/unload in just a few seconds with good luck.

After Applying the Patch

  • load module
[root@localhost kpatch]# ./kpatch load ../kpatch-build/livepatch-diff.ko
loading patch module: ../kpatch-build/livepatch-diff.ko
waiting (up to 15 seconds) for patch transition to complete...
transition complete (14 seconds)
  • unload module
[root@localhost kpatch]# ./kpatch unload ../kpatch-build/livepatch-diff.ko
disabling patch module: livepatch_diff
waiting (up to 15 seconds) for patch transition to complete...
transition complete (1 seconds)
unloading patch module: livepatch_diff
[root@localhost kpatch]# 

other

If you need me to provide any additional information, please contact me. I would also appreciate it if you could offer me some better solutions.
/cc @oceansue

Copy link

This issue has been open for 30 days with no activity and no assignee. It will be closed in 7 days unless a comment is added.

@github-actions github-actions bot added the stale label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant