Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1672498 > unrolled thread

[PATCH] iommu/amd: Free already flushed ring-buffer entries before full-check

Started byJoerg Roedel <joro@8bytes.org>
First post2017-06-22 12:20 +0200
Last post2017-06-22 12:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] iommu/amd: Free already flushed ring-buffer entries before full-check Joerg Roedel <joro@8bytes.org> - 2017-06-22 12:20 +0200

#1672498 — [PATCH] iommu/amd: Free already flushed ring-buffer entries before full-check

FromJoerg Roedel <joro@8bytes.org>
Date2017-06-22 12:20 +0200
Subject[PATCH] iommu/amd: Free already flushed ring-buffer entries before full-check
Message-ID<tV7ns-3hH-19@gated-at.bofh.it>
From: Joerg Roedel <jroedel@suse.de>

To benefit from IOTLB flushes on other CPUs we have to free
the already flushed IOVAs from the ring-buffer before we do
the queue_ring_full() check.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/iommu/amd_iommu.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 623ab53..34a6cac 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1883,14 +1883,20 @@ static void queue_add(struct dma_ops_domain *dom,
 	spin_lock_irqsave(&queue->lock, flags);
 
 	/*
+	 * First remove the enries from the ring-buffer that are already
+	 * flushed to make the below queue_ring_full() check less likely
+	 */
+	queue_ring_free_flushed(dom, queue);
+
+	/*
 	 * When ring-queue is full, flush the entries from the IOTLB so
 	 * that we can free all entries with queue_ring_free_flushed()
 	 * below.
 	 */
-	if (queue_ring_full(queue))
+	if (queue_ring_full(queue)) {
 		dma_ops_domain_flush_tlb(dom);
-
-	queue_ring_free_flushed(dom, queue);
+		queue_ring_free_flushed(dom, queue);
+	}
 
 	idx = queue_ring_add(queue);
 
-- 
2.7.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web