gpu: nvgpu: add support for pre-allocated resources

Add support for pre-allocation of job tracking resources
w/ new (extended) ioctl. Goal is to avoid dynamic memory
allocation in the submit path. This patch does the following:

1) Intoduces a new ioctl, NVGPU_IOCTL_CHANNEL_ALLOC_GPFIFO_EX,
which enables pre-allocation of tracking resources per job:
a) 2x priv_cmd_entry
b) 2x gk20a_fence

2) Implements circular ring buffer for job
tracking to avoid lock contention between producer
(submitter) and consumer (clean-up)

Bug 1795076

Change-Id: I6b52e5c575871107ff380f9a5790f440a6969347
Signed-off-by: Sachit Kadle <skadle@nvidia.com>
Reviewed-on: http://git-master/r/1203300
(cherry picked from commit 9fd270c22b860935dffe244753dabd87454bef39)
Reviewed-on: http://git-master/r/1223934
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sachit Kadle
2016-08-15 14:32:39 -07:00
committed by mobile promotions
parent 63e8592e06
commit 733fb79b39
7 changed files with 463 additions and 66 deletions

View File

@@ -126,9 +126,9 @@ static void gk20a_ce_finished_ctx_cb(struct channel_gk20a *ch, void *data)
bool channel_idle;
u32 event;
spin_lock(&ch->jobs_lock);
channel_idle = list_empty(&ch->jobs);
spin_unlock(&ch->jobs_lock);
channel_gk20a_joblist_lock(ch);
channel_idle = channel_gk20a_joblist_is_empty(ch);
channel_gk20a_joblist_unlock(ch);
if (!channel_idle)
return;
@@ -462,7 +462,7 @@ u32 gk20a_ce_create_context_with_cb(struct device *dev,
/* allocate gpfifo (1024 should be more than enough) */
err = gk20a_alloc_channel_gpfifo(ce_ctx->ch,
&(struct nvgpu_alloc_gpfifo_args){1024, 0});
&(struct nvgpu_alloc_gpfifo_ex_args){1024, 0, 0, {}});
if (err) {
gk20a_err(ce_ctx->dev, "ce: unable to allocate gpfifo");
goto end;