The following two patches to pci-hyperv were submitted upstream but missed getting pulled into Bjorn's tree. They are needed to fix an issue discovered working on SR-IOV on Azure.
Patch 1: hv_pci_devices_present is called in hv_pci_remove when we remove a PCI device from host (e.g. by disabling SRIOV on a device). In hv_pci_remove, the bus is already removed before the call, so we don't need to rescan the bus in the workqueue scheduled from hv_pci_devices_present. By introducing status hv_pcibus_removed, we can avoid this situation.
Patch 2: A PCI_EJECT message can arrive at the same time we are calling pci_scan_child_bus in the workqueue for the previous PCI_BUS_RELATIONS message or in create_root_hv_pci_bus(), in this case we could potentailly modify the bus from multiple places. Properly lock the bus access.
I built a Xenial test kernel with the two patches. The test kernel can be downloaded from:
http:// kernel. ubuntu. com/~jsalisbury /lp1665097/ xenial/
Can you test this kernel and see if it resolves this bug?