Hi Andrea, sorry for the slow reply, had to work on other stuff for a bit. On Mon, Jan 30, 2012 at 12:20 PM, Andrea Arcangeli <[email protected]> wrote: > If you map it with an mmap(PROT_READ|PROT_WRITE), force or not force > won't change a thing in terms of cows. Just make sure you map your > control memory right, then safely remove force=1 and you won't get the > control page cowed by mistake. Then if you map it with MAP_SHARED it > won't be mapped read-only by fork() (leading to either parent or child > losing the control on the device), Hugh already suggested you to use > MAP_SHARED instead of MAP_PRIVATE.
Actually this isn't about control memory for the RDMA adapter... as you mentioned that typically is MMIO and mapped with remap_pfn stuff, without using any GUP stuff. I'm talking about the registration of other memory for reading/writing by a remote system via RDMA. The reason I'm talking about exporting kernel memory is that I wanted to do a debugging trick where a kernel module exposed some state into an mmap'able buffer. And I wanted to be able to read that state even if my broken module killed the whole system (in fact exactly when things crash I want to be able to read the state to figure out why I crashed!). So I wrote a trivial userspace program that does nothing but mmap the buffer, accept RDMA connections from remote systems, and map the buffer for reading over those connections. Then I can have a second system that connects to that process and polls the buffer. Because all the RDMA state is setup in advance, I can keep polling even after the first system panics. It's sort of like that firewire remote debugging, except I only get access to a limited memory buffer. The only difficulty is the problem that started this thread, ie a bogus COW so the remote system ends up polling the wrong pages. So with my original patch, I'm able to debug but I guess we agree it's the wrong fix for the general problem, and I'll write up a patch that adds what I think is the correct fix (the new FOLL flag) soon. - R. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
