summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorThomas Fleury <tfleury@nvidia.com>2016-06-16 20:31:45 -0400
committerVijayakumar Subbu <vsubbu@nvidia.com>2016-07-19 02:19:09 -0400
commitf4b77e465648e87b19a7df4bb2a121ac8ac1b851 (patch)
tree25e5db7e8f16e76985d2a56ad7b8e8573ad1fccd /drivers
parentd6efa8fc625fc297b9baa0755407cee1180fbbe6 (diff)
gpu: nvgpu: process granularity for FECS traces
When processing FECS traces, a hash table is used to retrieve the 'pid' of the process that created the channel/TSG. Report process identifer (aka tgid in kernel) instead of thread identifier (aka pid) for FECS traces. Bug 1736423 Change-Id: I54cb9d298b9fe3e1cccdd7145604cd01c5758c9d Signed-off-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-on: http://git-master/r/1166501 (cherry picked from commit f7fd1f6d7ad0753b787ec20604a08a1f4882fe6f) Reviewed-on: http://git-master/r/1168728 (cherry picked from commit 97a62e5b89352fce576f1bca71b38bf2242ff047) Reviewed-on: http://git-master/r/1177823 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Richard Zhao <rizhao@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c1
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.h1
-rw-r--r--drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c2
-rw-r--r--drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c6
-rw-r--r--drivers/gpu/nvgpu/gk20a/fifo_gk20a.c2
-rw-r--r--drivers/gpu/nvgpu/vgpu/fifo_vgpu.c2
6 files changed, 10 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index e631b836..d5457d10 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -1171,6 +1171,7 @@ struct channel_gk20a *gk20a_open_new_channel(struct gk20a *g,
1171 * alive and used (i.e. get-able) yet */ 1171 * alive and used (i.e. get-able) yet */
1172 1172
1173 ch->pid = current->pid; 1173 ch->pid = current->pid;
1174 ch->tgid = current->tgid; /* process granularity for FECS traces */
1174 1175
1175 /* By default, channel is regular (non-TSG) channel */ 1176 /* By default, channel is regular (non-TSG) channel */
1176 ch->tsgid = NVGPU_INVALID_TSG_ID; 1177 ch->tsgid = NVGPU_INVALID_TSG_ID;
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
index c5a1bd24..4b5fe1b3 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.h
@@ -117,6 +117,7 @@ struct channel_gk20a {
117 bool vpr; 117 bool vpr;
118 bool cde; 118 bool cde;
119 pid_t pid; 119 pid_t pid;
120 pid_t tgid;
120 struct mutex ioctl_lock; 121 struct mutex ioctl_lock;
121 122
122 int tsgid; 123 int tsgid;
diff --git a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c
index d43c06be..1f18d9cf 100644
--- a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c
@@ -657,7 +657,7 @@ void gk20a_ctxsw_trace_channel_reset(struct gk20a *g, struct channel_gk20a *ch)
657 .vmid = 0, 657 .vmid = 0,
658 .tag = NVGPU_CTXSW_TAG_ENGINE_RESET, 658 .tag = NVGPU_CTXSW_TAG_ENGINE_RESET,
659 .context_id = 0, 659 .context_id = 0,
660 .pid = ch->pid, 660 .pid = ch->tgid,
661 }; 661 };
662 662
663 if (!g->ctxsw_trace) 663 if (!g->ctxsw_trace)
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
index 15e645f2..abf1cc55 100644
--- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
@@ -631,10 +631,14 @@ static int gk20a_fecs_trace_bind_channel(struct gk20a *g,
631 GK20A_FECS_TRACE_NUM_RECORDS)); 631 GK20A_FECS_TRACE_NUM_RECORDS));
632 632
633 gk20a_mem_end(g, mem); 633 gk20a_mem_end(g, mem);
634
635 /* pid (process identifier) in user space, corresponds to tgid (thread
636 * group id) in kernel space.
637 */
634 if (gk20a_is_channel_marked_as_tsg(ch)) 638 if (gk20a_is_channel_marked_as_tsg(ch))
635 pid = tsg_gk20a_from_ch(ch)->tgid; 639 pid = tsg_gk20a_from_ch(ch)->tgid;
636 else 640 else
637 pid = ch->pid; 641 pid = ch->tgid;
638 gk20a_fecs_trace_hash_add(g, context_ptr, pid); 642 gk20a_fecs_trace_hash_add(g, context_ptr, pid);
639 643
640 return 0; 644 return 0;
diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
index 8c82fc68..5133f86a 100644
--- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c
@@ -2999,7 +2999,7 @@ static int gk20a_fifo_sched_debugfs_seq_show(
2999 seq_printf(s, "%-8d %-8d %-8d %-9d %-8d %-10d %-8d %-8d\n", 2999 seq_printf(s, "%-8d %-8d %-8d %-9d %-8d %-10d %-8d %-8d\n",
3000 ch->hw_chid, 3000 ch->hw_chid,
3001 ch->tsgid, 3001 ch->tsgid,
3002 ch->pid, 3002 ch->tgid,
3003 tsg ? tsg->timeslice_us : ch->timeslice_us, 3003 tsg ? tsg->timeslice_us : ch->timeslice_us,
3004 ch->timeout_ms_max, 3004 ch->timeout_ms_max,
3005 ch->interleave_level, 3005 ch->interleave_level,
diff --git a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
index 29692573..8d3a5e9f 100644
--- a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c
@@ -74,7 +74,7 @@ static int vgpu_channel_alloc_inst(struct gk20a *g, struct channel_gk20a *ch)
74 msg.cmd = TEGRA_VGPU_CMD_CHANNEL_ALLOC_HWCTX; 74 msg.cmd = TEGRA_VGPU_CMD_CHANNEL_ALLOC_HWCTX;
75 msg.handle = platform->virt_handle; 75 msg.handle = platform->virt_handle;
76 p->id = ch->hw_chid; 76 p->id = ch->hw_chid;
77 p->pid = (u64)current->pid; 77 p->pid = (u64)current->tgid;
78 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); 78 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
79 if (err || msg.ret) { 79 if (err || msg.ret) {
80 gk20a_err(dev_from_gk20a(g), "fail"); 80 gk20a_err(dev_from_gk20a(g), "fail");