drm/amdgpu/fence: Fix oops due to non-matching drm_sched init/fini
authorjsg <jsg@openbsd.org>
Wed, 15 Feb 2023 10:18:26 +0000 (10:18 +0000)
committerjsg <jsg@openbsd.org>
Wed, 15 Feb 2023 10:18:26 +0000 (10:18 +0000)
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

index d3f86b3..b06a0f0 100644 (file)
@@ -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)