summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2014-10-31 04:47:00 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:11:58 -0400
commit7bb9fe2748d3324915108af85e6014da367071f6 (patch)
treeb95b11407d99657318b7a669891102a530b18323 /drivers/gpu/nvgpu/gk20a/channel_gk20a.h
parent14577a339ccc160ed58f8d936ebcbd96dba3b6ca (diff)
gpu: nvgpu: protect channel update callback access
Protect callback races from spurious gk20a channel updates by testing if the channel update callback still exists when in the scheduled work (instead of only when scheduling the work to the queue), and by canceling the work when the channel is freed. Protect access to the callback and its data by accessing them together inside spinlock-protected regions. Bug 200051384 Change-Id: Ib4e1571c35f662195e1dec1e362df32ddc099eb3 Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: http://git-master/r/592026 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.h')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
index a028b6f3..263ca291 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
@@ -24,6 +24,7 @@
24#include <linux/mutex.h> 24#include <linux/mutex.h>
25#include <uapi/linux/nvgpu.h> 25#include <uapi/linux/nvgpu.h>
26#include <linux/poll.h> 26#include <linux/poll.h>
27#include <linux/spinlock.h>
27 28
28struct gk20a; 29struct gk20a;
29struct gr_gk20a; 30struct gr_gk20a;
@@ -162,6 +163,7 @@ struct channel_gk20a {
162 * via schedule_work */ 163 * via schedule_work */
163 void (*update_fn)(struct channel_gk20a *, void *); 164 void (*update_fn)(struct channel_gk20a *, void *);
164 void *update_fn_data; 165 void *update_fn_data;
166 spinlock_t update_fn_lock; /* make access to the two above atomic */
165 struct work_struct update_fn_work; 167 struct work_struct update_fn_work;
166}; 168};
167 169