[PATCH 2/2] [WIP]drm/amdgpu: fix scheduling balance

Chunming Zhou david1.zhou at amd.com
Fri Jan 26 10:22:47 UTC 2018


Change-Id: I6535023db57d4ff5e79f7928595bf8ff1f60f23f
Signed-off-by: Chunming Zhou <david1.zhou at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c  | 4 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
index 7abc1f3251ea..5bed3d8e364a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c
@@ -173,6 +173,10 @@ static int amdgpu_gtt_mgr_new(struct ttm_mem_type_manager *man,
 		spin_unlock(&mgr->lock);
 		return 0;
 	}
+	if (!ttm_man_check_bo(man, tbo, place)) {
+		spin_unlock(&mgr->lock);
+		return 0;
+	}
 	atomic64_sub(mem->num_pages, &mgr->available);
 	spin_unlock(&mgr->lock);
 
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index 9aca653bec07..7202599bb67f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -121,6 +121,9 @@ static int amdgpu_vram_mgr_new(struct ttm_mem_type_manager *man,
 	unsigned i;
 	int r;
 
+	if (!ttm_man_check_bo(man, tbo, place))
+		return 0;
+
 	lpfn = place->lpfn;
 	if (!lpfn)
 		lpfn = man->size;
-- 
2.14.1



More information about the amd-gfx mailing list