lkml.org 
[lkml]   [2024]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH net-next v3 2/7] dma: avoid redundant calls for sync operations
From
On 15/02/2024 5:08 am, Christoph Hellwig wrote:
> On Wed, Feb 14, 2024 at 05:55:23PM +0000, Robin Murphy wrote:
>>> #define DMA_F_PCI_P2PDMA_SUPPORTED (1 << 0)
>>> +#define DMA_F_CAN_SKIP_SYNC BIT(1)
>>
>> Yuck, please be consistent - either match the style of the existing code,
>> or change that to BIT(0) as well.
>
> Just don't use BIT() ever. It doesn't save any typing and creates a
> totally pointless mental indirection.
>
>> I guess this was the existing condition from dma_need_sync(), but now it's
>> on a one-off slow path it might be nice to check the sync_sg_* ops as well
>> for completeness, or at least comment that nobody should be implementing
>> those without also implementing the sync_single_* ops.
>
> Implementing only one and not the other doesn't make any sense. Maybe
> a debug check for that is ok, but thing will break badly if they aren't
> in sync anyway.

In principle we *could* have an implementation which used bouncing
purely to merge coherent scatterlist segments, thus didn't need to do
anything for single mappings. I agree that it wouldn't seem like a
particularly realistic thing to do these days, but I don't believe the
API rules it out, so it might be nice to enforce that assumption
somewhere if we are actually relying on it (although I also concur that
this may not necessarily be the ideal place to do that in general).

Thanks,
Robin.

\
 
 \ /
  Last update: 2024-05-27 15:05    [W:0.094 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site