gpu: nvgpu: unify joblist api names

Add the nvgpu_ prefix to the peek, add and delete functions to make them
consistent with the rest of the joblist functions. Rename the "prealloc
resources" alloc and free functions to joblist init and deinit; there
are many other resources that are also preallocated, and these handle
just the job tracking list.

NVGPU-5772

Change-Id: Ie5e6ba4f4b17465d626f36a0239bddb03a0a2fcb
Signed-off-by: Konsta Hölttä <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2397395
Reviewed-by: automaticguardword <automaticguardword@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Konsta Hölttä
2020-08-11 12:54:17 +03:00
committed by Alex Waterman
parent 345eae584d
commit 91515d1b47
3 changed files with 18 additions and 18 deletions

View File

@@ -234,7 +234,7 @@ static void channel_kernelmode_deinit(struct nvgpu_channel *ch)
ch->priv_cmd_q = NULL;
}
channel_free_prealloc_resources(ch);
nvgpu_channel_joblist_deinit(ch);
/* sync must be destroyed before releasing channel vm */
nvgpu_mutex_acquire(&ch->sync_lock);
@@ -390,7 +390,7 @@ static int channel_setup_kernelmode(struct nvgpu_channel *c,
job_count = nvgpu_safe_add_u32(gpfifo_size, 2U) / 3U;
}
err = channel_prealloc_resources(c, job_count);
err = nvgpu_channel_joblist_init(c, job_count);
if (err != 0) {
goto clean_up_sync;
}
@@ -411,7 +411,7 @@ clean_up_priv_cmd:
nvgpu_priv_cmdbuf_queue_free(c->priv_cmd_q);
c->priv_cmd_q = NULL;
clean_up_prealloc:
channel_free_prealloc_resources(c);
nvgpu_channel_joblist_deinit(c);
clean_up_sync:
if (c->sync != NULL) {
nvgpu_channel_sync_destroy(c->sync);
@@ -638,7 +638,7 @@ int nvgpu_channel_add_job(struct nvgpu_channel *c,
nvgpu_channel_wdt_start(c->wdt, c);
nvgpu_channel_joblist_lock(c);
channel_joblist_add(c, job);
nvgpu_channel_joblist_add(c, job);
nvgpu_channel_joblist_unlock(c);
} else {
err = -ETIMEDOUT;
@@ -688,7 +688,7 @@ void nvgpu_channel_clean_up_jobs(struct nvgpu_channel *c)
bool completed;
nvgpu_channel_joblist_lock(c);
job = channel_joblist_peek(c);
job = nvgpu_channel_joblist_peek(c);
nvgpu_channel_joblist_unlock(c);
if (job == NULL) {
@@ -752,7 +752,7 @@ void nvgpu_channel_clean_up_jobs(struct nvgpu_channel *c)
nvgpu_channel_free_job(c, job);
nvgpu_channel_joblist_lock(c);
channel_joblist_delete(c, job);
nvgpu_channel_joblist_delete(c, job);
nvgpu_channel_joblist_unlock(c);
job_finished = true;
@@ -787,7 +787,7 @@ void nvgpu_channel_clean_up_deterministic_job(struct nvgpu_channel *c)
nvgpu_mutex_acquire(&c->joblist.cleanup_lock);
nvgpu_channel_joblist_lock(c);
job = channel_joblist_peek(c);
job = nvgpu_channel_joblist_peek(c);
nvgpu_channel_joblist_unlock(c);
if (job == NULL) {
@@ -817,7 +817,7 @@ void nvgpu_channel_clean_up_deterministic_job(struct nvgpu_channel *c)
nvgpu_channel_free_job(c, job);
nvgpu_channel_joblist_lock(c);
channel_joblist_delete(c, job);
nvgpu_channel_joblist_delete(c, job);
nvgpu_channel_joblist_unlock(c);
out_unlock:

View File

@@ -76,7 +76,7 @@ void nvgpu_channel_joblist_unlock(struct nvgpu_channel *c)
nvgpu_mutex_release(&c->joblist.pre_alloc.read_lock);
}
struct nvgpu_channel_job *channel_joblist_peek(struct nvgpu_channel *c)
struct nvgpu_channel_job *nvgpu_channel_joblist_peek(struct nvgpu_channel *c)
{
unsigned int get = c->joblist.pre_alloc.get;
unsigned int put = c->joblist.pre_alloc.put;
@@ -85,21 +85,21 @@ struct nvgpu_channel_job *channel_joblist_peek(struct nvgpu_channel *c)
return empty ? NULL : &c->joblist.pre_alloc.jobs[get];
}
void channel_joblist_add(struct nvgpu_channel *c,
void nvgpu_channel_joblist_add(struct nvgpu_channel *c,
struct nvgpu_channel_job *job)
{
c->joblist.pre_alloc.put = (c->joblist.pre_alloc.put + 1U) %
(c->joblist.pre_alloc.length);
}
void channel_joblist_delete(struct nvgpu_channel *c,
void nvgpu_channel_joblist_delete(struct nvgpu_channel *c,
struct nvgpu_channel_job *job)
{
c->joblist.pre_alloc.get = (c->joblist.pre_alloc.get + 1U) %
(c->joblist.pre_alloc.length);
}
int channel_prealloc_resources(struct nvgpu_channel *c, u32 num_jobs)
int nvgpu_channel_joblist_init(struct nvgpu_channel *c, u32 num_jobs)
{
int err;
u32 size;
@@ -140,7 +140,7 @@ clean_up:
return err;
}
void channel_free_prealloc_resources(struct nvgpu_channel *c)
void nvgpu_channel_joblist_deinit(struct nvgpu_channel *c)
{
if (c->joblist.pre_alloc.jobs != NULL) {
nvgpu_vfree(c->g, c->joblist.pre_alloc.jobs);

View File

@@ -47,13 +47,13 @@ void nvgpu_channel_free_job(struct nvgpu_channel *c,
void nvgpu_channel_joblist_lock(struct nvgpu_channel *c);
void nvgpu_channel_joblist_unlock(struct nvgpu_channel *c);
struct nvgpu_channel_job *channel_joblist_peek(struct nvgpu_channel *c);
void channel_joblist_add(struct nvgpu_channel *c,
struct nvgpu_channel_job *nvgpu_channel_joblist_peek(struct nvgpu_channel *c);
void nvgpu_channel_joblist_add(struct nvgpu_channel *c,
struct nvgpu_channel_job *job);
void channel_joblist_delete(struct nvgpu_channel *c,
void nvgpu_channel_joblist_delete(struct nvgpu_channel *c,
struct nvgpu_channel_job *job);
int channel_prealloc_resources(struct nvgpu_channel *c, u32 num_jobs);
void channel_free_prealloc_resources(struct nvgpu_channel *c);
int nvgpu_channel_joblist_init(struct nvgpu_channel *c, u32 num_jobs);
void nvgpu_channel_joblist_deinit(struct nvgpu_channel *c);
#endif