diff options
author | Thomas Hellstrom <thellstrom@vmware.com> | 2017-03-27 06:38:25 -0400 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2017-03-30 05:43:40 -0400 |
commit | 3ce7803cf3a7bc52c0eb9f516de8b72a0305ad57 (patch) | |
tree | 9d64b8496547d9ae8efdf3180321195c531cce3e | |
parent | fe25deb7737ce6c0879ccf79c99fa1221d428bf2 (diff) |
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 <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_object.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_object.c b/drivers/gpu/drm/ttm/ttm_object.c index d750140bafbc..26a7ad0f4789 100644 --- a/drivers/gpu/drm/ttm/ttm_object.c +++ b/drivers/gpu/drm/ttm/ttm_object.c | |||
@@ -453,10 +453,10 @@ void ttm_object_file_release(struct ttm_object_file **p_tfile) | |||
453 | ttm_ref_object_release(&ref->kref); | 453 | ttm_ref_object_release(&ref->kref); |
454 | } | 454 | } |
455 | 455 | ||
456 | spin_unlock(&tfile->lock); | ||
456 | for (i = 0; i < TTM_REF_NUM; ++i) | 457 | for (i = 0; i < TTM_REF_NUM; ++i) |
457 | drm_ht_remove(&tfile->ref_hash[i]); | 458 | drm_ht_remove(&tfile->ref_hash[i]); |
458 | 459 | ||
459 | spin_unlock(&tfile->lock); | ||
460 | ttm_object_file_unref(&tfile); | 460 | ttm_object_file_unref(&tfile); |
461 | } | 461 | } |
462 | EXPORT_SYMBOL(ttm_object_file_release); | 462 | EXPORT_SYMBOL(ttm_object_file_release); |
@@ -533,9 +533,7 @@ void ttm_object_device_release(struct ttm_object_device **p_tdev) | |||
533 | 533 | ||
534 | *p_tdev = NULL; | 534 | *p_tdev = NULL; |
535 | 535 | ||
536 | spin_lock(&tdev->object_lock); | ||
537 | drm_ht_remove(&tdev->object_hash); | 536 | drm_ht_remove(&tdev->object_hash); |
538 | spin_unlock(&tdev->object_lock); | ||
539 | 537 | ||
540 | kfree(tdev); | 538 | kfree(tdev); |
541 | } | 539 | } |