Running two Xorg instances - iGPU, NVidia GPU

Hi,

I am trying to build a VFIO/PCI passthrough setup. I am currently using an NVidia GTX 1070 video card my for install. I am considering using the Intel GPU ( i6500 ) for day-to-day tasks and passing through the NVidia card to a virtual machine. I would like to keep it available for Linux as well, so I’m considering the following setup:

  • Most desktop activities run using the integrated GPU
  • (when needed) start a different Xorg instance bound to the NVidia GPU for Steam
  • (when needed) start a KVM virtual machine bound the the NVidia GPU

The two final steps won’t be done at the same time, but ideally this would be done without rebooting. I would be using the same monitor but with different cables, for instance HDMI for the iGPU and DisplayPort for the NVidia card. If needed I can whip up another mouse/keyboard pair.

Apparently my searching skills are inadequate for this topic, so my question is how can I configure my system for two Xorg instances - each using a different GPU?

First be aware that the xorg X server isn’t implemented by default in openSUSE nowadays.

Ding a GPU pass-through to a virtual machine Guest is generally close to the bleeding edge nowadays, implementations are constantly changing… So, I recommend that a Google search every time your question is asked can turn up whatever the latest news and recommendations.

Looks like one person posted a blog within the past half year or so…
https://blog.dancadar.eu/gpu-passthrough-with-kvm-on-opensuse/

The following was volunteered and submitted to the “Unofficial How To”
https://forums.opensuse.org/showthread.php/522015-VGA-PCI-Passthrough-guide-on-openSuSE-Leap-42-2

Arch Wiki articles are always good sources of information…
https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF

There are other threads in the Virtualization Forum and I encourage you to ask any other related questions in that Forum (since your Q relates to using a virtual machine Guest).

TSU

It is Optimus system? If not - do you have multiple monitors (each GPU with own monitor)?

Thank you for a good laugh at the start of the day.

Thanks for the reply.

What are the differences?

I am one test short of GPU passthrough. I have 2 NVidia cards, but apparently I can’t convince the second one to be passed to the VM. So I am trying to run on iGPU but use my NVidia 1070 for

  • gaming on linux
  • PCI passthrough

Not an optimus system. It’s a desktop and I have a single display with multiple inputs. So for instance iGPU goes to DisplayPort and NVidia to HDMI.

In addition to mentioned references you may find this thread interesting - apparently the guy succeeded in dynamically switching dGPU between host and guest without reboot: Reddit - Dive into anything

Pretty good stuff, thanks. But for me VFIO is step 2, as I don’t want to tie my NVidia GPU to the VM only. What are my options for running steam on the dedicated GPU while booting from the integrated GPU? bumblebee? Separate xorg instance?

Well, bumblebee does start separate Xorg instance under the hood anyway, but it also adds overlay libraries to display content rendered on one GPU using monitor connected to another GPU. As you have separate monitors, bumblebee is likely not suitable. Just starting second Xorg instance on nVidia card looks more simple.

Once consequence if you’re not running an xorg X server is that xorg configuration settings won’t work. You’ll need to configure specifically for the X server you’re running. If you wish

A fundamental principal of hardware pass-through is that whatever Guest or the Host has monopolistic access to that device, and isn’t accessible (can’t be shared or used by another Guest or the Host). This applies to any hardware device, not just GPUs.

For more info,
You can search the Virtualization Forum for recent postings.

TSU

First of all, VFIO is not the focus of my question. VFIO is the second step. First, I want to run steam on a different GPU, whether using bumblebee or a second Xorg instance.

(That means that maybe a mod should move this to the Applications forum).

Can I find some configurations or instructions somewhere on how to run multiple Xorg instances?

Thanks again.

First,
You should understand you intend to run multiple “systems” on your hardware.
This doesn’t necessarily mean virtualization, but you need isolation for each instance.
You should then pick your choice of technology to run your simultaneous instances… You have many choices…

If you want to run “directly on hardware,” the following are some options, it’s usually a bit more difficult to set up but if you’re chasing performance, then your better options…

  • WINE, which includes PlayonLinux.
  • Docker
  • LXC

Common virtualization technologies are usually easier to set up. You often do have the option to enable hardware pass-through for selected hardware devices.

  • Virtualbox (kind of lagging behind others on GPU pass through capabilities nowadays)
  • VMware (various, Player is free but requires technical know-how for unusual setups. Paid versions hand hold you through complexities)
  • KVM
  • Xen

There are plenty of other choices as well, the above is only a short list of most popular and well known.

I haven’t thought about assigning applications running in a non-virtualized environment to specific GPUs (and cores). If you don’t mind running your GPU intensive app in the same system environment as your other system processes (and apps), then this might be your easiiest approach. You may not need to set up different X servers to do this (I wouldn’t know for sure since I’ve only done CPU affinity).

I’ve configured CPU affinity at times in the past. I’d think that similarly configuring GPU affinity should be extremely easy to configure, just do a Google search on “GPU affinity” and you’ll see plenty of hits.

TSU

On the second thought - you definitely need HW acceleration for games which means you will need to install both Intel and nVidia specific libraries and Xorg modules in parallel. This is exactly what bumblebee does (unless you will rely on glvnd - not sure in which shape it is in TW right now). So it makes sense to try bumblebee indeed. You may set bumblebeed to keep secondary X server (KeepUnusedXServer=true) and simply start application pointing directly at it, bypassing opti-/primusrun. bumblebeed will make all heavy lifting for you. Worth a try.

You will need to modify secondary xorg.conf which likely configures headless mode (here it sets Option “UseDisplayDevice” “none”).

Or you can simply take secondary xorg.conf frmo bumblebee as template.

Thanks, I’m aware of what my choices are and I know how I plan to accomplish them :slight_smile:

My objective is to be able to allocate a discrete GPU to VFIO or steam , alternatively, while using the integrated GPU for all the other Linux programs.

My reasons for doing that are:

  • performance; Wine is not by far close to Windows performance
  • low-maintenance; Once VFIO is set up all things should work just like they do in Windows, no need to try winetricks, registry tweaks or maintain separate wine prefixes for apps with different needs
  • steam streaming; I have a Steam link working just fine with a dual-booted Windows instance, which does not work with Wine. VFIO will allow me to stop dual-booting

So for me the choices are clear, I just need to find out the best way to achieve them.

I’ll try that, thanks

I posted a response to this thread in the Virtualization Forum listing what I consider current recommended references for GPU passthrough for Xen, KVM, VMware and Virtualbox.

https://forums.opensuse.org/showthread.php/524942-GPU-passthrough-Various-virtualization-technologies?p=2823640#post2823640

TSU

Thanks. I’ll set some time aside later on and reboot this project - did not have too much time to look into it recently.