RE: [PATCH v3 3/6] PCI: hv: serialize the present/eject work items
From: Michael Kelley (EOSG)
Date: Tue Mar 06 2018 - 13:30:44 EST
> -----Original Message-----
> From: Dexuan Cui
> Sent: Tuesday, March 6, 2018 10:22 AM
> To: bhelgaas@xxxxxxxxxx; linux-pci@xxxxxxxxxxxxxxx; KY Srinivasan <kys@xxxxxxxxxxxxx>;
> Stephen Hemminger <sthemmin@xxxxxxxxxxxxx>; olaf@xxxxxxxxx; apw@xxxxxxxxxxxxx;
> jasowang@xxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx; driverdev-devel@xxxxxxxxxxxxxxxxxxxxxx; Haiyang Zhang
> <haiyangz@xxxxxxxxxxxxx>; vkuznets@xxxxxxxxxx; marcelo.cerri@xxxxxxxxxxxxx; Michael
> Kelley (EOSG) <Michael.H.Kelley@xxxxxxxxxxxxx>; Dexuan Cui <decui@xxxxxxxxxxxxx>; Jack
> Morgenstein <jackm@xxxxxxxxxxxx>; stable@xxxxxxxxxxxxxxx
> 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@xxxxxxxxxxxxx>
> Tested-by: Adrian Suhov <v-adsuho@xxxxxxxxxxxxx>
> Tested-by: Chris Valean <v-chvale@xxxxxxxxxxxxx>
> Cc: Vitaly Kuznetsov <vkuznets@xxxxxxxxxx>
> Cc: Jack Morgenstein <jackm@xxxxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
> Cc: Stephen Hemminger <sthemmin@xxxxxxxxxxxxx>
> Cc: K. Y. Srinivasan <kys@xxxxxxxxxxxxx>
> ---
> drivers/pci/host/pci-hyperv.c | 17 ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
Reviewed-by: Michael Kelley <mikelley@xxxxxxxxxxxxx>