Skip to content

Commit 3ce7803

Browse files
committed
drm/ttm: Avoid calling drm_ht_remove from atomic context
On recent kernels, calling drm_ht_remove triggers a might_sleep() warning from within vfree(). So avoid calling it from atomic context. The use-cases we fix here are both from destructors so there should be no concurrent use of the hash tables. Signed-off-by: Thomas Hellstrom <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Sinclair Yeh <[email protected]>
1 parent fe25deb commit 3ce7803

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/gpu/drm/ttm/ttm_object.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,10 +453,10 @@ void ttm_object_file_release(struct ttm_object_file **p_tfile)
453453
ttm_ref_object_release(&ref->kref);
454454
}
455455

456+
spin_unlock(&tfile->lock);
456457
for (i = 0; i < TTM_REF_NUM; ++i)
457458
drm_ht_remove(&tfile->ref_hash[i]);
458459

459-
spin_unlock(&tfile->lock);
460460
ttm_object_file_unref(&tfile);
461461
}
462462
EXPORT_SYMBOL(ttm_object_file_release);
@@ -533,9 +533,7 @@ void ttm_object_device_release(struct ttm_object_device **p_tdev)
533533

534534
*p_tdev = NULL;
535535

536-
spin_lock(&tdev->object_lock);
537536
drm_ht_remove(&tdev->object_hash);
538-
spin_unlock(&tdev->object_lock);
539537

540538
kfree(tdev);
541539
}

0 commit comments

Comments
 (0)