* Re: crash in gart_unmap_page() with master snapshot (commit e1ef035d272e) [not found] <20190102083854.GA28932@unicorn.suse.cz> @ 2019-01-04 8:53 ` Christoph Hellwig 2019-01-04 21:55 ` Michal Kubecek 0 siblings, 1 reply; 2+ messages in thread From: Christoph Hellwig @ 2019-01-04 8:53 UTC (permalink / raw) To: Michal Kubecek; +Cc: linux-kernel, iommu, Joerg Roedel Hi Michal, can you try the patch below? --- >From 6b22ae23a1971646dacc8a0ad313a6329a04cf98 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig <hch@lst.de> Date: Fri, 4 Jan 2019 09:50:33 +0100 Subject: x86/amd_gart: fix unmapping of non-GART mappings In many cases we don't have to create a GART mapping at all, which also means there is nothing to unmap. Fix the range check that was incorrectly modified when removing the mapping_error method. Fixes: 9e8aa6b546 ("x86/amd_gart: remove the mapping_error dma_map_ops method") Reported-by: Michal Kubecek <mkubecek@suse.cz> Signed-off-by: Christoph Hellwig <hch@lst.de> --- arch/x86/kernel/amd_gart_64.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c index e0ff3ac8c127..2c0aa34af69c 100644 --- a/arch/x86/kernel/amd_gart_64.c +++ b/arch/x86/kernel/amd_gart_64.c @@ -256,7 +256,15 @@ static void gart_unmap_page(struct device *dev, dma_addr_t dma_addr, int npages; int i; - if (dma_addr == DMA_MAPPING_ERROR || + if (WARN_ON_ONCE(dma_addr == DMA_MAPPING_ERROR)) + return; + + /* + * This driver will not always use a GART mapping, but might have + * created a direct mapping instead. If that is the case there is + * nothing to unmap here. + */ + if (dma_addr < iommu_bus_base || dma_addr >= iommu_bus_base + iommu_size) return; -- 2.20.1 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: crash in gart_unmap_page() with master snapshot (commit e1ef035d272e) 2019-01-04 8:53 ` crash in gart_unmap_page() with master snapshot (commit e1ef035d272e) Christoph Hellwig @ 2019-01-04 21:55 ` Michal Kubecek 0 siblings, 0 replies; 2+ messages in thread From: Michal Kubecek @ 2019-01-04 21:55 UTC (permalink / raw) To: Christoph Hellwig; +Cc: linux-kernel, iommu, Joerg Roedel On Fri, Jan 04, 2019 at 09:53:18AM +0100, Christoph Hellwig wrote: > Hi Michal, > > can you try the patch below? The machine has been running with it for 12 hours now without any apparent problem. Without the patch it crashed once after ~10 minutes and once after ~3 hours (then I switched back to 4.20). Thanks a lot for quick help. Tested-by: Michal Kubecek <mkubecek@suse.cz> > > --- > From 6b22ae23a1971646dacc8a0ad313a6329a04cf98 Mon Sep 17 00:00:00 2001 > From: Christoph Hellwig <hch@lst.de> > Date: Fri, 4 Jan 2019 09:50:33 +0100 > Subject: x86/amd_gart: fix unmapping of non-GART mappings > > In many cases we don't have to create a GART mapping at all, which > also means there is nothing to unmap. Fix the range check that was > incorrectly modified when removing the mapping_error method. > > Fixes: 9e8aa6b546 ("x86/amd_gart: remove the mapping_error dma_map_ops method") > Reported-by: Michal Kubecek <mkubecek@suse.cz> > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > arch/x86/kernel/amd_gart_64.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c > index e0ff3ac8c127..2c0aa34af69c 100644 > --- a/arch/x86/kernel/amd_gart_64.c > +++ b/arch/x86/kernel/amd_gart_64.c > @@ -256,7 +256,15 @@ static void gart_unmap_page(struct device *dev, dma_addr_t dma_addr, > int npages; > int i; > > - if (dma_addr == DMA_MAPPING_ERROR || > + if (WARN_ON_ONCE(dma_addr == DMA_MAPPING_ERROR)) > + return; > + > + /* > + * This driver will not always use a GART mapping, but might have > + * created a direct mapping instead. If that is the case there is > + * nothing to unmap here. > + */ > + if (dma_addr < iommu_bus_base || > dma_addr >= iommu_bus_base + iommu_size) > return; > > -- > 2.20.1 > ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-04 21:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20190102083854.GA28932@unicorn.suse.cz>
2019-01-04 8:53 ` crash in gart_unmap_page() with master snapshot (commit e1ef035d272e) Christoph Hellwig
2019-01-04 21:55 ` Michal Kubecek
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox