diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h | 4 |
2 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c index be9f7fc6..ac11e378 100644 --- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Tegra GK20A GPU Debugger/Profiler Driver | 2 | * Tegra GK20A GPU Debugger/Profiler Driver |
3 | * | 3 | * |
4 | * Copyright (c) 2013-2016, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2013-2017, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -117,6 +117,7 @@ static int gk20a_dbg_gpu_do_dev_open(struct inode *inode, | |||
117 | init_waitqueue_head(&dbg_session->dbg_events.wait_queue); | 117 | init_waitqueue_head(&dbg_session->dbg_events.wait_queue); |
118 | INIT_LIST_HEAD(&dbg_session->ch_list); | 118 | INIT_LIST_HEAD(&dbg_session->ch_list); |
119 | mutex_init(&dbg_session->ch_list_lock); | 119 | mutex_init(&dbg_session->ch_list_lock); |
120 | mutex_init(&dbg_session->ioctl_lock); | ||
120 | dbg_session->dbg_events.events_enabled = false; | 121 | dbg_session->dbg_events.events_enabled = false; |
121 | dbg_session->dbg_events.num_pending_events = 0; | 122 | dbg_session->dbg_events.num_pending_events = 0; |
122 | 123 | ||
@@ -899,6 +900,9 @@ long gk20a_dbg_gpu_dev_ioctl(struct file *filp, unsigned int cmd, | |||
899 | gk20a_idle(g->dev); | 900 | gk20a_idle(g->dev); |
900 | } | 901 | } |
901 | 902 | ||
903 | /* protect from threaded user space calls */ | ||
904 | mutex_lock(&dbg_s->ioctl_lock); | ||
905 | |||
902 | switch (cmd) { | 906 | switch (cmd) { |
903 | case NVGPU_DBG_GPU_IOCTL_BIND_CHANNEL: | 907 | case NVGPU_DBG_GPU_IOCTL_BIND_CHANNEL: |
904 | err = dbg_bind_channel_gk20a(dbg_s, | 908 | err = dbg_bind_channel_gk20a(dbg_s, |
@@ -1003,6 +1007,8 @@ long gk20a_dbg_gpu_dev_ioctl(struct file *filp, unsigned int cmd, | |||
1003 | break; | 1007 | break; |
1004 | } | 1008 | } |
1005 | 1009 | ||
1010 | mutex_unlock(&dbg_s->ioctl_lock); | ||
1011 | |||
1006 | gk20a_dbg(gpu_dbg_gpu_dbg, "ret=%d", err); | 1012 | gk20a_dbg(gpu_dbg_gpu_dbg, "ret=%d", err); |
1007 | 1013 | ||
1008 | if ((err == 0) && (_IOC_DIR(cmd) & _IOC_READ)) | 1014 | if ((err == 0) && (_IOC_DIR(cmd) & _IOC_READ)) |
diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h index 600715f5..773a669c 100644 --- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Tegra GK20A GPU Debugger Driver | 2 | * Tegra GK20A GPU Debugger Driver |
3 | * | 3 | * |
4 | * Copyright (c) 2013-2016, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2013-2017, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -73,6 +73,8 @@ struct dbg_session_gk20a { | |||
73 | struct dbg_gpu_session_events dbg_events; | 73 | struct dbg_gpu_session_events dbg_events; |
74 | 74 | ||
75 | bool broadcast_stop_trigger; | 75 | bool broadcast_stop_trigger; |
76 | |||
77 | struct mutex ioctl_lock; | ||
76 | }; | 78 | }; |
77 | 79 | ||
78 | struct dbg_session_data { | 80 | struct dbg_session_data { |