diff options
author | Peter Daifuku <pdaifuku@nvidia.com> | 2017-03-07 20:51:42 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-03-17 13:56:34 -0400 |
commit | 38d90b60922e6de6b795694d3e3cdf66d4ddae5f (patch) | |
tree | 8a8c14d5e45383918f9518b608ee8aba43ec100d /drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |
parent | ca762e42205febba72ce063417e1ac598610941d (diff) |
gpu: nvgpu: del channel job before fence is closed
In gk20a_channel_clean_up_jobs, move removal of job from channel's job list
to before fences are cleaned up; this will prevent gk20a_channel_abort from
asynchronously trying to dereference an already freed job.
Bug 1844305
JIRA EVLR-849
Change-Id: I1ba05237aa74be1350007630bfa5eba9988f859a
Signed-off-by: Peter Daifuku <pdaifuku@nvidia.com>
(cherry picked from commit 2a9ce58b1b318b95ecfcdf78462f918d090eab99)
Reviewed-on: http://git-master/r/1319026
(cherry picked from commit 990f070b0a363159ce1b21f936b7512f469018ca)
Reviewed-on: http://git-master/r/1321624
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 8a9729ab..73cc18d2 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -2658,6 +2658,14 @@ static void gk20a_channel_clean_up_jobs(struct channel_gk20a *c, | |||
2658 | gk20a_vm_put_buffers(vm, job->mapped_buffers, | 2658 | gk20a_vm_put_buffers(vm, job->mapped_buffers, |
2659 | job->num_mapped_buffers); | 2659 | job->num_mapped_buffers); |
2660 | 2660 | ||
2661 | /* Remove job from channel's job list before we close the | ||
2662 | * fences, to prevent other callers (gk20a_channel_abort) from | ||
2663 | * trying to dereference post_fence when it no longer exists. | ||
2664 | */ | ||
2665 | channel_gk20a_joblist_lock(c); | ||
2666 | channel_gk20a_joblist_delete(c, job); | ||
2667 | channel_gk20a_joblist_unlock(c); | ||
2668 | |||
2661 | /* Close the fences (this will unref the semaphores and release | 2669 | /* Close the fences (this will unref the semaphores and release |
2662 | * them to the pool). */ | 2670 | * them to the pool). */ |
2663 | gk20a_fence_put(job->pre_fence); | 2671 | gk20a_fence_put(job->pre_fence); |
@@ -2673,13 +2681,10 @@ static void gk20a_channel_clean_up_jobs(struct channel_gk20a *c, | |||
2673 | gk20a_channel_put(c); | 2681 | gk20a_channel_put(c); |
2674 | 2682 | ||
2675 | /* | 2683 | /* |
2676 | * ensure all pending writes complete before deleting the node. | 2684 | * ensure all pending writes complete before freeing up the job. |
2677 | * see corresponding rmb in channel_gk20a_alloc_job(). | 2685 | * see corresponding rmb in channel_gk20a_alloc_job(). |
2678 | */ | 2686 | */ |
2679 | wmb(); | 2687 | wmb(); |
2680 | channel_gk20a_joblist_lock(c); | ||
2681 | channel_gk20a_joblist_delete(c, job); | ||
2682 | channel_gk20a_joblist_unlock(c); | ||
2683 | 2688 | ||
2684 | channel_gk20a_free_job(c, job); | 2689 | channel_gk20a_free_job(c, job); |
2685 | job_finished = 1; | 2690 | job_finished = 1; |