Re: igb driver can cause cache invalidation of non-owned memory?

From: Nikita Yushchenko
Date: Mon Oct 10 2016 - 05:51:42 EST

>> 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:

<device writes here>
skb_add_rx_frag(skb, half_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?