LXC GPU sharing

Hello all,
Thanks in advance for reading.

Background:
Currently I run a single system with multiple users at home for general computing and gaming using qemu with GPU passthrough. This is a threadripper system, 64GB of ram, 2 gpu’s for passthrough and another for the OS console with a stack of SSD’s and spinning rust in a BTRFS array.

This system is running gentoo as the base OS and could be described as the typical ‘2 gamers 1 cpu setup’. Just that it’s also running a bunch of other stuff in docker and all guests are running Linux.

With the cost and difficulty of upgrading a single GPU currently, never mind 2, it’s got me rethinking this setup.

Question:
So it seems to be possible using LXC/LXD to run GUI apps and output them to an xorg display and that when doing this GPU acceleration is possible when using a container.

So this leaves me wondering if it’s possible to containerise a desktop environment, set its display output and then passthrough a keyboard and mouse to the container, meaning that a single GPU can be used across multiple user environments.

Does any know if this is possible, has been done before or can provide any information to point me in the right direction on this endeavour.
Should it be promising, I’ll provide updates.

Regards

1 Like

This should be possible without to much trouble, a setup like that is sometimes called “multiseat”(Multiple desktop sessions with separate sets of input/output devices).
See the ArchWiki.

Besides that it should basically just be “normal” X11 in LXC, e.g. something like this.

Keep in mind that while fine for running multiple seats, this does not provide the same security as “proper” isolation, via MMU or separate hardware(probably irrelevant for your setup).

EDIT: Also see this forgotten marvel of technology

1 Like