Blame SOURCES/kvm-intel_iommu-Skip-page-walking-on-device-iotlb-invali.patch

c687bc
From d8f84a8086dbe339a9f97dbcd10abd6379525068 Mon Sep 17 00:00:00 2001
c687bc
From: eperezma <eperezma@redhat.com>
c687bc
Date: Tue, 12 Jan 2021 14:36:37 -0500
c687bc
Subject: [PATCH 13/17] intel_iommu: Skip page walking on device iotlb
c687bc
 invalidations
c687bc
MIME-Version: 1.0
c687bc
Content-Type: text/plain; charset=UTF-8
c687bc
Content-Transfer-Encoding: 8bit
c687bc
c687bc
RH-Author: eperezma <eperezma@redhat.com>
c687bc
Message-id: <20210112143638.374060-13-eperezma@redhat.com>
c687bc
Patchwork-id: 100605
c687bc
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH v2 12/13] intel_iommu: Skip page walking on device iotlb invalidations
c687bc
Bugzilla: 1843852
c687bc
RH-Acked-by: Xiao Wang <jasowang@redhat.com>
c687bc
RH-Acked-by: Peter Xu <peterx@redhat.com>
c687bc
RH-Acked-by: Auger Eric <eric.auger@redhat.com>
c687bc
c687bc
Although they didn't reach the notifier because of the filtering in
c687bc
memory_region_notify_iommu_one, the vt-d was still splitting huge
c687bc
memory invalidations in chunks. Skipping it.
c687bc
c687bc
This improves performance in case of netperf with vhost-net:
c687bc
* TCP_STREAM: From 1923.6Mbit/s to 2175.13Mbit/s (13%)
c687bc
* TCP_RR: From 8464.73 trans/s to 8932.703333 trans/s (5.5%)
c687bc
* UDP_RR: From 8562.08 trans/s to 9005.62/s (5.1%)
c687bc
* UDP_STREAM: No change observed (insignificant 0.1% improvement)
c687bc
c687bc
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
c687bc
Acked-by: Jason Wang <jasowang@redhat.com>
c687bc
Message-Id: <20201116165506.31315-5-eperezma@redhat.com>
c687bc
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
c687bc
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
c687bc
(cherry picked from commit f7701e2c7983b680790af47117577b285b6a1aed)
c687bc
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
c687bc
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
c687bc
---
c687bc
 hw/i386/intel_iommu.c | 4 ++++
c687bc
 1 file changed, 4 insertions(+)
c687bc
c687bc
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
c687bc
index 3640bc2ed15..2b270f06645 100644
c687bc
--- a/hw/i386/intel_iommu.c
c687bc
+++ b/hw/i386/intel_iommu.c
c687bc
@@ -1421,6 +1421,10 @@ static int vtd_sync_shadow_page_table(VTDAddressSpace *vtd_as)
c687bc
     VTDContextEntry ce;
c687bc
     IOMMUNotifier *n;
c687bc
 
c687bc
+    if (!(vtd_as->iommu.iommu_notify_flags & IOMMU_NOTIFIER_IOTLB_EVENTS)) {
c687bc
+        return 0;
c687bc
+    }
c687bc
+
c687bc
     ret = vtd_dev_to_context_entry(vtd_as->iommu_state,
c687bc
                                    pci_bus_num(vtd_as->bus),
c687bc
                                    vtd_as->devfn, &ce);
c687bc
-- 
c687bc
2.27.0
c687bc