umr can now VM decode on systems with IOMMU enabled

Tom St Denis tom.stdenis at amd.com
Tue Aug 8 17:22:33 UTC 2017


Hi all,

I've pushed changes to umr (master) and our linux (amd-staging-4.12 
should be on 
https://cgit.freedesktop.org/~agd5f/linux/log/?h=amd-staging-4.12 
soonish) trees that allow in limited circumstances to VM decode through 
IOMMU which has been tested for both iommu active and inactive.

umr previously could not fully resolve addresses when IOMMU is active 
since the GPU is programmed with dma mapped addresses.  As such reading 
IBs or shaders or VM decoding in general would fail.

The change to the kernel adds a tracepoint which logs all dma map/unmap 
operations (via the TTM) which umr can read and use to access physical 
memory behind the mappings.

To enable this you need to enable two trace points:

echo 1 > 
/sys/kernel/debug/tracing/events/amdgpu/amdgpu_ttm_tt_populate/enable

echo 1 > 
/sys/kernel/debug/tracing/events/amdgpu/amdgpu_ttm_tt_unpopulate/enable

You need to enable the traces before running your test case/application.

If the trace file can't hold enough for your application you can tail it 
to ~/trace which umr will read preferentially (make sure you delete this 
file when done or you will be reading old mappings).

cat /sys/kernel/debug/tracing/trace_pipe > ~/trace

umr can process the traces fairly quickly (at about 1,500,000+ lines/sec 
on my Carrizo...) so theoretically heavy workloads should be manageable.

The traces contain PCI information which umr uses to match mappings so 
multiple GPU systems should work fine as well.  Though testing would be 
appreciated.

Cheers,
Tom


More information about the amd-gfx mailing list