Re: [PATCH v3 04/12] drm/ttm: Set dma addr to null after freee

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 23.11.20 um 06:15 schrieb Andrey Grodzovsky:

On 11/21/20 9:13 AM, Christian König wrote:
Am 21.11.20 um 06:21 schrieb Andrey Grodzovsky:
Fixes oops.

That file doesn't even exist any more. What oops should this fix?


Which file ?

ttm_page_alloc.c

I've rewritten the whole page pool from scratch upstream.

We set dma_address to NULL in every other place after unmap. This is so that if dma address was already unmapped we skip it next time we enter ttm_unmap_and_unpopulate_pages
with same tt for some reason.

Dave and I already fixed that as well by having a flag preventing double unpopulate.

The oops happens with IOMMU enabled. The device is removed from it's IOMMU group during PCI remove but the BOs are all still alive if user mode client holds reference to drm file. Later when the refernece is droppped and device fini happens i get oops in ttm_unmap_and_unpopulate_pages->dma_unmap_page becaue of IOMMU group structures being gone already. Patch  [11/12] drm/amdgpu: Register IOMMU topology notifier per device together with this patch solve the oops.

It should be sufficient to unpopulate all BOs now.

Maybe you should rebase the patches on drm-misc-next.

Christian.


Andrey


Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@xxxxxxx>
---
  drivers/gpu/drm/ttm/ttm_page_alloc.c | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index b40a467..b0df328 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -1160,6 +1160,8 @@ void ttm_unmap_and_unpopulate_pages(struct device *dev, struct ttm_dma_tt *tt)           dma_unmap_page(dev, tt->dma_address[i], num_pages * PAGE_SIZE,
                     DMA_BIDIRECTIONAL);
  +        tt->dma_address[i] = 0;
+
          i += num_pages;
      }
      ttm_pool_unpopulate(&tt->ttm);

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Candrey.grodzovsky%40amd.com%7C1c70eb602a49497aff3508d88e27ad1a%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637415648381338288%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=p8HjrEfydKrspsFCp1v8KCdT6lKr1OEKXdF3%2BSoh4zk%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux