drm/amdgpu: add amdgpu.sched_jobs option
authorJammy Zhou <Jammy.Zhou@amd.com>
Thu, 30 Jul 2015 08:36:58 +0000 (16:36 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 17 Aug 2015 20:50:41 +0000 (16:50 -0400)
This option can be used to specify the max job number in the job queue,
and it is 16 by default.

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu.h
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
drivers/gpu/drm/amd/scheduler/gpu_scheduler.h

index 0703fbfd513017fcc33e9ee61924f343c2b71369..4de1147119515e078ab9bcfc5ea7acc58b1f936f 100644 (file)
@@ -80,6 +80,7 @@ extern int amdgpu_deep_color;
 extern int amdgpu_vm_size;
 extern int amdgpu_vm_block_size;
 extern int amdgpu_enable_scheduler;
+extern int amdgpu_sched_jobs;
 
 #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS         3000
 #define AMDGPU_MAX_USEC_TIMEOUT                        100000  /* 100 ms */
index a5d8242ace95ca25d992499b6ed708b4d4f932a5..58ce2655a8fd0886554393b6a63284a6d70f76c9 100644 (file)
@@ -105,7 +105,8 @@ int amdgpu_ctx_alloc(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv,
                                rq = &adev->rings[i]->scheduler->kernel_rq;
                        r = amd_context_entity_init(adev->rings[i]->scheduler,
                                                    &ctx->rings[i].c_entity,
-                                                   NULL, rq, *id);
+                                                   NULL, rq, *id,
+                                                   amdgpu_sched_jobs);
                        if (r)
                                break;
                }
index 8f33cef9c82816b0c272630df89787f6283f08b9..319de441e9076aa2710bdb78bb2033dffef7d364 100644 (file)
@@ -76,6 +76,7 @@ int amdgpu_vm_size = 8;
 int amdgpu_vm_block_size = -1;
 int amdgpu_exp_hw_support = 0;
 int amdgpu_enable_scheduler = 0;
+int amdgpu_sched_jobs = 16;
 
 MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
 module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
@@ -143,6 +144,9 @@ module_param_named(exp_hw_support, amdgpu_exp_hw_support, int, 0444);
 MODULE_PARM_DESC(enable_scheduler, "enable SW GPU scheduler (1 = enable, 0 = disable ((default))");
 module_param_named(enable_scheduler, amdgpu_enable_scheduler, int, 0444);
 
+MODULE_PARM_DESC(sched_jobs, "the max number of jobs supported in the sw queue (default 16)");
+module_param_named(sched_jobs, amdgpu_sched_jobs, int, 0444);
+
 static struct pci_device_id pciidlist[] = {
 #ifdef CONFIG_DRM_AMDGPU_CIK
        /* Kaveri */
index 5799474808e9536e4eeaffcce567ad1687baa54e..87993e06ba37dd3b4828df277c95ccd4795c4040 100644 (file)
@@ -173,6 +173,7 @@ exit:
  * @parent     The parent entity of this amd_context_entity
  * @rq         The run queue this entity belongs
  * @context_id The context id for this entity
+ * @jobs       The max number of jobs in the job queue
  *
  * return 0 if succeed. negative error code on failure
 */
@@ -180,7 +181,8 @@ int amd_context_entity_init(struct amd_gpu_scheduler *sched,
                            struct amd_context_entity *entity,
                            struct amd_sched_entity *parent,
                            struct amd_run_queue *rq,
-                           uint32_t context_id)
+                           uint32_t context_id,
+                           uint32_t jobs)
 {
        uint64_t seq_ring = 0;
 
@@ -196,7 +198,7 @@ int amd_context_entity_init(struct amd_gpu_scheduler *sched,
        init_waitqueue_head(&entity->wait_queue);
        init_waitqueue_head(&entity->wait_emit);
        if(kfifo_alloc(&entity->job_queue,
-                      AMD_MAX_JOB_ENTRY_PER_CONTEXT * sizeof(void *),
+                      jobs * sizeof(void *),
                       GFP_KERNEL))
                return -EINVAL;
 
index a6226e1e924a1d10ffc8d07b7c760b981e123e19..52577a88b05457891453968b6352bc9eeadc80c4 100644 (file)
@@ -27,7 +27,6 @@
 #include <linux/kfifo.h>
 
 #define AMD_MAX_ACTIVE_HW_SUBMISSION           2
-#define AMD_MAX_JOB_ENTRY_PER_CONTEXT          16
 
 #define AMD_KERNEL_CONTEXT_ID                  0
 #define AMD_KERNEL_PROCESS_ID                  0
@@ -155,6 +154,7 @@ int amd_context_entity_init(struct amd_gpu_scheduler *sched,
                            struct amd_context_entity *entity,
                            struct amd_sched_entity *parent,
                            struct amd_run_queue *rq,
-                           uint32_t context_id);
+                           uint32_t context_id,
+                           uint32_t jobs);
 
 #endif