Skip to content

iommu/virtio: Enable IOMMU_CAP_DERRED_FLUSH

Niklas Schnelle linux-iommu lkml virtualization 3 versions – Applied

Status from this message: Applied, thanks.

Get series with b4
b4 am [email protected] change-id 20230825-viommu-sync-map-1bf0cc4fdc15

Versions newest first

  1. v3 Latest2 patches 2 repliesApplied
  2. v22 patches 19 repliesSuperseded
  3. v12 patches 6 repliesSuperseded

Changes in v3 from the cover letter

- Removed NULL check from viommu_sync_req() (Jason)
- Went back to checking for 0 endpoints in IOTLB ops (Robin)
- Rebased on v6.7-rc2 which includes necessary iommu-dma changes
- Link to v2: https://lore.kernel.org/r/[email protected]

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/2iommu/virtio: Make use of ops->iotlb_sync_mapdrivers/iommu/virtio-iommu.c+16 -10 replies
2/2iommu/virtio: Add ops->flush_iotlb_all and enable deferred flushdrivers/iommu/virtio-iommu.c+16 -00 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchJean-Philippe Brucker
SeriesR-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/2] iommu/virtio: Enable IOMMU_CAP_DERRED_FLUSH

Hi All,

Previously I used virtio-iommu as a non-s390x test vehicle[0] for the single queue flushing scheme introduced by my s390x DMA API conversion series[1]. For this I modified virtio-iommu to a) use .iotlb_sync_map and b) enable IOMMU_CAP_DEFERRED_FLUSH. It turned out that deferred flush and even just the introduction of ops->iotlb_sync_map yield performance uplift[2] even with per-CPU queues. So here is a small series of these two changes.

The code is also available on the b4/viommu-deferred-flush branch of my kernel.org git repository[3].

Note on testing: I tested this series on my AMD Ryzen 3900X workstation using QEMU 8.1.2 a pass-through NVMe and Intel 82599 NIC VFs. For the NVMe I saw an increase of about 10% in IOPS and 30% in read bandwidth compared with v6.7-rc2. One odd thing though is that QEMU seemed to make the entire guest resident/pinned once I passed-through a PCI device. I seem to remember this wasn't the case with my last version but not sure which QEMU version I used back then.

@Jean-Philippe: I didn't include your R-b's as I changed back to the nr_endpoints check and this is like 30% of the patches.

Thanks,
Niklas

[0] https://lore.kernel.org/lkml/[email protected]/
[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/20230802123612.GA6142@myrica/

---
Changes in v3:
- Removed NULL check from viommu_sync_req() (Jason)
- Went back to checking for 0 endpoints in IOTLB ops (Robin)
- Rebased on v6.7-rc2 which includes necessary iommu-dma changes
- Link to v2: https://lore.kernel.org/r/[email protected]

Changes in v2:
- Check for viommu == NULL in viommu_sync_req() instead of for
0 endpoints in ops (Jean-Philippe)
- Added comment where viommu can be NULL (me)
- Link to v1: https://lore.kernel.org/r/[email protected]

To: Jean-Philippe Brucker <[email protected]>
To: Joerg Roedel <[email protected]>
To: Will Deacon <[email protected]>
To: Jason Gunthorpe <[email protected]>
To: Robin Murphy <[email protected]>
Cc: [email protected],
Cc: [email protected]
Cc: [email protected],
Cc: Niklas Schnelle <[email protected]>

---
Niklas Schnelle (2):

      iommu/virtio: Make use of ops->iotlb_sync_map
      iommu/virtio: Add ops->flush_iotlb_all and enable deferred flush
 drivers/iommu/virtio-iommu.c | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

---
base-commit: 98b1cc82c4affc16f5598d4fa14b1858671b2263
change-id: 20230825-viommu-sync-map-1bf0cc4fdc15

Best regards,

Signature · 1 line
Niklas Schnelle