Two independent, stable-worthy fixes to the device-private THP migration
path in nouveau, both introduced by commit c32287471077 ("gpu/drm/nouveau:
enable THP support for GPU memory migration") and still present in
mainline.Patch 1 fixes two dma_unmap_page() sites that pass a literal PAGE_SIZE instead of the mapped page_size(). For an order > 0 folio this unmaps less than was mapped and leaks the remainder of the IOMMU/IOVA mapping. Patch 2 accounts for large-folio splits in the ->folio_split() hook, which previously left chunk->callocated unchanged. A folio counted once at allocation (+1) is later freed as N sub-folios (-N), so the unsigned counter underflows on the first split/free cycle and the chunk leaks. Both are confined to nouveau and orthogonal to the in-flight "Remove device private pages from the physical address space" rework, which touches nouveau_dmem_page_addr()/nouveau_dmem_chunk_alloc()/ nouveau_dmem_fini() rather than these teardown/accounting sites; they apply and are needed independently. Signed-off-by: Zhenhao Wan <[email protected]> --- Zhenhao Wan (2): drm/nouveau/dmem: fix mismatched DMA unmap size for large folios drm/nouveau/dmem: fix callocated underflow on large folio split drivers/gpu/drm/nouveau/nouveau_dmem.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) --- base-commit: db2ddb87143519e20a95aa36c60b36107b736a58 change-id: 20260811-b4-nouveau-dmem-thp-fixes-e8ef1afff282 Best regards, -- Zhenhao Wan <[email protected]>
