提交 5012f506 编写于 作者: J Jerome Glisse 提交者: Dave Airlie

drm/ttm: Fix memory type manager debug information printing

System memory type doesn't have a drm_mm manager associated to
it. This patch avoid trying to call drm_mm_debug on unitialized
drm_mm when printing debug info on the system memory manager.
Signed-off-by: NJerome Glisse <jglisse@redhat.com>
Signed-off-by: NDave Airlie <airlied@redhat.com>
上级 eb6d2c39
...@@ -71,9 +71,10 @@ static inline int ttm_mem_type_from_flags(uint32_t flags, uint32_t *mem_type) ...@@ -71,9 +71,10 @@ static inline int ttm_mem_type_from_flags(uint32_t flags, uint32_t *mem_type)
return -EINVAL; return -EINVAL;
} }
static void ttm_mem_type_manager_debug(struct ttm_bo_global *glob, static void ttm_mem_type_debug(struct ttm_bo_device *bdev, int mem_type)
struct ttm_mem_type_manager *man)
{ {
struct ttm_mem_type_manager *man = &bdev->man[mem_type];
printk(KERN_ERR TTM_PFX " has_type: %d\n", man->has_type); printk(KERN_ERR TTM_PFX " has_type: %d\n", man->has_type);
printk(KERN_ERR TTM_PFX " use_type: %d\n", man->use_type); printk(KERN_ERR TTM_PFX " use_type: %d\n", man->use_type);
printk(KERN_ERR TTM_PFX " flags: 0x%08X\n", man->flags); printk(KERN_ERR TTM_PFX " flags: 0x%08X\n", man->flags);
...@@ -85,17 +86,16 @@ static void ttm_mem_type_manager_debug(struct ttm_bo_global *glob, ...@@ -85,17 +86,16 @@ static void ttm_mem_type_manager_debug(struct ttm_bo_global *glob,
man->available_caching); man->available_caching);
printk(KERN_ERR TTM_PFX " default_caching: 0x%08X\n", printk(KERN_ERR TTM_PFX " default_caching: 0x%08X\n",
man->default_caching); man->default_caching);
spin_lock(&glob->lru_lock); if (mem_type != TTM_PL_SYSTEM) {
drm_mm_debug_table(&man->manager, TTM_PFX); spin_lock(&bdev->glob->lru_lock);
spin_unlock(&glob->lru_lock); drm_mm_debug_table(&man->manager, TTM_PFX);
spin_unlock(&bdev->glob->lru_lock);
}
} }
static void ttm_bo_mem_space_debug(struct ttm_buffer_object *bo, static void ttm_bo_mem_space_debug(struct ttm_buffer_object *bo,
struct ttm_placement *placement) struct ttm_placement *placement)
{ {
struct ttm_bo_device *bdev = bo->bdev;
struct ttm_bo_global *glob = bo->glob;
struct ttm_mem_type_manager *man;
int i, ret, mem_type; int i, ret, mem_type;
printk(KERN_ERR TTM_PFX "No space for %p (%lu pages, %luK, %luM)\n", printk(KERN_ERR TTM_PFX "No space for %p (%lu pages, %luK, %luM)\n",
...@@ -106,10 +106,9 @@ static void ttm_bo_mem_space_debug(struct ttm_buffer_object *bo, ...@@ -106,10 +106,9 @@ static void ttm_bo_mem_space_debug(struct ttm_buffer_object *bo,
&mem_type); &mem_type);
if (ret) if (ret)
return; return;
man = &bdev->man[mem_type];
printk(KERN_ERR TTM_PFX " placement[%d]=0x%08X (%d)\n", printk(KERN_ERR TTM_PFX " placement[%d]=0x%08X (%d)\n",
i, placement->placement[i], mem_type); i, placement->placement[i], mem_type);
ttm_mem_type_manager_debug(glob, man); ttm_mem_type_debug(bo->bdev, mem_type);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册