diff options
author | Jammy Zhou <Jammy.Zhou@amd.com> | 2015-07-30 04:36:58 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2015-08-17 16:50:41 -0400 |
commit | 1333f723fb6f1356a54135586f1ede44dcaa9652 (patch) | |
tree | a91edb7bb65004749a8cf8390dd7ef665e034f1f | |
parent | c0044bc2c62dc3267f2a555ed8342181516008a5 (diff) |
drm/amdgpu: add amdgpu.sched_jobs option
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>
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | 4 |
5 files changed, 13 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 0703fbfd5130..4de114711951 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h | |||
@@ -80,6 +80,7 @@ extern int amdgpu_deep_color; | |||
80 | extern int amdgpu_vm_size; | 80 | extern int amdgpu_vm_size; |
81 | extern int amdgpu_vm_block_size; | 81 | extern int amdgpu_vm_block_size; |
82 | extern int amdgpu_enable_scheduler; | 82 | extern int amdgpu_enable_scheduler; |
83 | extern int amdgpu_sched_jobs; | ||
83 | 84 | ||
84 | #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000 | 85 | #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS 3000 |
85 | #define AMDGPU_MAX_USEC_TIMEOUT 100000 /* 100 ms */ | 86 | #define AMDGPU_MAX_USEC_TIMEOUT 100000 /* 100 ms */ |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index a5d8242ace95..58ce2655a8fd 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | |||
@@ -105,7 +105,8 @@ int amdgpu_ctx_alloc(struct amdgpu_device *adev, struct amdgpu_fpriv *fpriv, | |||
105 | rq = &adev->rings[i]->scheduler->kernel_rq; | 105 | rq = &adev->rings[i]->scheduler->kernel_rq; |
106 | r = amd_context_entity_init(adev->rings[i]->scheduler, | 106 | r = amd_context_entity_init(adev->rings[i]->scheduler, |
107 | &ctx->rings[i].c_entity, | 107 | &ctx->rings[i].c_entity, |
108 | NULL, rq, *id); | 108 | NULL, rq, *id, |
109 | amdgpu_sched_jobs); | ||
109 | if (r) | 110 | if (r) |
110 | break; | 111 | break; |
111 | } | 112 | } |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 8f33cef9c828..319de441e907 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | |||
@@ -76,6 +76,7 @@ int amdgpu_vm_size = 8; | |||
76 | int amdgpu_vm_block_size = -1; | 76 | int amdgpu_vm_block_size = -1; |
77 | int amdgpu_exp_hw_support = 0; | 77 | int amdgpu_exp_hw_support = 0; |
78 | int amdgpu_enable_scheduler = 0; | 78 | int amdgpu_enable_scheduler = 0; |
79 | int amdgpu_sched_jobs = 16; | ||
79 | 80 | ||
80 | MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); | 81 | MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes"); |
81 | module_param_named(vramlimit, amdgpu_vram_limit, int, 0600); | 82 | 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); | |||
143 | MODULE_PARM_DESC(enable_scheduler, "enable SW GPU scheduler (1 = enable, 0 = disable ((default))"); | 144 | MODULE_PARM_DESC(enable_scheduler, "enable SW GPU scheduler (1 = enable, 0 = disable ((default))"); |
144 | module_param_named(enable_scheduler, amdgpu_enable_scheduler, int, 0444); | 145 | module_param_named(enable_scheduler, amdgpu_enable_scheduler, int, 0444); |
145 | 146 | ||
147 | MODULE_PARM_DESC(sched_jobs, "the max number of jobs supported in the sw queue (default 16)"); | ||
148 | module_param_named(sched_jobs, amdgpu_sched_jobs, int, 0444); | ||
149 | |||
146 | static struct pci_device_id pciidlist[] = { | 150 | static struct pci_device_id pciidlist[] = { |
147 | #ifdef CONFIG_DRM_AMDGPU_CIK | 151 | #ifdef CONFIG_DRM_AMDGPU_CIK |
148 | /* Kaveri */ | 152 | /* Kaveri */ |
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c index 5799474808e9..87993e06ba37 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | |||
@@ -173,6 +173,7 @@ exit: | |||
173 | * @parent The parent entity of this amd_context_entity | 173 | * @parent The parent entity of this amd_context_entity |
174 | * @rq The run queue this entity belongs | 174 | * @rq The run queue this entity belongs |
175 | * @context_id The context id for this entity | 175 | * @context_id The context id for this entity |
176 | * @jobs The max number of jobs in the job queue | ||
176 | * | 177 | * |
177 | * return 0 if succeed. negative error code on failure | 178 | * return 0 if succeed. negative error code on failure |
178 | */ | 179 | */ |
@@ -180,7 +181,8 @@ int amd_context_entity_init(struct amd_gpu_scheduler *sched, | |||
180 | struct amd_context_entity *entity, | 181 | struct amd_context_entity *entity, |
181 | struct amd_sched_entity *parent, | 182 | struct amd_sched_entity *parent, |
182 | struct amd_run_queue *rq, | 183 | struct amd_run_queue *rq, |
183 | uint32_t context_id) | 184 | uint32_t context_id, |
185 | uint32_t jobs) | ||
184 | { | 186 | { |
185 | uint64_t seq_ring = 0; | 187 | uint64_t seq_ring = 0; |
186 | 188 | ||
@@ -196,7 +198,7 @@ int amd_context_entity_init(struct amd_gpu_scheduler *sched, | |||
196 | init_waitqueue_head(&entity->wait_queue); | 198 | init_waitqueue_head(&entity->wait_queue); |
197 | init_waitqueue_head(&entity->wait_emit); | 199 | init_waitqueue_head(&entity->wait_emit); |
198 | if(kfifo_alloc(&entity->job_queue, | 200 | if(kfifo_alloc(&entity->job_queue, |
199 | AMD_MAX_JOB_ENTRY_PER_CONTEXT * sizeof(void *), | 201 | jobs * sizeof(void *), |
200 | GFP_KERNEL)) | 202 | GFP_KERNEL)) |
201 | return -EINVAL; | 203 | return -EINVAL; |
202 | 204 | ||
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h index a6226e1e924a..52577a88b054 100644 --- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h +++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/kfifo.h> | 27 | #include <linux/kfifo.h> |
28 | 28 | ||
29 | #define AMD_MAX_ACTIVE_HW_SUBMISSION 2 | 29 | #define AMD_MAX_ACTIVE_HW_SUBMISSION 2 |
30 | #define AMD_MAX_JOB_ENTRY_PER_CONTEXT 16 | ||
31 | 30 | ||
32 | #define AMD_KERNEL_CONTEXT_ID 0 | 31 | #define AMD_KERNEL_CONTEXT_ID 0 |
33 | #define AMD_KERNEL_PROCESS_ID 0 | 32 | #define AMD_KERNEL_PROCESS_ID 0 |
@@ -155,6 +154,7 @@ int amd_context_entity_init(struct amd_gpu_scheduler *sched, | |||
155 | struct amd_context_entity *entity, | 154 | struct amd_context_entity *entity, |
156 | struct amd_sched_entity *parent, | 155 | struct amd_sched_entity *parent, |
157 | struct amd_run_queue *rq, | 156 | struct amd_run_queue *rq, |
158 | uint32_t context_id); | 157 | uint32_t context_id, |
158 | uint32_t jobs); | ||
159 | 159 | ||
160 | #endif | 160 | #endif |