Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/ttm: make the device list mutex static

This way it can protect the whole BO global state.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Christian König and committed by
Alex Deucher
56b3d204 27eb1fa9

+9 -6
+9 -5
drivers/gpu/drm/ttm/ttm_bo.c
··· 45 45 46 46 static void ttm_bo_global_kobj_release(struct kobject *kobj); 47 47 48 + /** 49 + * ttm_global_mutex - protecting the global BO state 50 + */ 51 + DEFINE_MUTEX(ttm_global_mutex); 52 + 48 53 static struct attribute ttm_bo_count = { 49 54 .name = "bo_count", 50 55 .mode = S_IRUGO ··· 1544 1539 if (ret) 1545 1540 return ret; 1546 1541 1547 - mutex_init(&glob->device_list_mutex); 1548 1542 spin_lock_init(&glob->lru_lock); 1549 1543 glob->mem_glob = &ttm_mem_glob; 1550 1544 glob->mem_glob->bo_glob = glob; ··· 1591 1587 } 1592 1588 } 1593 1589 1594 - mutex_lock(&glob->device_list_mutex); 1590 + mutex_lock(&ttm_global_mutex); 1595 1591 list_del(&bdev->device_list); 1596 - mutex_unlock(&glob->device_list_mutex); 1592 + mutex_unlock(&ttm_global_mutex); 1597 1593 1598 1594 cancel_delayed_work_sync(&bdev->wq); 1599 1595 ··· 1640 1636 bdev->dev_mapping = mapping; 1641 1637 bdev->glob = glob; 1642 1638 bdev->need_dma32 = need_dma32; 1643 - mutex_lock(&glob->device_list_mutex); 1639 + mutex_lock(&ttm_global_mutex); 1644 1640 list_add_tail(&bdev->device_list, &glob->device_list); 1645 - mutex_unlock(&glob->device_list_mutex); 1641 + mutex_unlock(&ttm_global_mutex); 1646 1642 1647 1643 return 0; 1648 1644 out_no_sys:
-1
include/drm/ttm/ttm_bo_driver.h
··· 407 407 struct kobject kobj; 408 408 struct ttm_mem_global *mem_glob; 409 409 struct page *dummy_read_page; 410 - struct mutex device_list_mutex; 411 410 spinlock_t lru_lock; 412 411 413 412 /**