Is there a 'best practice' for gaming vm?


Recommended Posts

Hi,

 

I recently created my first gaming vm, 6c/12t from my 3900x and then a gtx 1070. installed on a virtual disk on nvme ssd.

i experience some stutter some times and started to search for best practices.

and.. well.. there is a lot of information out there, and a lot of different configurations.

for example there is a lot to change here: <cpumode> and <cputune>
the we have q35 vs i440fx.
We have the advanced gpu settings, like make usre we have the gpu and audio on the same bus.

so, is there a best practice? and where do we find all settings? I don't mind reading and learning stuff, but since i didn't even know about all different feature policys its hard to know where to start

Link to comment

You don't quite need all those super advanced techniques as they only offer marginal improvement (if any).

And then you have to take into account some of those tweaks were for older gen CPU (e.g. numa tuning was only required for TR gen 1 + 2) and some were workarounds while waiting for the software to catch up with the hardware (e.g. cpumode tweaks to fake TR as Epyc so cache is used correctly no longer required; use Unraid 6.9.0-beta1 for the latest 5.5.8 kernel which supposedly works better with 3rd-gen Ryzen; compile your own 6.8.3 with 5.5.8 kernel for the same reason, etc.)

 

In terms of "best practice" for gaming VM, I have these "rules of hand" (cuz there are 5 🧐 )

  1. Pick all the VM cores from the same CCX and CCD (i.e. die) would improve fps consistency (i.e. less stutter).
    • Note: this is specific for gaming VM for which maximum performance is less important than consistent performance. For a workstation VM (for which max performance is paramount), VM cores should be spread evenly across as many CCX/CCD as possible, even if it means partially using a CCX/CCD.
  2. Isolate the VM cores in syslinux. The 2020 advice is to use isolcpus + nohz_full + rcu_nocs. (the old advice is just use isolcpus).
  3. Pin emulator to cores that are NOT the main VM cores.
    • The advanced technique is also pin iothreads. This only applies if you use vdisk / ata-id pass-through. From my own testing, iothread pinning makes no diff with NVMe PCIe pass-through.
  4. Do msi fix with msi_util to help with sound issues
    • The advanced technique is to put all devices from the GPU on the same bus with multifunction. To be honest though, I haven't found this to make any diff.
  5. Not run parity sync or any heavy IO / cpu activities while gaming.

 

In terms of where you can find these settings

  1. 3900X has 12 cores, which is 3x4 -> every 3 cores is a CCX, every 2 CCX is a die (and your 3900X has 2 dies + an IO die).
  2. Watch SpaceInvader One tutorial on youtube. Just remember to do what you do with isolcpus to nohz_full + rcu_nocs as well.
  3. Watch SpaceInvader One tutorial on youtube. This is an VM xml edit.
  4. Watch SpaceInvader One tutorial on youtube. He has a link to download the msi_util.
  5. No explanation needed.

 

 

Note that due to the inherent CCX/CCD design of Ryzen, you can never match Intel single-die CPU when it comes to consistent performance (i.e. less stutter). And this comes from someone currently running an AMD server, not an Intel fanboy.

And of course, running VM will always introduce some variability above bare metal.

 

 

Edited by testdasi
  • Like 4
  • Thanks 1
Link to comment

Thanks a lot for this great info! Might be a stupid question but is there a way to recognize the dies in Unraid GUI somehow when greating the VM?

 

I’m currently running a 1700X but will upgrade to 3900X soon. Have you found a ”stutter free” way to give 8c/16t to a Windows 10 VM with your 3900X? I’m just wondering because I have a really poor single core performance with 1700X and hoping that this could be fixed with a newer Ryzen(or some settings) but haven’t found a up to date info. Custom Unraid with kernel 5.5.8 and Navi patch did help with RX 5700 XT reset bug but still hoping to fix the poor cpu performance somehow. :)

Link to comment
15 minutes ago, Stalkkaaja said:

Thanks a lot for this great info! Might be a stupid question but is there a way to recognize the dies in Unraid GUI somehow when greating the VM?

 

I’m currently running a 1700X but will upgrade to 3900X soon. Have you found a ”stutter free” way to give 8c/16t to a Windows 10 VM with your 3900X? I’m just wondering because I have a really poor single core performance with 1700X and hoping that this could be fixed with a newer Ryzen(or some settings) but haven’t found a up to date info. Custom Unraid with kernel 5.5.8 and Navi patch did help with RX 5700 XT reset bug but still hoping to fix the poor cpu performance somehow. :)

The proper way is to run lstopo from the command line (see SpaceInvader One tutorial for the command).

I used to have to install packages manually to get lstopo to work but I think it has been included by default to Unraid 6.8.x.

 

The quick and dirty way is just count from your VM GUI.

If your core count is a multiple of 3 (e.g. 12 or 6) then every block of 3 PAIRS is 1 CCX. Every 2 CCX (i.e. block of 6 PAIRS) is 1 CCD (die).

If your core count is a multiple 4 (e.g. 16 or 8) then follow the same process but every 4 pairs.

 

So for your 3900X, your gaming VM should have 6c/12t and not 8c/16t.

Most games don't need 8 cores anyway so there's really no need to go there.

 

Also you might need to elaborate on your "single core performance" issue as well. Not sure what you meant by poor there.

Link to comment
  • 6 months later...

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.