mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 02:22:34 +03:00
gpu: nvgpu: always prealloc jobs and fences
Unify the job metadata handling by deleting the parts that have handled dynamically allocated job structs and fences. Now a channel can be in one less mode than before which reduces branching in tricky places and makes the submit/cleanup sequence easier to understand. While preallocating all the resources upfront may increase average memory consumption by some kilobytes, users of channels have to supply the worst case numbers anyway and this preallocation has been already done on deterministic channels. Flip the channel_joblist_delete() call in nvgpu_channel_clean_up_jobs() to be done after nvgpu_channel_free_job(). Deleting from the list (which is a ringbuffer) makes it possible to reuse the job again, so the job must be freed before that. The comment about using post_fence is no longer valid; nvgpu_channel_abort() does not use fences. This inverse order has not posed problems before because it's been buggy only for deterministic channels, and such channels do not do the cleanup asynchronously so no races are possible. With preallocated job list for all channels, this would have become a problem. Jira NVGPU-5492 Change-Id: I085066b0c9c2475e38be885a275d7be629725d64 Signed-off-by: Konsta Hölttä <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2346064 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: automaticguardword <automaticguardword@nvidia.com> Reviewed-by: Debarshi Dutta <ddutta@nvidia.com> Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
Alex Waterman
parent
14a988776a
commit
ff41d97ab5
@@ -90,6 +90,11 @@ static int nvgpu_submit_create_incr_cmd(struct nvgpu_channel *c,
|
||||
|
||||
*post_fence = nvgpu_fence_alloc(c);
|
||||
if (*post_fence == NULL) {
|
||||
/*
|
||||
* The fence pool is exactly as long as the job list so this
|
||||
* should always succeed. If not, things are so broken that
|
||||
* ENOMEM is better than ENOSPC.
|
||||
*/
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -351,7 +356,9 @@ static int nvgpu_submit_prepare_gpfifo_track(struct nvgpu_channel *c,
|
||||
struct nvgpu_channel_job *job = NULL;
|
||||
int err;
|
||||
|
||||
nvgpu_channel_joblist_lock(c);
|
||||
err = nvgpu_channel_alloc_job(c, &job);
|
||||
nvgpu_channel_joblist_unlock(c);
|
||||
if (err != 0) {
|
||||
return err;
|
||||
}
|
||||
@@ -572,11 +579,6 @@ static int nvgpu_submit_deterministic(struct nvgpu_channel *c,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* dynamic job allocation wouldn't be deterministic */
|
||||
if (!nvgpu_channel_is_prealloc_enabled(c)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* dynamic sync allocation wouldn't be deterministic */
|
||||
if (g->aggressive_sync_destroy_thresh != 0U) {
|
||||
return -EINVAL;
|
||||
|
||||
Reference in New Issue
Block a user