FAILED: patch "[PATCH] drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini" failed to apply to 6.12-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x d8726ef11512754a68c0ab53c57634a569b8feff
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026080542-reload-plentiful-f343@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From d8726ef11512754a68c0ab53c57634a569b8feff Mon Sep 17 00:00:00 2001
From: Pierre-Eric Pelloux-Prayer <[email protected]>
Date: Mon, 22 Jun 2026 10:11:22 +0200
Subject: [PATCH] drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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.
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +16 -14
@@ -1177,19 +1177,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 ; }
@@ -1378,6 +1365,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);
@@ -1393,8 +1382,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);
Sasha Levin
maintainerPATCH 1/2 drm/amdgpu: remove unused function parameter
From: Yunxiang Li <[email protected]>
[ Upstream commit a541a6e865ecd8dfd8df6eeb134cc20e7139d329 ]
amdgpu_vm_bo_invalidate doesn't use the adev parameter and not all callers have a reference to adev handy, so remove it for cleanliness.
Stable-dep-of: d8726ef11512 ("drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini")
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 3 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 4 +--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 3 +-- 6 files changed, 7 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +2 -2
@@ -1109,7 +1109,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)* We can't use gang submit on with reserved VMIDs when the VM changes * can't be invalidated by more than one engine at the same time. */ -if (p->gang_size >1 && !p->adev->vm_manager.concurrent_flush) { +if (p->gang_size >1 && !adev->vm_manager.concurrent_flush) {for (i =0 ; i < p->gang_size; ++i) {struct drm_sched_entity *entity = p->entities[i];struct drm_gpu_scheduler *sched = entity->rq->sched;
@@ -1193,7 +1193,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)if (!bo)continue ; -amdgpu_vm_bo_invalidate (adev, bo, false); +amdgpu_vm_bo_invalidate (bo, false); } }
drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c +1 -1
@@ -382,7 +382,7 @@ amdgpu_dma_buf_move_notify(struct dma_buf_attachment *attach)/* FIXME: This should be after the "if", but needs a fix to make sure * DMABuf imports are initialized in the right VM list. */ -amdgpu_vm_bo_invalidate (adev, bo, false); +amdgpu_vm_bo_invalidate (bo, false);if (!bo->tbo.resource || bo->tbo.resource->mem_type ==TTM_PL_SYSTEM )return ;
drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +1 -2
@@ -840,7 +840,6 @@ int amdgpu_gem_va_ioctl(struct drm_device *dev, void *data,int amdgpu_gem_op_ioctl (struct drm_device *dev,void *data,struct drm_file *filp) { -struct amdgpu_device *adev =drm_to_adev (dev);struct drm_amdgpu_gem_op *args = data;struct drm_gem_object *gobj;struct amdgpu_vm_bo_base *base;
@@ -900,7 +899,7 @@ int amdgpu_gem_op_ioctl(struct drm_device *dev, void *data, robj->allowed_domains |=AMDGPU_GEM_DOMAIN_GTT ;if (robj->flags &AMDGPU_GEM_CREATE_VM_ALWAYS_VALID ) -amdgpu_vm_bo_invalidate (adev, robj, true); +amdgpu_vm_bo_invalidate (robj, true);amdgpu_bo_unreserve (robj);break ;
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +1 -2
@@ -1152,7 +1152,6 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,bool evict, struct ttm_resource *new_mem) { - struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev); struct ttm_resource *old_mem = bo->resource;struct amdgpu_bo *abo;
@@ -1160,7 +1159,7 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,return ; abo =ttm_to_amdgpu_bo (bo); -amdgpu_vm_bo_invalidate (adev, abo, evict); +amdgpu_vm_bo_invalidate (abo, evict);amdgpu_bo_kunmap (abo);
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +1 -3
@@ -2139,14 +2139,12 @@ bool amdgpu_vm_evictable(struct amdgpu_bo *bo)/** * amdgpu_vm_bo_invalidate - mark the bo as invalid * -* @adev: amdgpu_device pointer * @bo: amdgpu buffer object * @evicted: is the BO evicted * * Mark @bo as invalid. */ -void amdgpu_vm_bo_invalidate (struct amdgpu_device *adev, -struct amdgpu_bo *bo,bool evicted) +void amdgpu_vm_bo_invalidate (struct amdgpu_bo *bo,bool evicted) {struct amdgpu_vm_bo_base *bo_base;
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h +1 -2
@@ -511,8 +511,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,struct amdgpu_bo_va *bo_va, bool clear);bool amdgpu_vm_evictable (struct amdgpu_bo *bo); -void amdgpu_vm_bo_invalidate (struct amdgpu_device *adev, -struct amdgpu_bo *bo,bool evicted); +void amdgpu_vm_bo_invalidate (struct amdgpu_bo *bo,bool evicted);uint64_t amdgpu_vm_map_gart (const dma_addr_t *pages_addr,uint64_t addr);struct amdgpu_bo_va *amdgpu_vm_bo_find (struct amdgpu_vm *vm,struct amdgpu_bo *bo);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini
From: Pierre-Eric Pelloux-Prayer <[email protected]>
[ Upstream commit d8726ef11512754a68c0ab53c57634a569b8feff ]
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.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 30 ++++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +16 -14
@@ -1184,19 +1184,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 ; }
@@ -1383,6 +1370,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);
@@ -1398,8 +1387,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);
Signature · 1 line
2.53.0