Closed Anthonywolfe closed 3 years ago
Thank you for the issue.
Is it possible to disclose the source code of the application where MemoryAccessViolation occurred?
I've created a example application that experiences the same issues here: https://gist.github.com/Anthonywolfe/73da20856ec3faf83848383f3ee6448a
Some notes, we only see the Descriptors writing to the wrong location after the 128th, And the AccessViolationException is a bit random, sometimes it will happen on the first run, others the 5th. Sometimes it won't even happen at all.
please tell me.
What exactly is the value of the _MapSize variable in Init ()? Or what is the value of Environment.SystemPageSize? Are these values higher than the capacity required for DMA? Is it small?
Oh wow, For reference Environment.SystemPageSize is a API around getpagesize so it returned 4096.
Originally when I wrote the MemoryMap abstraction I built it with structs I could sizeof to get their size. When I went to make use of the dma buffers I had just used a byte as the type which had a sizeof 1 and it aligned the size to the page which masked my issue as I could write some descriptors before I exceeded the memory I requested same goes for reading data back...
Thank you so much for your time and pointing out the issue.
I'm glad that I could help you out.
Hi,
I've setup the u-dma-buf to alloc 2 buffers on a Zybo-Z7-20 using petalinux and the device tree. I've expanded the CMA to 128MB (cma: Reserved 128 MiB at 0x38000000) My device tree configuration is
Which appears to work fine as my bootlog reports
I'm using mmap to map "/dev/udmabuf_rx" and "/dev/udmabuf_tx". However I've ran into a strange issue when reading and writing the buffers. Sometimes when reading/writing to the mmap I get a MemoryAccessViolation and we've captured some writes to /dev/udmabuf_tx ending up on our axi_dma_uio which is located at 0x43C10000. Which makes me think that the virtual reads/writes may not be reading/writing to the correct physical locations?
Pictured is a data being written to the DMA registers captured from a ILA.
If you need any more info let me know and I'll try and provide it.