Operations on ATA DMA memory
Posted: Thu Feb 23, 2012 10:19 pm
Just last week I got ATA DMA working on my OS (Available at https://github.com/champo/ArqvengerOS/). Now during the work to integrate it with the rest of the OS, I find myself wondering if I can access (read & write) memory that I just asked the DMA controller to write to disk safely.
If you feel like understanding why I ask, this is it:
I have a cache layer between the FS and the ATA device. I'm trying to offer the cache memory directly to FS, and to have a kernel thread write back dirty pages (checking for the dirty bit set by the MMU). This would allow me to map the FS structures directly to that memory, which will get written automatically, freeing the file system from that task. The problem is, it's likely a page that might still suffer modifications while it's being written to disk. So I either need to do extensive use of locks (locks that I have already, but I'd rather not use if possible), or things get sorted out by the controller/CPU.
If you feel like understanding why I ask, this is it:
I have a cache layer between the FS and the ATA device. I'm trying to offer the cache memory directly to FS, and to have a kernel thread write back dirty pages (checking for the dirty bit set by the MMU). This would allow me to map the FS structures directly to that memory, which will get written automatically, freeing the file system from that task. The problem is, it's likely a page that might still suffer modifications while it's being written to disk. So I either need to do extensive use of locks (locks that I have already, but I'd rather not use if possible), or things get sorted out by the controller/CPU.