|
33 | 33 | #include "xfuncs.h" |
34 | 34 |
|
35 | 35 | static int init_within_userns(struct error *); |
36 | | -static int load_kernel_modules(struct error *, const char *, const struct nvc_imex_info *); |
| 36 | +static int load_kernel_modules(struct error *, const char *, const struct nvc_imex_info *, int32_t); |
37 | 37 | static int copy_config(struct error *, struct nvc_context *, const struct nvc_config *); |
38 | 38 |
|
39 | 39 | const char interpreter[] __attribute__((section(".interp"))) = LIB_DIR "/" LD_SO; |
@@ -229,7 +229,7 @@ mig_nvcaps_mknodes(struct error *err, int num_gpus) { |
229 | 229 | } |
230 | 230 |
|
231 | 231 | static int |
232 | | -load_kernel_modules(struct error *err, const char *root, const struct nvc_imex_info *imex) |
| 232 | +load_kernel_modules(struct error *err, const char *root, const struct nvc_imex_info *imex, int32_t flags) |
233 | 233 | { |
234 | 234 | int userns; |
235 | 235 | pid_t pid; |
@@ -290,10 +290,13 @@ load_kernel_modules(struct error *err, const char *root, const struct nvc_imex_i |
290 | 290 | log_info("running mknod for all nvcaps in " NV_CAPS_DEVICE_DIR); |
291 | 291 | if (mig_nvcaps_mknodes(err, devs.num_matches) < 0) |
292 | 292 | log_errf("could not create kernel module device nodes: %s", err->msg); |
293 | | - for (int i = 0; i < (int)imex->nchans; ++i) { |
294 | | - log_infof("running mknod for " NV_CAPS_IMEX_DEVICE_PATH, imex->chans[i].id); |
295 | | - if (nvidia_cap_imex_channel_mknod(imex->chans[i].id) == 0) |
296 | | - log_errf("could not mknod for IMEX channel %d", imex->chans[i].id); |
| 293 | + |
| 294 | + if (!(flags & OPT_NO_CREATE_IMEX_CHANNELS)) { |
| 295 | + for (int i = 0; i < (int)imex->nchans; ++i) { |
| 296 | + log_infof("running mknod for " NV_CAPS_IMEX_DEVICE_PATH, imex->chans[i].id); |
| 297 | + if (nvidia_cap_imex_channel_mknod(imex->chans[i].id) == 0) |
| 298 | + log_errf("could not mknod for IMEX channel %d", imex->chans[i].id); |
| 299 | + } |
297 | 300 | } |
298 | 301 | error_reset(err); |
299 | 302 | } |
@@ -420,7 +423,7 @@ nvc_init(struct nvc_context *ctx, const struct nvc_config *cfg, const char *opts |
420 | 423 | if (flags & OPT_LOAD_KMODS) { |
421 | 424 | if (ctx->dxcore.initialized) |
422 | 425 | log_warn("skipping kernel modules load on WSL"); |
423 | | - else if (load_kernel_modules(&ctx->err, ctx->cfg.root, &ctx->cfg.imex) < 0) |
| 426 | + else if (load_kernel_modules(&ctx->err, ctx->cfg.root, &ctx->cfg.imex, flags) < 0) |
424 | 427 | goto fail; |
425 | 428 | } |
426 | 429 |
|
|
0 commit comments