2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

plugin: enable multiple plugins for the same hook

CRIU provides two plugins for checkpoint/restore of GPU applications:
amdgpu and cuda. Both plugins use the `RESUME_DEVICES_LATE` hook to
enable restore:

    CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__RESUME_DEVICES_LATE, amdgpu_plugin_resume_devices_late)
    CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__RESUME_DEVICES_LATE, cuda_plugin_resume_devices_late)

However, CRIU currently does not support running more than one plugin
for the same hook. As a result, when both plugins are installed, the
resume function for CUDA applications is not executed. To fix this,
we need to make sure that both `plugin_resume_devices_late()` functions
return `-ENOTSUP` when restore is not supported.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
Radostin Stoyanov 2024-07-24 11:30:59 +01:00 committed by Andrei Vagin
parent 85050be66b
commit c42b58f4fb
2 changed files with 3 additions and 2 deletions

View File

@ -1809,7 +1809,7 @@ int amdgpu_plugin_resume_devices_late(int target_pid)
fd = open(AMDGPU_KFD_DEVICE, O_RDWR | O_CLOEXEC); fd = open(AMDGPU_KFD_DEVICE, O_RDWR | O_CLOEXEC);
if (fd < 0) { if (fd < 0) {
pr_perror("failed to open kfd in plugin"); pr_perror("failed to open kfd in plugin");
return -1; return -ENOTSUP;
} }
args.pid = target_pid; args.pid = target_pid;
@ -1818,6 +1818,7 @@ int amdgpu_plugin_resume_devices_late(int target_pid)
if (kmtIoctl(fd, AMDKFD_IOC_CRIU_OP, &args) == -1) { if (kmtIoctl(fd, AMDKFD_IOC_CRIU_OP, &args) == -1) {
if (errno == ESRCH) { if (errno == ESRCH) {
pr_info("Pid %d has no kfd process info\n", target_pid); pr_info("Pid %d has no kfd process info\n", target_pid);
exit_code = -ENOTSUP;
} else { } else {
pr_perror("restore late ioctl failed"); pr_perror("restore late ioctl failed");
exit_code = -1; exit_code = -1;

View File

@ -408,7 +408,7 @@ interrupt:
int cuda_plugin_resume_devices_late(int pid) int cuda_plugin_resume_devices_late(int pid)
{ {
if (plugin_disabled) { if (plugin_disabled) {
return 0; return -ENOTSUP;
} }
return resume_device(pid, 1); return resume_device(pid, 1);