LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] swiotlb: Suppress "Out of SW-IOMMU" errors for NO_WARN
@ 2018-05-02 10:05 Chris Wilson
  2018-05-02 12:44 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Wilson @ 2018-05-02 10:05 UTC (permalink / raw)
  To: iommu
  Cc: linux-kernel, intel-gfx, Chris Wilson, Christian König,
	Mike Galbraith, Konrad Rzeszutek Wilk, Christoph Hellwig

This extends the warning suppression from commit d0bc0c2a31c9 ("swiotlb:
suppress warning when __GFP_NOWARN is set") to suppress the warnings
when DMA_ATTR_NO_WARN is given by caller. In such cases the caller wants
to handle the error themselves.

Fixes: d0bc0c2a31c9 ("swiotlb: suppress warning when __GFP_NOWARN is set")
Cc: Christian König <christian.koenig@amd.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
---
 lib/swiotlb.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index fece57566d45..2bfb936c5708 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -768,11 +768,14 @@ static bool swiotlb_free_buffer(struct device *dev, size_t size,
 
 static void
 swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir,
-	     int do_panic)
+	     unsigned long attrs, int do_panic)
 {
 	if (swiotlb_force == SWIOTLB_NO_FORCE)
 		return;
 
+	if (attrs & DMA_ATTR_NO_WARN)
+		return;
+
 	/*
 	 * Ran out of IOMMU space for this operation. This is very bad.
 	 * Unfortunately the drivers cannot handle this operation properly.
@@ -823,7 +826,7 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page,
 	/* Oh well, have to allocate and map a bounce buffer. */
 	map = map_single(dev, phys, size, dir, attrs);
 	if (map == SWIOTLB_MAP_ERROR) {
-		swiotlb_full(dev, size, dir, 1);
+		swiotlb_full(dev, size, dir, attrs, 1);
 		return __phys_to_dma(dev, io_tlb_overflow_buffer);
 	}
 
@@ -959,7 +962,7 @@ swiotlb_map_sg_attrs(struct device *hwdev, struct scatterlist *sgl, int nelems,
 			if (map == SWIOTLB_MAP_ERROR) {
 				/* Don't panic here, we expect map_sg users
 				   to do proper error handling. */
-				swiotlb_full(hwdev, sg->length, dir, 0);
+				swiotlb_full(hwdev, sg->length, dir, attrs, 0);
 				attrs |= DMA_ATTR_SKIP_CPU_SYNC;
 				swiotlb_unmap_sg_attrs(hwdev, sgl, i, dir,
 						       attrs);
-- 
2.17.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] swiotlb: Suppress "Out of SW-IOMMU" errors for NO_WARN
  2018-05-02 10:05 [PATCH] swiotlb: Suppress "Out of SW-IOMMU" errors for NO_WARN Chris Wilson
@ 2018-05-02 12:44 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2018-05-02 12:44 UTC (permalink / raw)
  To: Chris Wilson
  Cc: iommu, linux-kernel, intel-gfx, Christian König,
	Mike Galbraith, Konrad Rzeszutek Wilk, Christoph Hellwig

On Wed, May 02, 2018 at 11:05:01AM +0100, Chris Wilson wrote:
> This extends the warning suppression from commit d0bc0c2a31c9 ("swiotlb:
> suppress warning when __GFP_NOWARN is set") to suppress the warnings
> when DMA_ATTR_NO_WARN is given by caller. In such cases the caller wants
> to handle the error themselves.

I have patches that remove swiotlb_full entirely to be posted soon.
I'll defer the patch for now.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-05-02 12:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-02 10:05 [PATCH] swiotlb: Suppress "Out of SW-IOMMU" errors for NO_WARN Chris Wilson
2018-05-02 12:44 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).