Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Thumshirn <jthumshirn@suse.de>2018-01-12 16:12:14 +0100
committerJohannes Thumshirn <jthumshirn@suse.de>2018-01-12 16:23:59 +0100
commitaa6f28e2859c9945b3651d4fa2107389d11dce63 (patch)
treea44cdbc95830b11ba9da8e88461b978534486e5c
parentadd9b931414c646634f384ae71a6409ba639d000 (diff)
s390/pci: handle insufficient resources during dma tlb flush
(bnc#1072915, LTC#163393).
-rw-r--r--patches.arch/s390-sles15-02-06-pci-handle-insufficient-resources-during-dma-tl.patch85
-rw-r--r--series.conf1
2 files changed, 86 insertions, 0 deletions
diff --git a/patches.arch/s390-sles15-02-06-pci-handle-insufficient-resources-during-dma-tl.patch b/patches.arch/s390-sles15-02-06-pci-handle-insufficient-resources-during-dma-tl.patch
new file mode 100644
index 0000000000..629348e722
--- /dev/null
+++ b/patches.arch/s390-sles15-02-06-pci-handle-insufficient-resources-during-dma-tl.patch
@@ -0,0 +1,85 @@
+From: Sebastian Ott <sebott@linux.vnet.ibm.com>
+Subject: s390/pci: handle insufficient resources during dma tlb flush
+Patch-mainline: v4.15-rc7
+Git-commit: a5f1005517534aeb1fac20180badfbf0896c183c
+References: bnc#1072915, LTC#163393
+
+Description: s390/pci: improve lazy IOTLB flushing mode
+Symptom: Some PCI workloads don't reach full
+ performance potential.
+Problem: Even with lazy IOTLB flushing it is done
+ more often than needed.
+Solution: Improve that and be as lazy as possible.
+Reproduction: -
+
+Upstream-Description:
+
+ s390/pci: handle insufficient resources during dma tlb flush
+
+ In a virtualized setup lazy flushing can lead to the hypervisor
+ running out of resources when lots of guest pages need to be
+ pinned. In this situation simply trigger a global flush to give
+ the hypervisor a chance to free some of these resources.
+
+ Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
+ Reviewed-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
+ Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
+ Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+
+Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
+Acked-by: Johannes Thumshirn <jthumshirn@suse.de>
+---
+ arch/s390/pci/pci_dma.c | 21 +++++++++++++++++++--
+ arch/s390/pci/pci_insn.c | 3 +++
+ 2 files changed, 22 insertions(+), 2 deletions(-)
+
+--- a/arch/s390/pci/pci_dma.c
++++ b/arch/s390/pci/pci_dma.c
+@@ -178,6 +178,9 @@ out_unlock:
+ static int __dma_purge_tlb(struct zpci_dev *zdev, dma_addr_t dma_addr,
+ size_t size, int flags)
+ {
++ unsigned long irqflags;
++ int ret;
++
+ /*
+ * With zdev->tlb_refresh == 0, rpcit is not required to establish new
+ * translations when previously invalid translation-table entries are
+@@ -193,8 +196,22 @@ static int __dma_purge_tlb(struct zpci_d
+ return 0;
+ }
+
+- return zpci_refresh_trans((u64) zdev->fh << 32, dma_addr,
+- PAGE_ALIGN(size));
++ ret = zpci_refresh_trans((u64) zdev->fh << 32, dma_addr,
++ PAGE_ALIGN(size));
++ if (ret == -ENOMEM && !s390_iommu_strict) {
++ /* enable the hypervisor to free some resources */
++ if (zpci_refresh_global(zdev))
++ goto out;
++
++ spin_lock_irqsave(&zdev->iommu_bitmap_lock, irqflags);
++ bitmap_andnot(zdev->iommu_bitmap, zdev->iommu_bitmap,
++ zdev->lazy_bitmap, zdev->iommu_pages);
++ bitmap_zero(zdev->lazy_bitmap, zdev->iommu_pages);
++ spin_unlock_irqrestore(&zdev->iommu_bitmap_lock, irqflags);
++ ret = 0;
++ }
++out:
++ return ret;
+ }
+
+ static int dma_update_trans(struct zpci_dev *zdev, unsigned long pa,
+--- a/arch/s390/pci/pci_insn.c
++++ b/arch/s390/pci/pci_insn.c
+@@ -87,6 +87,9 @@ int zpci_refresh_trans(u64 fn, u64 addr,
+ if (cc)
+ zpci_err_insn(cc, status, addr, range);
+
++ if (cc == 1 && (status == 4 || status == 16))
++ return -ENOMEM;
++
+ return (cc) ? -EIO : 0;
+ }
+
diff --git a/series.conf b/series.conf
index 6910ed4e37..66e4033615 100644
--- a/series.conf
+++ b/series.conf
@@ -6461,6 +6461,7 @@
patches.drivers/IB-mlx5-Fix-mlx5_ib_alloc_mr-error-flow.patch
patches.drivers/drm-i915-Apply-Display-WA-1183-on-skl-kbl-and-cfl
patches.drivers/crypto-chelsio-select-CRYPTO_GF128MUL.patch
+ patches.arch/s390-sles15-02-06-pci-handle-insufficient-resources-during-dma-tl.patch
patches.drivers/bnxt_en-Fix-population-of-flow_type-in-bnxt_hwrm_cfa.patch
patches.drivers/bnxt_en-Fix-the-Invalid-VF-id-check-in-bnxt_vf_ndo_p.patch
patches.drivers/nvme-mpath-fix-last-path-removal-during-traffic.patch