[vfio-users] Small patch for those that have nVidia cards and want to easily use LibVirt.

Alex Williamson alex.l.williamson at gmail.com
Sat Mar 19 15:15:03 UTC 2016


On Fri, Mar 18, 2016 at 4:49 PM, Jukka Helinko <j at logicerror.net> wrote:

> On 17.03.2016 19:48, Alex Williamson wrote:
> > <qemu:arg> is inherently evil.  You end up specifying two -cpu
> > args, the one libvirt generates and the one you specific in the
> > qemucommand (which is opaque to libvirt) and you hope that qemu
> > selects the one you want.  Using virt-manager to fiddle with cpu
> > options might become meaningless, we don't know whether qemu merges
> > all cpu options together or only takes the last (we could look, but
> > it's probably unexpected and therefore undefined and could change
> > at any release).
> >
>
> I was actually wondering this myself yesterday. How multiple -cpus
> would be interpreted (didn't go as far as to look at the code).
>
> Main goal was to convince nvidia drivers to not code 43, with hv_*
> options. Ended up adding few sed lines to the emulator startup script
> and removing the qemu args from xml.
>
> "
> #!/bin/sh
> exec /usr/bin/qemu-system-x86_64 \
>  `echo "\$@" | \
>  sed 's/Haswell-noTSX/host,kvm=off/g' | \
>

Both of these can be set directly in libvirt XML, no need to apply them
like this.

  <features>
    <kvm>
      <hidden state='on'/>
    </kvm>
    ...

  <cpu mode='host-passthrough'>


>  sed 's/05:00.0/05:00.0,x-vga=on/g' | \
>  sed 's/hv_time/hv_time,hv_vendor_id=KeenlyKVM/g
> "
>
> At first it was just 's/Haswell-noTSX/Haswell-noTSX,kvm=off/g' | \..,
> but apparently Starcraft 2 didn't like that at all. So had to change
> it to host to stop it from restarting the VM (probably bluescreen).
>
> Should the nvidia not code 43 just with hv_vendor_id or do I still
> need the kvm=off? Because if I remove the kvm=off option, I'll get the
> code 43. Is there something else I should change in the xml config?
>

Remember, history went:

NVIDIA detects kvm, therefore hide kvm
NVIDIA detects hyper-v, therefore hide hyper-v

hv_vendor_id works around NVIDIA's hyper-v detection, hiding kvm is still
required.


> End result is that, there's only one -cpu argument passed to qemu, but
> I'm not not sure if 'host' makes sense with all the other cpu options.
> At least with these options nvidia doesn't code 43 with my setup, and
> Windows sees that it is running in a virtual machine (and hopefully
> behaves accordingly). Whether this makes any difference in performance
> is at the moment a mystery.
>
>
> /J
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/vfio-users/attachments/20160319/0cc674c4/attachment.htm>


More information about the vfio-users mailing list