ssd-gpu-dma
ssd-gpu-dma copied to clipboard
Incorrect use of DMA API
I think the kernel module is technically using the DMA API incorrectly. dma_map_page and dma_map_single are supposed to be for 'streaming DMA' where you write to the buffer in userspace, then dma_map it, then hand it over to the device. Otherwise data in the CPU cache can be missed. I think dma_alloc_coherent is the correct thing to use in cases like this where the buffer contents are changed repeatedly. I suspect that x86_64 doesn't have a problem because the cache is coherent anyway, but it's a problem for me on 32-bit ARM. So it probably won't affect 99% of users, but I thought I'd report it in case anyone else has problems. I've worked around it by using another memory allocation system I have on my platform.
Yes, this is probably the case. I haven't tested properly on ARM, it's on my TODO list. I will look a bit more into this. Thank you for your observations and comments.