diff options
author | Konsta Holtta <kholtta@nvidia.com> | 2015-01-29 03:35:04 -0500 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-04-04 21:08:27 -0400 |
commit | e1ae4e3053d5860d671e3264a467ade376828784 (patch) | |
tree | f9e728b8f195962a2dbcb18546523ae3ccf4d4cd /drivers/gpu/nvgpu/gk20a/channel_gk20a.h | |
parent | 593c7a3f3027cf95e1b35f9acb8b3d0dc45f24e4 (diff) |
gpu: nvgpu: protect channel ioctls with a mutex
Add a big mutex for protecting the channel during ioctls, in case the
userspace uses the same channel from several threads at once. The lock
is taken during all operations except CHANNEL_WAIT, which could deadlock.
Bug 1603482
Change-Id: Ibed962eadc9f00645abd54413dde9aaee00377ab
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/678871
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.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h index c028e3b1..034de53f 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GK20A graphics channel | 2 | * GK20A graphics channel |
3 | * | 3 | * |
4 | * Copyright (c) 2011-2014, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2011-2015, 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, |
@@ -84,6 +84,7 @@ struct channel_gk20a { | |||
84 | bool first_init; | 84 | bool first_init; |
85 | bool vpr; | 85 | bool vpr; |
86 | pid_t pid; | 86 | pid_t pid; |
87 | struct mutex ioctl_lock; | ||
87 | 88 | ||
88 | int tsgid; | 89 | int tsgid; |
89 | struct list_head ch_entry; /* channel's entry in TSG */ | 90 | struct list_head ch_entry; /* channel's entry in TSG */ |