enfiskutensykkel / ssd-gpu-dma

Build userspace NVMe drivers and storage applications with CUDA support
BSD 2-Clause "Simplified" License
338 stars 47 forks source link

Kernel module doesn't clean up resources if program crashes or doesn't release handles #18

Open enfiskutensykkel opened 5 years ago

enfiskutensykkel commented 5 years ago

Currently mappings are stored on a global linked list. We should instead keep track of open and close of the ioctl file descriptor and create a linked list per process. This would allow us to close all mappings for once process, and avoid checking the current process in lookup.

patstew commented 5 years ago

The other way to go about it is to use mmap to get the memory then the kernel does it for you. You still need an ioctl to get the physical address though,

enfiskutensykkel commented 5 years ago

Hmm, good point. I think the module may be up for a major overhaul, ideally it should support huge pages and allocate contiguous address ranges that it maps for the userspace program. It would simplify the logic in the library, eliminating the hard separation between the code dependent on the SISCI/SmartIO path and also make larger queues and buffers simpler to deal with by avoiding PRP lists. I will give this some thought.