Commit 021ad27
PCI: hv: Serialize the present and 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.
Since access to present/eject work items is serialized, we do not need the
hbus->enum_sem anymore, so remove it.
Fixes: 4daace0 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs")
Link: https://lkml.kernel.org/r/KL1P15301MB00064DA6B4D221123B5241CFBFD70@KL1P15301MB0006.APCP153.PROD.OUTLOOK.COM
Tested-by: Adrian Suhov <v-adsuho@microsoft.com>
Tested-by: Chris Valean <v-chvale@microsoft.com>
Signed-off-by: Dexuan Cui <decui@microsoft.com>
[lorenzo.pieralisi@arm.com: squashed semaphore removal patch]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Acked-by: Haiyang Zhang <haiyangz@microsoft.com>
Cc: <stable@vger.kernel.org> # v4.6+
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Jack Morgenstein <jackm@mellanox.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>1 parent 7928b2c commit 021ad27
1 file changed
+16
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
450 | | - | |
451 | 450 | | |
452 | 451 | | |
453 | 452 | | |
| |||
461 | 460 | | |
462 | 461 | | |
463 | 462 | | |
| 463 | + | |
| 464 | + | |
464 | 465 | | |
465 | 466 | | |
466 | 467 | | |
| |||
1590 | 1591 | | |
1591 | 1592 | | |
1592 | 1593 | | |
1593 | | - | |
1594 | | - | |
1595 | | - | |
1596 | | - | |
1597 | | - | |
1598 | | - | |
| 1594 | + | |
| 1595 | + | |
1599 | 1596 | | |
1600 | 1597 | | |
1601 | 1598 | | |
| |||
1616 | 1613 | | |
1617 | 1614 | | |
1618 | 1615 | | |
1619 | | - | |
1620 | | - | |
1621 | | - | |
1622 | | - | |
1623 | | - | |
1624 | 1616 | | |
1625 | 1617 | | |
1626 | 1618 | | |
| |||
1637 | 1629 | | |
1638 | 1630 | | |
1639 | 1631 | | |
1640 | | - | |
1641 | 1632 | | |
1642 | 1633 | | |
1643 | 1634 | | |
| |||
1724 | 1715 | | |
1725 | 1716 | | |
1726 | 1717 | | |
1727 | | - | |
1728 | 1718 | | |
1729 | 1719 | | |
1730 | 1720 | | |
| |||
1770 | 1760 | | |
1771 | 1761 | | |
1772 | 1762 | | |
1773 | | - | |
| 1763 | + | |
1774 | 1764 | | |
1775 | 1765 | | |
1776 | 1766 | | |
| |||
1848 | 1838 | | |
1849 | 1839 | | |
1850 | 1840 | | |
1851 | | - | |
| 1841 | + | |
1852 | 1842 | | |
1853 | 1843 | | |
1854 | 1844 | | |
| |||
2461 | 2451 | | |
2462 | 2452 | | |
2463 | 2453 | | |
2464 | | - | |
2465 | 2454 | | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
2466 | 2461 | | |
2467 | 2462 | | |
2468 | 2463 | | |
2469 | 2464 | | |
2470 | | - | |
| 2465 | + | |
2471 | 2466 | | |
2472 | 2467 | | |
2473 | 2468 | | |
| |||
2536 | 2531 | | |
2537 | 2532 | | |
2538 | 2533 | | |
| 2534 | + | |
| 2535 | + | |
2539 | 2536 | | |
2540 | 2537 | | |
2541 | 2538 | | |
| |||
2615 | 2612 | | |
2616 | 2613 | | |
2617 | 2614 | | |
| 2615 | + | |
2618 | 2616 | | |
2619 | 2617 | | |
2620 | 2618 | | |
| |||
0 commit comments