Hi Karl,
Subject: Re: [PATCH v2] udmabuf: respect the device's maximum segment size
On Tue, Sep 29, 2026 at 07:48:35AM +0100, Karl Mehltretter wrote:
get_sg_table() merges physically contiguous pages without accounting for the mapping device's maximum segment size. This affects both importer mappings and the udmabuf misc device mapping used for
CPU
access.
With DMA_API_DEBUG enabled, DMA_BUF_IOCTL_SYNC on a 64 MiB
udmabuf
reports:
DMA-API: misc udmabuf: mapping sg segment longer than device
claims to
support [len=65884160] [max=65536]
Use sg_alloc_table_from_pages_segment() with the mapping device's maximum segment size. Return -EINVAL if the limit is smaller than PAGE_SIZE because the page-based allocator cannot honor it.
Before commit 5bf888673e0d ("udmabuf: Do not create malformed scatterlists"), each entry covered one page.
Fixes: 5bf888673e0d ("udmabuf: Do not create malformed
scatterlists")
Reviewed-by: Jason Gunthorpe jgg@nvidia.com Assisted-by: LLM Signed-off-by: Karl Mehltretter kmehltretter@gmail.com
Friendly ping on v2. It has Reviewed-by tags from Jason and Christian.
Will push this patch to drm-misc-next soon (in a day or two).
Thanks, Vivek
Thanks, Karl