-----Original Message----- From: Dexuan Cui Sent: Tuesday, March 6, 2018 1:22 PM To: bhelgaas@google.com; linux-pci@vger.kernel.org; KY Srinivasan kys@microsoft.com; Stephen Hemminger sthemmin@microsoft.com; olaf@aepfle.de; apw@canonical.com; jasowang@redhat.com Cc: linux-kernel@vger.kernel.org; driverdev-devel@linuxdriverproject.org; Haiyang Zhang haiyangz@microsoft.com; vkuznets@redhat.com; marcelo.cerri@canonical.com; Michael Kelley (EOSG) Michael.H.Kelley@microsoft.com; Dexuan Cui decui@microsoft.com; Jack Morgenstein jackm@mellanox.com; stable@vger.kernel.org Subject: [PATCH v3 3/6] PCI: hv: serialize the present/eject work items
When we hot-remove the device, we first receive a PCI_EJECT message and then receive a PCI_BUS_RELATIONS message with bus_rel->device_count == 0.
The first message is offloaded to hv_eject_device_work(), and the second is offloaded to pci_devices_present_work(). Both the paths can be running list_del(&hpdev->list_entry), causing general protection fault, because system_wq can run them concurrently.
The patch eliminates the race condition.
Signed-off-by: Dexuan Cui decui@microsoft.com Tested-by: Adrian Suhov v-adsuho@microsoft.com Tested-by: Chris Valean v-chvale@microsoft.com Cc: Vitaly Kuznetsov vkuznets@redhat.com Cc: Jack Morgenstein jackm@mellanox.com Cc: stable@vger.kernel.org Cc: Stephen Hemminger sthemmin@microsoft.com Cc: K. Y. Srinivasan kys@microsoft.com
Acked-by: Haiyang Zhang haiyangz@microsoft.com