[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ROCm test launcher modifications when there is other non-AMD GPU cards.



Hi Fred, Étienne,

On 2025-05-26 20:29, Étienne Mollier wrote:
> PICCA Frederic-Emmanuel, on 2025-05-26:
>> do you know what should de done in order to prepare the chroot in our case.

>> a sort of bind mount but when we tryed to bind mount something under /dev/, it enup with this error

I'm not yet familiar with sbuild's unshare backend, but I assume that
just like the autopkgtest-virt-unshare backend, it only supports bind
mount of directories at most.

So you could bind mount the necessary directory /dev/dri, but not the
device /dev/kfd.

I took a brief look at adding this a shorte while ago but shelved it
for now as we are in hard freeze. For now, you'd have to use the
podman backend to run tests.

> I'm not sure yet how to expose devices the right way in unshare
> mode.  I would expect any method involving bind-mount to require
> running the pre-build commands as root, and any method involving
> mknod to require work with capabilities(7), user_namespaces(7)
> and setcap(8), but implementation details are evading me so far.

I think it should work just with user_namespaces, because rootless
podman does it like that.

This PoC seemed to work:

  christian@host$ unshare --user --map-root-user --mount
  root@host$ touch /tmp/kfd && mount --bind /dev/kfd /tmp/kfd && ls -l /tmp/kfd
  crw-rw---- 1 nobody nogroup 239, 0 Mai 26 22:56 /tmp/kfd

Though I have to say, without some web searches pointing me to the
solution of touching the file to bind-mount the device over, I
would have not found this.

(I strongly suspect that chown'ing won't be possible or won't fix the
issue entirely. For podman, I had to jump through a few hoops, search
for "setgroups" in [1]).

Best,
Christian

[1]: https://salsa.debian.org/rocm-team/community/team-project/-/blob/master/doc/rocm-autopkgtests-in-containers.md


Reply to: