On Wed, Aug 02, 2017 at 10:26:40AM +0200, Christian König wrote: > Hi Jerome, > > sorry for being a bit late to the discussion and the top posting. > > But I think you miss a very important point here, which makes the whole > discussion on how to implement completely superfluous: > > We already have a functionality to access the content of BOs in a process > for debugging purpose which works similar as you described and just uses the > BO housekeeping structures in the driver to access the pages and VRAM > locations in question. > > See here for the implementation: > 1. drm/ttm: Implement vm_operations_struct.access v2 > (http://www.spinics.net/lists/dri-devel/msg147302.html) > 2. drm/amdgpu: Implement ttm_bo_driver.access_memory callback v2 > (http://www.spinics.net/lists/dri-devel/msg147303.html) > > Those patches allow you to just attach gdb to a process and access the > content of every CPU mapped buffer, even when that buffer is in CPU > invisible VRAM. > > So the primary goal of that effort is *NOT* to make the BO content > accessible to the debugger through the BO housekeeping, cause that's > something we already have. > > The goal here is to walk the different page tables and hardware mapping > functionalities to access the data just in the same way the GPU would do to > catch problems. > > That works fine as long as IOMMU is disabled, but when it is enabled the > additional mapping breaks our neck and we don't knew if the stuff the page > table dumper is producing is correct or not. > > So what we need is just a way to translate dma addresses back to struct > pages to check their validity. > > I've considered to just add this information to amdgpu_gem_info, but then we > get page->dma-address mapping instead dma-address->page as we want. >
So to summarize you are saying you do not trust the value you get from pci_map_page() ? If not then i stress again that you have all the informations you need inside the amdgpu driver. You can take the same scheme i propose to dump ttm.dma_address[] and compare against content of GPU page table. Jérôme _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
