From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E050C390608; Fri, 7 Aug 2026 15:47:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786117645; cv=none; b=nf3ZGiyr48I8/ESUGUjSvow3TfT9LeI9WbAFa8OOyErLJak5cQItFFqNtFaCJzzw3IcjCVaXW/naf06LdAFXXFRJAslfXr8k/RCCe56XNlJRy//ITYd9wufG0sNF1vibbDc3o4kbt+JjaBJcEHVA1uTNRUKUSEcXzaw5/tWBgxA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786117645; c=relaxed/simple; bh=bVc+tHir2zIyRQ3WKCcG+VK7AxwZnt/PHNoQLjQKYuc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ESS5nHueCeHqFpzxMem+qwA5CYsDuha9Nh5sI0ZSQhh5sSzXYRzS1QZPnjtCJHepwa+xQv96krjes5S62t+qN1c8vb/2b/Moa83xjTmYhugtsClCwU9rSFaEteR+YdZ2qeuV41muuCBaZYN0HwCCBw6AY/PfOVYvcZX026Qe7js= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QVdpCt0j; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="QVdpCt0j" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0534C1F000E9; Fri, 7 Aug 2026 15:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786117643; bh=qziFWxhQfGXVOMGijirgJ/SYbx32nMrgTZygjUMg0nM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QVdpCt0jRyFjq1QsIvu7WJra+zSQ8lxCtkYQV1aMiYWpWDCivTQVgNqQxI7dK4wb5 XfeC2cYd7KZkrUod7HgwL8v2UsAy84jH055F4GvDSsW+MiXo6SDMj/+1m2XmljhWKz 1Ibt1xvKbwqV1id5xIh6l6xXBxyPO232E4OoDuZY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pierre-Eric Pelloux-Prayer , =?UTF-8?q?Christian=20K=C3=B6nig?= , Alex Deucher Subject: [PATCH 7.1 390/438] drm/amdgpu: move debug_vm handling to amdgpu_cs_parser_fini Date: Fri, 7 Aug 2026 16:39:46 +0200 Message-ID: <20260807143436.279653201@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260807143428.008222056@linuxfoundation.org> References: <20260807143428.008222056@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pierre-Eric Pelloux-Prayer commit d8726ef11512754a68c0ab53c57634a569b8feff upstream. 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: 59720bfd8c6d ("drm/amdgpu: restart the CS if some parts of the VM are still invalidated") Signed-off-by: Pierre-Eric Pelloux-Prayer Reviewed-by: Christian König Signed-off-by: Alex Deucher (cherry picked from commit 8c990ee9daa295462df24982ce6878db997a380a) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c @@ -1182,19 +1182,6 @@ static int amdgpu_cs_vm_handling(struct 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; } @@ -1384,6 +1371,8 @@ static int amdgpu_cs_submit(struct amdgp /* 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); @@ -1399,8 +1388,21 @@ static void amdgpu_cs_parser_fini(struct 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);