drm/amdgpu: Raise dma resv usage for created TLB fence
Subsystems (2)
PATCH 1/1 drm/amdgpu: Raise dma resv usage for created TLB fence
When using SDMA for PT updates, a TLB fence hooked to a buffer objects dma resv object with usage declared as BOOKKEEP leaves a chance for TLB flush to occur prematurely. This will lead to a page fault. Raising the usage from BOOKKEEP to KERNEL removes this possibility.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -1
@@ -928,7 +928,7 @@ amdgpu_vm_tlb_flush(struct amdgpu_vm_update_params *params,/* Makes sure no PD/PT is freed before the flush */ dma_resv_add_fence (vm->root.bo->tbo.base.resv, *fence, -DMA_RESV_USAGE_BOOKKEEP ); +DMA_RESV_USAGE_KERNEL ); } }
Signature · 1 line
2.43.0
Christian König
maintainerAm 05.09.24 um 10:58 schrieb Dejan Andjelkovic:
Quoted 5 lines
When using SDMA for PT updates, a TLB fence hooked to a buffer objects dma resv object with usage declared as BOOKKEEP leaves a chance for TLB flush to occur prematurely. This will lead to a page fault. Raising the usage from BOOKKEEP to KERNEL removes this possibility.
Well that's complete nonsense. The usage model is for implicit syncing and not even remotely related to TLB flushing.
What exactly is the problem you run into?
Regards,
Christian.
Quoted 19 lines
Signed-off-by Dejan Andjelkovic <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-1@@ -928,7 +928,7 @@ amdgpu_vm_tlb_flush(struct amdgpu_vm_update_params *params,/* Makes sure no PD/PT is freed before the flush */ dma_resv_add_fence (vm->root.bo->tbo.base.resv, *fence, -DMA_RESV_USAGE_BOOKKEEP ); +DMA_RESV_USAGE_KERNEL ); } }
[AMD Official Use Only - AMD Internal Distribution Only]
Hi there. We're running into a page fault issue that's very easily reproducible on a SRIOV environment when using SDMA for page table updates. Going through mapping logs and trace files, it seems TLB flush is occurring prematurely. Changing the usage to KERNEL completely stops the page fault from occurring with no performance impact, which was confirmed with extensive testing. Looking through amdgpu_vm_sdma.c, namely within amdgpu_vm_sdma_update when waiting for PD/PT moves to be completed, fences are iterated with KERNEL usage specified which are then added as a job dependency.
Best regards,
Dejan
________________________________
From: Koenig, Christian <[email protected]>
Sent: Thursday, September 5, 2024 1:17 PM
To: Andjelkovic, Dejan <[email protected]>; [email protected] <[email protected]>
Cc: Prica, Nikola <[email protected]>; Kuehling, Felix <[email protected]>; Deng, Emily <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Raise dma resv usage for created TLB fence
Am 05.09.24 um 10:58 schrieb Dejan Andjelkovic:
Quoted 5 lines
When using SDMA for PT updates, a TLB fence hooked to a buffer objects dma resv object with usage declared as BOOKKEEP leaves a chance for TLB flush to occur prematurely. This will lead to a page fault. Raising the usage from BOOKKEEP to KERNEL removes this possibility.
Well that's complete nonsense. The usage model is for implicit syncing and not even remotely related to TLB flushing.
What exactly is the problem you run into?
Regards,
Christian.
Quoted 19 lines
Signed-off-by Dejan Andjelkovic <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-1@@ -928,7 +928,7 @@ amdgpu_vm_tlb_flush(struct amdgpu_vm_update_params *params,/* Makes sure no PD/PT is freed before the flush */ dma_resv_add_fence (vm->root.bo->tbo.base.resv, *fence, -DMA_RESV_USAGE_BOOKKEEP ); +DMA_RESV_USAGE_KERNEL ); } }
Christian König
maintainerWell that explanation doesn't seem to make much sense either.
What do you mean with TLB flush is occurring prematurely?
Regards,
Christian.
Am 05.09.24 um 14:38 schrieb Andjelkovic, Dejan:
Quoted 51 lines
[AMD Official Use Only - AMD Internal Distribution Only]
Hi there. We're running into a page fault issue that's very easily reproducible on a SRIOV environment when using SDMA for page table updates. Going through mapping logs and trace files, it seems TLB flush is occurring prematurely. Changing the usage to KERNEL completely stops the page fault from occurring with no performance impact, which was confirmed with extensive testing. Looking through
amdgpu_vm_sdma.c, namely withinamdgpu_vm_sdma_updatewhen waiting for PD/PT moves to be completed, fences are iterated with KERNEL usage specified which are then added as a job dependency.Best regards,
Dejan
------------------------------------------------------------------------
*From:* Koenig, Christian <[email protected]>
*Sent:* Thursday, September 5, 2024 1:17 PM
*To:* Andjelkovic, Dejan <[email protected]>; [email protected] <[email protected]> *Cc:* Prica, Nikola <[email protected]>; Kuehling, Felix <[email protected]>; Deng, Emily <[email protected]> *Subject:* Re: [PATCH] drm/amdgpu: Raise dma resv usage for created TLB fence
Am 05.09.24 um 10:58 schrieb Dejan Andjelkovic:Quoted 5 lines
When using SDMA for PT updates, a TLB fence hooked to a buffer objects dma resv object with usage declared as BOOKKEEP leaves a chance for TLB flush to occur prematurely. This will lead to a page fault. Raising the usage from BOOKKEEP to KERNEL removes this possibility.
Well that's complete nonsense. The usage model is for implicit syncing and not even remotely related to TLB flushing.
What exactly is the problem you run into?
Regards,
Christian.Review
Quoted 7 lines
Signed-off-by Dejan Andjelkovic <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.cdrivers/gpu/drm/amd/amdgpu/amdgpu_vm.c amdgpu_vm_tlb_flush(struct
Quoted 4 lines
index
f93804902fd3..8efc2cf9bbb0100644drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0@@ -928,7 +928,7 @@ amdgpu_vm_tlb_flush(struct
amdgpu_vm_update_params*params,Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-1/* Makes sure no PD/PT is freed before the flush */dma_resv_add_fence (vm->root.bo->tbo.base.resv, *fence, -DMA_RESV_USAGE_BOOKKEEP ); +DMA_RESV_USAGE_KERNEL ); } }
[AMD Official Use Only - AMD Internal Distribution Only]
I might have worded that poorly, I meant that it seems like TLB flush is out of sync with the SDMA update, which leads to a page fault reliably. I don't feel it has anything to do with the implicit sync in itself. When TLB fence is created it's added to the dma_resv of the vm's root buffer object with BOOKKEEP usage specified, in order to make sure no PD/PT is freed before the flush. But I don't think it's being added as a job dependency within the amdgpu_vm_sdma_update, we're adding all the fences found within the dma_resv object with KERNEL usage specified. I may be missing something so I'd love to hear what you think.
Best regards,
Dejan
________________________________
From: Koenig, Christian <[email protected]>
Sent: Thursday, September 5, 2024 2:40 PM
To: Andjelkovic, Dejan <[email protected]>; [email protected] <[email protected]>
Cc: Prica, Nikola <[email protected]>; Kuehling, Felix <[email protected]>; Deng, Emily <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Raise dma resv usage for created TLB fence
Well that explanation doesn't seem to make much sense either.
What do you mean with TLB flush is occurring prematurely?
Regards,
Christian.
Am 05.09.24 um 14:38 schrieb Andjelkovic, Dejan:
[AMD Official Use Only - AMD Internal Distribution Only]
Hi there. We're running into a page fault issue that's very easily reproducible on a SRIOV environment when using SDMA for page table updates. Going through mapping logs and trace files, it seems TLB flush is occurring prematurely. Changing the usage to KERNEL completely stops the page fault from occurring with no performance impact, which was confirmed with extensive testing. Looking through amdgpu_vm_sdma.c, namely within amdgpu_vm_sdma_update when waiting for PD/PT moves to be completed, fences are iterated with KERNEL usage specified which are then added as a job dependency.
Best regards,
Dejan
________________________________
From: Koenig, Christian <[email protected]><mailto:[email protected]>
Sent: Thursday, September 5, 2024 1:17 PM
To: Andjelkovic, Dejan <[email protected]><mailto:[email protected]>; [email protected]<mailto:[email protected]> <[email protected]><mailto:[email protected]>
Cc: Prica, Nikola <[email protected]><mailto:[email protected]>; Kuehling, Felix <[email protected]><mailto:[email protected]>; Deng, Emily <[email protected]><mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu: Raise dma resv usage for created TLB fence
Am 05.09.24 um 10:58 schrieb Dejan Andjelkovic:
Quoted 5 lines
When using SDMA for PT updates, a TLB fence hooked to a buffer objects dma resv object with usage declared as BOOKKEEP leaves a chance for TLB flush to occur prematurely. This will lead to a page fault. Raising the usage from BOOKKEEP to KERNEL removes this possibility.
Well that's complete nonsense. The usage model is for implicit syncing and not even remotely related to TLB flushing.
What exactly is the problem you run into?
Regards,
Christian.
Quoted 19 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-1@@ -928,7 +928,7 @@ amdgpu_vm_tlb_flush(struct amdgpu_vm_update_params *params,/* Makes sure no PD/PT is freed before the flush */ dma_resv_add_fence (vm->root.bo->tbo.base.resv, *fence, -DMA_RESV_USAGE_BOOKKEEP ); +DMA_RESV_USAGE_KERNEL ); } }
Christian König
maintainerWell that's the whole reason I'm asking :)
Why do you think it should be added as dependency in amdgpu_vm_sdma_update? As far as I can see that is complete nonsense.
Page table updates never depend on TLB flushes, it's the TLB flush which depends on the page table update.
Regards,
Christian.
Am 06.09.24 um 16:10 schrieb Andjelkovic, Dejan:
Quoted 75 lines
[AMD Official Use Only - AMD Internal Distribution Only]
I might have worded that poorly, I meant that it seems like TLB flush is out of sync with the SDMA update, which leads to a page fault reliably. I don't feel it has anything to do with the implicit sync in itself. When TLB fence is created it's added to the
dma_resvof the vm's root buffer object with BOOKKEEP usage specified, in order to make sure no PD/PT is freed before the flush. But I don't think it's being added as a job dependency within theamdgpu_vm_sdma_update, we're adding all the fences found within thedma_resvobject with KERNEL usage specified. I may be missing something so I'd love to hear what you think.Best regards,
Dejan
------------------------------------------------------------------------
*From:* Koenig, Christian <[email protected]>
*Sent:* Thursday, September 5, 2024 2:40 PM
*To:* Andjelkovic, Dejan <[email protected]>; [email protected] <[email protected]> *Cc:* Prica, Nikola <[email protected]>; Kuehling, Felix <[email protected]>; Deng, Emily <[email protected]> *Subject:* Re: [PATCH] drm/amdgpu: Raise dma resv usage for created TLB fence
Well that explanation doesn't seem to make much sense either.What do you mean with TLB flush is occurring prematurely?
Regards,
Christian.Am 05.09.24 um 14:38 schrieb Andjelkovic, Dejan:
Quoted 52 lines
[AMD Official Use Only - AMD Internal Distribution Only]
Hi there. We're running into a page fault issue that's very easily reproducible on a SRIOV environment when using SDMA for page table updates. Going through mapping logs and trace files, it seems TLB flush is occurring prematurely. Changing the usage to KERNEL completely stops the page fault from occurring with no performance impact, which was confirmed with extensive testing. Looking through
amdgpu_vm_sdma.c, namely withinamdgpu_vm_sdma_updatewhen waiting for PD/PT moves to be completed, fences are iterated with KERNEL usage specified which are then added as a job dependency.Best regards,
Dejan
------------------------------------------------------------------------
*From:* Koenig, Christian <[email protected]> <mailto:[email protected]>
*Sent:* Thursday, September 5, 2024 1:17 PM
*To:* Andjelkovic, Dejan <[email protected]> <mailto:[email protected]>; [email protected] <mailto:[email protected]> <[email protected]> <mailto:[email protected]> *Cc:* Prica, Nikola <[email protected]> <mailto:[email protected]>; Kuehling, Felix <[email protected]> <mailto:[email protected]>; Deng, Emily <[email protected]> <mailto:[email protected]> *Subject:* Re: [PATCH] drm/amdgpu: Raise dma resv usage for created TLB fence
Am 05.09.24 um 10:58 schrieb Dejan Andjelkovic:Quoted 5 lines
When using SDMA for PT updates, a TLB fence hooked to a buffer objects dma resv object with usage declared as BOOKKEEP leaves a chance for TLB flush to occur prematurely. This will lead to a page fault. Raising the usage from BOOKKEEP to KERNEL removes this possibility.
Well that's complete nonsense. The usage model is for implicit syncing and not even remotely related to TLB flushing.
What exactly is the problem you run into?
Regards,
Christian.Quoted 2 lines
Signed-off-by Dejan Andjelkovic <[email protected]><mailto:[email protected]>
Review
Quoted 5 lines
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.cdrivers/gpu/drm/amd/amdgpu/amdgpu_vm.c amdgpu_vm_tlb_flush(struct
Quoted 4 lines
index
f93804902fd3..8efc2cf9bbb0100644drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +0
-0@@ -928,7 +928,7 @@ amdgpu_vm_tlb_flush(struct
amdgpu_vm_update_params*params,Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1
-1/* Makes sure no PD/PT is freed before the flush */dma_resv_add_fence (vm->root.bo->tbo.base.resv, *fence, -DMA_RESV_USAGE_BOOKKEEP ); +DMA_RESV_USAGE_KERNEL ); } }