Skip to contentSkip to conversation

drm/amdgpu: Limit vm max ctx number to 4096

PATCH In review Rex Zhu 2 participants 2 messages Oct 24, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Limit vm max ctx number to 4096

driver need to reserve resource for each ctx for
some hw features. so add this limitation.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 33f5f2c..26f11eb 100644
@@ -161,6 +161,7 @@ struct amdgpu_mgpu_info
 extern int amdgpu_cik_support;
 #endif
 
+#define VM_MAX_NUM_CTX		4096
 #define AMDGPU_SG_THRESHOLD			(256*1024*1024)
 #define AMDGPU_DEFAULT_GTT_SIZE_MB		3072ULL /* 3GB by default */
 #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS	        3000
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +1 -1
index f9b5423..08b47dc 100644
@@ -247,7 +247,7 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev,
 		return -ENOMEM;
 
 	mutex_lock(&mgr->lock);
-	r = idr_alloc(&mgr->ctx_handles, ctx, 1, 0, GFP_KERNEL);
+	r = idr_alloc(&mgr->ctx_handles, ctx, 1, VM_MAX_NUM_CTX, GFP_KERNEL);
 	if (r < 0) {
 		mutex_unlock(&mgr->lock);
 		kfree(ctx);
Signature · 6 lines
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1540370865-23409-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

#2 lore raw

Am 24.10.18 um 10:47 schrieb Rex Zhu:

Quoted 14 lines

driver need to reserve resource for each ctx for
some hw features. so add this limitation.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 2 +-
  2 files changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index 33f5f2c..26f11eb 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amdgpu_mgpu_info · line 164

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -161,6 +161,7 @@ struct amdgpu_mgpu_info
  extern int amdgpu_cik_support;
  #endif
 
+#define VM_MAX_NUM_CTX		4096

Please add AMDGPU_ as prefix to this define.

Apart from that looks good to me,
Christian.

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
  #define AMDGPU_SG_THRESHOLD			(256*1024*1024)
  #define AMDGPU_DEFAULT_GTT_SIZE_MB		3072ULL /* 3GB by default */
  #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS	        3000
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +0 -0
index f9b5423..08b47dc 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c static int amdgpu_ctx_alloc(struct amdgpu_device *adev, · line 253

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +1 -1
@@ -247,7 +247,7 @@ static int amdgpu_ctx_alloc(struct amdgpu_device *adev,
  		return -ENOMEM;
 
  	mutex_lock(&mgr->lock);
-	r = idr_alloc(&mgr->ctx_handles, ctx, 1, 0, GFP_KERNEL);
+	r = idr_alloc(&mgr->ctx_handles, ctx, 1, VM_MAX_NUM_CTX, GFP_KERNEL);
  	if (r < 0) {
  		mutex_unlock(&mgr->lock);
  		kfree(ctx);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx