summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/channel.c
diff options
context:
space:
mode:
authorKonsta Holtta <kholtta@nvidia.com>2018-05-22 05:59:02 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-05-25 18:16:26 -0400
commitcae514120b2c6420127ac6102a2d3fd5023218d0 (patch)
tree32d844f3224ed823172d8136d0279c1f7487df97 /drivers/gpu/nvgpu/common/linux/channel.c
parent45d0a9c711d50290eb3e8297ab9b5c4a5161f242 (diff)
gpu: nvgpu: abstract submit profiling
Add gk20a_fifo_profile_snapshot() to store the submit time in a profiling entry that was acquired from gk20a_fifo_profile_acquire(). Also get rid of ifdef CONFIG_DEBUG_FS by stubbing the acquire and free functions when debugfs is not enabled. This reduces some cyclomatic complexity in the submit path. Jira NVGPU-708 Change-Id: I39829a6475cfe3aa582620219e420bde62228e52 Signed-off-by: Konsta Holtta <kholtta@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1729545 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/channel.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/channel.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/channel.c b/drivers/gpu/nvgpu/common/linux/channel.c
index 727b5067..7810bc21 100644
--- a/drivers/gpu/nvgpu/common/linux/channel.c
+++ b/drivers/gpu/nvgpu/common/linux/channel.c
@@ -19,7 +19,6 @@
19#include <nvgpu/ltc.h> 19#include <nvgpu/ltc.h>
20#include <nvgpu/error_notifier.h> 20#include <nvgpu/error_notifier.h>
21#include <nvgpu/os_sched.h> 21#include <nvgpu/os_sched.h>
22#include <nvgpu/timers.h>
23 22
24/* 23/*
25 * This is required for nvgpu_vm_find_buf() which is used in the tracing 24 * This is required for nvgpu_vm_find_buf() which is used in the tracing
@@ -812,8 +811,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
812 return -EINVAL; 811 return -EINVAL;
813 } 812 }
814 813
815 if (profile) 814 gk20a_fifo_profile_snapshot(profile, PROFILE_ENTRY);
816 profile->timestamp[PROFILE_ENTRY] = nvgpu_current_time_ns();
817 815
818 /* update debug settings */ 816 /* update debug settings */
819 nvgpu_ltc_sync_enabled(g); 817 nvgpu_ltc_sync_enabled(g);
@@ -961,8 +959,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
961 goto clean_up_job; 959 goto clean_up_job;
962 } 960 }
963 961
964 if (profile) 962 gk20a_fifo_profile_snapshot(profile, PROFILE_JOB_TRACKING);
965 profile->timestamp[PROFILE_JOB_TRACKING] = nvgpu_current_time_ns();
966 963
967 if (wait_cmd) 964 if (wait_cmd)
968 gk20a_submit_append_priv_cmdbuf(c, wait_cmd); 965 gk20a_submit_append_priv_cmdbuf(c, wait_cmd);
@@ -986,8 +983,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
986 if (need_job_tracking) 983 if (need_job_tracking)
987 /* TODO! Check for errors... */ 984 /* TODO! Check for errors... */
988 gk20a_channel_add_job(c, job, skip_buffer_refcounting); 985 gk20a_channel_add_job(c, job, skip_buffer_refcounting);
989 if (profile) 986 gk20a_fifo_profile_snapshot(profile, PROFILE_APPEND);
990 profile->timestamp[PROFILE_APPEND] = nvgpu_current_time_ns();
991 987
992 g->ops.fifo.userd_gp_put(g, c); 988 g->ops.fifo.userd_gp_put(g, c);
993 989
@@ -1005,8 +1001,8 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
1005 nvgpu_log_info(g, "post-submit put %d, get %d, size %d", 1001 nvgpu_log_info(g, "post-submit put %d, get %d, size %d",
1006 c->gpfifo.put, c->gpfifo.get, c->gpfifo.entry_num); 1002 c->gpfifo.put, c->gpfifo.get, c->gpfifo.entry_num);
1007 1003
1008 if (profile) 1004 gk20a_fifo_profile_snapshot(profile, PROFILE_END);
1009 profile->timestamp[PROFILE_END] = nvgpu_current_time_ns(); 1005
1010 nvgpu_log_fn(g, "done"); 1006 nvgpu_log_fn(g, "done");
1011 return err; 1007 return err;
1012 1008