[PATCH v2 0/2] drm/ttm: Cleanup state in global ttm structures

2019-04-16 Thread Brian Yip
memory in global structure initialization functions rather than checking reference counters in their corresponding release functions. Brian Yip (2): drm/ttm: Reset ttm_mem_global when initialized drm/ttm: Reset ttm_bo_glob when initialized drivers/gpu/drm/ttm/ttm_bo.c | 6 +- drivers

[PATCH v2 2/2] drm/ttm: Reset ttm_bo_glob when initialized

2019-04-16 Thread Brian Yip
Always initialize ttm_bo_glob from a pristine state when its use_count is 0. Persist use_count so that ttm_bo_glob can later be released. Signed-off-by: Brian Yip --- drivers/gpu/drm/ttm/ttm_bo.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm

[PATCH v2 1/2] drm/ttm: Reset ttm_mem_global when initialized

2019-04-16 Thread Brian Yip
ttm_mem_global structure such that its state will be pristine and thus, ready to be re-initialized. Signed-off-by: Brian Yip --- drivers/gpu/drm/ttm/ttm_memory.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c index 699fed9e08ee

[PATCH 2/3] drm/ttm: Fix ttm_mem_glob.kobj state on cleanup

2019-04-15 Thread Brian Yip
Cleanup ttm_mem_glob.kobj when its reference count hits 0 so that it can be re-initialized by future ttm_mem_global_init calls without dumping a stack trace. Signed-off-by: Brian Yip --- drivers/gpu/drm/ttm/ttm_memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a

[PATCH 3/3] drm/ttm: Fix ttm_bo_glob.kobj state on cleanup

2019-04-15 Thread Brian Yip
Cleanup ttm_bo_glob.kobj when its reference count hits 0 so that it can be re-initialized by future ttm_bo_global_init calls without dumping a stack trace. Signed-off-by: Brian Yip --- drivers/gpu/drm/ttm/ttm_bo.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/ttm

[PATCH 1/3] drm/ttm: Reset num_zones on ttm_mem_global cleanup

2019-04-15 Thread Brian Yip
ttm_mem_global_init where ttm_mem_global.num_zones is eventually incremented beyond TTM_MEM_MAX_ZONES. ttm_mem_global.num_zones is then used to dereference a ttm_mem_zone beyond the amount of ttm_mem_zones allocated, resulting in a crash. Signed-off-by: Brian Yip --- drivers/gpu/drm/ttm/ttm_memory.c

[PATCH 0/3] drm/ttm: Cleanup state in global ttm structures

2019-04-15 Thread Brian Yip
during this process. This resulted in a crash and false positive kobj initialization warnings during subsequent initialization of these global structures. Fix the crash and false positive kobj initialization warnings. Brian Yip (3): drm/ttm: Reset num_zones on ttm_mem_global cleanup drm/ttm