On 8/17/26 4:50 PM, Junrui Luo via B4 Relay wrote:
> From: Junrui Luo <[email protected]>
> 
> Commit c32287471077 ("gpu/drm/nouveau: enable THP support for GPU memory
> migration") grew the device-private region that
> nouveau_dmem_chunk_alloc() registers from DMEM_CHUNK_SIZE to
> DMEM_CHUNK_SIZE * NR_CHUNKS, but left the VRAM buffer object backing that
> region at DMEM_CHUNK_SIZE.
> 
> nouveau_dmem_page_addr() returns chunk->bo->offset plus the page's offset
> within the registered region, so every page past the first chunk resolves
> to VRAM outside the buffer object.
> 
> Size the buffer object to the region it backs.
> 
> Fixes: c32287471077 ("gpu/drm/nouveau: enable THP support for GPU memory 
> migration")
> Reported-by: Yuhao Jiang <[email protected]>
> Assisted-by: Claude:claude-opus-5
> Cc: [email protected]
> Signed-off-by: Junrui Luo <[email protected]>
> ---
>  drivers/gpu/drm/nouveau/nouveau_dmem.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nouveau_dmem.c 
> b/drivers/gpu/drm/nouveau/nouveau_dmem.c
> index 9442ec6e1f6c..356ff8f3c1b8 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_dmem.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_dmem.c
> @@ -325,8 +325,8 @@ nouveau_dmem_chunk_alloc(struct nouveau_drm *drm, struct 
> page **ppage,
>       chunk->pagemap.ops = &nouveau_dmem_pagemap_ops;
>       chunk->pagemap.owner = drm->dev;
>  
> -     ret = nouveau_bo_new_pin(&drm->client, NOUVEAU_GEM_DOMAIN_VRAM, 
> DMEM_CHUNK_SIZE,
> -                              &chunk->bo);
> +     ret = nouveau_bo_new_pin(&drm->client, NOUVEAU_GEM_DOMAIN_VRAM,
> +                              DMEM_CHUNK_SIZE * NR_CHUNKS, &chunk->bo);
>       if (ret)
>               goto out_release;
>  
> 

Thanks for catching this!

Acked-by: Balbir Singh <[email protected]>

Reply via email to