How to detect if a PCI device is in use?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, all

As the $subject says, currently we don't check whether the
PCI device is in use or not by guest when reattaching it
to host, it causes problems, should we prevent reattaching
if the device is in use? if yes, how to detect whether the
device is in use or not?

The easiest way in my mind is to check if the device is bound
to some driver by check if symbol link "driver"
(e.g. /sys/bus/pci/devices/0000\:00\:1f.2/) exists, but it's
not reasonable, as even if the device is bound to some driver,
it probly is not in use by guest, e.g.

  1) attach PCI device to guest (non-managed)
  2) destroy the guest without detaching the device first
  3) reattach the PCI device to host

It will be success, and should be success, as it's not used
by any stuff, though it's bound to driver ("pci-stub" for qemu,
"pciback" for xen).

And it seems we can't do any futher lookup to see if the device
is in use or not via sysfs.

Any idea?

Thanks
Osier

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]