From: "Christian König" <christian.koenig@amd.com>
To: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Vitaly Prosyak <vitaly.prosyak@amd.com>
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/2] drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini
Date: Mon, 22 Jun 2026 14:19:19 +0200 [thread overview]
Message-ID: <7a8a2bd8-9da5-48f4-8a42-bb7924f6721f@amd.com> (raw)
In-Reply-To: <20260622092859.3600-1-pierre-eric.pelloux-prayer@amd.com>
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);
prev parent reply other threads:[~2026-06-22 12:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 9:39 ` [PATCH v1 1/2] drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini sashiko-bot
2026-06-22 12:19 ` 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=7a8a2bd8-9da5-48f4-8a42-bb7924f6721f@amd.com \
--to=christian.koenig@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pierre-eric.pelloux-prayer@amd.com \
--cc=simona@ffwll.ch \
--cc=vitaly.prosyak@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