Revert "gpu: nvgpu: fix race for channel sync read/write"

This reverts commit e22d743a20.

Change-Id: I4ea0a8158030d2fb9700ef5b84f8d77e579c1025
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2182350
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Vedashree Vidwans
2019-08-23 11:13:19 -07:00
committed by mobile promotions
parent cf81afa4dc
commit 83fea157a3
2 changed files with 5 additions and 6 deletions

View File

@@ -1357,8 +1357,6 @@ void nvgpu_channel_clean_up_jobs(struct nvgpu_channel *c,
break;
}
nvgpu_mutex_acquire(&c->sync_lock);
WARN_ON(c->sync == NULL);
if (c->sync != NULL) {
@@ -1368,15 +1366,16 @@ void nvgpu_channel_clean_up_jobs(struct nvgpu_channel *c,
}
if (g->aggressive_sync_destroy_thresh != 0U) {
nvgpu_mutex_acquire(&c->sync_lock);
if (nvgpu_channel_sync_put_ref_and_check(c->sync)
&& g->aggressive_sync_destroy) {
nvgpu_channel_sync_destroy(c->sync,
false);
c->sync = NULL;
}
nvgpu_mutex_release(&c->sync_lock);
}
}
nvgpu_mutex_release(&c->sync_lock);
if (job->num_mapped_buffers != 0U) {
nvgpu_vm_put_buffers(vm, job->mapped_buffers,

View File

@@ -60,17 +60,19 @@ static int nvgpu_submit_prepare_syncs(struct nvgpu_channel *c,
bool flag_sync_fence = (flags & NVGPU_SUBMIT_FLAGS_SYNC_FENCE) != 0U;
bool flag_fence_wait = (flags & NVGPU_SUBMIT_FLAGS_FENCE_WAIT) != 0U;
nvgpu_mutex_acquire(&c->sync_lock);
if (g->aggressive_sync_destroy_thresh != 0U) {
nvgpu_mutex_acquire(&c->sync_lock);
if (c->sync == NULL) {
c->sync = nvgpu_channel_sync_create(c, false);
if (c->sync == NULL) {
err = -ENOMEM;
nvgpu_mutex_release(&c->sync_lock);
goto fail;
}
new_sync_created = true;
}
nvgpu_channel_sync_get_ref(c->sync);
nvgpu_mutex_release(&c->sync_lock);
}
if ((g->ops.channel.set_syncpt != NULL) && new_sync_created) {
@@ -162,7 +164,6 @@ static int nvgpu_submit_prepare_syncs(struct nvgpu_channel *c,
goto clean_up_incr_cmd;
}
nvgpu_mutex_release(&c->sync_lock);
return 0;
clean_up_incr_cmd:
@@ -181,7 +182,6 @@ clean_up_wait_cmd:
job->wait_cmd = NULL;
}
fail:
nvgpu_mutex_release(&c->sync_lock);
*wait_cmd = NULL;
return err;
}