Skip to content

Commit

Permalink
plugin/cuda: disable CUDA plugin if /dev/nvidiactl isn't present
Browse files Browse the repository at this point in the history
The presence of /dev/nvidiactl indicates that the system has a
compatible NVIDIA GPU driver installed and that the GPU is accessible to
the operating system.

Signed-off-by: Andrei Vagin <[email protected]>
  • Loading branch information
avagin committed Sep 14, 2024
1 parent 1190f10 commit b9bdaf4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions criu/include/fault-injection.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ enum faults {
FI_DONT_USE_PAGEMAP_SCAN = 135,
FI_DUMP_CRASH = 136,
FI_DISABLE_FREEZE_CGROUP = 137,
FI_PLUGIN_CUDA_FORCE_ENABLE = 138,
FI_MAX,
};

Expand Down
10 changes: 9 additions & 1 deletion plugins/cuda/cuda_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "pid.h"
#include "proc_parse.h"
#include "seize.h"
#include "fault-injection.h"

#include <common/list.h>
#include <compel/infect.h>
Expand Down Expand Up @@ -460,8 +461,15 @@ CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__RESUME_DEVICES_LATE, cuda_plugin_resume_

int cuda_plugin_init(int stage)
{
int ret = cuda_checkpoint_supports_flag("--action");
int ret;

if (fault_injected(FI_VDSO_TRAMPOLINES) || access("/dev/nvidiactl", F_OK)) {
pr_info("/dev/nvidiactl doesn't exist. The CUDA plugin is disabled.");
plugin_disabled = true;
return 0;
}

ret = cuda_checkpoint_supports_flag("--action");
if (ret == -1) {
pr_warn("check that %s is present in $PATH\n", CUDA_CHECKPOINT);
plugin_disabled = true;
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/run-ci-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,4 @@ make -C plugins/amdgpu/ test_topology_remap
./test/zdtm.py run -t zdtm/static/maps00 -t zdtm/static/maps02 --criu-plugin amdgpu
./test/zdtm.py run -t zdtm/static/maps00 -t zdtm/static/maps02 --criu-plugin amdgpu cuda

./test/zdtm.py run -t zdtm/static/sigpending -t zdtm/static/pthread00 --mocked-cuda-checkpoint
./test/zdtm.py run -t zdtm/static/sigpending -t zdtm/static/pthread00 --mocked-cuda-checkpoint --fault 138

0 comments on commit b9bdaf4

Please sign in to comment.