On 11/27/26 07:30, Philipp Stanner wrote:
> On Wed, 2026-11-25 at 16:30 +0100, Christian König wrote:
>> This not only fixes rare GPU page faults in the kernel queues but also
>> potentially issues with the user queues should a PDE update make a TLB
>> invalidation necessary.
>>
>> v2: also handle the case where the chain head is already signaled as
>>     pointed out by Alan.
>>
>> Signed-off-by: Christian König <[email protected]>
>> Reported-by: Li, Chong(Alan) <[email protected]>
> 
> You mention "fixes" above and there was a "report". Cc stable?

We usually add that while discussing the patch, but yeah I agree that we need 
to backport this.

> 
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c        | 173 +++++++++---------
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h        |  32 +---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c    |   3 +-
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c   |   3 -
>>  .../gpu/drm/amd/amdgpu/amdgpu_vm_tlb_fence.c  |   2 +-
>>  5 files changed, 94 insertions(+), 119 deletions(-)
> 
> Do you think it might be possible to split this rework up into smaller
> commits that are more atomic and, thus, easier to review / understand?

I already tried that and always ended up with something which was broken in 
between patches.

>>  
>>      amdgpu_amdkfd_gpuvm_destroy_cb(adev, vm);
>> @@ -2876,10 +2885,6 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, 
>> struct amdgpu_vm *vm)
>>                                    false, MAX_SCHEDULE_TIMEOUT);
>>      dma_fence_wait(vm->last_unlocked, false);
>>      dma_fence_put(vm->last_unlocked);
>> -    dma_fence_wait(vm->last_seq_flush, false);
>> -    /* Make sure that all fence callbacks have completed */
>> -    dma_fence_lock_irqsave(vm->last_seq_flush, flags);
>> -    dma_fence_unlock_irqrestore(vm->last_seq_flush, flags);
> 
> Certainly nice to see, but I can't derive from the commit message why
> it's now ensured that the fence callbacks have ran?

The point is the callback which increases the sequence number after the fences 
signaled is removed.

So there is no chance that they can race any more. I will update the commit 
message.

> 
> 
>>      dma_fence_put(vm->last_seq_flush);
>>      dma_fence_put(vm->last_tlb_inv);
> 
> […]
> 
>>  
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
>> index d03b9bbe20c7c..17a579dbf7b90 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
>> @@ -122,8 +122,7 @@ static int amdgpu_vm_cpu_commit(struct 
>> amdgpu_vm_update_params *p,
>>  {
>>      struct amdgpu_device *adev = p->adev;
>>  
>> -    if (p->needs_flush)
>> -            atomic64_inc(&p->vm->tlb_seq);
>> +    *fence = dma_fence_get_stub();
>>  
>>      mb();
> 
> Hey look, an undocumented mb! ^_^

Yeah the comment directly below explains why it is here. It is just not showing 
up in this diff and the technical relationship is not so straight forward to 
understand.

> Would be a good opportunity to document why it exists. Does it order
> against dma_fence_get_stub()? Seems unlikely…

No, most mb() in amdgpu should actually be a dma_wmb() which needs to be used 
so that the HW sees written values.

It's just that the code is older than the dma_wmb() function and nobody had the 
time to update all mb() occasions in the driver and test if nothing was missed.

Regards,
Christian.

> 
> 

Reply via email to