Skip to content

Commit e567b83

Browse files
committed
UCT/ROCM: Fix dmabuf support check for coreos.
1 parent 33e7d1d commit e567b83

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Gonzalo Brito Gadeschi <gonzalob@nvidia.com>
4242
Graham Lopez <lopezmg@ornl.gov>
4343
Guy Ealey Morag <gealeymorag@nvidia.com>
4444
Guy Shattah <sguy@mellanox.com>
45+
Hannes Hansen <hannes.jakob.hansen@cern.ch>
4546
Hessam Mirsadeghi <hmirsadeghi@nvidia.com>
4647
Hiroyuki Sato <hiroysato@gmail.com>
4748
Hod Badihi <hbadihi@nvidia.com>

src/uct/rocm/base/rocm_base.c

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,18 +310,35 @@ int uct_rocm_base_is_dmabuf_supported()
310310
struct utsname utsname;
311311
char kernel_conf_file[128];
312312
char buf[256];
313-
313+
const char *fmts[] = {
314+
"/boot/config-%s",
315+
"/usr/src/linux-%s/.config",
316+
"/usr/src/linux/.config",
317+
"/usr/lib/modules/%s/config",
318+
"/usr/lib/ostree-boot/config-%s",
319+
"/usr/lib/kernel/config-%s",
320+
"/usr/src/linux-headers-%s/.config",
321+
"/lib/modules/%s/build/.config"
322+
};
323+
314324
if (uname(&utsname) == -1) {
315325
ucs_trace("could not get kernel name");
316326
goto out;
317327
}
318328

319-
ucs_snprintf_safe(kernel_conf_file, sizeof(kernel_conf_file),
320-
"/boot/config-%s", utsname.release);
321-
fp = fopen(kernel_conf_file, "r");
329+
for (size_t i = 0; i < sizeof(fmts) / sizeof(fmts[0]); ++i) {
330+
const char *path = fmts[i];
331+
ucs_snprintf_safe(kernel_conf_file, sizeof(kernel_conf_file), path, utsname.release);
332+
fp = fopen(path, "r");
333+
if (fp != NULL) {
334+
ucs_trace("reading kernel config from %s", path);
335+
break;
336+
}
337+
ucs_trace("could not open kernel conf file %s error: %m", path);
338+
}
339+
322340
if (fp == NULL) {
323-
ucs_trace("could not open kernel conf file %s error: %m",
324-
kernel_conf_file);
341+
ucs_trace("no kernel conf file found");
325342
goto out;
326343
}
327344

0 commit comments

Comments
 (0)