On Fri, 2016-03-18 at 12:23 +0100, Gerd Hoffmann wrote:
> For ad-hoc usage such as with desktop virt, then I think users
would
> typically want to use have PCI devices re-assigned to host at shutdown
> for the most part.
Unfortunately that tends to not work very well for some kinds of
devices.
I have an explicit "managed=no" in my configs, otherwise I risk the igd
(intel gfx) hangs the system when assigning it back to the host.
> If apps change to use managed=detach then they will only work with
> new libvirt, where as if they change to use the virNodeDeviceDetach()
> API they'll work with all historic version of libvirt that support PCI
> assignment.
My "app" is "virsh edit" ;)
So, I have to do an explicit "virsh nodedev-detach" before I can start
the guest. Yes, it's annonying. But guest failing to start is better
than host crashing on guest shutdown in case I forget to do it. And,
no, I don't want do that in the boot scripts somewhere because I might
want to use the igd on the host.
"managed=detach" would be a very nice solution to that problem.
So what do you do after shutting down the guest? Your host
ends up having no usable GPU, so you have to access it using
some other mean (eg. ssh) and reboot it, right?
My point is that if your devices are dedicated to guest
assignment, you're better off if they're never bound to the
host driver to begin with - if the facilities one can use to
ensure that is the case are not flexible or user-friendly
enough, we should improve them.
If you're instead working mostly on bare metal (eg. your
laptop) and you want to, every once in a while, assign your
card reader or some other secondary peripheral to a guest,
then manged='yes' should be what you're looking for.
But, in that case, doing something like assigning your
primary and only GPU to a guest is a behaviour that falls
entirely into the "hacks" category, and libvirt should not
grow code dedicated to support it.
Setting the device to managed='no' and detaching it from the
host manually, in this case, is the equivalent of
saying "I really know what I'm doing" :)
Cheers.
--
Andrea Bolognani
Software Engineer - Virtualization Team