lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e0be48b9-4871-4124-9d71-8bb7f46ca141@arm.com>
Date: Thu, 15 Feb 2024 11:36:35 +0000
From: Robin Murphy <robin.murphy@....com>
To: Christoph Hellwig <hch@....de>
Cc: Alexander Lobakin <aleksander.lobakin@...el.com>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
 Marek Szyprowski <m.szyprowski@...sung.com>, Joerg Roedel <joro@...tes.org>,
 Will Deacon <will@...nel.org>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 "Rafael J. Wysocki" <rafael@...nel.org>,
 Magnus Karlsson <magnus.karlsson@...el.com>,
 Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
 Alexander Duyck <alexanderduyck@...com>, bpf@...r.kernel.org,
 netdev@...r.kernel.org, iommu@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v3 2/7] dma: avoid redundant calls for sync
 operations

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ