diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2015-10-12 04:51:34 -0400 |
---|---|---|
committer | Ishan Mittal <imittal@nvidia.com> | 2015-10-20 02:52:04 -0400 |
commit | da8ff40e55c498f2ca24d446d45cda9d4d83bbcf (patch) | |
tree | 878ffca16046eabf03b9e1e334b45edeec341162 /drivers/gpu/nvgpu/gk20a | |
parent | 68099f8298d25e94579f7d45c61b959f2c7ac184 (diff) |
gpu: nvgpu: fix deadlock on timeout lock
In gk20a_channel_timeout_stop(), we take the channel's
timeout lock and then cancel the timeout worker thread
Timeout worker thread also tries to acquire same timeout
lock.
Hence, while cancelling the timeout in gk20a_channel_timeout_stop()
if the timeout_handler is already scheduled, we will have a deadlock
Fix this by moving cancel_delayed_work_sync() out of the locks
Bug 200133289
Bug 1695481
Change-Id: Iea78770180b483a63e5e176efba27831174e9dde
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/815922
Reviewed-by: Ishan Mittal <imittal@nvidia.com>
Tested-by: Ishan Mittal <imittal@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 6dad412a..6f0d7375 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c | |||
@@ -1561,15 +1561,16 @@ static void gk20a_channel_timeout_start(struct channel_gk20a *ch, | |||
1561 | static void gk20a_channel_timeout_stop(struct channel_gk20a *ch) | 1561 | static void gk20a_channel_timeout_stop(struct channel_gk20a *ch) |
1562 | { | 1562 | { |
1563 | mutex_lock(&ch->timeout.lock); | 1563 | mutex_lock(&ch->timeout.lock); |
1564 | |||
1565 | if (!ch->timeout.initialized) { | 1564 | if (!ch->timeout.initialized) { |
1566 | mutex_unlock(&ch->timeout.lock); | 1565 | mutex_unlock(&ch->timeout.lock); |
1567 | return; | 1566 | return; |
1568 | } | 1567 | } |
1568 | mutex_unlock(&ch->timeout.lock); | ||
1569 | 1569 | ||
1570 | ch->timeout.initialized = false; | ||
1571 | cancel_delayed_work_sync(&ch->timeout.wq); | 1570 | cancel_delayed_work_sync(&ch->timeout.wq); |
1572 | 1571 | ||
1572 | mutex_lock(&ch->timeout.lock); | ||
1573 | ch->timeout.initialized = false; | ||
1573 | mutex_unlock(&ch->timeout.lock); | 1574 | mutex_unlock(&ch->timeout.lock); |
1574 | } | 1575 | } |
1575 | 1576 | ||