All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Andreas Hartmann <andihartmann@freenet.de>
Cc: Mikulas Patocka <mpatocka@redhat.com>,
	iommu@lists.linux-foundation.org, Leo Duran <leo.duran@amd.com>,
	Christoph Hellwig <hch@lst.de>,
	device-mapper development <dm-devel@redhat.com>,
	Milan Broz <mbroz@redhat.com>, Jens Axboe <axboe@fb.com>,
	linux-pci <linux-pci@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [dm-devel] AMD-Vi IO_PAGE_FAULTs and ata3.00: failed command: READ FPDMA QUEUED errors since Linux 4.0
Date: Tue, 6 Oct 2015 12:13:56 +0200	[thread overview]
Message-ID: <20151006101356.GE12506@8bytes.org> (raw)
In-Reply-To: <560BF73F.8000008@maya.org>

[-- Attachment #1: Type: text/plain, Size: 839 bytes --]

On Wed, Sep 30, 2015 at 04:52:47PM +0200, Andreas Hartmann wrote:
> > Alternativly someone who can reproduce it should trace the calls to
> > __map_single and __unmap_single in the AMD IOMMU driver to find out
> > whether the addresses which the faults happen on are really mapped, or
> > at least requested from the AMD IOMMU driver.
> 
> How can I trace it?

Please apply the attached debug patch on-top of Linux v4.3-rc3 and boot
the machine. After boot you run (as root):


	# cat /sys/kernel/debug/tracing/trace_pipe > trace-data

Please run this in a seperate shell an keep it running.

Then trigger the problem while the above command is running. When you
triggered it, please send me the (compressed) trace-data file, full
dmesg and output of lspci on the box.

Please let me know if you have further questions.


Thanks,

	Joerg


[-- Attachment #2: iommu-debug.patch --]
[-- Type: text/x-diff, Size: 2298 bytes --]

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index f82060e7..0002e79 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2465,6 +2465,7 @@ static dma_addr_t __map_single(struct device *dev,
 {
 	dma_addr_t offset = paddr & ~PAGE_MASK;
 	dma_addr_t address, start, ret;
+	phys_addr_t old_paddr = paddr;
 	unsigned int pages;
 	unsigned long align_mask = 0;
 	int i;
@@ -2521,6 +2522,8 @@ retry:
 		domain_flush_pages(&dma_dom->domain, address, size);
 
 out:
+	trace_printk("%s: mapped %llx paddr %llx size %zu\n",
+			dev_name(dev), address, old_paddr, size);
 	return address;
 
 out_unmap:
@@ -2532,6 +2535,9 @@ out_unmap:
 
 	dma_ops_free_addresses(dma_dom, address, pages);
 
+	trace_printk("%s: return DMA_ERROR_CODE paddr %llx size %zu\n",
+			dev_name(dev), old_paddr, size);
+
 	return DMA_ERROR_CODE;
 }
 
@@ -2628,6 +2634,8 @@ static void unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size,
 
 	spin_lock_irqsave(&domain->lock, flags);
 
+	trace_printk("%s: unmap dma_addr %llx size %zu\n",
+			dev_name(dev), dma_addr, size);
 	__unmap_single(domain->priv, dma_addr, size, dir);
 
 	domain_flush_complete(domain);
@@ -2683,9 +2691,13 @@ out:
 	return mapped_elems;
 unmap:
 	for_each_sg(sglist, s, mapped_elems, i) {
-		if (s->dma_address)
+		if (s->dma_address) {
+			trace_printk("%s: unmap dma_addr %llx size %u\n",
+					dev_name(dev), s->dma_address,
+					s->dma_length);
 			__unmap_single(domain->priv, s->dma_address,
 				       s->dma_length, dir);
+		}
 		s->dma_address = s->dma_length = 0;
 	}
 
@@ -2716,6 +2728,9 @@ static void unmap_sg(struct device *dev, struct scatterlist *sglist,
 	spin_lock_irqsave(&domain->lock, flags);
 
 	for_each_sg(sglist, s, nelems, i) {
+	trace_printk("%s: unmap dma_addr %llx size %u\n",
+			dev_name(dev), s->dma_address, s->dma_length);
+
 		__unmap_single(domain->priv, s->dma_address,
 			       s->dma_length, dir);
 		s->dma_address = s->dma_length = 0;
@@ -2813,6 +2828,9 @@ static void free_coherent(struct device *dev, size_t size,
 
 	spin_lock_irqsave(&domain->lock, flags);
 
+	trace_printk("%s: unmap dma_addr %llx size %zu\n",
+			dev_name(dev), dma_addr, size);
+
 	__unmap_single(domain->priv, dma_addr, size, DMA_BIDIRECTIONAL);
 
 	domain_flush_complete(domain);

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

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 17:40 AMD-Vi IO_PAGE_FAULTs and ata3.00: failed command: READ FPDMA QUEUED errors since Linux 4.0 Andreas Hartmann
2015-07-28 17:50 ` Mike Snitzer
2015-07-28 18:20   ` Andreas Hartmann
2015-07-28 18:58     ` Mike Snitzer
2015-07-28 19:23       ` Andreas Hartmann
2015-07-28 19:31         ` Mike Snitzer
2015-07-28 20:08           ` Andreas Hartmann
2015-07-28 21:24             ` Mike Snitzer
2015-07-29  6:17               ` [dm-devel] " Ondrej Kozina
2015-07-29  6:41                 ` Milan Broz
2015-07-29 17:23                   ` Andreas Hartmann
2015-07-30 20:30                     ` Andreas Hartmann
2015-07-31  7:23                       ` Milan Broz
2015-07-31  7:55                         ` Andreas Hartmann
2015-07-31  8:15                           ` Andreas Hartmann
2015-07-31  8:28                           ` Milan Broz
2015-07-29 10:37               ` Milan Broz
2015-07-28 18:56   ` Andreas Hartmann
2015-07-28 19:29     ` Mike Snitzer
2015-08-01 14:20       ` [dm-devel] " Andreas Hartmann
2015-08-02 13:38         ` Andreas Hartmann
2015-08-02 17:57           ` Mikulas Patocka
     [not found]             ` <alpine.LRH.2.02.1508021347480.17729-Hpncn10jQN4oNljnaZt3ZvA+iT7yCHsGwRM8/txMwJMAicBL8TP8PQ@public.gmane.org>
2015-08-02 18:48               ` Andreas Hartmann
2015-08-02 18:48                 ` Andreas Hartmann
2015-08-03  8:12                 ` Joerg Roedel
2015-08-04 14:47                   ` Mike Snitzer
2015-08-04 16:10                     ` Jeff Moyer
     [not found]                       ` <x4937zzm3uc.fsf-RRHT56Q3PSP4kTEheFKJxxDDeQx5vsVwAInAS/Ez/D0@public.gmane.org>
2015-08-04 18:11                         ` Andreas Hartmann
2015-08-04 18:11                           ` Andreas Hartmann
2015-08-07  6:04                           ` Andreas Hartmann
2015-09-20  6:50               ` [dm-devel] " Andreas Hartmann
2015-09-20  6:50                 ` Andreas Hartmann
     [not found]                 ` <55FE5740.2060701-YKS6W9RDU/w@public.gmane.org>
2015-09-29 15:21                   ` Joerg Roedel
2015-09-29 15:21                     ` Joerg Roedel
     [not found]                     ` <20150929152100.GL3036-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-09-29 15:58                       ` Mikulas Patocka
2015-09-29 15:58                         ` Mikulas Patocka
2015-09-29 16:20                         ` Joerg Roedel
     [not found]                           ` <20150929162042.GR3036-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-09-30 14:52                             ` Andreas Hartmann
2015-09-30 14:52                               ` Andreas Hartmann
2015-10-06 10:13                               ` Joerg Roedel [this message]
     [not found]                                 ` <20151006101356.GE12506-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-10-06 18:37                                   ` Andreas Hartmann
2015-10-06 18:37                                     ` Andreas Hartmann
     [not found]                                     ` <56141507.7040103-YKS6W9RDU/w@public.gmane.org>
2015-10-07  2:57                                       ` Andreas Hartmann
     [not found]                                         ` <56148A1B.5060506-YKS6W9RDU/w@public.gmane.org>
2015-10-07 16:10                                           ` Joerg Roedel
2015-10-07 16:10                                             ` Joerg Roedel
     [not found]                                             ` <20151007161022.GI28811-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-10-07 16:52                                               ` Andreas Hartmann
2015-10-07 16:52                                                 ` Andreas Hartmann
2015-10-08 16:39                                                 ` Joerg Roedel
     [not found]                                                   ` <20151008163957.GK28811-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-10-08 18:21                                                     ` Andreas Hartmann
2015-10-08 18:21                                                       ` Andreas Hartmann
     [not found]                                                       ` <5616B436.1000802-YKS6W9RDU/w@public.gmane.org>
2015-10-08 19:52                                                         ` Andreas Hartmann
2015-10-08 19:52                                                           ` Andreas Hartmann
     [not found]                                                           ` <5616C998.1010309-YKS6W9RDU/w@public.gmane.org>
2015-10-09  5:20                                                             ` Andreas Hartmann
2015-10-09  5:20                                                               ` Andreas Hartmann
     [not found]                                                               ` <56174EA6.7000106-YKS6W9RDU/w@public.gmane.org>
2015-10-09  9:15                                                                 ` Andreas Hartmann
2015-10-09  9:15                                                                   ` Andreas Hartmann
     [not found]                                                                   ` <56178599.6010807-YKS6W9RDU/w@public.gmane.org>
2015-10-09 14:59                                                                     ` Joerg Roedel
2015-10-09 14:59                                                                       ` Joerg Roedel
     [not found]                                                                       ` <20151009145951.GC27420-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-10-09 17:46                                                                         ` Andreas Hartmann
2015-10-09 17:46                                                                           ` Andreas Hartmann
     [not found]                                                                           ` <5617FD6E.70802-YKS6W9RDU/w@public.gmane.org>
2015-10-11 12:23                                                                             ` Andreas Hartmann
2015-10-11 12:23                                                                               ` Andreas Hartmann
2015-10-12 12:07                                                                               ` Andreas Hartmann
2015-10-12 12:34                                                                           ` Mikulas Patocka
2015-10-07 15:40                                     ` Joerg Roedel
2015-10-07 17:02                                       ` Andreas Hartmann
2015-10-08 17:30                                         ` Joerg Roedel
     [not found]                                           ` <20151008173007.GL28811-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-10-08 18:59                                             ` Andreas Hartmann
2015-10-08 18:59                                               ` Andreas Hartmann
     [not found]                                               ` <5616BCF4.10104-YKS6W9RDU/w@public.gmane.org>
2015-10-08 19:47                                                 ` Andreas Hartmann
2015-10-08 19:47                                                   ` Andreas Hartmann
2015-10-09 10:40                                                   ` Joerg Roedel
     [not found]                                                   ` <5616C850.2000906-YKS6W9RDU/w@public.gmane.org>
2015-10-09 14:45                                                     ` [PATCH] iommu/amd: Fix NULL pointer deref on device detach " Joerg Roedel
2015-10-09 14:45                                                       ` Joerg Roedel
2015-10-09 14:45                                                       ` Joerg Roedel
2015-10-09 17:42                                                       ` Andreas Hartmann

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=20151006101356.GE12506@8bytes.org \
    --to=joro@8bytes.org \
    --cc=andihartmann@freenet.de \
    --cc=axboe@fb.com \
    --cc=dm-devel@redhat.com \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=leo.duran@amd.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=mbroz@redhat.com \
    --cc=mpatocka@redhat.com \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.