HOW-TO make dual-boot obsolete using kvm VGA passthrough

Questions about virtualization software
Forum rules
Before you post please read how to get help
MikeF
Level 1
Level 1
Posts: 3
Joined: Wed Feb 01, 2017 6:13 pm

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by MikeF »

I gave the updated bios a try.

/usr/share/edk2.git/ovmf-x64/OVMF-pure-efi.fd

Still will not boot using the mint.img file.

Slightly different behavior, I do not get the "Boot Failed: ..." messages anymore but the bios still ends up trying to boot off the network (iPXE).
If I wait for it to time out and go into the Boot Manager I do see UEFI QEMU HARDDISK QM00001 in the list

I will try and reinstall mint using pure-efi and see if that helps.

driz
Level 1
Level 1
Posts: 24
Joined: Mon May 12, 2014 3:38 pm

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by driz »

when you installed your linux (i dont use mint) where did you install the bootloader? MBR or first partition? I'm not sure how MBR in a kvm guest would work, but perhaps if you mark partition 1 as bootable and install the bootloader there it will work?

i would also verify the label on your disk is gpt, esp if using ovmf.

in fdisk `a` makes a partition bootable, in parted `set X boot on`; to install grub to a partition rather than mbr, you can usually grub-install /dev/sdX

to be fair, i still build linux boxes like i did in the 90s so i have a separate /boot partition, i'm pretty sure it's not necessary anymore, but hell, i still use bsd-style init scripts too..

odtech
Level 2
Level 2
Posts: 98
Joined: Sat Jan 21, 2017 9:25 am

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by odtech »

Just some more comments on hardware and software issues i encountered while finalising my hardware setup.

HDMI sound stops working for no apparant reason when Intel IOMMU is turned on. There is a workaround but it breaks PCI passthrough for GPU.
This only affect setups that uses Intel Intergrated graphics and audio via HDMI for the host.
https://bugs.launchpad.net/ubuntu/+sour ... ug/1428121

Passing through Killer network adapters causes instability.
  • 05:00.0 Ethernet controller: Qualcomm Atheros Killer E220x Gigabit Ethernet Controller (rev 13)
Regularly causes the host and guest to freeze. Only way to recover is to reboot the system
  • 04:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 20)
This causes 0x000001d4 BSOD in the Windows Guest. It's a driver issue which is temporarily fixed by downloading an updated driver but windows 10 seems to overwrite is after an update and the issue returns.
The solution was to just remove it from my VM startup script.

powerhouse
Level 6
Level 6
Posts: 1093
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse »

About installing Linux as VM with VGA passthrough: I'm afraid I can't be of much help here. The only thing I read is that Windows is a lot easier with VGA passthrough than Linux. I personally do not have experience with it (I may have tried it, but I cannot recollect). I'm glad that others have jumped in to offer help!

Right now my main effort is to get the Windows VM run in unprivileged mode, that is not as root. I've made some progress but am still struggling with issues such as networking. Any help is appreciated.

@driz: I too use a separate /boot partition using ext2, non-LVM. All my other partitions use LVM and ext4, unless its a Windows volume which is NTFS. A separate /boot partition may be required if you run LVM like me. Here a quote from the Arch Linux Wiki:
Warning: /boot cannot reside in LVM when using a boot loader, which does not support LVM, you must create a separate /boot partition and format it directly. Only GRUB is known to support LVM.
Gigabyte Aorus X570 Pro, AMD Ryzen 3900X CPU, 2x32GB Corsair DDR4, water cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Samsung 500GB + 1TB NVMe + Samsung Evo 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

powerhouse
Level 6
Level 6
Posts: 1093
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse »

odtech wrote:Just some more comments on hardware and software issues i encountered while finalising my hardware setup.

HDMI sound stops working for no apparant reason when Intel IOMMU is turned on. There is a workaround but it breaks PCI passthrough for GPU.
This only affect setups that uses Intel Intergrated graphics and audio via HDMI for the host.
https://bugs.launchpad.net/ubuntu/+sour ... ug/1428121

Passing through Killer network adapters causes instability.
  • 05:00.0 Ethernet controller: Qualcomm Atheros Killer E220x Gigabit Ethernet Controller (rev 13)
Regularly causes the host and guest to freeze. Only way to recover is to reboot the system
  • 04:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 20)
This causes 0x000001d4 BSOD in the Windows Guest. It's a driver issue which is temporarily fixed by downloading an updated driver but windows 10 seems to overwrite is after an update and the issue returns.
The solution was to just remove it from my VM startup script.
I've read about problems with the Intel Integrated Graphics (IGD) and IOMMU, but using the OVMF (UEFI) method was supposed to take care of that. The reason I stuck to the OVMF method were the reports about needing to patch the kernel with the i915 VGA arbiter patch together with the i915.enable_hd_vgaarb=1 option in GRUB. In the words of Alex Williamson (I believe he wrote the patch):
the i915 vga arbiter patch is necessary any time you have host Intel graphics and make use of the x-vga=on option
OK, so I take it that HDMI sound doesn't work for the Intel Integrated Graphics Device (IGD) running on the host. BUT, this might be related to your running a patched 4.4 kernel with the ACS patch. I also wonder if this bug has been addressed by a newer kernel?

About passing through network adapters: Back in the old days when I ran a Xen hypervisor I did some benchmarks. Eventually I got to a point where network speed was no issue anymore (I also optimized the SAMBA config file to improve the file transfer speed, see here). I haven't done any network speed benchmarks using KVM, something to look into.
From practical experience, the way I'm running my Windows VM now I do not see a need to pass through a network card. The bridge and the tap interface that I created seems to work well and I haven't noticed any performance issues, yet. There are some configuration and performance tuning tips on the Internet, so if you encounter performance issues with a bridged network, you may want to try them first. See also http://www.linux-kvm.org/page/10G_NIC_p ... _vs_virtio, https://www.ibm.com/support/knowledgece ... ostnet.htm, http://www.linux-kvm.org/page/Multiqueue and http://blog.vmsplice.net/2011/09/qemu-i ... cture.html.

In an earlier post you explained how you required UEFI boot to pass through your SATA controller. I hadn't commented on that since I can see some scenarios where that would make sense, if only for some improved disk performance. Besides, sharing your experiments here gives us valuable information, things I or many others wouldn't have discovered. So what I am writing below should NOT discourage you in your quests. It is simply my own perspective and/or experience:

1. Passing through a SATA controller: Passing through the SATA controller, the best performance you can hope for is "bare metal" performance. While some virtio VM configurations will give you a performance penalty, it often is so little that it won't matter in practice. As long as you don't use the default caching method "writethrough" which really cripples write performance. For an in-depth benchmark, see http://jrs-s.net/2013/05/17/kvm-io-benchmarking/. The conclusion of this benchmark is:
... a ZFS zvol with ext4, qcow2 files, and writeback caching offers you the absolute best performance.
It's not the only benchmark around. I've done my own benchmarks using Passmark, which are documented here.
Not discussed above is the iothread option (formerly x-data-plane), see https://www.reddit.com/r/VFIO/comments/ ... _settings/. See also http://www.linux-kvm.org/page/Virtio/Block/Latency, http://blog.vmsplice.net/2013/03/new-in ... irtio.html and http://www.slideshare.net/pradeepkumars ... or-threads.

There are many KVM options to tweak, let alone deciding upon the underlying partitions/file systems (raw, zfs, LVM, xfs,..) and whether or not to use qcow2 (preallocated or not?), whereas PCI passthrough seems to be straightforward. But PCI passthrough has its drawbacks. qcow2 for instance is easy to handle and to back up. I use LVM and a backup script to create a snapshot of the Windows VM, compress it and save it in a tgz file. There are a number of advantages to letting Linux handle the storage. But I'm sure you have your reasons why you chose to let Windows handle its storage media.

2. Passing through a network controller: This requires you to physically connect the NIC to an Ethernet switch or a router. Unless you got a real beast of a switch/router, the virtual bridge created with brctl and configured in the qemu startup script will most likely be faster.
I do not see Windows suitable for running network or server tasks that would require a separate NIC. However, passing NICs to a Linux guest is common practice. Possible applications are nearly endless: NAS, media streamer, firewall, demilitarized zone (DMZ), honeypots, servers of all kinds, you name it. But unless you are running your machine in an enterprise environment, I can't really see the need for NIC passthrough. I'm open to learn.

3. Passing through a USB controller: I actually use PCI passthrough to pass through 2 USB host controllers, a USB 2 and a USB 3 controller. My board has several USB controllers and I have a separate SATA/USB3 PCI card so I got plenty of USB ports. When running Windows I use a USB2 port for mouse and keyboard, a USB3 port to hook up an external HDD, another USB2 port for a dedicated photo printer, and often a USB3 card reader to read the memory cards from my cameras. Here I need speed, as these cards often hold several GByte worth of photos, and who wants to wait?

I wanted to list these points as I am sure that many users will not need to pass through any other devices aside of the VGA card.
Gigabyte Aorus X570 Pro, AMD Ryzen 3900X CPU, 2x32GB Corsair DDR4, water cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Samsung 500GB + 1TB NVMe + Samsung Evo 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

odtech
Level 2
Level 2
Posts: 98
Joined: Sat Jan 21, 2017 9:25 am

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by odtech »

powerhouse wrote:
odtech wrote:Just some more comments on hardware and software issues i encountered while finalising my hardware setup.

HDMI sound stops working for no apparant reason when Intel IOMMU is turned on. There is a workaround but it breaks PCI passthrough for GPU.
This only affect setups that uses Intel Intergrated graphics and audio via HDMI for the host.
https://bugs.launchpad.net/ubuntu/+sour ... ug/1428121

Passing through Killer network adapters causes instability.
  • 05:00.0 Ethernet controller: Qualcomm Atheros Killer E220x Gigabit Ethernet Controller (rev 13)
Regularly causes the host and guest to freeze. Only way to recover is to reboot the system
  • 04:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter (rev 20)
This causes 0x000001d4 BSOD in the Windows Guest. It's a driver issue which is temporarily fixed by downloading an updated driver but windows 10 seems to overwrite is after an update and the issue returns.
The solution was to just remove it from my VM startup script.
I've read about problems with the Intel Integrated Graphics (IGD) and IOMMU, but using the OVMF (UEFI) method was supposed to take care of that. The reason I stuck to the OVMF method were the reports about needing to patch the kernel with the i915 VGA arbiter patch together with the i915.enable_hd_vgaarb=1 option in GRUB. In the words of Alex Williamson (I believe he wrote the patch):
the i915 vga arbiter patch is necessary any time you have host Intel graphics and make use of the x-vga=on option
OK, so I take it that HDMI sound doesn't work for the Intel Integrated Graphics Device (IGD) running on the host. BUT, this might be related to your running a patched 4.4 kernel with the ACS patch. I also wonder if this bug has been addressed by a newer kernel?

About passing through network adapters: Back in the old days when I ran a Xen hypervisor I did some benchmarks. Eventually I got to a point where network speed was no issue anymore (I also optimized the SAMBA config file to improve the file transfer speed, see here). I haven't done any network speed benchmarks using KVM, something to look into.
From practical experience, the way I'm running my Windows VM now I do not see a need to pass through a network card. The bridge and the tap interface that I created seems to work well and I haven't noticed any performance issues, yet. There are some configuration and performance tuning tips on the Internet, so if you encounter performance issues with a bridged network, you may want to try them first. See also http://www.linux-kvm.org/page/10G_NIC_p ... _vs_virtio, https://www.ibm.com/support/knowledgece ... ostnet.htm, http://www.linux-kvm.org/page/Multiqueue and http://blog.vmsplice.net/2011/09/qemu-i ... cture.html.

In an earlier post you explained how you required UEFI boot to pass through your SATA controller. I hadn't commented on that since I can see some scenarios where that would make sense, if only for some improved disk performance. Besides, sharing your experiments here gives us valuable information, things I or many others wouldn't have discovered. So what I am writing below should NOT discourage you in your quests. It is simply my own perspective and/or experience:

1. Passing through a SATA controller: Passing through the SATA controller, the best performance you can hope for is "bare metal" performance. While some virtio VM configurations will give you a performance penalty, it often is so little that it won't matter in practice. As long as you don't use the default caching method "writethrough" which really cripples write performance. For an in-depth benchmark, see http://jrs-s.net/2013/05/17/kvm-io-benchmarking/. The conclusion of this benchmark is:
... a ZFS zvol with ext4, qcow2 files, and writeback caching offers you the absolute best performance.
It's not the only benchmark around. I've done my own benchmarks using Passmark, which are documented here.
Not discussed above is the iothread option (formerly x-data-plane), see https://www.reddit.com/r/VFIO/comments/ ... _settings/. See also http://www.linux-kvm.org/page/Virtio/Block/Latency, http://blog.vmsplice.net/2013/03/new-in ... irtio.html and http://www.slideshare.net/pradeepkumars ... or-threads.

There are many KVM options to tweak, let alone deciding upon the underlying partitions/file systems (raw, zfs, LVM, xfs,..) and whether or not to use qcow2 (preallocated or not?), whereas PCI passthrough seems to be straightforward. But PCI passthrough has its drawbacks. qcow2 for instance is easy to handle and to back up. I use LVM and a backup script to create a snapshot of the Windows VM, compress it and save it in a tgz file. There are a number of advantages to letting Linux handle the storage. But I'm sure you have your reasons why you chose to let Windows handle its storage media.

2. Passing through a network controller: This requires you to physically connect the NIC to an Ethernet switch or a router. Unless you got a real beast of a switch/router, the virtual bridge created with brctl and configured in the qemu startup script will most likely be faster.
I do not see Windows suitable for running network or server tasks that would require a separate NIC. However, passing NICs to a Linux guest is common practice. Possible applications are nearly endless: NAS, media streamer, firewall, demilitarized zone (DMZ), honeypots, servers of all kinds, you name it. But unless you are running your machine in an enterprise environment, I can't really see the need for NIC passthrough. I'm open to learn.

3. Passing through a USB controller: I actually use PCI passthrough to pass through 2 USB host controllers, a USB 2 and a USB 3 controller. My board has several USB controllers and I have a separate SATA/USB3 PCI card so I got plenty of USB ports. When running Windows I use a USB2 port for mouse and keyboard, a USB3 port to hook up an external HDD, another USB2 port for a dedicated photo printer, and often a USB3 card reader to read the memory cards from my cameras. Here I need speed, as these cards often hold several GByte worth of photos, and who wants to wait?

I wanted to list these points as I am sure that many users will not need to pass through any other devices aside of the VGA card.
Thanks for the suggestions. As i stated in a previous post it turns out i did not need the ACS override patch and i'm now using kernel 4.9 without issue. The HDMI audio bug i mentioned has been reported as far back as pre pre 4.0 and it is not the arbitration bug....i think...... It only relates to audio.
This is the workaround used in the grub file
  • intel_iommu=on,igfx_on
As for performance tweaking i havn't gotten around to that, i've been in the process of buying/upgrading my hardware to optimize the way i will physically interact with the VM along with linux. I want access to everything at the same time, i tried sharing a monitor between the vm and host but it's not working for me so i'm getting a dedicated 27" screen for the VM tomorrow. The VM is strictly for gaming and as it stands now all games i tried works good enough for me, the issues i do have with high end games like DOOM is i think because of my aging GPU. Other new games like Shadow Warrior 2 runs smooth as butter. I might very well go for a virtio disc if it turns out to be better but as it stands now i'm quite pleased with performance.
All the VM data is stored on a 3tb disc so it will be easy for me to mess around with different options on the dedicated SSD i have for windows.

As far as networking goes it is not needed anymore so i use the default unbridged connection. The reason i tried the killer networking devices was i couldn't initialy get the bridge to work and i'm right next to the router so i have the box connected with a lan cable. The wifi adapter is free...

I'm only passing through a sata controller, usb controller, gpu and 1 kb/mouse dongle. The input dongle would have been connected to the usb controller but i have signal issue between the back of the case and the desk where the mouse is... go figure.

powerhouse
Level 6
Level 6
Posts: 1093
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse »

odtech wrote:...Thanks for the suggestions. As i stated in a previous post it turns out i did not need the ACS override patch and i'm now using kernel 4.9 without issue. The HDMI audio bug i mentioned has been reported as far back as pre pre 4.0 and it is not the arbitration bug....i think...... It only relates to audio.
This is the workaround used in the grub file
  • intel_iommu=on,igfx_on
As for performance tweaking i havn't gotten around to that, i've been in the process of buying/upgrading my hardware to optimize the way i will physically interact with the VM along with linux. I want access to everything at the same time, i tried sharing a monitor between the vm and host but it's not working for me so i'm getting a dedicated 27" screen for the VM tomorrow. The VM is strictly for gaming and as it stands now all games i tried works good enough for me, the issues i do have with high end games like DOOM is i think because of my aging GPU. Other new games like Shadow Warrior 2 runs smooth as butter. I might very well go for a virtio disc if it turns out to be better but as it stands now i'm quite pleased with performance.
All the VM data is stored on a 3tb disc so it will be easy for me to mess around with different options on the dedicated SSD i have for windows.

As far as networking goes it is not needed anymore so i use the default unbridged connection. The reason i tried the killer networking devices was i couldn't initialy get the bridge to work and i'm right next to the router so i have the box connected with a lan cable. The wifi adapter is free...

I'm only passing through a sata controller, usb controller, gpu and 1 kb/mouse dongle. The input dongle would have been connected to the usb controller but i have signal issue between the back of the case and the desk where the mouse is... go figure.
Thanks for explaining, it makes sense. Strange that the network bridge didn't work. Are you connected to the router by wire?

Looks like everything is working fine. If so, I wouldn't bother changing things. If you pass through your SATA controller you might be able to also run Windows directly on bare metal using dual boot. But don't try if you don't need this, Windows will install all sorts of drivers to cope with the new hardware it discovers. I personally never did this and try to keep things clean without unnecessary drivers and stuff.

Enjoy your new Windows gaming VM! By the way, how does the current setup compare with your previous one?
Gigabyte Aorus X570 Pro, AMD Ryzen 3900X CPU, 2x32GB Corsair DDR4, water cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Samsung 500GB + 1TB NVMe + Samsung Evo 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

odtech
Level 2
Level 2
Posts: 98
Joined: Sat Jan 21, 2017 9:25 am

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by odtech »

powerhouse wrote:
odtech wrote:...Thanks for the suggestions. As i stated in a previous post it turns out i did not need the ACS override patch and i'm now using kernel 4.9 without issue. The HDMI audio bug i mentioned has been reported as far back as pre pre 4.0 and it is not the arbitration bug....i think...... It only relates to audio.
This is the workaround used in the grub file
  • intel_iommu=on,igfx_on
As for performance tweaking i havn't gotten around to that, i've been in the process of buying/upgrading my hardware to optimize the way i will physically interact with the VM along with linux. I want access to everything at the same time, i tried sharing a monitor between the vm and host but it's not working for me so i'm getting a dedicated 27" screen for the VM tomorrow. The VM is strictly for gaming and as it stands now all games i tried works good enough for me, the issues i do have with high end games like DOOM is i think because of my aging GPU. Other new games like Shadow Warrior 2 runs smooth as butter. I might very well go for a virtio disc if it turns out to be better but as it stands now i'm quite pleased with performance.
All the VM data is stored on a 3tb disc so it will be easy for me to mess around with different options on the dedicated SSD i have for windows.

As far as networking goes it is not needed anymore so i use the default unbridged connection. The reason i tried the killer networking devices was i couldn't initialy get the bridge to work and i'm right next to the router so i have the box connected with a lan cable. The wifi adapter is free...

I'm only passing through a sata controller, usb controller, gpu and 1 kb/mouse dongle. The input dongle would have been connected to the usb controller but i have signal issue between the back of the case and the desk where the mouse is... go figure.
Thanks for explaining, it makes sense. Strange that the network bridge didn't work. Are you connected to the router by wire?

Looks like everything is working fine. If so, I wouldn't bother changing things. If you pass through your SATA controller you might be able to also run Windows directly on bare metal using dual boot. But don't try if you don't need this, Windows will install all sorts of drivers to cope with the new hardware it discovers. I personally never did this and try to keep things clean without unnecessary drivers and stuff.

Enjoy your new Windows gaming VM! By the way, how does the current setup compare with your previous one?
My pc is wired to a switch then i have a patch cable between the switch and router.

I have booted the Windows 10 drive once by mistake, it broke the Windows 10 installation for KVM so i had to reinstall.
TBH i don't have comparison benchmarks, in Windows VM passmark crashes with a Directio64.sys bsod. I'll play around with the -cpu option at some stage to try and get it to run. It's a known bug/issure and has been reported to the passmark devs on their forum iirc. At the moment i'm doing some head scratching with "Bad image" errors in Windows, it started all of a sudden yesteday. Launching most games just causes the vm to silently ungracefully reboot or it gives a bad image error for the exe file.

Edit: My observations about performance is that it runs very well. Only DOOM has significant slowdown to the point where even the menus lag. Other games like Shadow Warrior 2 too gives me 30-90+ fps. My monitor can only 60 so it's probably capping at 60 in reality. In Batman Arkhams Origins, RE:Revelations 2 and other games i see not difference between virtual and bare metal. I bought a nice 27" monitor yesterday and i have it at right angle to my 2 displays i use for Mint so i can just pick up the controller and turn. :D

I'm eyeing a gtx 980 second hand that's less than half the price of a new one, probably going to grab it which will solve the DOOM lag and hopefully any other upcoming demanding AAA's

powerhouse
Level 6
Level 6
Posts: 1093
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse »

@odtech: Regarding Passmark, use the following:

Code: Select all

echo "options kvm ignore_msrs=1" >> /etc/modprobe.d/kvm.conf
Hope you'll be able to solve the drive issue. And congrats to your new screen.
Gigabyte Aorus X570 Pro, AMD Ryzen 3900X CPU, 2x32GB Corsair DDR4, water cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Samsung 500GB + 1TB NVMe + Samsung Evo 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

odtech
Level 2
Level 2
Posts: 98
Joined: Sat Jan 21, 2017 9:25 am

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by odtech »

powerhouse wrote:@odtech: Regarding Passmark, use the following:

Code: Select all

echo "options kvm ignore_msrs=1" >> /etc/modprobe.d/kvm.conf
Hope you'll be able to solve the drive issue. And congrats to your new screen.
Cool it's working again. I had it working at the beginning after following your guide but i must have undone that specific setting when i was troubleshooting windows stability issues.
The bad image issue isn't a drive fault luckily, it's a windows thing. None kvm users also encounter it.

powerhouse
Level 6
Level 6
Posts: 1093
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse »

odtech wrote:
powerhouse wrote:@odtech: Regarding Passmark, use the following:

Code: Select all

echo "options kvm ignore_msrs=1" >> /etc/modprobe.d/kvm.conf
Hope you'll be able to solve the drive issue. And congrats to your new screen.
Cool it's working again. I had it working at the beginning after following your guide but i must have undone that specific setting when i was troubleshooting windows stability issues.
The bad image issue isn't a drive fault luckily, it's a windows thing. None kvm users also encounter it.
Great, so the Passmark issue is solved.

I never had a bad image issue, so I can't help. But there seem to be other users affected by it and you might follow one of the solutions posted on the net.

The following may not be related to your bad image issue, but it's still worth to remember: Once you installed Windows, make sure you disable hibernation, suspend, and most importantly fast boot. The latter is enabled by default, if I'm not mistaken, and fast boot can lead to lots of trouble. Whoever came up with that crap should be sent to colonize the moon. In effect it leaves behind some Windows partitions that are unreadable by anything but Windows.
Gigabyte Aorus X570 Pro, AMD Ryzen 3900X CPU, 2x32GB Corsair DDR4, water cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Samsung 500GB + 1TB NVMe + Samsung Evo 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

GregoriMarow
Level 1
Level 1
Posts: 20
Joined: Tue Dec 06, 2016 12:31 pm

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by GregoriMarow »

ups late reaction from me, sry
Dont know if it is still actual. You wrote:
Attempt 5.2: Mint 18.1 with KVM, only IGD enabled in BIOS, q35
I started with the startup-script provided by Powerhouse and simply changed the paths to the images, iso’s and OVMF.fd. The VM booted fine from the Windows ISO and the installation of Windows went well. I was presented with an 800x600 resolution, but installing system updates (Radeon drivers included) failed and I was left with a reboot-loop.

Also manually downloading Radeon drivers and installing them resulted in a reboot-loop.
I had the same with the boot loop after installing radeon drivers.
I used pc instead of q35 and now its working.
I have a Radeon RX 480 for the VM.
Linux Mint 18.1 with Windows Gaming VM:
Intel i7 6900K with Intel TS13X, ASRock Fatal1ty X99X Killer, GeForce GT730 (Linux), 8GB Sapphire Radeon RX 480 Nitro+ OC Aktiv (VM), 32GB Corsair Vengeance LPX C DDR4-3000, CSL - 4-Port USB 3.0 PCIe (VM).

powerhouse
Level 6
Level 6
Posts: 1093
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse »

GregoriMarow wrote:ups late reaction from me, sry
Dont know if it is still actual. You wrote:
Attempt 5.2: Mint 18.1 with KVM, only IGD enabled in BIOS, q35
I started with the startup-script provided by Powerhouse and simply changed the paths to the images, iso’s and OVMF.fd. The VM booted fine from the Windows ISO and the installation of Windows went well. I was presented with an 800x600 resolution, but installing system updates (Radeon drivers included) failed and I was left with a reboot-loop.

Also manually downloading Radeon drivers and installing them resulted in a reboot-loop.
I had the same with the boot loop after installing radeon drivers.
I used pc instead of q35 and now its working.
I have a Radeon RX 480 for the VM.
Thanks, this is very helpful. I have already mentioned the pc option in my how-to, but I will provide more information based on these posts.
Gigabyte Aorus X570 Pro, AMD Ryzen 3900X CPU, 2x32GB Corsair DDR4, water cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Samsung 500GB + 1TB NVMe + Samsung Evo 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

odtech
Level 2
Level 2
Posts: 98
Joined: Sat Jan 21, 2017 9:25 am

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by odtech »

Has anyone had any success in passing through a USB hub and have it behave like a usb controller?

I want to take out my pci-e usb controller to free up some pci lanes but i can't seem to get my usb hub working at all in the vm. End goal to be able to plug a thumbdrive into the hub and have the VM access it then take it out and pug it into another usb port on the box and have the host access it.

inb4: Why not use file sharing with samba? It's not for file transfer, sometimes i need to create windows installation disks with Universal USB Creator and using DD for this i've had mixed success. To name just one example.

powerhouse
Level 6
Level 6
Posts: 1093
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse »

odtech wrote:Has anyone had any success in passing through a USB hub and have it behave like a usb controller?

I want to take out my pci-e usb controller to free up some pci lanes but i can't seem to get my usb hub working at all in the vm. End goal to be able to plug a thumbdrive into the hub and have the VM access it then take it out and pug it into another usb port on the box and have the host access it. ...
How many USB controllers does your motherboard have? If you got more than one, you could try to PCI passthrough one of the USB controllers. See my modified script at the end of the how-to.
Gigabyte Aorus X570 Pro, AMD Ryzen 3900X CPU, 2x32GB Corsair DDR4, water cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Samsung 500GB + 1TB NVMe + Samsung Evo 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

User avatar
davidem
Level 1
Level 1
Posts: 13
Joined: Sun Jan 22, 2017 4:40 am

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by davidem »

Hi, I just want to say I've installed the extra sound card ( Asus Xonar DG-X PCIe) and used step 12 of the how-to to pass it on to Windows, nothing fancy, but it works fantastically. No more cracking sound...

I also want to share the following... As I don't want to keep the qemu-monitors open all the time for all VMs I'm running (1 to 3 simultaneously), I was looking for a method to send commands to a VM. I came across the following site, describing exactly what I needed: http://www.nico.schottelius.org/blog/co ... ix-socket/

I added the following option to the startupsript:

Code: Select all

-monitor unix:/usr/local/VMs/monitors/${VMname}.monitor,server,no wait \
It creates a socket file to which signals can be sent via 'socat', like this:

Code: Select all

echo "system_powerdown" | socat - UNIX-CONNECT:/usr/local/VMs/monitors/VM.monitor 
This way the VM can be controlled from outside the guest-OS.Here's a list of frequently used signals I use ( not just for the Windows VM):
- system_powerdown ; Sends a powerdown signal and instructs the the guest-OS to shutdown nicely.
- system_reset ; Instant power-cycle a VM, this does NOT shutdown nicely
- system_wakeup ; if the VM is asleep, this wakes it up. Particularly useful in my case, as my Windows VM does not wake up from mouse- or keyboard-input.
- q ; Instant shutdown a VM, this does NOT shutdown nicely

There's a lot more, simply all options from the qemu-monitor, like disabling/enabling vnc settings, adding/removing USB devices on the fly, listing information...

Cheers,

David
Linux Mint 18.3 with Windows Gaming VM:
Intel i7 6700, MSI Z170a SLI Plus, 16 GB DDR4 2133MHz, 256 GB Intel 600P PCIe M.2 SSD, 512 GB Samsung 850 EVO SSD, Radeon RX 470 Gaming x 4G (VM), Asus Xonar DG-X 5.1 (VM)

driz
Level 1
Level 1
Posts: 24
Joined: Mon May 12, 2014 3:38 pm

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by driz »

odtech wrote:Has anyone had any success in passing through a USB hub and have it behave like a usb controller?

I want to take out my pci-e usb controller to free up some pci lanes but i can't seem to get my usb hub working at all in the vm. End goal to be able to plug a thumbdrive into the hub and have the VM access it then take it out and pug it into another usb port on the box and have the host access it.

inb4: Why not use file sharing with samba? It's not for file transfer, sometimes i need to create windows installation disks with Universal USB Creator and using DD for this i've had mixed success. To name just one example.
I guess to start, a usb hub isn't a controller, I doubt you will force it to become one. That being said, there is no need to pass through the hub, you just pass through the items on the hub. The hub is still controlled by a physical controller. that being said, don't pass through the ID of the usb thumb drive, pass through the hub and bus. when you change the port, it'll be on the host. the only downside is that when reattaching it to the vm, the host/bus will have changed. It's the PITA but hub != controller
davidem wrote:Hi, I just want to say I've installed the extra sound card ( Asus Xonar DG-X PCIe) and used step 12 of the how-to to pass it on to Windows, nothing fancy, but it works fantastically. No more cracking sound...

I also want to share the following... As I don't want to keep the qemu-monitors open all the time for all VMs I'm running (1 to 3 simultaneously), I was looking for a method to send commands to a VM. I came across the following site, describing exactly what I needed: http://www.nico.schottelius.org/blog/co ... ix-socket/

I added the following option to the startupsript:

Code: Select all

-monitor unix:/usr/local/VMs/monitors/${VMname}.monitor,server,no wait \
It creates a socket file to which signals can be sent via 'socat', like this:

Code: Select all

echo "system_powerdown" | socat - UNIX-CONNECT:/usr/local/VMs/monitors/VM.monitor 
This way the VM can be controlled from outside the guest-OS.Here's a list of frequently used signals I use ( not just for the Windows VM):
- system_powerdown ; Sends a powerdown signal and instructs the the guest-OS to shutdown nicely.
- system_reset ; Instant power-cycle a VM, this does NOT shutdown nicely
- system_wakeup ; if the VM is asleep, this wakes it up. Particularly useful in my case, as my Windows VM does not wake up from mouse- or keyboard-input.
- q ; Instant shutdown a VM, this does NOT shutdown nicely

There's a lot more, simply all options from the qemu-monitor, like disabling/enabling vnc settings, adding/removing USB devices on the fly, listing information...

Cheers,

David
I had the same issue you ran into and didn't want qemu sessions left running. Of course my kvm box is headless now, so it didn't matter. What I ended up doing is similar, but I run qemu instances within screen named sessions. It effectively provides the same capability you're leveraging with socat. I created a powershell and batch script on my work pc (and bash scripts on my home pc) to control the qemu sessions based on the screen session-name. This let's me "insert" cds for my girls, turn their PCs on, or even shut them down.

powerhouse
Level 6
Level 6
Posts: 1093
Joined: Thu May 03, 2012 3:54 am
Location: Israel
Contact:

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by powerhouse »

davidem wrote:...I also want to share the following... As I don't want to keep the qemu-monitors open all the time for all VMs I'm running (1 to 3 simultaneously), I was looking for a method to send commands to a VM. I came across the following site, describing exactly what I needed: http://www.nico.schottelius.org/blog/co ... ix-socket/

I added the following option to the startupsript:

Code: Select all

-monitor unix:/usr/local/VMs/monitors/${VMname}.monitor,server,no wait \
It creates a socket file to which signals can be sent via 'socat', like this:

Code: Select all

echo "system_powerdown" | socat - UNIX-CONNECT:/usr/local/VMs/monitors/VM.monitor 
This way the VM can be controlled from outside the guest-OS.Here's a list of frequently used signals I use ( not just for the Windows VM):
- system_powerdown ; Sends a powerdown signal and instructs the the guest-OS to shutdown nicely.
- system_reset ; Instant power-cycle a VM, this does NOT shutdown nicely
- system_wakeup ; if the VM is asleep, this wakes it up. Particularly useful in my case, as my Windows VM does not wake up from mouse- or keyboard-input.
- q ; Instant shutdown a VM, this does NOT shutdown nicely

There's a lot more, simply all options from the qemu-monitor, like disabling/enabling vnc settings, adding/removing USB devices on the fly, listing information...

Cheers,

David
Thanks David, that is very useful. I had added the -monitor option to my own script, but haven't done much with it. I guess I will play with that and reference your post in the how-to.

On another subject: When editing the how-to, I ran into the 60,000 character limit. It turns out that posts are limited to ~60,000 characters, which I didn't consider when I wrote the how-to all in one post. The good thing is that this keeps me from expanding more, it's long enough as it is.
Gigabyte Aorus X570 Pro, AMD Ryzen 3900X CPU, 2x32GB Corsair DDR4, water cooler, GTX 970 + Quadro 2000 GPU, Asus Xonar Essence STX, Samsung 500GB + 1TB NVMe + Samsung Evo 1TB SSD + 4 HDD, Corsair 500R, SeaSonic 660W Gold X PS https://heiko-sieger.info

driz
Level 1
Level 1
Posts: 24
Joined: Mon May 12, 2014 3:38 pm

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by driz »

put it in PDF and submit to tldp :D

i didnt actually check if tldp still exists, but i used to use the hell out of it in the 90s.

User avatar
davidem
Level 1
Level 1
Posts: 13
Joined: Sun Jan 22, 2017 4:40 am

Re: HOW-TO make dual-boot obsolete using kvm VGA passthrough

Post by davidem »

powerhouse wrote: Thanks David, that is very useful. I had added the -monitor option to my own script, but haven't done much with it. I guess I will play with that and reference your post in the how-to.
Thanks. I've also scripted my setup it to make my life a bit easier, including these reset/powerdown/wake-up calls. I'll post it when I've ironed out the bugs :)
powerhouse wrote: On another subject: When editing the how-to, I ran into the 60,000 character limit. It turns out that posts are limited to ~60,000 characters, which I didn't consider when I wrote the how-to all in one post. The good thing is that this keeps me from expanding more, it's long enough as it is.
Perhaps you can hijack your second post (both first and second are yours) and offload some stuff to it, like troubleshooting, references and the changelog? That gives you some room to adjust the howto if needed.
Linux Mint 18.3 with Windows Gaming VM:
Intel i7 6700, MSI Z170a SLI Plus, 16 GB DDR4 2133MHz, 256 GB Intel 600P PCIe M.2 SSD, 512 GB Samsung 850 EVO SSD, Radeon RX 470 Gaming x 4G (VM), Asus Xonar DG-X 5.1 (VM)

Post Reply

Return to “Virtualization”