From: David C. <da...@ar...> - 2006-10-25 02:29:19
|
Andrew Straw wrote: > David Cournapeau wrote: > >> I don't know anything about your device, but a driver directly accessing >> a memory buffer from a userland program sounds like a bug to me. >> > David, DMA memory (yes, I know thats an example of RAS Syndrome, > apologies) allows hardware to fill a chunk of RAM and then hand it over > to a userspace program. In my experience, RAM used for this purpose must > be pre-allocated, usually in a ring-buffer type arrangement. So this is > normal operating procedure for something like a frame grabber and not a > bug at all. > What I understood from former emails was that the user is allocating a memory buffer, and that it gives this memory buffer to the hardware. In this sense, I don't see how it is possible to avoid kernel panic or equivalents. If on the contrary, the driver gives you the memory buffer, then, ok, by eg a mmap-like call, you can access directly the device memory, but within a range fixed by the driver, which is valid if the driver is not buggy. That's why I don't understand the paging problem and why allocating anything from C or python would change anything (I think windows can page out kernel, contrary to linux, but I doubt it can page out DMA areas), because the user does not allocate anything in this scenario. But again, this is just what I would think from "common sense", and I have never done any system programming, so I may just miss something, David |