On Fri, Apr 26, 2019 at 10:11:54AM +0200, CREGUT Pierre IMT/OLN wrote:
I also initially thought that kobject_uevent generated the netlink eventI don't know anything about netlink. The script from the bugzilla
but this is not the case. This is generated by the specific driver in use.
For the Intel i40e driver, this is the call to i40e_do_reset_safe in
i40e_pci_sriov_configure that sends the event.
It is followed by i40e_pci_sriov_enable that calls i40e_alloc_vfs that
finally calls the generic pci_enable_sriov function.
(https://bugzilla.kernel.org/show_bug.cgi?id=202991) looks like it
runs
ip monitor dev enp9s0f2
What are the actual netlink events you see? Are they related to a
device being removed?
When we change num_VFs, I think we have to disable any existing VFsYes but we are speaking of the event sent when num_vfs is changed from 0 to N
before enabling the new num_VFs, so if you trigger on a netlink
"remove" event, I wouldn't be surprised that reading sriov_numvfs
would give a zero until the new VFs are enabled.
[...]The use of device_lock was the cheapest solution. It is true that lock and trylock are
I thought this was a good idea, but
- It does break the device_lock() encapsulation a little bit:
sriov_numvfs_store() uses device_lock(), which happens to be
implemented as "mutex_lock(&dev->mutex)", but we really shouldn't
rely on that implementation, and
- The netlink events are being generated via the NIC driver, and I'm
a little hesitant about changing the PCI core to deal with timing
issues "over there".