linux-stable/drivers/pci
Vitaly Kuznetsov bdd74440d9 PCI: hv: Add explicit barriers to config space access
I'm trying to pass-through Broadcom BCM5720 NIC (Dell device 1f5b) on a
Dell R720 server.  Everything works fine when the target VM has only one
CPU, but SMP guests reboot when the NIC driver accesses PCI config space
with hv_pcifront_read_config()/hv_pcifront_write_config().  The reboot
appears to be induced by the hypervisor and no crash is observed.  Windows
event logs are not helpful at all ('Virtual machine ... has quit
unexpectedly').  The particular access point is always different and
putting debug between them (printk/mdelay/...) moves the issue further
away.  The server model affects the issue as well: on Dell R420 I'm able to
pass-through BCM5720 NIC to SMP guests without issues.

While I'm obviously failing to reveal the essence of the issue I was able
to come up with a (possible) solution: if explicit barriers are added to
hv_pcifront_read_config()/hv_pcifront_write_config() the issue goes away.
The essential minimum is rmb() at the end on _hv_pcifront_read_config() and
wmb() at the end of _hv_pcifront_write_config() but I'm not confident it
will be sufficient for all hardware.  I suggest the following barriers:

1) wmb()/mb() between choosing the function and writing to its space.
2) mb() before releasing the spinlock in both _hv_pcifront_read_config()/
   _hv_pcifront_write_config() to ensure that consecutive reads/writes to
  the space won't get re-ordered as drivers may count on that.

Config space access is not supposed to be performance-critical so these
explicit barriers should not cause any slowdown.

[bhelgaas: use Linux "barriers" terminology]
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Jake Oshins <jakeo@microsoft.com>
2016-05-04 17:03:41 -05:00
..
host PCI: hv: Add explicit barriers to config space access 2016-05-04 17:03:41 -05:00
hotplug s390/pci: remove pdev pointer from arch data 2016-02-23 08:56:16 +01:00
pcie PCI changes for the v4.6 merge window: 2016-03-16 14:45:55 -07:00
access.c PCI: Sleep rather than busy-wait for VPD access completion 2016-03-10 14:24:48 -06:00
ats.c
bus.c powerpc updates for 4.6 2016-03-19 15:38:41 -07:00
host-bridge.c
hotplug-pci.c
htirq.c
iov.c powerpc updates for 4.6 2016-03-19 15:38:41 -07:00
irq.c
Kconfig PCI: Restore inclusion of pci/hotplug Kconfig 2016-03-21 07:33:34 -05:00
Makefile ARC: Add PCI support 2016-03-10 14:44:13 -06:00
msi.c PCI changes for the v4.5 merge window: 2016-01-21 11:52:16 -08:00
of.c PCI/MSI: Use of_msi_get_domain instead of open-coded "msi-parent" parsing 2015-10-16 13:07:14 +01:00
pci-acpi.c Power management and ACPI updates for v4.5-rc1 2016-01-12 20:25:09 -08:00
pci-driver.c PCI / PM: Tune down retryable runtime suspend error messages 2015-12-02 15:24:21 +01:00
pci-label.c PCI: Fix broken URL for Dell biosdevname 2016-02-29 12:03:19 -06:00
pci-stub.c
pci-sysfs.c Merge branch 'pci/resource' into next 2016-03-15 08:56:28 -05:00
pci.c PCI changes for the v4.6 merge window: 2016-03-16 14:45:55 -07:00
pci.h PCI: Fold struct pci_vpd_pci22 into struct pci_vpd 2016-02-29 17:47:36 -06:00
probe.c Merge branch 'pci/resource' into next 2016-03-15 08:56:28 -05:00
proc.c
quirks.c Merge branches 'pci/aer', 'pci/enumeration', 'pci/kconfig', 'pci/misc', 'pci/virtualization' and 'pci/vpd' into next 2016-03-15 08:55:02 -05:00
remove.c Merge branch 'pci/resource' into next 2016-03-15 08:56:28 -05:00
rom.c PCI: Remove unused IORESOURCE_ROM_COPY and IORESOURCE_ROM_BIOS_COPY 2016-03-12 06:00:29 -06:00
search.c
setup-bus.c PCI: Remove includes of empty asm-generic/pci-bridge.h 2016-02-05 16:28:36 -06:00
setup-irq.c
setup-res.c PCI: Don't assign or reassign immutable resources 2016-03-08 12:14:31 -06:00
slot.c
syscall.c
vc.c
vpd.c
xen-pcifront.c xen/pcifront: Fix mysterious crashes when NUMA locality information was extracted. 2016-02-15 14:34:57 +00:00