* [PATCH v1 1/2] drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini
@ 2026-06-22 9:28 Pierre-Eric Pelloux-Prayer
2026-06-22 9:28 ` [PATCH v1 2/2] drm/amdgpu: remove left-over variable Pierre-Eric Pelloux-Prayer
2026-06-22 12:19 ` [PATCH v1 1/2] drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini Christian König
0 siblings, 2 replies; 3+ messages in thread
From: Pierre-Eric Pelloux-Prayer @ 2026-06-22 9:28 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Simona Vetter,
Vitaly Prosyak
Cc: Pierre-Eric Pelloux-Prayer, amd-gfx, dri-devel, linux-kernel
The commit referenced below restarts the CS if the validation is
still in progress. When debug_vm is enabled, all BOs from the CS
are invalidated so we will hit an infinite loop.
To avoid that, defer BO invalidation to amdgpu_cs_parser_fini.
Fixes: 83ac717d7837 ("drm/amdgpu: restart the CS if some parts of the VM are still invalidated")
Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 30 ++++++++++++++------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index d63fbc7c568d..7e75c536dab3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -1180,19 +1180,6 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)
job->vm_pd_addr = amdgpu_gmc_pd_addr(vm->root.bo);
}
- if (adev->debug_vm) {
- /* Invalidate all BOs to test for userspace bugs */
- amdgpu_bo_list_for_each_entry(e, p->bo_list) {
- struct amdgpu_bo *bo = e->bo;
-
- /* ignore duplicates */
- if (!bo)
- continue;
-
- amdgpu_vm_bo_invalidate(bo, false);
- }
- }
-
return 0;
}
@@ -1382,6 +1369,8 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
/* Cleanup the parser structure */
static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser)
{
+ struct amdgpu_device *adev = parser->adev;
+ struct amdgpu_bo_list_entry *e;
unsigned int i;
amdgpu_sync_free(&parser->sync);
@@ -1397,8 +1386,21 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser)
if (parser->ctx)
amdgpu_ctx_put(parser->ctx);
- if (parser->bo_list)
+ if (parser->bo_list) {
+ if (adev->debug_vm) {
+ /* Invalidate all BOs to test for userspace bugs */
+ amdgpu_bo_list_for_each_entry(e, parser->bo_list) {
+ struct amdgpu_bo *bo = e->bo;
+
+ /* ignore duplicates */
+ if (!bo)
+ continue;
+
+ amdgpu_vm_bo_invalidate(bo, false);
+ }
+ }
amdgpu_bo_list_put(parser->bo_list);
+ }
for (i = 0; i < parser->nchunks; i++)
kvfree(parser->chunks[i].kdata);
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v1 2/2] drm/amdgpu: remove left-over variable
2026-06-22 9:28 [PATCH v1 1/2] drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini Pierre-Eric Pelloux-Prayer
@ 2026-06-22 9:28 ` Pierre-Eric Pelloux-Prayer
2026-06-22 12:19 ` [PATCH v1 1/2] drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini Christian König
1 sibling, 0 replies; 3+ messages in thread
From: Pierre-Eric Pelloux-Prayer @ 2026-06-22 9:28 UTC (permalink / raw)
To: Alex Deucher, Christian König, David Airlie, Simona Vetter
Cc: Pierre-Eric Pelloux-Prayer, amd-gfx, dri-devel, linux-kernel
887db1e49a73 ("drm/amdgpu: Merge debug module parameters") removed amdgpu_vm_debug
handling but this variable was forgotten.
Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index e2d4be3c111d..3b78503ec78e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -182,7 +182,6 @@ extern int amdgpu_vm_size;
extern int amdgpu_vm_block_size;
extern int amdgpu_vm_fragment_size;
extern int amdgpu_vm_fault_stop;
-extern int amdgpu_vm_debug;
extern int amdgpu_vm_update_mode;
extern int amdgpu_exp_hw_support;
extern int amdgpu_dc;
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1 1/2] drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini
2026-06-22 9:28 [PATCH v1 1/2] drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini Pierre-Eric Pelloux-Prayer
2026-06-22 9:28 ` [PATCH v1 2/2] drm/amdgpu: remove left-over variable Pierre-Eric Pelloux-Prayer
@ 2026-06-22 12:19 ` Christian König
1 sibling, 0 replies; 3+ messages in thread
From: Christian König @ 2026-06-22 12:19 UTC (permalink / raw)
To: Pierre-Eric Pelloux-Prayer, Alex Deucher, David Airlie,
Simona Vetter, Vitaly Prosyak
Cc: amd-gfx, dri-devel, linux-kernel
On 6/22/26 11:28, Pierre-Eric Pelloux-Prayer wrote:
> The commit referenced below restarts the CS if the validation is
> still in progress. When debug_vm is enabled, all BOs from the CS
> are invalidated so we will hit an infinite loop.
>
> To avoid that, defer BO invalidation to amdgpu_cs_parser_fini.
>
> Fixes: 83ac717d7837 ("drm/amdgpu: restart the CS if some parts of the VM are still invalidated")
> Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com> for both patches.
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 30 ++++++++++++++------------
> 1 file changed, 16 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index d63fbc7c568d..7e75c536dab3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -1180,19 +1180,6 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)
> job->vm_pd_addr = amdgpu_gmc_pd_addr(vm->root.bo);
> }
>
> - if (adev->debug_vm) {
> - /* Invalidate all BOs to test for userspace bugs */
> - amdgpu_bo_list_for_each_entry(e, p->bo_list) {
> - struct amdgpu_bo *bo = e->bo;
> -
> - /* ignore duplicates */
> - if (!bo)
> - continue;
> -
> - amdgpu_vm_bo_invalidate(bo, false);
> - }
> - }
> -
> return 0;
> }
>
> @@ -1382,6 +1369,8 @@ static int amdgpu_cs_submit(struct amdgpu_cs_parser *p,
> /* Cleanup the parser structure */
> static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser)
> {
> + struct amdgpu_device *adev = parser->adev;
> + struct amdgpu_bo_list_entry *e;
> unsigned int i;
>
> amdgpu_sync_free(&parser->sync);
> @@ -1397,8 +1386,21 @@ static void amdgpu_cs_parser_fini(struct amdgpu_cs_parser *parser)
>
> if (parser->ctx)
> amdgpu_ctx_put(parser->ctx);
> - if (parser->bo_list)
> + if (parser->bo_list) {
> + if (adev->debug_vm) {
> + /* Invalidate all BOs to test for userspace bugs */
> + amdgpu_bo_list_for_each_entry(e, parser->bo_list) {
> + struct amdgpu_bo *bo = e->bo;
> +
> + /* ignore duplicates */
> + if (!bo)
> + continue;
> +
> + amdgpu_vm_bo_invalidate(bo, false);
> + }
> + }
> amdgpu_bo_list_put(parser->bo_list);
> + }
>
> for (i = 0; i < parser->nchunks; i++)
> kvfree(parser->chunks[i].kdata);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-22 12:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-22 9:28 [PATCH v1 1/2] drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini Pierre-Eric Pelloux-Prayer
2026-06-22 9:28 ` [PATCH v1 2/2] drm/amdgpu: remove left-over variable Pierre-Eric Pelloux-Prayer
2026-06-22 12:19 ` [PATCH v1 1/2] drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini Christian König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®