From 5b9b016d1845bbdb4750061e59b6373e4a7fdc76 Mon Sep 17 00:00:00 2001 From: jsg Date: Wed, 15 Feb 2023 10:18:26 +0000 Subject: [PATCH] drm/amdgpu/fence: Fix oops due to non-matching drm_sched init/fini From Guilherme G. Piccoli 2bcbbef9cace772f5b7128b11401c515982de34b in linux-6.1.y/6.1.12 5ad7bbf3dba5c4a684338df1f285080f2588b535 in mainline linux --- sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c index d3f86b3eed7..b06a0f06800 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_fence.c @@ -584,7 +584,13 @@ void amdgpu_fence_driver_sw_fini(struct amdgpu_device *adev) if (!ring || !ring->fence_drv.initialized) continue; - if (!ring->no_scheduler) + /* + * Notice we check for sched.ops since there's some + * override on the meaning of sched.ready by amdgpu. + * The natural check would be sched.ready, which is + * set as drm_sched_init() finishes... + */ + if (ring->sched.ops) drm_sched_fini(&ring->sched); for (j = 0; j <= ring->fence_drv.num_fences_mask; ++j) -- 2.20.1