All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Jesse Zhang <Jesse.Zhang@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com, Prike Liang <prike.liang@amd.com>,
	Sunil Khatri <sunil.khatri@amd.com>
Subject: Re: [PATCH] drm/amdgpu: keep PRT mappings off the VM state lists again
Date: Mon, 19 Oct 2026 16:14:18 +0200	[thread overview]
Message-ID: <ea34abe3-0d4e-4754-ae81-e9e46c0be86d@amd.com> (raw)
In-Reply-To: <20261019014711.1486757-1-Jesse.Zhang@amd.com>



On 10/19/26 03:46, Jesse Zhang wrote:
> Since amdgpu_vm_bo_insert_map() moves all BOs to needs_update, it moves
> the PRT bo_va, which has no BO, there as well. amdgpu_vm_bo_update()
> leaves it there, so the next amdgpu_vm_handle_moved() dereferences the
> NULL BO.
> 
> A CS after mapping a PRT range:
> 
>   BUG: kernel NULL pointer dereference, address: 0000000000000158
>   RIP: 0010:amdgpu_vm_handle_moved+0x17a/0x200 [amdgpu]
>    amdgpu_cs_ioctl+0x1579/0x2510 [amdgpu]
> 
> Only move bo_vas with a BO to needs_update.
> 
> Fixes: 3a1abd9743c2 ("drm/amdgpu: fix amdgpu_vm_bo_insert_map to let bo gets update")
> Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index c79a673d9d2e..9d6f93d4ff38 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -1832,7 +1832,8 @@ static void amdgpu_vm_bo_insert_map(struct amdgpu_device *adev,
>  	if (mapping->flags & AMDGPU_VM_PAGE_PRT)
>  		amdgpu_vm_prt_get(adev);
>  
> -	if (!bo_va->base.moved)
> +	/* PRT mappings have no BO and are kept off the state lists */
> +	if (bo_va->base.bo && !bo_va->base.moved)
>  		amdgpu_vm_bo_needs_update(&bo_va->base);
>  
>  	trace_amdgpu_vm_bo_map(bo_va, mapping);


      reply	other threads:[~2026-10-19 14:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19  1:46 [PATCH] drm/amdgpu: keep PRT mappings off the VM state lists again Jesse Zhang
2026-10-19 14:14 ` Christian König [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ea34abe3-0d4e-4754-ae81-e9e46c0be86d@amd.com \
    --to=christian.koenig@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Jesse.Zhang@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=prike.liang@amd.com \
    --cc=sunil.khatri@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.