Re: [net-next PATCH RFC 19/26] arch/sparc: Add option to skip DMA sync as a part of map and unmap

From: Alexander Duyck
Date: Mon Oct 24 2016 - 15:39:14 EST


On Mon, Oct 24, 2016 at 11:27 AM, David Miller <davem@xxxxxxxxxxxxx> wrote:
> From: Alexander Duyck <alexander.h.duyck@xxxxxxxxx>
> Date: Mon, 24 Oct 2016 08:06:07 -0400
>
>> This change allows us to pass DMA_ATTR_SKIP_CPU_SYNC which allows us to
>> avoid invoking cache line invalidation if the driver will just handle it
>> via a sync_for_cpu or sync_for_device call.
>>
>> Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
>> Cc: sparclinux@xxxxxxxxxxxxxxx
>> Signed-off-by: Alexander Duyck <alexander.h.duyck@xxxxxxxxx>
>
> This is fine for avoiding the flush for performance reasons, but the
> chip isn't going to write anything back unless the device wrote into
> the area.

That is mostly what I am doing here. The original implementation was
mostly for performance. I am trying to take the attribute that was
already in place for ARM and apply it to all the other architectures.
So what will be happening now is that we call the map function with
this attribute set and then use the sync functions to map it to the
device and then pull the mapping later.

The idea is that if Jesper does his page pool stuff it would be
calling the map/unmap functions and then the drivers would be doing
the sync_for_cpu/sync_for_device. I want to make sure the map is
cheap and we will have to call sync_for_cpu from the drivers anyway
since there is no guarantee if we will have a new page or be reusing
an existing one.

- Alex