Gaming on windows virtual machine

Не знаю как у вас, а у меня есть набор любимых игр, которые постоянно установлены на моем ПК, даже если я в них давно не играл. Это Heroes of Might and Magic III и V, Disciples II: Dark Prophecy, Sid Meier’s Civilization V, Age of Empires II и многие другие хиты прошлых лет. Я писал о таких играх в блогах «10 великолепных игр — я перепрохожу их снова и снова уже более 10 лет».

Не все из этих игр запускаются после переустановки Windows, некоторые не идут под Windows 10, как например, стратегия Majesty 2. А если вы ищете редкую игру 10-20 летней давности, которую уже нельзя купить, высок и шанс нахватать вирусов. Да даже при установке этих лицензионных игр с диска, защищенного системой StarForce, можно получить кучу проблем на новых версиях Windows.

У меня бывало и такое, что после установки древней игры Windows настолько повреждалась и глючила, что оставалось только переустанавливать ее.

Теперь, я думаю, вы поймете мое желание засунуть кучу старых игр в виртуальную машину, что решит сразу множество проблем.

Плюсы игровой виртуальной машины

Во-первых, можно создать виртуальные машины с нужной версией Windows: 7, XP и даже 98. И игра пойдет в нужной ей версии Windows без проблем.

Во-вторых, вы не будете замусоривать основную Windows и избежите вирусного заражения. Если старые игры что и заразят, то это ОС виртуальной машины.

В-третьих, ваша виртуальная машина будет независима от основной ОС и вам не придется переустанавливать и настраивать игры после переустановки Windows.

Я давно следил за развитием виртуальных машин VMware Workstation и помню даже момент, когда у них появилось простейшее 3D ускорение. Тогда это казалось прорывом, но было не играбельно для большинства игр.

Время шло, проект развивался и сегодня версия VMware Workstation 15.5.6 Pro поддерживает API DirectX 10.1, что позволяет запустить множество замечательных игр.

А теперь я опишу пошагово, как создать игровую виртуальную машину.

Создание виртуальной машины 

После запуска VMware Workstation 15.5.6 Pro вас ждет окно с предложением создать виртуальную машину.

Выбирайте «Создать новую виртуальную машину».

Обычного типа конфигурации будет достаточно.

Выбираем местоположение виртуальной машины.

Указываем место с образом ОС. Я буду ставить Windows 7.

Диска в 60 Гб будет пока достаточно.

Приступаем к настройке конфигурации виртуальной машины. Я для начала выделил ей 8 Гб ОЗУ из 32 имеющихся и два потока из 12-ти своего Ryzen 5 1600

Видеопамяти можно выделить аж 3 Гб. 

Нажимаем «Готово» и виртуальная машина создается.

Установка Windows 7

Автоматически начинается установка Windows 7 из указанного образа.Я создал виртуальную машину на SSD диске, что очень настоятельно вам рекомендую. Установка Windows 7 происходит очень быстро.

Основной ПК загружен во время установки не сильно. Но ОЗУ уже тратится прилично.

 

Windows 7 установлен и в простое почти не «напрягает» процессор.

Папка с виртуальной машиной весит 19.3 Гб.

Настройка и тесты

Я сразу посмотрел через dxdiag свойства графики. Версия «DirectX 11» внушила надежду, но запуск 3DMark 11 все расставил по местам.

С включенным Aero при перемещении и развертывании окон ощущалась какая-то задержка. Включение упрощенного стиля решило эту проблему.

Проблема с окнами озадачила меня я и решил посмотреть, какую задержку дает система в целом, программой LatencyMon.

Мониторинг за минуту. В целом — вполне терпимо.

Для мониторинга FPS и снятия скриншотов я установил MSI Afterburner.

К сожалению, разогнать видеокарту VMware SVGA 3D не получится.

Оценить графическую производительность я решил с помощью 3DMark Vantage, рассчитанного как раз на системы с DirectX 10.

3DMark Vantage будет запускаться с пресетом High.

Результаты очень неплохие.

Это уровень производительности процессора AMD FX-8350 с видеокартой GeForce GTX 1060. А наша виртуалка крутится, напомню, на одном ядре Ryzen 5 1600!

Тесты в играх

Игры я подобрал учитывая требования DirectX 10 и небольшого размера на диске.

Первым под руку попался Portal.

Игра выдает 300 кадров. Играется нормально, но иногда проскакиваю фризы, которые почти целиком убираются фиксацией кадровой частоты на 60.

Очень удивил факт отсутствия «тиринга».

Sid Meier’s Civilization V идет гладко, неотличимо от настоящего ПК.

Стратегия про викингов Northgard тоже отлично играется.

Добавляем еще два потока процессору и тестируем дальше

После успешных тестов игр я решил добавить виртуальной машине процессорной мощи. Я добавил еще одно ядро Ryzen 5 1600, получив аналог Core i3-2100, два ядра и четыре потока. Перетест в 3DMark Vantage дает уже более 30000 очков.


Это уровень производительности Core i5-3570K и GeForce GTX 1060. Очень недурно, но учтите, что мой Ryzen 5 1600 работает на 4000 МГц, а память разогнана до 3400 МГц с настройкой всех таймингов.

После этого мне стало интересно протестировать процессорную производительность в AIDA64.

Сведения о системе, обратите внимание на название чипсета.

Тест кеша и памяти выдает вот такие результаты. Латентность отличная для виртуальной машины.

Очень высокий результат в тесте CPU PhotoWorxx.

Итоги

Результаты получились обнадеживающими. Теперь вполне можно создать виртуальную машину, наполнить ее кучей  игр и держать обособленно от основной системы. Учитывая возможность создания «слепков» виртуальной машины, можно держать ее в «свежеустановленном» состоянии в «облаке». И даже если произойдет какой-нибудь сбой, восстановить ее можно будет за пару часов.

Очень порадовала производительность VMware Workstation 15.5.6 Pro даже на моем, не особо мощном процессоре. А на Ryzen 7 3700X, к примеру, и с более мощной видеокартой, все будет просто «летать».

рекомендации

4070 MSI по старой цене дешевле Palit

13900K в Регарде дешевле чем при курсе 60

Ищем PHP-программиста для апгрейда конфы

Пишите, используете ли вы виртуальные машины? И для каких целей?

Yes, using a virtual machine for gaming is possible. In this article, we’ll explain what virtual machine gaming is all about and in what cases you can use it. You’ll also find out how to maximize performance and make gaming on a virtual machine smooth and pleasant.

Virtualization creates many opportunities to optimize the use of hardware resources. That works not just  organizations that build high-performance servers to run complex environments but regular people too. What if you want to use a virtual machine for gaming?

In short: that’s possible. A gamer can use a virtual machine (VM) to run games with reasonable benefits over traditional PC gaming approaches. Virtual machines were designed to make hardware usage more convenient and flexible along with the boost in security. However, when you consider VM gaming, things become more complicated. The performance issue arises especially urgently when you want to run a resource-intensive game on a virtual machine. 

In this post, we explain the benefits of using a VM for gaming. Read on to learn how to increase a VM’s performance to play games more conveniently and pleasantly.

Why Use a Virtual Machine for Gaming?

Let’s suppose that you have a workstation running several VMs for production purposes in your home office. Such rigs usually have powerful high-end hardware that you don’t always use at a 100% load. You need your VMs running continuously to complete projects and be available any moment but building a different rig just to run games is not an option. In this case, creating another VM for gaming using the spare resources of your main hardware seems to be the best option.

Along with the use of hardware resources that you already have, using VMware for games can bring you other advantages. Configuring Hyper-V for gaming is also a way to consider and the benefits can remain the same.

Choose OS for Gaming

An OS is used to manage resources besides simply enabling the utilization of hardware and software installed. Various operating systems can have their own pros and cons in terms of resource usage, which can directly affect gaming performance. Based on the game you are going to play, you can install the most suitable OS on that gaming VM and get the best performance possible.

Another reason to use this advantage of VM gaming appears when you want to play old-school games. Titles released in the 90s or early 2000s, for example, do not always run on modern hardware or support latest Windows versions. You can install Windows 98 on a VM and enjoy the gaming classics of the past years on a high-end rig without wasting hours setting up emulators and drivers.  

Keep Environments Secure

VMs are independent from each other, thus creating a security layer inside the IT environment. When you set up a separate VM for gaming, you can protect your main system from threats such as ransomware or viruses. In case some kind of malware sneaks into a gaming VM after certain software experiments, that malware remains isolated. You protect the host and other virtual machines from the infection, plus the infected VM can be quickly deleted and replaced with an identical one.

Easily Back Up VMs

A VM and a VM’s virtual storage disk are files. A file can be copied and moved to a different location to enhance data safety. Thus, you can have a default copy of your gaming VM to use in case an incident renders the main virtual machine inoperable. 

However, when you use virtual machines on VMware or Hyper-V for gaming, you might want to automate regular backup workflows and have control over your gaming data, such as game configurations, settings and saved game files. Modern backup and recovery solutions can give you that automation and control. 

Minimize Downtime

A virtual machine is flexible and easy to move between hypervisors on various physical hardware. Whenever you need to redistribute the resources of a main workstation or reconfigure your environment, you can move your VM for gaming with all your games to a different device (a laptop, for example) and play games there while the main machine is busy or unavailable.

Additionally, when you use a modern data protection solution to back up your gaming VM, the same solution can help you recover a fully functional virtual machine in minutes. If your virtual machine for gaming gets infected with malware, or you go the wrong way while experimenting with configs, you can quickly recover a default VM and continue gaming. 

Optimizing a VM for Gaming

When considering the use of a virtual machine for gaming, what impacts the gaming experience the most is performance. For sure, virtualized workloads can demand more hardware resources than usual gaming PCs to run games properly. Still, you can spend some time optimizing your gaming VM. In this case, your gameplay can become smoother, and the experience from gaming on a virtual machine might be significantly more pleasant.

Here is a list of hardware and software optimization tips that you can consider to optimize a VM for gaming.

  1. Host a gaming VM on a Solid State Drive (SSD) whenever possible because SSD disks have noticeably higher read and write speeds than regular HDDs. It’s even better if you can use high-speed NVMe SSDs that are faster than SATA drives by design. 
  2. Create a gaming VM with a fixed virtual hard disk (VHD).
  3. Regardless of circumstances, don’t apply encryption or compression to drivers on a gaming VM.
  4. Have minimum 1 gigabyte RAM free as a spare resource on your host. 
  5. Defragment hard disks on the host. Defragmented disks exclude file scattering and boost overall performance.
  6. Check the antivirus configs and ensure they don’t conflict with the gaming VM’s workflows.
  7. When using Hyper-V for gaming, enable the Dynamic Memory feature on your gaming VM. Thus, that VM can have more RAM when necessary to run the game with more frames per second. 
  8. While gaming, try to run only the necessary operations on the host. Disabling the apps which are not critical within the environment can boost a game’s performance on a gaming VM.  
  9. You can redistribute host resources to increase a gaming VM’s performance and play high-end games when the main host isn’t busy with resource-intensive production tasks.

Conclusion

Gaming on a virtual machine is possible and can have certain benefits, such as:

  • The opportunity to choose and flexibly change the OS on a VM.
  • Secure the production environment from possible threats by isolating a VM.
  • Back up a gaming virtual machine to preserve important data such as saved game files.
  • Restore the default VM for gaming with the games and settings from a backup in minutes.

Optimizing a virtual machine for gaming purposes can take time and effort but the performance boost is worth it. Consider hosting a VM on an SSD, using fixed virtual hard disks, defragmenting drives on the host and configure antivirus software properly.

Also, don’t compress or encrypt drivers on a gaming VM and disable the unnecessary apps on the host while gaming. Don’t forget to enable Dynamic Memory if you use Hyper-V and to redistribute the host hardware resources when planning to play high-end games.

Article contributed by Alex Tray.

About the author: Alex Tray is a seasoned system administrator with a decade of experience in the IT industry, specializing in Windows Server and Desktop Administration. Armed with a Bachelor’s degree in computer science, he has worked for various Silicon Valley companies and helped launch several start-ups. As a freelance writer and cybersecurity consultant, Alex contributes his data protection and backup expertise to NAKIVO Backup and Replication, focusing on the Hyper-V backup from NAKIVO, which protects virtual machines running on Hyper-V. 

His extensive knowledge also encompasses Azure, Active Directory, Office 365, DNS, DHCP, Group Policy, Endpoint Manager (Intune), and Microsoft Endpoint Configuration.

Subscribe to our website and stay in touch with the latest news in technology.

Preamble

This guide describes performance optimizations for gaming on a virtual machine (VM) with GPU passthrough.

In order to optimize the user experience for virtualized gaming, I started to pursue low latency and high performance. Especially since my main focus are demanding online multiplayer games.

The Benchmarking Process

I started benchmarking several setups (found on level1tech, reddit and the arch wiki) using Superpossition Demo to compare perfomance results, and LatencyMon 6.70 in order to measure the input lag.

Unfortunately, after several hours of testing I had to learn that those two categories weren’t enough to guarantee a decent gaming experience. Additionally, even when I had one game running smoothly it was not guaranteed that others were not stuttering.

I had to extend my observations.

Instead of testing the performance with the Superpossition demo (measuring FPS only), I used three games to measure my progress.

  • Player Unknowns Battlegrounds (PUBG)
    • which is CPU demanding
  • Apex Legends
    • which is GPU demanding
  • Blizzards Overwatch (OW)
    • which has a pretty low profile

As the previous tests had shown, FPS alone are no reliable performance measurement in a virtual gaming environment.

Thus I came up with the following rules:

  1. Input lag  – the smallest possible input latency is crucial for gaming.
  2. Consistency – no freezes and/or stuttering should
  3. Performance – more is better, gaming performance is measured in frames per second (fps)
  4. Stability – there shall be no crashes!
  5. Compatibility – don’t get banned, work fluently with anti-cheat tools etc.

Whereas 1 is more important than 2 is more important than 3 and so on.

Benchmarking Results

I have forged two libvirt XML files during the tests.

One for i440fx and one for Q35 chipsets. I reached the better gaming experience on a virtual machine with i440fx, Windows 10 1803 configuration.

Passages from QEMU 4.1, i440fx chipset libvirt config file

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>win10-1803-i440fx</name>
  <uuid>073f2a4e-5ab2-4bc7-99c2-2ac006adc87e</uuid>
  <memory unit='KiB'>16777216</memory>
  <currentMemory unit='KiB'>16777216</currentMemory>
  <memoryBacking> <!-- hugepages enable -->
    <hugepages/>
  </memoryBacking>
  <vcpu placement='static'>8</vcpu>
  <iothreads>2</iothreads>
  <cputune>
    <vcpupin vcpu='0' cpuset='8'/>
    <vcpupin vcpu='1' cpuset='9'/>
    <vcpupin vcpu='2' cpuset='10'/>
    <vcpupin vcpu='3' cpuset='11'/>
    <vcpupin vcpu='4' cpuset='12'/>
    <vcpupin vcpu='5' cpuset='13'/>
    <vcpupin vcpu='6' cpuset='14'/>
    <vcpupin vcpu='7' cpuset='15'/>
    <emulatorpin cpuset='0-3'/>
    <iothreadpin iothread='1' cpuset='0-1'/>
    <iothreadpin iothread='2' cpuset='2-3'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-i440fx-4.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
       [...]
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
<vapic state='on'/>
<spinlocks state='on' retries='8191'/>
<vpindex state='on'/>
<synic state='on'/>
<stimer state='on'/>
<reset state='on'/>
<vendor_id state='on' value='1234567890ab'/> <!-- nvidia error code 43 prevention -->
<frequencies state='on'/> </hyperv> <kvm> <hidden state='on'/> <!-- nvidia error code 43 prevention --> </kvm> <vmport state='off'/> <ioapic driver='kvm'/> <!-- required for QEMU 4.0 or later --> </features> <cpu mode='custom' match='exact' check='none'>
<model fallback='allow'>EPYC</model>
<topology sockets='1' cores='4' threads='2'/>
<feature policy='require' name='topoext'/>
<feature policy='require' name='svm'/>
<feature policy='require' name='apic'/>
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='invtsc'/>
</cpu>
<clock offset='localtime'> <timer name='rtc' present='no' tickpolicy='catchup'/> <timer name='pit' present='no' tickpolicy='delay'/> <timer name='hpet' present='no'/> <timer name='hypervclock' present='yes'/> <timer name='tsc' present='yes' mode='native'/> </clock> [...] <devices> <emulator>/usr/local/bin/qemu4.1-system-x86_64</emulator> [...] </devices> <qemu:commandline> <qemu:env name='QEMU_AUDIO_DRV' value='pa'/> <qemu:env name='QEMU_PA_SAMPLES' value='8192'/> <qemu:env name='QEMU_AUDIO_TIMER_PERIOD' value='99'/> <qemu:env name='QEMU_PA_SERVER' value='/run/user/1000/pulse/native'/> </qemu:commandline> </domain>

[collapse]

With the Q35 settings I reach lower input latency (with stutters though).

These are my settings for Q35, Windows 10 1903.

Passages from QEMU 4.1, Q35 chipset libvirt config file

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>win10-1903-q35</name>
  <uuid>cc37803d-a904-44cd-a333-5830ce22d20f</uuid>
  <memory unit='KiB'>16777216</memory>
  <currentMemory unit='KiB'>16777216</currentMemory>
  <memoryBacking> <!-- hugepages enable -->
    <hugepages/>
  </memoryBacking>
  <vcpu placement='static'>8</vcpu>
  <iothreads>2</iothreads>
  <cputune>
    <vcpupin vcpu='0' cpuset='8'/>
    <vcpupin vcpu='1' cpuset='9'/>
    <vcpupin vcpu='2' cpuset='10'/>
    <vcpupin vcpu='3' cpuset='11'/>
    <vcpupin vcpu='4' cpuset='12'/>
    <vcpupin vcpu='5' cpuset='13'/>
    <vcpupin vcpu='6' cpuset='14'/>
    <vcpupin vcpu='7' cpuset='15'/>
    <emulatorpin cpuset='0-3'/>
    <iothreadpin iothread='1' cpuset='0-1'/>
    <iothreadpin iothread='2' cpuset='2-3'/>
  </cputune>
  <os>
    <type arch='x86_64' machine='pc-q35-4.1'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/OVMF/OVMF_CODE.fd</loader>
       [...]
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
<vapic state='on'/>
<spinlocks state='on' retries='8191'/>
<vpindex state='on'/>
<synic state='on'/>
<stimer state='on'/>
<reset state='on'/>
<vendor_id state='on' value='1234567890ab'/> <!-- nvidia error code 43 prevention -->
<frequencies state='on'/> </hyperv> <kvm> <hidden state='on'/> <!-- nvidia error code 43 prevention --> </kvm> <vmport state='off'/> <ioapic driver='kvm'/> <!-- required for QEMU 4.0 or later --> </features> <cpu mode='custom' match='exact' check='none'>
<model fallback='allow'>EPYC</model>
<topology sockets='1' cores='4' threads='2'/>
<feature policy='require' name='topoext'/>
<feature policy='require' name='svm'/>
<feature policy='require' name='apic'/>
<feature policy='require' name='hypervisor'/>
<feature policy='require' name='invtsc'/>
</cpu>
<clock offset='localtime'> <timer name='rtc' present='no' tickpolicy='catchup'/> <timer name='pit' present='no' tickpolicy='delay'/> <timer name='hpet' present='no'/> <timer name='kvmclock' present='no'/> <timer name='hypervclock' present='yes'/> <timer name='tsc' present='yes' mode='native'/> </clock> [...] <devices> <emulator>/usr/local/bin/qemu4.1-system-x86_64</emulator> [...] </devices> <qemu:commandline> <qemu:env name='QEMU_AUDIO_DRV' value='pa'/> <qemu:env name='QEMU_PA_SAMPLES' value='8192'/> <qemu:env name='QEMU_AUDIO_TIMER_PERIOD' value='99'/> <qemu:env name='QEMU_PA_SERVER' value='/run/user/1000/pulse/native'/> </qemu:commandline> </domain>

[collapse]

The following chapters will give you some optimization tips for Host, Guest and hopefully some insights behind the picked libvirt settings.

Is this content any helpful? Then please consider supporting me.

If you appreciate the content I create, this is your chance to give something back and earn some good old karma.

Although ads are fun to play with, and very important for content creators, I felt a strong hypocrisy in putting ads on my website. Even though, I always try to minimize the data collecting part to a minimum.

Thus, please consider supporting this website directly 😘

Overview – the GPU Passthrough Setup

I am using an AMD Ryzen platform for my GPU passthrough setup. This means, some optimizations are especially (or only) relevant to Ryzen CPUs, while others are relevant to any system. I will try to mark these settings throughout the article.

Hardware components

  • CPU: AMD Ryzen 7 1800x (8 Core @3.6GHz)
  • RAM: 32GB DDR4 RAM (@2800MHz)
  • Mainboard: ASUS Prime x370 pro (BIOS version 4207)

Attention! The ASUS Prime x370 pro BIOS versions for RYZEN 3000-series support (up to current latest version 5220 and further), will break a PCI passthrough setup. Error “Unknown PCI header type ‘127’ “. BIOS versions up to (and including) 4406 are working.

Software Components

The Ubuntu host

  • OS: (X)Ubuntu 18.04
  • Kernel: 5.3.6
  • Hypervisor: QEMU version 4.1
  • Manager: Libvirt version 4.7

The Windows virtual machine (guest)

  • Windows 10 version 1903 on Q35 chip
  • Windows 10 version 1803 on i440fx chip
  • Nvidia Driver version 436.68

Attention! A known bug for libvirt and Windows 10 1903: Do not use 6ch/9ch audio devices in the virtual machine, as it creates awful stuttering and performance loss. Using ac97 audio fixes this issue.

Host OS Optimization

CPU Governor Settings

Right after your Host system has booted, the CPU governor settings are usually set to “on demand“. When the CPU requires a boost for a process it will be allowed, in other cases it saves energy.

Unfortunately does the boost trigger from within a virtual machine not work consistent in my tests.

Thus, I force CPU governor setting to “performance” on the host, while the virtual machine is running. The downside is higher energy consumption. :

I use this bash script to enable performance.

#!/bin/bash
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "performance" > $file; done
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

I use this bash script to enable on-demand afterwards.

#!/bin/bash
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "ondemand" > $file; done
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Unfortunately I have lost the exact source to give credit for the code. source1, source2

QEMU and LIBVIRT Versions

QEMU version 3.1 or higher is recommended as it adds improved SMT support for Ryzen CPUs. Ubuntu-1804-LTS’s version is currently 2.12.0. So I recommend upgrading by either building QEMU on your own (read here) or download it via custom ppa.

You can check the libvirt documentation for suppoorted commands and version matching. Why do we need a higher Libvirt version? Not all libvirt versions support all XML commands (link to documentation – )

Clocksource

Make sure ‘tsc’ is set as clock source. You can check this via:

cat /sys/devices/system/clocksource/clocksource0/current_clocksource

this should return ‘tsc

Guest OS Optimization

The optimization recommendations in this chapter are not solely relevant for virtual machines. They can be used as for Windows in general.

  • disable Windows Defender *recommended for virtual machines only
  • disable index and/or cortana search
  • disable mouse acceleration
  • set power plan to maximum performance
  • use the latest graphics card driver
  • Nvidia control panel (in case nvidia GPU is used)
    • Open “3D settings” branch -> Select “Manage 3D settings” -> Select “Global settings” tab
      • set “Power Management mode” -> “Prefer maximum performance”
      • set “Low Latency Mode” -> “On”

Windows 1903 is used on purpose, because it brings better Ryzen SMT support.

Enable MSI Interrupts

One can enable MSI interrupts for passed through hardware with the MSI_util_v2. Get it from CHEF-KOCHs git-hub repository. the MSIInturuptEnabler (thank you Mark).

Spectre Patches (optional)

it is possible to disable the spectre patches in the system using InSpectre tool (downside less secure). Heiko Sieger has an article about the topic.

Is this content any helpful? Then please consider supporting me.

If you appreciate the content I create, this is your chance to give something back and earn some good old karma.

Although ads are fun to play with, and very important for content creators, I felt a strong hypocrisy in putting ads on my website. Even though, I always try to minimize the data collecting part to a minimum.

Thus, please consider supporting this website directly 😘

Virtual machine Configuration Optimizations

Five sections, in the Libvirt virtual machine configuration, are crucial in order to optimize the virtual machines performance:

  • CPU pinning
  • CPU model information
  • Hyper-V enlightments
  • Clock settings
  • Hugepages

CPU Pinning

CPU-pinning will allocate CPU-cores for mainly (or solely) Guest tasks, when the Guest is running. If everything works as expected, the Host will not use the Guest allocated CPU cores.

One could go one even further and restrict access to the guest cores completely, even if the guest isn’t running. This would use the isolcpus kernel command line flag at boot time. I do not use this feature as I would like to have maximum Host performance if the Guest is not running.

AMD Ryzen CPU architecture

Ryzen CPU architecture

The AMD Ryzen architecture houses 8 physical cores, each core capable of handling two threads. This leads to a total of 16 cores available for pinning. The 8 cores are separated into two complexes of 4 cores called CCX. Each CCX has its own L3 cache.   The plan is to have one CCX for the host, and one CCX for the guest. As the hosts runs first, ill assume it will use the (first) CCX with cores 0-3. The second CCX (cores 4-7) shall be used for the virtual machine.   I used a 12 pin setup to the Guest (6 cores) for half a year.

Sometimes I encountered micro lag-spikes which I couldn’t track down. Then I switched to 8 cpus (4 cores).

Core separation between host and guest system

The plan is to have one CCX for the host, and one CCX for the guest. As the hosts runs first, ill assume it will use the (first) CCX with cores 0-3. The second CCX (cores 4-7) shall be used for the virtual machine. I used a 12 pin setup to the Guest (6 cores) for half a year. Sometimes I encountered micro lag-spikes which I couldn’t track down. Then I switched to 8 cpus (4 cores).

The benchmarks indicated that the 6 core pinning had better CPU mark results, and slightly higher FPS, but since I switched to the CCX seperation the lag spikes went away.

Here are my settings:

AMD Ryzen CPU Pinning Recommendation for Optimal Gaming Performance

In order edit the virtual machines configuration use: virsh edit your-windows-vm-name

Once your done editing, you can use CTRL+x CTRL+y to save the changes. First of all find the very first line, which should read:

<domain type='kvm'>

and replace it with:

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>

Now find the line which ends with </vcpu>and add the following block in the next line:

<vcpu placement='static'>8</vcpu>
<iothreads>2</iothreads>
<cputune>
    <vcpupin vcpu='0' cpuset='8'/>
    <vcpupin vcpu='1' cpuset='9'/>
    <vcpupin vcpu='2' cpuset='10'/>
    <vcpupin vcpu='3' cpuset='11'/>
    <vcpupin vcpu='4' cpuset='12'/>
    <vcpupin vcpu='5' cpuset='13'/>
    <vcpupin vcpu='6' cpuset='14'/>
    <vcpupin vcpu='7' cpuset='15'/>
    <emulatorpin cpuset='0-1'/>
    <iothreadpin iothread='1' cpuset='0-1'/>
    <iothreadpin iothread='2' cpuset='2-3'/>
 </cputune>

I have tested <vcpusched vcpus='0' scheduler='fifo' priority='1'/> for the every pinned core but removed it eventually. Without it, it felt more responsive. I have no hard number benchmarks to proof this though.

Remark! Make sure <vcpu>, <iothreads> and <cputune> have the same indent.

Remark! Make sure the pinned cores do match the CPUs topology from below.

CPU Model Information

The chapter above gave us some insights in the AMD Ryzen CPU structure. It is a good thing if the Guest operating system also knows about the structure.

The Libvirt CPU model and topology settings block are used to make the Guest aware of the CPU specifications (as CCX layout, chache size, etc.)

CPU Mode and Cache

For Ryzen CPUs the model definition “Epyc” can be used, this is recommended for QEMU version 3.1 and below. This defines structure and caches of the CPU.

For Qemu version above 3.1 host-passthrough is also feasable.

Attention! Windows 10 release >1803 require the Host to have kvm ignore_msrs=1 enabled, otherwise BSOD occur.

CPU Topology

This is were the actual number of cores are defined. Using 1 socket with 4 cores and 2 threads will toll the Guest operating system it has access to one 4 core hyperthreading CPU.

Important for the CPUs topology is that the number of cores matches the number of pinned cores from above.

CPU Features

In both cases <feature policy=’require’ name=’topoext’/> should be added as CPU feature. See arch wiki. But as /u/llitz said using EPYC is to best way to have an optimal setup.

AMD Ryzen CPU model recommendation for optimal gaming performance

Find the block <CPU> and adapt it to look like this:

 <cpu mode='host-passthrough' check='none' migratable='on'>
    <topology sockets='1' dies='1' cores='4' threads='2'/>
    <cache mode='passthrough'/>
    <feature policy='require' name='topoext'/>
   <!-- add additional cpu features here-->
 </cpu>

For QEMU 3.1 and below “EPYC” is prefered over “host-passthrough”:

<cpu mode='custom' match='exact' check='none'>
    <model fallback='allow'>EPYC</model>
    <topology sockets='1' cores='4' threads='2'/>
    <feature policy='require' name='topoext'/>
    <!-- add additional cpu features here--> 
</cpu>

Hyper-V Enlightments

Hyper-V enlightments help the Guest operating system handling virtualization tasks. The operating has to support those features (Win 10 1903 should be better with it than Win 10 1803).

After excessive testing I went with the settings shown below. My general rule of thumb is “the more the merrier“. The vendor_id setting was only required for Nvidia Error 43 prevention.

The function of each setting (and for which version it is available) can be analyzed in the libvirt documentation.

Add Hyper-V enlightments in the block <features> and add the following block in parallel to the <acpi> block:

HyperV Settings Recommendaction

<hyperv>
   <relaxed state='on'/>
   <vapic state='on'/>
   <spinlocks state='on' retries='8191'/>
   <vpindex state='on'/>
   <synic state='on'/>
   <stimer state='on'/>
   <reset state='on'/>
   <vendor_id state='on' value='1234567890ab'/> <!-- former nvidia error code 43 now AMD GPU prevention -->
   <frequencies state='on'/>
</hyperv>

Remark!

Make sure <hyperv>and <acpi> have the same indent.

Clock Settings

todo.

Hugepages

Unfortunately is the Hugepages post out dated. Until I have fixed this, I recommend using the glorious Arch Wiki.

Troubleshooting

A common issues and troubleshooting article exists here.

Updates

  • 06.07.2021 – Added new MSIInterupt Enabler (thank you Mark)
  • 21.08.2019 – Added further information and todos
  • 30.09.2019 – Updated Hyper-V settings
  • 21.11.2019 – Rewrote the article and added further information

Is this content any helpful? Then please consider supporting me.

If you appreciate the content I create, this is your chance to give something back and earn some good old karma.

Although ads are fun to play with, and very important for content creators, I felt a strong hypocrisy in putting ads on my website. Even though, I always try to minimize the data collecting part to a minimum.

Thus, please consider supporting this website directly 😘

Virtual machine gaming is a concept of the future because it allows people to play games, stream and program through a GPU passthrough. The cloud virtual machine for gaming elevates the feeling to a completely new dimension and provides a more enjoyable experience.

Virtual Machine Gaming

This article will explain everything necessary for virtualbox gaming and what is the best VM gaming performance. Keep reading this guide to learn all the details and understand what it takes to build the best virtual machine for gaming.

Contents

  • 1 What Is Virtual Machine Gaming?
  • 2 What You Will Need To Create a VM
  • 3 How To Create a VM for Gaming
    • 3.1 – Designing a Resource Group
    • 3.2 – Entering Your Credentials
    • 3.3 – Configuring the Storage for Your VM
    • 3.4 – Preparing Your Operating System for the VM
    • 3.5 – Preparing the Operating System for Gaming
  • 4 – How To Optimize the Performance for Your Gaming VM
    • 4.1 – Benchmarking the Process
    • 4.2 – Creating the Passthrough Setup
    • 4.3 – Accessing the CPU Governor Settings 
    • 4.4 – Configuration Settings for Your VM
  • 5 Final Recap and Important Notes

Virtual Machine gaming is a device used as a remote desktop for running games you would like to play. This is the perfect solution for those who do not want to spend thousands of dollars on gaming computers because they rarely play the latest games.

What You Will Need To Create a VM

The VM will solve all the problems because it will be stored in the cloud and you do not need a computer with expensive RAM or CPU. In addition, the windows virtual device will have great latency, though many people thought this would have been a big issue.

You will need a Microsoft Azure account as a prerequisite for your virtual machine Windows 10 gaming. Moreover, since you are building a Windows 10 compatible VM cloud device, it is recommended to have the licensed version for the best results. If you do not have this account, you can create one on the Microsoft Azure web page.

So now that you understand a lot more about VM gaming, let us learn how to create this machine in the following section of this guide.

How To Create a VM for Gaming

Follow these steps to create your own VM for gaming. With the help of our comprehensive guide, you’ll learn that it doesn’t take a genius to set this up!

– Designing a Resource Group

The first step in creating a VM for gaming is designing a dedicated resource group for your gaming-related resources. The name of the resource group can be anything, but try to add some meaning for easier navigation. Next, create a different VM in the created resource group, and pick the desired region. You should select a proper Windows 10 image, and it would be best if you either use NV6_Promo or NV6 as file size.

However, since available sizes depend on the specified region, it might be required to alter the region to select the adequate size. On the flip side, the latest sizes such as NV8as_v4 will not work because the desktop viewer has lower latency than necessary.

In terms of price, for the complete VM gaming experience, expect to pay around $20 per year, which definitely sounds good, especially if you consider the price of a proper gaming computer. In addition, the current price of NV6_promo is less than $1, but you should not forget to turn the VM off when you do not need it.

– Entering Your Credentials

Next, you should insert your username and password to access your VM at a later point. In addition, you should expose the RDP port 3389 to an open internet connection. This port is required for connecting to the remote desktop of the VM, especially for gaming or streaming. Finally, you are supposed to select your region, VM name, availability options, add an image, and select the size in this step.

Now, check that you have an appropriate license available so that you can toggle the checkbox appropriately. In addition, you should select the public inbound ports and specify them in the following menu.

At this point, it is time to configure the storage for your VM. Learn how it is done in the following section of this article.

– Configuring the Storage for Your VM

Experts recommend using the Standard SSD disk type for your operating system and an additional Standard SSD disk with 512 GB for everything installed later, such as games and applications. You can keep the default settings, but changing them to your preference is recommended because you should initiate the creation process. After your personalized settings are ready, it is time to start the process.

Configuring the Storage for Your VM

The creation process takes around 2-5 minutes to finish, and this is when additional resources are created by default, such as a network. Once the complete process is done, you can refer to the previously created VM extension section to check the necessary graphics card driver. Finally, choose the NVIDIA GPU driver extension or install the driver manually from inside the VM.

Next, we will show you how to prepare the operating system for your VM.

– Preparing Your Operating System for the VM

Completely installing the operating system for your VM is not enough for a proper gaming experience. Next, you should prepare the necessary settings so that they can be used for gaming. Click the Connect button in the resource overview from the Azure Portal, and select RDP. Keep the default settings and download the RDP file that contains the necessary connection details for the remote desktop application.

If your laptop has Microsoft Windows, you will be able to download the VM directly using the same RDP file. Now, enter your credentials defined in the previous steps and accept the offered certificate. To check whether the complete process was successful, go to the device manager and make sure the NVIDIA Tesla M60 file is listed below the display adapters. You are almost done.

Check whether Windows offer any updates and if so, install all. This process might be time-consuming, but it is necessary for an optimal experience. Next, you need to navigate the disk manager, select the additional storage from previously, and initialize it. The basic preparation for your operating system is now complete, and now we will need to apply certain gaming criteria.

– Preparing the Operating System for Gaming

This is the final step of the complete process before starting the VM gaming experience. First, you need to install Parsec on your VM and laptop. In addition, you need to create a Parsec account if you do not have one. Finally, you can close the RDP connection if you have successfully managed to log in and connect.

From this point, you can use the same connection to access the Parsec account. However, you should always log in using the RDP credentials once the stopped VM is initiated again. Now you are ready to install games and enjoy.

Take note that there is a way you can optimize the performance of your gaming VM as shown in the following section of this guide.

– How To Optimize the Performance for Your Gaming VM

In this section, we will teach you how to optimize the performance of your gaming VM by accessing the passthrough. One of the essential steps is achieving low latency with high performance. This is especially true for demanding online multiplayer games. As with the previous process, this process also contains several steps.

– Benchmarking the Process

You should use the Superpossition Demo to benchmark several setups in your gaming VM. You can use the performance results to compare other criteria and measure the input lag. We have conducted a single benchmark where we have used three games such as Apex Legends, Blizzards Overwatch, and PUBG.

There are several rules that we came up with, as shown in the following bullet list:

  • Input lag – the lowest possible input latency is crucial
  • Consistency – no stuttering and/or freezing
  • Performance – gaming is measured in frames per second, so more is better
  • Stability – no crashes are allowed
  • Compatibility – work fluently with anti-cheat tools, and avoid getting banned

The benchmarking results are necessary to understand why these rules are crucial. It is easy to reach an improved gaming experience on a VM with the i440FX and the Windows 10 configuration. After the benchmark is complete, it is time to move on to the next step. Learn more about it in the following section of this article.

– Creating the Passthrough Setup

We have used the AMD Ryzen platform for the current passthrough setup. This fact is important to know because certain settings may only apply to the specific Ryzen CPUs, while other settings may require additional changes.

Creating the Passthrough Setup

Let us learn more about the hardware components from the following list:

  • CPU: AMD Ryzen 7 1800x
  • RAM: 32 GB DDR4 RAM
  • Mainboard: ASUS Prime x370 Pro

These hardware components are more than enough to provide the necessary power and latency. However, you need to learn more about the software components too. They are shown in the following bullet list:

  • OS: Ubuntu 18.04
  • Kernel: 5.3.6
  • Hypervisor: QEMU version 4.1
  • Manager: Libvirt version 4.7

The guest will have the following software components:

  • Windows 10 version 1903 on Q35 chip
  • Windows 10 version 1803 on i440fx chip
  • Nvidia Driver version 436.68

This concludes the second step. Your passthrough setup is ready, and it is now time to access the OS governor settings. Keep reading to learn more about them.

– Accessing the CPU Governor Settings 

The CPU governor settings will be set to “on demand” immediately after the host has been booted. Unfortunately, this is not enough, and you should trigger the “performance” setting for the host. The only downside to this change is the higher energy consumption. The necessary script for this is shown below:

#!/bin/bash

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo “performance” > $file; done

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

After this script, you should use a different one to enable the on-demand, as shown here:

#!/bin/bash

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo “ondemand” > $file; done

cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

This script wraps the change in the CPU governor settings. You are nearly done because there is one more step you are supposed to do. Learn more in the following section.

– Configuration Settings for Your VM

Besides the change in the CPU governor settings, you must make certain changes to the configuration settings for your VM.

Configuration Settings for Your VM

Five sections inside the Libvirt VM are crucial for proper optimization of the VM performance, as shown here:

  • CPU pinning
  • CPU model information
  • Hyper-V enlightenments
  • Clock settings
  • Hugepages

Pay attention to the configuration settings shown in this list. All it takes is a simple tune to your computer’s specs, and the complete process is done. These five sections will enable a smoother operation of your VM and provide an adequate gaming experience.

This section wraps everything important you were supposed to know about VM gaming. Now you know a lot more about the complete creation process. Let us go ahead and summarize the information from this article.

Final Recap and Important Notes

Virtual machine gaming is a concept of the future because it allows people to play new games, stream and program through an adequate passthrough. Make sure to read the following condensed bullet list containing all the important information, and come back to it whenever you need help:

  • Virtual Machine gaming is a device used as a remote desktop for running games you would like to play.
  • VM gaming is a concept that is cheap to implement and provides a number of advantages.
  • The creation process for your VM gaming setup may sometimes be complicated.
  • You will need a Microsoft Azure account as a prerequisite for your virtual machine Windows 10 gaming, and this article covered the necessary steps so that you can do it easily.
  • Experts recommend optimizing the performance settings of your VM, and it is possible to reuse the same script provided in this article for your VM settings.

VM gaming setup will probably cost you around $20 per year, which is significantly less than purchasing a gaming computer. Hopefully, this guide made you an expert at preparing your personal VM gaming setup without any problems, so go ahead and start making your own! 

  • Gaming ethernet family controller для windows
  • Gamestick lite 4k драйвер для windows
  • Gamesir t1s драйвер скачать windows
  • Gamesir g4 pro драйвер для windows 10 x64
  • Games gta 4 games for windows live для windows