linux: GFP_DMA/GFP_DMA32
While I have a patch queued to address related issues in intel-agp, a quick scan of the Linux tree seems to reveal several more cases where assumptions are being made on GFP_DMA{,32} allocations - either the result (even properly passed through virt_to_bus()) is put into hardware registers (with no guarantee that it fits the width required by those registers or fields thereof), or page-crossing arithmetic is being done (explicitly or implicitly). All this is set to cause data corruption.
Are there any ideas, other than either suppressing such components or fixing them one by one, how to address this problem?
Thanks, Jan
How many callers rely on GFP_DMA32? We gave up on GFP_DMA because no halfway modern hardware relies on it and we can't currently satisfy requests for memory below 16MB anyway.
As for solutions, either we have to hook the memory allocator somehow to get a call out to allocate memory of the correct type, or callers do indeed need fixing one by one.
-- Keir
Quoted 13 lines · Jan Beulich
While I have a patch queued to address related issues in intel-agp, a quick scan
of the Linux tree seems to reveal several more cases where assumptions are being made on GFP_DMA{,32} allocations - either the result (even properly passed throughvirt_to_bus()) is put into hardware registers (with no guarantee that it fits the width required by those registers or fields thereof),
or page-crossing arithmetic is being done (explicitly or implicitly). All this is set
to cause data corruption.Are there any ideas, other than either suppressing such components or fixing them one by one, how to address this problem?
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Keir Fraser <[email protected]> 04.04.07 09:11 >>>
How many callers rely on
GFP_DMA32? We gave up onGFP_DMAbecause no halfway modern hardware relies on it and we can't currently satisfy requests for memory below 16MB anyway.
For GFP_DMA, I stopped counting when I found the third or fourth one - the grep indicated another dozen or so candidates. For GFP_DMA32, it's just two (all agp drivers, which I said I have a fix for, and drivers/media/video/video-buf.c - there are many suspicious virt_to_phys() uses underneath drivers/media/, so this subtree looks broken in general).
In may cases GFP_DMA is just being used to restrict memory to somewhere below 32-bits, not necessarily to 24.
Quoted 3 lines
As for solutions, either we have to hook the memory allocator somehow to get a call out to allocate memory of the correct type, or callers do indeed need fixing one by one.
I thought about possible hooks, too, but after a page was allocated you don't know what GFP_* it was allocated with. The only not too intrusive way I could immediately think of would be to further leverage PG_foreign here, but I'm afraid its use of page->index may then get into conflict with other uses...
Jan