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] [day] [month] [year] [list]
Message-ID: <ba78ff0c-ff42-4240-b318-41ef9160c3de@huawei.com>
Date: Thu, 6 Mar 2025 19:32:30 +0800
From: Yunsheng Lin <linyunsheng@...wei.com>
To: Jason Gunthorpe <jgg@...pe.ca>
CC: <davem@...emloft.net>, <kuba@...nel.org>, <pabeni@...hat.com>,
	<zhangkun09@...wei.com>, <liuyonglong@...wei.com>, <fanghaiqing@...wei.com>,
	Robin Murphy <robin.murphy@....com>, Alexander Duyck
	<alexander.duyck@...il.com>, IOMMU <iommu@...ts.linux.dev>, Jesper Dangaard
 Brouer <hawk@...nel.org>, Ilias Apalodimas <ilias.apalodimas@...aro.org>,
	Eric Dumazet <edumazet@...gle.com>, Simon Horman <horms@...nel.org>,
	<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next v10 4/4] page_pool: skip dma sync operation for
 inflight pages

On 2025/3/6 1:29, Jason Gunthorpe wrote:
> On Wed, Feb 26, 2025 at 07:03:39PM +0800, Yunsheng Lin wrote:
>> Skip dma sync operation for inflight pages before the
>> sync operation in page_pool_item_unmap() as DMA API
>> expects to be called with a valid device bound to a
>> driver as mentioned in [1].
>>
>> After page_pool_destroy() is called, the page is not
>> expected to be recycled back to pool->alloc cache and
>> dma sync operation is not needed when the page is not
>> recyclable or pool->ring is full, so only skip the dma
>> sync operation for the infilght pages by clearing the
>> pool->dma_sync, as rcu sync operation in
>> page_pool_destroy() is paired with rcu lock in
>> page_pool_recycle_in_ring() to ensure that there is no
>> dma sync operation called after rcu sync operation.
> 
> Are you guaranteeing that the cache is made consistent before freeing
> the page back to the mm? That is required..

As page_pool is only calling the sync_for_device API before the
device triggers the DMA, and the above skip is only done for the
sync_for_device API after page_pool_destroy() is called, which
means there is no DMA messing with the page before freeing the
page back to the mm if I understand the question correctly.

And the driver is supposed to call sync_for_cpu API before
passing the page to networking stack, which passes the page
back to page_pool eventually.

> 
> Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ