Overclock.net - An Overclocking Community - Reply to Topic

Thread: {Guide} Create a Gaming Virtual Machine Reply to Thread
Title:
Message:

Register Now

In order to be able to post messages on the Overclock.net - An Overclocking Community forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.
User Name:
If you do not want to register, fill this field only and the name will be used as user name for your post.
Password
Please enter a password for your user account. Note that passwords are case-sensitive.
Password:
Confirm Password:
Email Address
Please enter a valid email address for yourself.
Email Address:

Log-in


  Additional Options
Miscellaneous Options

  Topic Review (Newest First)
11-11-2017 07:53 AM
zipeldiablo
Quote:
Originally Posted by powerhouse View Post

I didn't know. Do you have any place you share your knowledge? I'm always interested to learn more.

No i don't, there is enough place as it is on the web wink.gif
The blog from the redhat guy is a good start (alex richardson or something, it should be the first result when it comes to vfio), the mailing list is top-notch if you have any issue and you can still find 182 pages of information on arch-linux forum wink.gif
09-02-2017 02:32 PM
powerhouse
Quote:
Originally Posted by zipeldiablo View Post

You do realize that I already know more on the subject than the sum of the content you posted on your website right?

Anyway, I had windows on Vm too but before switching it as main os I already moved it on baremetal, I needed to run benchmarks to compare performance between vm and host so...

I didn't know. Do you have any place you share your knowledge? I'm always interested to learn more.
08-31-2017 11:27 AM
zipeldiablo
Quote:
Originally Posted by powerhouse View Post

The reason I replied to your previous post was that I couldn't understand why your hardware wouldn't work with VGA passthrough - it should have been rather easy.

In any case, if you're interested, here is my how-to: https://heiko-sieger.info/running-windows-10-on-linux-using-kvm-with-vga-passthrough/

Probably because I had a different hardware back then, it was a real pain in the ass.
You do realize that I already know more on the subject than the sum of the content you posted on your website right?

Anyway, I had windows on Vm too but before switching it as main os I already moved it on baremetal, I needed to run benchmarks to compare performance between vm and host so...
08-29-2017 09:49 AM
powerhouse
Quote:
Originally Posted by zipeldiablo View Post

Mate It was almost a year and a half ago when i said i don't have a clue, i meant i don't remember.

Also i can't post anything, since then i switched to a 4k monitor and before the release of the gtx 1080ti i had a 980ti which wasn't powerfull enought, so i had to go sli rolleyes.gif

And since it wasn't possible i moved from linux main os to win10 main os.
Also now with linux inside windows i pretty much don't need linux on my main computer, especially since i also have a macbook pro for work.
(also i could finally get rid of my zfs array and move to a 10to hdd o/ )

I had an extra usb 3 pcie card by the way, which i used for usb passthrough.
Speaking of motherboard, i am wondering if i had the same cpu back then, quite possible i was on a different chipset, time flies so...

Wow, didn't notice that this was so long ago. Glad you found a way to enjoy both worlds - Linux and Windows. It looks like you got some nice hardware, too.

I myself would not want to run Windows as a host OS - too many bad memories from deteriorating disk / general performance to "disk not readable" since Microsoft dropped support for disk compression (moving from Win98 to 2000 or whatever was the next) to - surprise surprise - virus infection, despite commercial anti-virus software etc. The list goes on.

Since I run Windows 10 Pro in a VM on lvm formated drives, backups are easy - create snapshot and backup, even while Windows is running. A 110 GB Windows partition on SSD takes me about 10 minutes to backup to HDD, and about the same time to restore. I have always 2 consecutive backups, plus a "golden copy" when I installed Windows and the software I use. All copies are stored both local on a backup drive and remote on a server. If my CPU/motherboard dies on me, I can replace/upgrade both CPU and m/b and boot my Windows VM as if nothing happened.

Sometimes I install software on Windows for trials, or experiment with different settings inside Windows. If I'm not happy with the results, I simply restore Windows from a backup. This would be a lot more complicated if Windows was installed on bare metal.

Backup and restore, including remote backup/restore, is all done in Linux. Linux has lots of utilities for handling and safekeeping data, and all of them free. I'm not a script wizard and often use GUI applications to get the job done. But sometimes I use scripts since they are unbeatable.

The reason I replied to your previous post was that I couldn't understand why your hardware wouldn't work with VGA passthrough - it should have been rather easy.

In any case, if you're interested, here is my how-to: https://heiko-sieger.info/running-windows-10-on-linux-using-kvm-with-vga-passthrough/

Forgive me if I posted the link before.
08-27-2017 08:51 AM
zipeldiablo
Quote:
Originally Posted by powerhouse View Post

Interesting. I got the 3930K and 5960X should not be anything behind mine. I am also passing through 2 USB controllers, one of which is part of my X79 chipset. I never had the need to use the ACS patch.

Can you post your IOMMU groups before you patched the kernel? I'm quite surprised that you need a patch with that CPU.

I'm quite confident that if you were to do VGA passthrough with a modern graphics card that has a UEFI BIOS, using Windows 10 (or Windows 8) with UEFI boot, you should have no problems. In the worst case, you'd need an extra USB3 PCIe card, which is real cheap. Of course, if the motherboard BIOS is screwed, you may run into all sorts of problems. What's your motherboard?

Mate It was almost a year and a half ago when i said i don't have a clue, i meant i don't remember.

Also i can't post anything, since then i switched to a 4k monitor and before the release of the gtx 1080ti i had a 980ti which wasn't powerfull enought, so i had to go sli rolleyes.gif

And since it wasn't possible i moved from linux main os to win10 main os.
Also now with linux inside windows i pretty much don't need linux on my main computer, especially since i also have a macbook pro for work.
(also i could finally get rid of my zfs array and move to a 10to hdd o/ )

I had an extra usb 3 pcie card by the way, which i used for usb passthrough.
Speaking of motherboard, i am wondering if i had the same cpu back then, quite possible i was on a different chipset, time flies so...
08-22-2017 02:22 PM
powerhouse
Quote:
Originally Posted by zipeldiablo View Post

I have a x99 cpu (i7 5960x) and i did use the linux-vfio package, however I needed some custom things on the kernel (not a clue what it was biggrin.gif ) and so I had to patch it (might be related to usb hardware as i was doing usb passthrough too).
I saw some guys with other components, damn i was sorry for them tongue.gif

Interesting. I got the 3930K and 5960X should not be anything behind mine. I am also passing through 2 USB controllers, one of which is part of my X79 chipset. I never had the need to use the ACS patch.

Can you post your IOMMU groups before you patched the kernel? I'm quite surprised that you need a patch with that CPU.

I'm quite confident that if you were to do VGA passthrough with a modern graphics card that has a UEFI BIOS, using Windows 10 (or Windows 8) with UEFI boot, you should have no problems. In the worst case, you'd need an extra USB3 PCIe card, which is real cheap. Of course, if the motherboard BIOS is screwed, you may run into all sorts of problems. What's your motherboard?

EDIT: Just looked at your config file (xml sucks). I see you do UEFI boot. Haven't had the patience to extract the essence out of the xml garbage. So here is my start script. The interesting part starts at qemu-system...:

#!/bin/bash

configfile=/etc/vfio-pci.cfg
vmname="win10vm"

vfiobind() {
dev="$1"
vendor=$(cat /sys/bus/pci/devices/$dev/vendor)
device=$(cat /sys/bus/pci/devices/$dev/device)
if [ -e /sys/bus/pci/devices/$dev/driver ]; then
echo $dev > /sys/bus/pci/devices/$dev/driver/unbind
fi
echo $vendor $device > /sys/bus/pci/drivers/vfio-pci/new_id

}


if ps -A | grep -q $vmname; then
zenity --info --window-icon=info --timeout=15 --text="$vmname is already running." &
exit 1
else
cat $configfile | while read line;do
echo $line | grep ^# >/dev/null 2>&1 && continue
vfiobind $line
done

export QEMU_AUDIO_DRV=alsa
export QEMU_ALSA_ADC_BUFFER_SIZE=1024 QEMU_ALSA_ADC_PERIOD_SIZE=256
export QEMU_ALSA_DAC_BUFFER_SIZE=1024 QEMU_ALSA_DAC_PERIOD_SIZE=256
export QEMU_AUDIO_DAC_FIXED_SETTINGS=1
export QEMU_AUDIO_DAC_FIXED_FREQ=44100 QEMU_AUDIO_DAC_FIXED_FMT=S16 QEMU_AUDIO_ADC_FIXED_FREQ=44100 QEMU_AUDIO_ADC_FIXED_FMT=S16
export QEMU_AUDIO_DAC_TRY_POLL=1 QEMU_AUDIO_ADC_TRY_POLL=1
export QEMU_AUDIO_TIMER_PERIOD=50

cp /usr/share/OVMF/OVMF_VARS.fd /tmp/my_vars.fd
chown qemu-vga:qemu-vga /tmp/my_vars.fd

#taskset -c 0-9
qemu-system-x86_64 \
-monitor stdio \
-serial none \
-parallel none \
-nodefaults \
-nodefconfig \
-name $vmname,process=$vmname \
-machine q35,accel=kvm,kernel_irqchip=on,mem-merge=off \
-cpu host,kvm=off,hv_vendor_id=1234567890ab,hv_vapic,hv_time,hv_relaxed,hv_spinlocks=0x1fff \
-smp 12,sockets=1,cores=6,threads=2 \
-m 20G \
-mem-path /run/hugepages/kvm \
-mem-prealloc \
-balloon none \
-rtc base=localtime,clock=host \
-vga none \
-nographic \
-soundhw hda \
-device vfio-pci,host=02:00.0,multifunction=on \
-device vfio-pci,host=02:00.1 \
-device vfio-pci,host=00:1a.0 \
-device vfio-pci,host=08:00.0 \
-drive if=pflash,format=raw,readonly,file=/usr/share/OVMF/OVMF_CODE.fd \
-drive if=pflash,format=raw,file=/tmp/my_vars.fd \
-boot order=c \
-drive id=disk0,if=virtio,cache=none,format=raw,aio=native,file=/dev/mapper/lm13-win10 \
-drive id=disk1,if=virtio,cache=none,format=raw,aio=native,file=/dev/mapper/photos-photo_stripe \
-drive id=disk2,if=virtio,cache=none,format=raw,aio=native,file=/dev/mapper/media-photo_raw \
-netdev type=tap,id=net0,ifname=vmtap0,vhost=on \
-device virtio-net-pci,netdev=net0,mac=00:16:3e:00:01:01

#EOF

exit 0
fi



The rest of the setup you find here: https://heiko-sieger.info/running-windows-10-on-linux-using-kvm-with-vga-passthrough/
08-22-2017 08:31 AM
zipeldiablo
Quote:
Originally Posted by powerhouse View Post

Yes, I mean KVM.

I can feel your pain - building custom kernel and the like. However, given the right hardware, VGA passthrough is pretty easy. This is why I recommend Intels Xeon-based desktop CPUs, that is CPUs for the X299 or the older X99 chipsets. For example the 8-core Intel i7-7820X, or the 6-core i7-7800X. I'm not sure about the i7-7740X, if it offers ACS capabilities then it might be a good and less expensive choice for a gaming rig.

The Z170 / Z270 based CPUs are a mixed bag - some work OK, some need the ACS patch. That is where Arch Linux comes in - you don't need to patch, just select the linux-vfio package. Aside from that and their documentation I don't see a reason to switch from my favorite distribution to Arch. But that's a matter of taste - Arch is most certainly an excellent distribution.

I wouldn't use the harsh words you used (nazis), but the mods of the Arch forum could have been more tolerant and not closed the thread. It was the best thread on kvm and VGA passthrough - ever! I'm sure that quite some people switched to Arch just because of that thread.

Thanks for the VM files - need to look at them.

I have a x99 cpu (i7 5960x) and i did use the linux-vfio package, however I needed some custom things on the kernel (not a clue what it was biggrin.gif ) and so I had to patch it (might be related to usb hardware as i was doing usb passthrough too).
I saw some guys with other components, damn i was sorry for them tongue.gif
08-22-2017 08:10 AM
powerhouse
Quote:
Originally Posted by zipeldiablo View Post

The real pain for me was to build my custom kernel.
Once i've done that i was a pain of cake (mainly because i had fixed every problem before).

Back then i couldn't find any documentation on how to setup vga passthrough with xen and the threads i bump into said it wasn't possible, so i dropped the idea (wanted to do passthrough on qubes os)
Virt-manager sucks big time and should ONLY be used to create your config file on the first run.
When you say qemu you mean qemu-kvm right?
What is awesome with qemu is qemu hooks ! Plugging and deplugging your usb peripherals, damn that was good.

You say documentation sucks but there is a 170+pages thread on archlinux forum, about 20 blogpost from a guy working at redhat on virt and a mailing list where people actually answer your questions.

Arch is great for building your custom kernel, was really easy compared to do it on fedora... (also it took me 3 different oses to do what i wanted, since i started on centos but the damn thing being on lts didn't have a kernel recent enough).
There is a great thread on arch forums bug those modos are nazys mate, they closed it because a lot of folks who didn't use arch went on the forum ask for help, such a pity... since then the community apart from the mailing list kinda disolved.

Speaking of benchmarks i did some with 3dmark and i was only 3% behind in terms of performance between native win10 and vm win10.
It was due in fact to the cpu consumption of arch linux.

Anyway if you guys are looking for vm files or stuff like that i can share my former config : https://github.com/tirrorex/Virtual-machine

Yes, I mean KVM.

I can feel your pain - building custom kernel and the like. However, given the right hardware, VGA passthrough is pretty easy. This is why I recommend Intels Xeon-based desktop CPUs, that is CPUs for the X299 or the older X99 chipsets. For example the 8-core Intel i7-7820X, or the 6-core i7-7800X. I'm not sure about the i7-7740X, if it offers ACS capabilities then it might be a good and less expensive choice for a gaming rig.

The Z170 / Z270 based CPUs are a mixed bag - some work OK, some need the ACS patch. That is where Arch Linux comes in - you don't need to patch, just select the linux-vfio package. Aside from that and their documentation I don't see a reason to switch from my favorite distribution to Arch. But that's a matter of taste - Arch is most certainly an excellent distribution.

I wouldn't use the harsh words you used (nazis), but the mods of the Arch forum could have been more tolerant and not closed the thread. It was the best thread on kvm and VGA passthrough - ever! I'm sure that quite some people switched to Arch just because of that thread.

Thanks for the VM files - need to look at them.
08-21-2017 03:03 AM
zipeldiablo
Quote:
Originally Posted by JackCY View Post

Expected this to be unRAID, found Xen and KVM, hmm. Why not unRAID? From just technical POV, pricing aside.

Hum, if I remember correctly I did research on unraid back in the days and it was a real pain.
Not enough customisation and the lots.

Quote:
Originally Posted by powerhouse View Post

Dismissing Xen is a little unfair.

Xen is an excellent hypervisor that has a lot going for it. I have used it for VGA passthrough for over 3 years and it has been stable with excellent performance, and the setup was a piece of cake compared to KVM.

KVM, on the other side, has caught up and may be the better choice in many cases, particularly on desktops with Nvidia graphics. I myself switched to KVM for a very specific reason - support of Nvidia proprietary driver in Linux. To my knowledge this can now also be achieved in Xen.

With KVM, however, it can be a real pain in the neck to get good (or even decent) performance. The documentation pretty much sucks, with a few exceptions. I have had very bad experiences with virt-manager, a popular GUI to set up KVM virtual machines. Some people report success, however. I have followed many of the published virt-manager based guides and none of them gave me the performance I'm used to. And trust me, I'm not a newcomer to this.

Fedora versus Ubuntu: Perhaps the virt-manager based passthrough tutorials really only work with Fedora/Red Hat, which is a pretty bad sign as virt-manager is developed by Red Hat. I'd expect a software package to work on all major platforms, but all this is pure speculation on my side.
The fact is that Ubuntu and its derivatives like Linux Mint has many users, and quite a few of them managed to get VGA passthrough working using qemu and a little script. I've written how-tos for both Xen VGA passthrough and KVM VGA passthrough for Linux Mint, both of which work for Ubuntu too.

If I were to recommend a distribution for use with VGA passthrough, I'd name Arch Linux simply because of their built-in features and their excellent documentation, and because of their forum.

When I use the word "performance", I can share benchmarks to quantify it, for example: https://forums.linuxmint.com/viewtopic.php?f=225&t=153482.

The real pain for me was to build my custom kernel.
Once i've done that i was a pain of cake (mainly because i had fixed every problem before).

Back then i couldn't find any documentation on how to setup vga passthrough with xen and the threads i bump into said it wasn't possible, so i dropped the idea (wanted to do passthrough on qubes os)
Virt-manager sucks big time and should ONLY be used to create your config file on the first run.
When you say qemu you mean qemu-kvm right?
What is awesome with qemu is qemu hooks ! Plugging and deplugging your usb peripherals, damn that was good.

You say documentation sucks but there is a 170+pages thread on archlinux forum, about 20 blogpost from a guy working at redhat on virt and a mailing list where people actually answer your questions.

Arch is great for building your custom kernel, was really easy compared to do it on fedora... (also it took me 3 different oses to do what i wanted, since i started on centos but the damn thing being on lts didn't have a kernel recent enough).
There is a great thread on arch forums bug those modos are nazys mate, they closed it because a lot of folks who didn't use arch went on the forum ask for help, such a pity... since then the community apart from the mailing list kinda disolved.

Speaking of benchmarks i did some with 3dmark and i was only 3% behind in terms of performance between native win10 and vm win10.
It was due in fact to the cpu consumption of arch linux.

Anyway if you guys are looking for vm files or stuff like that i can share my former config : https://github.com/tirrorex/Virtual-machine
08-20-2017 05:16 AM
powerhouse
Quote:
Originally Posted by JackCY View Post

Expected this to be unRAID, found Xen and KVM, hmm. Why not unRAID? From just technical POV, pricing aside.

This is a very old thread/tutorial, back from a time when unRAID wasn't around or didn't support this stuff.

Although Xen is still a viable option, it has been put in second place by KVM. If I'm not mistaken, unRAID uses KVM for VGA passthrough.

unRAID is a commercial solution. Xen and KVM come free. There are more up-to-date tutorials for different Linux distributions, in particular when using KVM.

From a technical POV, it boils down to the hardware you have. If your hardware (CPU and motherboard) doesn't support IOMMU (VT-d in Intel terms), none of the above will work.
This thread has more than 10 replies. Click here to review the whole thread.

Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off