linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Subject: [PATCH] powerpc: convert 'iommu_alloc failed' messages to dynamic debug
Date: Fri, 10 Jun 2016 10:03:51 -0300	[thread overview]
Message-ID: <1465563831-6565-1-git-send-email-mauricfo@linux.vnet.ibm.com> (raw)

This prevents flooding the logs with 'iommu_alloc failed' messages
while I/O is performed (normally) to very fast devices (e.g. NVMe).

That error is not necessarily a problem; device drivers can retry
later / reschedule the requests for which the allocation failed,
and handle things gracefully for the caller stack on top of them.

This helps at least with NVMe devices without "64-bit"/direct DMA
window scenarios (e.g., systems with more than a few terabytes of
memory, on which DDW cannot be enabled, currently), where just an
'dd' command can trigger errors.

  # dd if=/dev/zero of=/dev/nvme0n1p1 bs=64k count=512k
  <...>
  # echo $?
  0

  # dmesg
  nvme 0000:00:06.0: iommu_alloc failed, tbl c0000001fa67c520 vaddr c000000151c90000 npages 16
  nvme 0000:00:06.0: iommu_alloc failed, tbl c0000001fa67c520 vaddr c000000151c90000 npages 16
  nvme 0000:00:06.0: iommu_alloc failed, tbl c0000001fa67c520 vaddr c000000151c90000 npages 16
  <...>
  ppc_iommu_map_sg: 8186 callbacks suppressed
  nvme 0000:00:06.0: iommu_alloc failed, tbl c0000001fa67c520 vaddr c0000000fa5c0000 npages 16
  nvme 0000:00:06.0: iommu_alloc failed, tbl c0000001fa67c520 vaddr c000000100440000 npages 16
  nvme 0000:00:06.0: iommu_alloc failed, tbl c0000001fa67c520 vaddr c000000100440000 npages 16
  <...>
  ppc_iommu_map_sg: 5707 callbacks suppressed
  nvme 0000:00:06.0: iommu_alloc failed, tbl c0000001fa67c520 vaddr c0000000b5f50000 npages 16
  nvme 0000:00:06.0: iommu_alloc failed, tbl c0000001fa67c520 vaddr c0000000b5c60000 npages 16
  nvme 0000:00:06.0: iommu_alloc failed, tbl c0000001fa67c520 vaddr c0000000b4b30000 npages 16
  <...>

Tested on next-20160609.

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/iommu.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index a8e3490..b585bdc 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -479,10 +479,9 @@ int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl,
 
 		/* Handle failure */
 		if (unlikely(entry == DMA_ERROR_CODE)) {
-			if (printk_ratelimit())
-				dev_info(dev, "iommu_alloc failed, tbl %p "
-					 "vaddr %lx npages %lu\n", tbl, vaddr,
-					 npages);
+			dev_dbg_ratelimited(dev, "iommu_alloc failed, tbl %p "
+				 "vaddr %lx npages %lu\n", tbl, vaddr,
+				 npages);
 			goto failure;
 		}
 
@@ -776,11 +775,9 @@ dma_addr_t iommu_map_page(struct device *dev, struct iommu_table *tbl,
 					 mask >> tbl->it_page_shift, align,
 					 attrs);
 		if (dma_handle == DMA_ERROR_CODE) {
-			if (printk_ratelimit())  {
-				dev_info(dev, "iommu_alloc failed, tbl %p "
-					 "vaddr %p npages %d\n", tbl, vaddr,
-					 npages);
-			}
+			dev_dbg_ratelimited(dev, "iommu_alloc failed, tbl %p "
+				 "vaddr %p npages %d\n", tbl, vaddr,
+				 npages);
 		} else
 			dma_handle |= (uaddr & ~IOMMU_PAGE_MASK(tbl));
 	}
-- 
1.8.3.1

             reply	other threads:[~2016-06-10 13:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10 13:03 Mauricio Faria de Oliveira [this message]
2016-06-11 23:02 ` [PATCH] powerpc: convert 'iommu_alloc failed' messages to dynamic debug Benjamin Herrenschmidt
2016-06-13 13:27   ` Mauricio Faria de Oliveira
2016-06-13 21:26     ` Benjamin Herrenschmidt
2016-06-13 21:43       ` Mauricio Faria de Oliveira
2016-06-13 21:51         ` Benjamin Herrenschmidt
2016-06-13 22:01           ` Mauricio Faria de Oliveira
2016-08-03 19:39       ` Mauricio Faria de Oliveira
2016-08-03 21:34         ` Benjamin Herrenschmidt
2016-08-03 21:39           ` Mauricio Faria de Oliveira

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465563831-6565-1-git-send-email-mauricfo@linux.vnet.ibm.com \
    --to=mauricfo@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).