mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: serialize debug session IOCTLs
Hold debug_s->ioctl_lock for all debug session IOCTLs to prevent multi-threaded user space IOCTL calls debug session IOCTL calls are not thread-safe and hence this serialization is required Bug 1832267 Change-Id: I847ac951601d4f0093546b592bdb8c8f00185317 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1286436 Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
4942cc4222
commit
72f27f7747
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Tegra GK20A GPU Debugger/Profiler Driver
|
||||
*
|
||||
* Copyright (c) 2013-2016, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2013-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* 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,
|
||||
init_waitqueue_head(&dbg_session->dbg_events.wait_queue);
|
||||
INIT_LIST_HEAD(&dbg_session->ch_list);
|
||||
mutex_init(&dbg_session->ch_list_lock);
|
||||
mutex_init(&dbg_session->ioctl_lock);
|
||||
dbg_session->dbg_events.events_enabled = false;
|
||||
dbg_session->dbg_events.num_pending_events = 0;
|
||||
|
||||
@@ -899,6 +900,9 @@ long gk20a_dbg_gpu_dev_ioctl(struct file *filp, unsigned int cmd,
|
||||
gk20a_idle(g->dev);
|
||||
}
|
||||
|
||||
/* protect from threaded user space calls */
|
||||
mutex_lock(&dbg_s->ioctl_lock);
|
||||
|
||||
switch (cmd) {
|
||||
case NVGPU_DBG_GPU_IOCTL_BIND_CHANNEL:
|
||||
err = dbg_bind_channel_gk20a(dbg_s,
|
||||
@@ -1003,6 +1007,8 @@ long gk20a_dbg_gpu_dev_ioctl(struct file *filp, unsigned int cmd,
|
||||
break;
|
||||
}
|
||||
|
||||
mutex_unlock(&dbg_s->ioctl_lock);
|
||||
|
||||
gk20a_dbg(gpu_dbg_gpu_dbg, "ret=%d", err);
|
||||
|
||||
if ((err == 0) && (_IOC_DIR(cmd) & _IOC_READ))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Tegra GK20A GPU Debugger Driver
|
||||
*
|
||||
* Copyright (c) 2013-2016, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2013-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -73,6 +73,8 @@ struct dbg_session_gk20a {
|
||||
struct dbg_gpu_session_events dbg_events;
|
||||
|
||||
bool broadcast_stop_trigger;
|
||||
|
||||
struct mutex ioctl_lock;
|
||||
};
|
||||
|
||||
struct dbg_session_data {
|
||||
|
||||
Reference in New Issue
Block a user