NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/60732: amdgpu attempts to take (sleeping) mutex while holding a spin lock
The following reply was made to PR kern/60732; it has been noted by GNATS.
From: Taylor R Campbell <riastradh%NetBSD.org@localhost>
To: matthew green <mrg%eterna23.net@localhost>
Cc: gnats-bugs%NetBSD.org@localhost, netbsd-bugs%NetBSD.org@localhost
Subject: Re: kern/60732: amdgpu attempts to take (sleeping) mutex while holding a spin lock
Date: Wed, 16 Sep 2026 13:04:38 +0000
This is a multi-part message in MIME format.
--=_aD0stfJJ+WVg8+9bTfy4bTTT5i9m1xYu
Content-Transfer-Encoding: quoted-printable
> Date: Wed, 16 Sep 2026 00:27:06 +0000 (UTC)
> From: mrg%eterna23.net@localhost
>=20
> idea i did not look at to see if feasible or try, would be to
> make the mutex into an spin mutex.
Won't work -- even if you change gtt_window_lock to a spin lock, the
function in question sleeps:
341 static void gmc_v10_0_flush_gpu_tlb(struct amdgpu_device *adev, uin=
t32_t vmid,
342 uint32_t vmhub, uint32_t flush_type)
343 {
...
377 r =3D amdgpu_job_alloc_with_ib(adev, 16 * 4, &job);
...
392 dma_fence_wait(fence, false);
...
403 }
https://nxr.NetBSD.org/xref/src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/a=
mdgpu_gmc_v10_0.c?r=3D1.5#333
Try the attached patch to drop the spin lock, but hold a reference to
the node so the iteration is safe, while calling
amdgpu_ttm_recover_gart?
--=_aD0stfJJ+WVg8+9bTfy4bTTT5i9m1xYu
Content-Type: text/plain; charset="ISO-8859-1"; name="pr60732-amdgpugartrecoverspinmutex"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="pr60732-amdgpugartrecoverspinmutex.patch"
# HG changeset patch
# User Taylor R Campbell <riastradh%NetBSD.org@localhost>
# Date 1789563496 0
# Wed Sep 16 12:58:16 2026 +0000
# Branch trunk
# Node ID 2c75d691e0dd07e7b4ab40237114314280231942
# Parent 4fbd288ac1da9e7d9592ddecf04f7513e244152f
# EXP-Topic riastradh-pr60732-amdgpugartrecoverspinmutex
WIP: amdgpu: Drop spin lock across possible (non-spin) mutex & wait.
PR kern/60732: amdgpu attempts to take (sleeping) mutex while holding
a spin lock
diff -r 4fbd288ac1da -r 2c75d691e0dd sys/external/bsd/drm2/dist/drm/amd/amd=
gpu/amdgpu_gtt_mgr.c
--- a/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gtt_mgr.c Mon Aug 10=
13:36:10 2026 +0000
+++ b/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_gtt_mgr.c Wed Sep 16=
12:58:16 2026 +0000
@@ -336,7 +336,11 @@ int amdgpu_gtt_mgr_recover(struct ttm_me
spin_lock(&mgr->lock);
drm_mm_for_each_node(mm_node, &mgr->mm) {
node =3D container_of(mm_node, struct amdgpu_gtt_node, node);
+ ttm_bo_get(node->tbo);
+ spin_unlock(&mgr->lock);
r =3D amdgpu_ttm_recover_gart(node->tbo);
+ spin_lock(&mgr->lock);
+ ttm_bo_put(node->tbo);
if (r)
break;
}
--=_aD0stfJJ+WVg8+9bTfy4bTTT5i9m1xYu--
Home |
Main Index |
Thread Index |
Old Index