summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorDavid Hu <xuehaohu@google.com>2026-09-01 17:08:49 +0000
committerChristian König <christian.koenig@amd.com>2026-09-11 12:10:01 +0200
commit06dd5e1ae8ce4e129791087c8c66594950f0ba03 (patch)
treebba16104f47ecf8a991c63afe53aebb24e2e8507 /tools/perf/scripts/python
parentb344ca94e8cc85796f16ea25e2e5a8e0303fe813 (diff)
downloadlinux-next-06dd5e1ae8ce4e129791087c8c66594950f0ba03.tar.gz
linux-next-06dd5e1ae8ce4e129791087c8c66594950f0ba03.zip
dma-buf: Split sgl by largest page-aligned chunk
Currently, `fill_sg_entry()` splits the scatterlist using `UINT_MAX`. This creates a non-page-aligned DMA length (`0xFFFFFFFF`) for the first entry, resulting in non-page-aligned DMA addresses for all subsequent entries. While the underlying IOMMU mapping may be contiguous, hardware DMA engines often require explicit address alignment (e.g., page, cacheline, or storage sector boundaries). Passing unaligned addresses and lengths can cause explicit failures in DMA descriptor creation or silent data corruption if lower unaligned bits are truncated. In addition, a non-page-aligned sgl length will trigger an edge case in `ib_umem_find_best_pgsz()`. In case of a discontinuity in later buffers, we will have a `va` with lowest bit set to 1. That will lead to `ib_umem_find_best_pgsz()` always return 0, and break the promise to find best page size for the mapping on the NIC side. Fix this by splitting the scatterlist by the largest possible page aligned chunk within `UINT_MAX` (`ALIGN_DOWN(UINT_MAX, PAGE_SIZE)`). This ensures all scatterlist DMA addresses and lengths remain page aligned, while minimizing the total number of sgl entries. Page-aligned entries allow the system to cleanly chunk payloads into PCIe MaxPayloadSize (MPS) (e.g., 128 bytes, 256 bytes, 512 bytes). As a result, this may help reduce TLP fragmentation in P2P transfers and alleviate potential congestion within a logical PCIe switch partition, especially when Relaxed Ordering is not possible due to hardware constraints. Reported-by: sashiko-bot <sashiko-bot@kernel.org> Closes: https://lore.kernel.org/all/20260609165431.778061F00893@smtp.kernel.org/ Fixes: 3aa31a8bb11e ("dma-buf: provide phys_vec to scatter-gather mapping routine") Cc: stable@vger.kernel.org Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: David Hu <xuehaohu@google.com> Signed-off-by: Christian König <christian.koenig@amd.com> Link: https://lore.kernel.org/r/20260901170849.4052816-3-dhu@x6u.co
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions