>> With this scheme, page used for Rx is completely dma_map()ed at >> allocation time, split into two buffers, and individual buffer is >> sync_to_cpu()ed AND PASSED TO NETWORK STACK via skb_add_rx_frag() - >> while driver driver still uses other buffer. Later, when driver decides >> to no longer use this page, it will dma_unmap() it completely - which on >> archs with non-coherent caches means cache invalidation. This cache >> invalidation will include area that is already passed elsewhere. > > This should happen only if the device wrote into that piece of the > memory which it absolutely should not.
Hmm... I'm not about device writing to memory. Sequence in igb driver is: dma_map(full_page) <device writes here> sync_to_cpu(half_page); skb_add_rx_frag(skb, half_page); napi_gro_receive(skb); ... dma_unmap(full_page) What I'm concerned about is - same area is first passed up to network stack, and _later_ dma_unmap()ed. Is this indeed safe? Nikita