Skip to content

Commit

Permalink
swiotlb: Rate-limit printing when running out of SW-IOMMU space
Browse files Browse the repository at this point in the history
If the system runs out of SW-IOMMU space, changes are high successive
requests will fail, too, flooding the kernel log.  This is true
especially for streaming DMA, which is typically used repeatedly outside
the driver's initialization routine.  Add rate-limiting to fix this.

While at it, get rid of the open-coded dev_name() handling by using the
appropriate dev_err_*() variant.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Konrad Rzeszutek Wilk <konrad@kernel.org>
  • Loading branch information
Geert Uytterhoeven authored and Konrad Rzeszutek Wilk committed Nov 7, 2016
1 parent c8d2bc9 commit 0d2e189
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/swiotlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,8 @@ swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir,
* When the mapping is small enough return a static buffer to limit
* the damage, or panic when the transfer is too big.
*/
printk(KERN_ERR "DMA: Out of SW-IOMMU space for %zu bytes at "
"device %s\n", size, dev ? dev_name(dev) : "?");
dev_err_ratelimited(dev, "DMA: Out of SW-IOMMU space for %zu bytes\n",
size);

if (size <= io_tlb_overflow || !do_panic)
return;
Expand Down

0 comments on commit 0d2e189

Please sign in to comment.