[libvirt] [PATCH] pci: autolearn name of stub driver, remove from arglist

Eric Blake eblake at redhat.com
Thu May 2 03:19:38 UTC 2013


On 05/01/2013 12:54 PM, Laine Stump wrote:
> virPCIDeviceReattach and virPCIDeviceUnbindFromStub (called by
> virPCIDeviceReattach) had previously required the name of the stub
> driver as input. This is unnecessary, because the name of the driver
> the device is currently bound to can be found by looking at the link:
> 
>   /sys/bus/pci/dddd:bb:ss.ff/driver
> 
> Instead of requiring that the name of the expected stub driver name
> and only unbinding if that one name is matched, we no longer take a
> driver name in the arglist for either of these
> functions. virPCIDeviceUnbindFromStub just compares the name of the
> currently bound driver to a list of "well known" stubs (right now
> contains "pci-stub" and "vfio-pci" for qemu, and "pciback" for xen),
> and only performs the unbind if it's one of those devices.
> 
> This allows virsh nodedevice-reattach to work properly across a
> libvirtd restart, and fixes a couple of cases where we were
> erroneously still hard-coding "pci-stub" as the drive name.

Which makes this a bug fix, worth having in 1.0.5 if you see this in time.

> 
> For some unknown reason, virPCIDeviceReattach had been calling
> modprobe on the stub driver prior to unbinding the device. This was
> problematic because we no longer know the name of the stub driver in
> that function. However, it is pointless to probe for the stub driver
> at that time anyway - because the device is bound to the stub driver,
> we are guaranteed that it is already loaded, and so that call to
> modprobe has been removed.
> ---
>  src/qemu/qemu_driver.c  |  2 +-
>  src/qemu/qemu_hostdev.c |  4 +--
>  src/util/virpci.c       | 66 ++++++++++++++++++++++++++++++++++---------------
>  src/util/virpci.h       |  3 +--
>  src/xen/xen_driver.c    |  2 +-
>  5 files changed, 51 insertions(+), 26 deletions(-)

ACK with your squashed in memleak fix.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130501/aeeb2387/attachment-0001.sig>


More information about the libvir-list mailing list