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

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