AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: "Srinivasan Shanmugam" <srinivasan.shanmugam@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Felix Kuehling <Felix.Kuehling@amd.com>
Subject: Re: [PATCH] drm/amdgpu: Make emit_vm_flush() check explicit in amdgpu_vm_flush()
Date: Mon, 16 Mar 2026 12:18:51 +0530	[thread overview]
Message-ID: <bb50bb58-4101-4908-aec4-be7003321f79@amd.com> (raw)
In-Reply-To: <20260315065528.1932950-1-srinivasan.shanmugam@amd.com>



On 15-Mar-26 12:25 PM, Srinivasan Shanmugam wrote:
> amdgpu_vm_flush() sends commands to the GPU to update the VM page tables
> for a job.
> 
> When a job uses a GPU virtual address space, the GPU needs to refresh
> its address translations after the driver updates the page tables.
> A VM flush tells the GPU to forget old address translations and use the
> updated page table mappings.
> 
> This flush command is not supported on all rings. Only rings that
> implement the emit_vm_flush() callback know how to emit the correct
> hardware command for this operation.
> 
> The function already gates vm_flush_needed on the presence of
> ring->funcs->emit_vm_flush earlier in the logic. However, static
> analysis tools such as Smatch may not track this relationship through
> the vm_flush_needed boolean and warn that emit_vm_flush() could be NULL
> when the VM flush command is emitted later.
> 
> Fixes the below:
> drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:826 amdgpu_vm_flush() error: we previously assumed 'ring->funcs->emit_vm_flush' could be null (see line 788)
> 

I think the code logic is correct and the check is implicit in 
vm_flush_needed. We don't need to write code to eliminate 'false 
warnings'. Moreover, it is inappropriate to use a Fixes tag for this.

Thanks,
Lijo

> Fixes: b3cd285fa68d ("drm/amdgpu: update the PASID mapping only on demand")
> Cc: Dan Carpenter <dan.carpenter@linaro.org>
> Cc: Felix Kuehling <Felix.Kuehling@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index b89013a6aa0b..cc79cb7dd4e1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -807,7 +807,7 @@ void amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,
>   	if (cleaner_shader_needed)
>   		ring->funcs->emit_cleaner_shader(ring);
>   
> -	if (vm_flush_needed) {
> +	if (vm_flush_needed && ring->funcs->emit_vm_flush) {
>   		trace_amdgpu_vm_flush(ring, job->vmid, job->vm_pd_addr);
>   		amdgpu_ring_emit_vm_flush(ring, job->vmid, job->vm_pd_addr);
>   	}


  reply	other threads:[~2026-03-16  6:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-15  6:55 [PATCH] drm/amdgpu: Make emit_vm_flush() check explicit in amdgpu_vm_flush() Srinivasan Shanmugam
2026-03-16  6:48 ` Lazar, Lijo [this message]
2026-03-16  7:04   ` SHANMUGAM, SRINIVASAN
2026-03-16  8:26     ` Christian König
2026-03-16 10:49     ` Dan Carpenter
2026-03-16  8:17 ` Christian König

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=bb50bb58-4101-4908-aec4-be7003321f79@amd.com \
    --to=lijo.lazar@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dan.carpenter@linaro.org \
    --cc=srinivasan.shanmugam@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox