From: jsg Date: Thu, 9 Nov 2023 08:08:17 +0000 (+0000) Subject: drm/ttm: Reorder sys manager cleanup step X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b0170149219692731560625c7fd88c47c156b942;p=openbsd drm/ttm: Reorder sys manager cleanup step From Karolina Stolarek 6a87b333ba4784ba23c1e74693f5c1b0268ac137 in linux-6.1.y/6.1.62 3b401e30c249849d803de6c332dad2a595a58658 in mainline linux --- diff --git a/sys/dev/pci/drm/ttm/ttm_device.c b/sys/dev/pci/drm/ttm/ttm_device.c index d4ad7edf700..a1f64635071 100644 --- a/sys/dev/pci/drm/ttm/ttm_device.c +++ b/sys/dev/pci/drm/ttm/ttm_device.c @@ -235,10 +235,6 @@ void ttm_device_fini(struct ttm_device *bdev) struct ttm_resource_manager *man; unsigned i; - man = ttm_manager_type(bdev, TTM_PL_SYSTEM); - ttm_resource_manager_set_used(man, false); - ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, NULL); - mutex_lock(&ttm_global_mutex); list_del(&bdev->device_list); mutex_unlock(&ttm_global_mutex); @@ -248,6 +244,10 @@ void ttm_device_fini(struct ttm_device *bdev) if (ttm_bo_delayed_delete(bdev, true)) pr_debug("Delayed destroy list was clean\n"); + man = ttm_manager_type(bdev, TTM_PL_SYSTEM); + ttm_resource_manager_set_used(man, false); + ttm_set_driver_manager(bdev, TTM_PL_SYSTEM, NULL); + spin_lock(&bdev->lru_lock); for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) if (list_empty(&man->lru[0]))