diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2016-12-19 06:01:43 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2016-12-27 04:24:35 -0500 |
commit | 505b442551a2e27aa3bc9e608c5a2bc9fccecbc4 (patch) | |
tree | 5b4d1d9664ab819e009fc9300784b897be035058 /drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | |
parent | f3d2dd4fd2c3d0fa3f774bcbc1d2b9ef482d7663 (diff) |
gpu: nvgpu: acquire mutex for notifier read
We use &ch->error_notifier_mutex to protect
writes and free of error notifier
But we currently do not protect reading of
notifier in gk20a_fifo_set_ctx_mmu_error()
and vgpu_fifo_set_ctx_mmu_error()
Add new API gk20a_set_error_notifier_locked()
which is same as gk20a_set_error_notifier()
but without the locks.
In *_fifo_set_ctx_mmu_error() APIs, acquire
the mutex explicitly, and then use this new
API
gk20a_set_error_notifier() will now just call
gk20a_set_error_notifier_locked() within
a mutex
Bug 1824788
Bug 1844312
Change-Id: I1f3831dc63fe1daa761b2e17e4de3c155f505d6f
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1273471
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Richard Zhao <rizhao@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fifo_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index b4fa8f0f..fb772ebd 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | |||
@@ -1219,7 +1219,8 @@ static bool gk20a_fifo_set_ctx_mmu_error(struct gk20a *g, | |||
1219 | if (!ch) | 1219 | if (!ch) |
1220 | return verbose; | 1220 | return verbose; |
1221 | 1221 | ||
1222 | if (ch->error_notifier) { | 1222 | mutex_lock(&ch->error_notifier_mutex); |
1223 | if (ch->error_notifier_ref) { | ||
1223 | u32 err = ch->error_notifier->info32; | 1224 | u32 err = ch->error_notifier->info32; |
1224 | if (ch->error_notifier->status == 0xffff) { | 1225 | if (ch->error_notifier->status == 0xffff) { |
1225 | /* If error code is already set, this mmu fault | 1226 | /* If error code is already set, this mmu fault |
@@ -1230,10 +1231,12 @@ static bool gk20a_fifo_set_ctx_mmu_error(struct gk20a *g, | |||
1230 | if (err == NVGPU_CHANNEL_FIFO_ERROR_IDLE_TIMEOUT) | 1231 | if (err == NVGPU_CHANNEL_FIFO_ERROR_IDLE_TIMEOUT) |
1231 | verbose = ch->timeout_debug_dump; | 1232 | verbose = ch->timeout_debug_dump; |
1232 | } else { | 1233 | } else { |
1233 | gk20a_set_error_notifier(ch, | 1234 | gk20a_set_error_notifier_locked(ch, |
1234 | NVGPU_CHANNEL_FIFO_ERROR_MMU_ERR_FLT); | 1235 | NVGPU_CHANNEL_FIFO_ERROR_MMU_ERR_FLT); |
1235 | } | 1236 | } |
1236 | } | 1237 | } |
1238 | mutex_unlock(&ch->error_notifier_mutex); | ||
1239 | |||
1237 | /* mark channel as faulted */ | 1240 | /* mark channel as faulted */ |
1238 | ch->has_timedout = true; | 1241 | ch->has_timedout = true; |
1239 | wmb(); | 1242 | wmb(); |