Announcement

Collapse
No announcement yet.

QEMU: Support For Passing GPUs To Virtual Machines

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • QEMU: Support For Passing GPUs To Virtual Machines

    Phoronix: QEMU: Support For Passing GPUs To Virtual Machines

    There's ongoing work so that graphics cards can be assigned for use by virtual machines with QEMU...

    http://www.phoronix.com/vr.php?view=MTI2OTk

  • #2
    Wow.... these are such exotic argurments!! I love such things. Pass GPU directly to the VM is surely the final move to use Linux and run a windows vm for gaming!!
    I'm just dreaming, but it really seems someone is actually "working" on it! Thanks

    Comment


    • #3
      To be honest, since Xen is able to do it for some time now and I have heard of nobody really using it, I have little hope this getting usable soon. Or is Xen that much more difficult to use then kvm?

      Comment


      • #4
        Well, first you do need an IOMMU, that means support for vt-d or amd-vi in the CPU and in the mainboard.

        Would it be possible for an ugly hack in the kernel to emulate an IOMMU? I mean it has direct PCI access, doesn't it? How much performance would it cost?

        Comment


        • #5
          Originally posted by Mathias View Post
          To be honest, since Xen is able to do it for some time now and I have heard of nobody really using it, I have little hope this getting usable soon. Or is Xen that much more difficult to use then kvm?
          have you looked up how to set up xen? It's not easy. Have you looked up how to do GPU passthrough? That's also a challenge. People don't do it because its such a pain to work on. I've looked into it myself since it would also allow multiplayer gaming on 1 PC but the effort wasn't worth it.

          VMware and Parallels also offers a gpu passthrough solution but you have to pay for them and IIRC they're somewhat limiting.

          Comment


          • #6
            You've been able to do gpu pass through for awhile now on KVM/qemu. Yes, you need iommu support for it to work.
            There's at least one YouTube video of it (the guy plays Lost Planet).
            Search for fedora kvm gpu passthrough

            Comment


            • #7
              Great

              This is great because graphics rendering under QEMU is really slow!

              Also if you do Android development it uses QEMU to run the Android virtual machine image, and the graphics is shit slow.

              Comment


              • #8
                Nice to have that, but don't you have a remote session to the VM in qemu? How does it help to have a dedicated GPU then?
                I use e.g. spice to connect to a vm on my system, loopback would be fast enough but still it would downscale any graphic effects.

                Comment


                • #9
                  So would this mean that I can then install an nVidia driver in my Windows guest in order to use my nVidia GPU as if it was running natively? If so it would be great to do that especially for games and for any Windows based graphics programs that make extensive use of GPU's

                  Comment


                  • #10
                    Xen with PCI/VGA passthrough isn't that hard to setup you just need proper hardware e.g VT-d (Intel) and IOMMU (AMD) support from your motherboard and CPU.

                    In terms of dedicated GPU passing AMD Radeons is quite easy but the same can't be said about Nvidia cards except Quadro series.

                    Personally I've passed i7's HD4000 integrated GPU, AMD HD5450 and AMD HD7850 to Windows 8 and Linux guests. Funny enough Linux guests are a bit trickier to setup.

                    For example here's how to pass i7's HD4000 to a Windows 8 HVM guest: http://linux-bsd-sharing.blogspot.pt...domu-with.html

                    Just browse Xen-user mailing list for more info.

                    Comment


                    • #11
                      Originally posted by bulletxt View Post
                      Wow.... these are such exotic argurments!! I love such things. Pass GPU directly to the VM is surely the final move to use Linux and run a windows vm for gaming!!
                      I'm just dreaming, but it really seems someone is actually "working" on it! Thanks
                      I'm using Xen for some time now with VGA passthrough to a Windows 7 VM. It works incredibly well!

                      Yes, it has been a pain to set up, mainly because of my stubborness to use unconfirmed hardware (a Nvidia Quadro 600 for the Windows guest system didn't work, my Quadro 2000 now works perfect) and because of making it work on a distro that hasn't yet seen a how-to on that.

                      The most important step before embarking on it is to check that the hardware meets the requirements. If it does, it's quite simple.

                      Here some links to start with:
                      http://www.overclock.net/t/1205216/g...irtual-machine - good tutorial with a long thread and a wealth of information.

                      http://forums.linuxmint.com/viewtopic.php?f=42&t=112013 - can't judge my own tutorial, but I hope it helps. It should work likewise (or very similar) under Ubuntu. There is some more info in posts following the tutorial, to tweak stuff.

                      Comment


                      • #12
                        Originally posted by Mathias View Post
                        To be honest, since Xen is able to do it for some time now and I have heard of nobody really using it, I have little hope this getting usable soon. Or is Xen that much more difficult to use then kvm?
                        I totally disagree with Xen being more difficult than kvm. It's perhaps not the easiest of hypervisors, but at least it offers a wealth of documentation. KVM on the other hand is a disaster! Perhaps the hype about KVM is because it's the new kid on the block?

                        When I started out on my quest for VGA passthrough I was set on KVM and almost dismissed Xen. One reason for dismissing Xen was the wealth of documentation which at that time I misinterpreted for Xen being complex. Yes, Xen offers multiple options and tools to reach the same goal (see below), but the fact that there is a lot of documentation is a real asset. The other reason for almost dismissing it was some reports here on Phoronix about poor performance. Boy, am I glad I dug a little deeper into that. It turned out there was some bug (which is long fixed now), but for most of these tests here I don't really see a point other than proofing that KVM is getting closer to Xen in some areas. As to real-life performance: you need to see it to believe it.

                        Some of the tests here are a bit questionable, for example comparing KVM and Xen with Linux HVM guests. The only reason I use Linux HVM guests from time to time is to check out a distro, but I don't expect performance miracles. Most times a Linux PV guest will perform better since it has access to the hardware drivers of the hypervisor and doesn't need an emulation layer. Linux HVM guest performance can be improved by using PVHVM drivers and I believe (or hope) they have been used by Phoronix. With Xen offering several options, it's really necessary to be precise about a test setup. Newcomers would certainly be helped with an explanation of why one option was chosen over another.

                        Recently Xen developers have rolled out a lot of improvements with kernel 3.x and Xen 4.x. Now that Xen 4.2 stable is out (but not yet included in the major distros) things should become even easier, with better support for more hardware. Xen 4.2 also does away with a lot of accumulated code and layers that are not really helping it. The new xl toolstack replaces xm and xend (among others), and is more efficient.

                        It is true there are probably not many KVM users who have accomplished VGA passthrough, though it's been done. But there are quite many people already doing Xen VGA passthrough.

                        From a practical perspective, I am using Xen and Windows with VGA/PCI passthrough for semi-professional photography work. When I compare my Xen system with native Windows 7 installs on similar hardware owned by friends, I find even less reasons to look back. If you have the right hardware, I would go for it any second.

                        Comment


                        • #13
                          Originally posted by DeepDayze View Post
                          So would this mean that I can then install an nVidia driver in my Windows guest in order to use my nVidia GPU as if it was running natively? If so it would be great to do that especially for games and for any Windows based graphics programs that make extensive use of GPU's
                          nVidia can be tricky or outright impossible to pass through. I am using a nVidia Quadro 2000 for pass through and it works perfect, BUT this card along with some more expensive ones are the only nVidia cards that officially support what they call "multi-OS" which is exactly what's needed for it to work.

                          It has been reported that some other (non-professional) nVidia cards can actually be passed through, so it's best to search. Look here http://wiki.xen.org/wiki/Xen_VGA_Pas...ested_Adapters and here http://www.overclock.net/t/1307834/x...phics-adapters for a start.

                          If your nVidia card is not listed, but you are adventurous, you might find a solution here: http://www.davidgis.fr/blog/index.ph...a-pass-through. Note that some of the patches listed there should already be available in the 4.2 stable hypervisor.

                          For instructions on how to get VGA passthrough working, see my post #11 above.

                          Comment

                          Working...
                          X