From cae514120b2c6420127ac6102a2d3fd5023218d0 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Tue, 22 May 2018 12:59:02 +0300 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1729545 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/channel.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'drivers/gpu/nvgpu/common/linux/channel.c') 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 @@ #include #include #include -#include /* * 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, return -EINVAL; } - if (profile) - profile->timestamp[PROFILE_ENTRY] = nvgpu_current_time_ns(); + gk20a_fifo_profile_snapshot(profile, PROFILE_ENTRY); /* update debug settings */ nvgpu_ltc_sync_enabled(g); @@ -961,8 +959,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, goto clean_up_job; } - if (profile) - profile->timestamp[PROFILE_JOB_TRACKING] = nvgpu_current_time_ns(); + gk20a_fifo_profile_snapshot(profile, PROFILE_JOB_TRACKING); if (wait_cmd) gk20a_submit_append_priv_cmdbuf(c, wait_cmd); @@ -986,8 +983,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, if (need_job_tracking) /* TODO! Check for errors... */ gk20a_channel_add_job(c, job, skip_buffer_refcounting); - if (profile) - profile->timestamp[PROFILE_APPEND] = nvgpu_current_time_ns(); + gk20a_fifo_profile_snapshot(profile, PROFILE_APPEND); g->ops.fifo.userd_gp_put(g, c); @@ -1005,8 +1001,8 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c, nvgpu_log_info(g, "post-submit put %d, get %d, size %d", c->gpfifo.put, c->gpfifo.get, c->gpfifo.entry_num); - if (profile) - profile->timestamp[PROFILE_END] = nvgpu_current_time_ns(); + gk20a_fifo_profile_snapshot(profile, PROFILE_END); + nvgpu_log_fn(g, "done"); return err; -- cgit v1.2.2