GPU passthrough without VFIO binding


Go to solution Solved by sonofdbn,

Recommended Posts

In my server I have an RTX 4070 graphics card, which is used by some of my docker containers. I also have a Win11 VM which just uses the default Virtual graphics card. The graphics card is not bound to VFIO, and I have the nVidia plug-in installed (which I understand is needed for the docker containers to use the GPU).

 

I understand that I can't have the VM and the containers using the GPU at the same time (that would of course be ideal). As the next best alternative, I'd like to be able to switch the usage between VM and containers as needed. What I envisage is, say, starting the server with the docker containers active and able to access the GPU. Then, if I want to use the VM with GPU access, I would shut down the containers and then start up the VM. If I then want to go back to using the containers, I shut down the VM and start the containers.

 

My thinking is that in order to be able to do this, I have to assign the GPU to the VM, but not bind the GPU to VFIO. Is there anything else I need to do? For example, would I also have to enable/disable the nVidia plug-in each time?

 

(I know this sort of question has been asked quite a few times. I've read various threads about GPU passthrough, but most seemed to assume this also meant VFIO binding - maybe "passthrough" does, but I wasn't sure. Also, any mention of the nVidia plug-in seemed to refer to older versions.)

 

On the risk side, assuming I can do this switching, what happens if I forget to shutdown the VM/containers and run them simultaneously? Will there just be no response or will something crash?

Link to comment
  • Solution

So I did a little test: stopped docker containers and VM. Set the graphics card in the VM to the Nvidia card (no VFIO binding) and then booted up the VM.

 

It seemed to be running but I couldn't connect via RDP. So I thought about stopping the Nvidia plug-in. At that point I thought it might be a good idea to see what the the Nvidia plug-in is meant to do, and went to the support thread. I didn't understand everything, but in the first post there was this warning:

 

"Please be sure to never use one card for a VM and also in docker containers (your server will hard lock if it's used in a VM and then something wants to use it in a Container)."

 

Looks like my idea is horribly risky, so I've abandoned it.

Link to comment
On 1/30/2024 at 1:34 PM, truetype said:

It would really be a great feature to have in Unraid to be able to divide a graphics card into multiple parts. So you can use, for example, a 4090 in a Windows VM as the main machine but also for Plex transcoding in Docker.

That's something the graphics card would have to support, it's not under Unraid's control.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.