Skip to content

Commit 8e4c62c

Browse files
committed
page_pool: add DMA_ATTR_WEAK_ORDERING on all mappings
Commit c519fe9 ("bnxt: add dma mapping attributes") added DMA_ATTR_WEAK_ORDERING to DMA attrs on bnxt. It has since spread to a few more drivers (possibly as a copy'n'paste). DMA_ATTR_WEAK_ORDERING only seems to matter on Sparc and PowerPC/cell, the rarity of these platforms is likely why we never bothered adding the attribute in the page pool, even though it should be safe to add. To make the page pool migration in drivers which set this flag less of a risk (of regressing the precious sparc database workloads or whatever needed this) let's add DMA_ATTR_WEAK_ORDERING on all page pool DMA mappings. We could make this a driver opt-in but frankly I don't think it's worth complicating the API. I can't think of a reason why device accesses to packet memory would have to be ordered. Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Acked-by: Somnath Kotur <somnath.kotur@broadcom.com> Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com> Acked-by: Jesper Dangaard Brouer <brouer@redhat.com> Link: https://lore.kernel.org/r/20230417152805.331865-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 4e19516 commit 8e4c62c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

net/core/page_pool.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,8 @@ static bool page_pool_dma_map(struct page_pool *pool, struct page *page)
316316
*/
317317
dma = dma_map_page_attrs(pool->p.dev, page, 0,
318318
(PAGE_SIZE << pool->p.order),
319-
pool->p.dma_dir, DMA_ATTR_SKIP_CPU_SYNC);
319+
pool->p.dma_dir, DMA_ATTR_SKIP_CPU_SYNC |
320+
DMA_ATTR_WEAK_ORDERING);
320321
if (dma_mapping_error(pool->p.dev, dma))
321322
return false;
322323

@@ -484,7 +485,7 @@ void page_pool_release_page(struct page_pool *pool, struct page *page)
484485
/* When page is unmapped, it cannot be returned to our pool */
485486
dma_unmap_page_attrs(pool->p.dev, dma,
486487
PAGE_SIZE << pool->p.order, pool->p.dma_dir,
487-
DMA_ATTR_SKIP_CPU_SYNC);
488+
DMA_ATTR_SKIP_CPU_SYNC | DMA_ATTR_WEAK_ORDERING);
488489
page_pool_set_dma_addr(page, 0);
489490
skip_dma_unmap:
490491
page_pool_clear_pp_info(page);

0 commit comments

Comments
 (0)