gpu: nvgpu: delete channel refs in job tracking

Each submitted job has held a reference to the channel where the job
runs. This is not necessary: all that the refs do is prevent the channel
from getting freed before the jobs are done in case the channel file is
closed early. However, that is already taken care of, so remove the
per-job get/put pair.

The channel closure path needs to unbind the channel from its tsg if
that hasn't done by the channel's user. Unbind gets the channel off the
runlist and forces all fences to expire, then enqueues the channel for
final job cleanup. No jobs can outlive this.

Delete also the extra get/put pair in job cleanup. The caller (either
the channel worker thread or the submit path in case of deterministic
channels) will always hold a reference.

Jira NVGPU-4548

Change-Id: I3a01759e1b2caf66c46cff19f6557645489ca8f4
Signed-off-by: Konsta Hölttä <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2322541
(cherry picked from commit 8af6260b8fcfd7bf393f50addb681b5353cbae38)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2324255
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Konsta Hölttä
2020-04-02 11:20:20 +03:00
committed by Alex Waterman
parent 9d577b8d9a
commit 8b96f27c45

View File

@@ -1250,12 +1250,6 @@ int nvgpu_channel_add_job(struct nvgpu_channel *c,
}
}
/*
* Ref to hold the channel open during the job lifetime. This is
* released by job cleanup launched via syncpt or sema interrupt.
*/
c = nvgpu_channel_get(c);
if (c != NULL) {
job->num_mapped_buffers = num_mapped_buffers;
job->mapped_buffers = mapped_buffers;
@@ -1313,13 +1307,7 @@ void nvgpu_channel_clean_up_jobs(struct nvgpu_channel *c,
bool watchdog_on = false;
#endif
c = nvgpu_channel_get(c);
if (c == NULL) {
return;
}
if (nvgpu_is_powered_off(c->g)) { /* shutdown case */
nvgpu_channel_put(c);
return;
}
@@ -1425,12 +1413,6 @@ void nvgpu_channel_clean_up_jobs(struct nvgpu_channel *c,
nvgpu_channel_update_priv_cmd_q_and_free_entry(c,
job->incr_cmd);
/*
* another bookkeeping taken in add_job. caller must hold a ref
* so this wouldn't get freed here.
*/
nvgpu_channel_put(c);
/*
* ensure all pending writes complete before freeing up the job.
* see corresponding nvgpu_smp_rmb in nvgpu_channel_alloc_job().
@@ -1460,8 +1442,6 @@ void nvgpu_channel_clean_up_jobs(struct nvgpu_channel *c,
(g->os_channel.work_completion_signal != NULL)) {
g->os_channel.work_completion_signal(c);
}
nvgpu_channel_put(c);
}
/**