diff options
author | Konsta Holtta <kholtta@nvidia.com> | 2018-05-22 05:59:02 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-05-25 18:16:26 -0400 |
commit | cae514120b2c6420127ac6102a2d3fd5023218d0 (patch) | |
tree | 32d844f3224ed823172d8136d0279c1f7487df97 /drivers/gpu/nvgpu/common | |
parent | 45d0a9c711d50290eb3e8297ab9b5c4a5161f242 (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')
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/channel.c | 14 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/debug_fifo.c | 7 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_channel.c | 14 |
3 files changed, 17 insertions, 18 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 | ||
diff --git a/drivers/gpu/nvgpu/common/linux/debug_fifo.c b/drivers/gpu/nvgpu/common/linux/debug_fifo.c index f2aaef58..2b5674c0 100644 --- a/drivers/gpu/nvgpu/common/linux/debug_fifo.c +++ b/drivers/gpu/nvgpu/common/linux/debug_fifo.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
20 | 20 | ||
21 | #include <nvgpu/sort.h> | 21 | #include <nvgpu/sort.h> |
22 | #include <nvgpu/timers.h> | ||
22 | 23 | ||
23 | void __gk20a_fifo_profile_free(struct nvgpu_ref *ref); | 24 | void __gk20a_fifo_profile_free(struct nvgpu_ref *ref); |
24 | 25 | ||
@@ -325,6 +326,12 @@ void gk20a_fifo_debugfs_init(struct gk20a *g) | |||
325 | 326 | ||
326 | } | 327 | } |
327 | 328 | ||
329 | void gk20a_fifo_profile_snapshot(struct fifo_profile_gk20a *profile, int idx) | ||
330 | { | ||
331 | if (profile) | ||
332 | profile->timestamp[idx] = nvgpu_current_time_ns(); | ||
333 | } | ||
334 | |||
328 | void __gk20a_fifo_profile_free(struct nvgpu_ref *ref) | 335 | void __gk20a_fifo_profile_free(struct nvgpu_ref *ref) |
329 | { | 336 | { |
330 | struct fifo_gk20a *f = container_of(ref, struct fifo_gk20a, | 337 | struct fifo_gk20a *f = container_of(ref, struct fifo_gk20a, |
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c index f93412c3..b04bb9de 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_channel.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_channel.c | |||
@@ -780,12 +780,9 @@ static int gk20a_ioctl_channel_submit_gpfifo( | |||
780 | int ret = 0; | 780 | int ret = 0; |
781 | nvgpu_log_fn(g, " "); | 781 | nvgpu_log_fn(g, " "); |
782 | 782 | ||
783 | #ifdef CONFIG_DEBUG_FS | ||
784 | profile = gk20a_fifo_profile_acquire(ch->g); | 783 | profile = gk20a_fifo_profile_acquire(ch->g); |
784 | gk20a_fifo_profile_snapshot(profile, PROFILE_IOCTL_ENTRY); | ||
785 | 785 | ||
786 | if (profile) | ||
787 | profile->timestamp[PROFILE_IOCTL_ENTRY] = nvgpu_current_time_ns(); | ||
788 | #endif | ||
789 | if (ch->has_timedout) | 786 | if (ch->has_timedout) |
790 | return -ETIMEDOUT; | 787 | return -ETIMEDOUT; |
791 | 788 | ||
@@ -825,12 +822,11 @@ static int gk20a_ioctl_channel_submit_gpfifo( | |||
825 | } | 822 | } |
826 | } | 823 | } |
827 | gk20a_fence_put(fence_out); | 824 | gk20a_fence_put(fence_out); |
828 | #ifdef CONFIG_DEBUG_FS | 825 | |
829 | if (profile) { | 826 | gk20a_fifo_profile_snapshot(profile, PROFILE_IOCTL_EXIT); |
830 | profile->timestamp[PROFILE_IOCTL_EXIT] = nvgpu_current_time_ns(); | 827 | if (profile) |
831 | gk20a_fifo_profile_release(ch->g, profile); | 828 | gk20a_fifo_profile_release(ch->g, profile); |
832 | } | 829 | |
833 | #endif | ||
834 | clean_up: | 830 | clean_up: |
835 | return ret; | 831 | return ret; |
836 | } | 832 | } |