mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 18:16:01 +03:00
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>
This commit is contained in:
committed by
mobile promotions
parent
45d0a9c711
commit
cae514120b
@@ -19,7 +19,6 @@
|
|||||||
#include <nvgpu/ltc.h>
|
#include <nvgpu/ltc.h>
|
||||||
#include <nvgpu/error_notifier.h>
|
#include <nvgpu/error_notifier.h>
|
||||||
#include <nvgpu/os_sched.h>
|
#include <nvgpu/os_sched.h>
|
||||||
#include <nvgpu/timers.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is required for nvgpu_vm_find_buf() which is used in the tracing
|
* 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;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile)
|
gk20a_fifo_profile_snapshot(profile, PROFILE_ENTRY);
|
||||||
profile->timestamp[PROFILE_ENTRY] = nvgpu_current_time_ns();
|
|
||||||
|
|
||||||
/* update debug settings */
|
/* update debug settings */
|
||||||
nvgpu_ltc_sync_enabled(g);
|
nvgpu_ltc_sync_enabled(g);
|
||||||
@@ -961,8 +959,7 @@ int gk20a_submit_channel_gpfifo(struct channel_gk20a *c,
|
|||||||
goto clean_up_job;
|
goto clean_up_job;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile)
|
gk20a_fifo_profile_snapshot(profile, PROFILE_JOB_TRACKING);
|
||||||
profile->timestamp[PROFILE_JOB_TRACKING] = nvgpu_current_time_ns();
|
|
||||||
|
|
||||||
if (wait_cmd)
|
if (wait_cmd)
|
||||||
gk20a_submit_append_priv_cmdbuf(c, 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)
|
if (need_job_tracking)
|
||||||
/* TODO! Check for errors... */
|
/* TODO! Check for errors... */
|
||||||
gk20a_channel_add_job(c, job, skip_buffer_refcounting);
|
gk20a_channel_add_job(c, job, skip_buffer_refcounting);
|
||||||
if (profile)
|
gk20a_fifo_profile_snapshot(profile, PROFILE_APPEND);
|
||||||
profile->timestamp[PROFILE_APPEND] = nvgpu_current_time_ns();
|
|
||||||
|
|
||||||
g->ops.fifo.userd_gp_put(g, c);
|
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",
|
nvgpu_log_info(g, "post-submit put %d, get %d, size %d",
|
||||||
c->gpfifo.put, c->gpfifo.get, c->gpfifo.entry_num);
|
c->gpfifo.put, c->gpfifo.get, c->gpfifo.entry_num);
|
||||||
|
|
||||||
if (profile)
|
gk20a_fifo_profile_snapshot(profile, PROFILE_END);
|
||||||
profile->timestamp[PROFILE_END] = nvgpu_current_time_ns();
|
|
||||||
nvgpu_log_fn(g, "done");
|
nvgpu_log_fn(g, "done");
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include <linux/seq_file.h>
|
#include <linux/seq_file.h>
|
||||||
|
|
||||||
#include <nvgpu/sort.h>
|
#include <nvgpu/sort.h>
|
||||||
|
#include <nvgpu/timers.h>
|
||||||
|
|
||||||
void __gk20a_fifo_profile_free(struct nvgpu_ref *ref);
|
void __gk20a_fifo_profile_free(struct nvgpu_ref *ref);
|
||||||
|
|
||||||
@@ -325,6 +326,12 @@ void gk20a_fifo_debugfs_init(struct gk20a *g)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gk20a_fifo_profile_snapshot(struct fifo_profile_gk20a *profile, int idx)
|
||||||
|
{
|
||||||
|
if (profile)
|
||||||
|
profile->timestamp[idx] = nvgpu_current_time_ns();
|
||||||
|
}
|
||||||
|
|
||||||
void __gk20a_fifo_profile_free(struct nvgpu_ref *ref)
|
void __gk20a_fifo_profile_free(struct nvgpu_ref *ref)
|
||||||
{
|
{
|
||||||
struct fifo_gk20a *f = container_of(ref, struct fifo_gk20a,
|
struct fifo_gk20a *f = container_of(ref, struct fifo_gk20a,
|
||||||
|
|||||||
@@ -780,12 +780,9 @@ static int gk20a_ioctl_channel_submit_gpfifo(
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
nvgpu_log_fn(g, " ");
|
nvgpu_log_fn(g, " ");
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS
|
|
||||||
profile = gk20a_fifo_profile_acquire(ch->g);
|
profile = gk20a_fifo_profile_acquire(ch->g);
|
||||||
|
gk20a_fifo_profile_snapshot(profile, PROFILE_IOCTL_ENTRY);
|
||||||
|
|
||||||
if (profile)
|
|
||||||
profile->timestamp[PROFILE_IOCTL_ENTRY] = nvgpu_current_time_ns();
|
|
||||||
#endif
|
|
||||||
if (ch->has_timedout)
|
if (ch->has_timedout)
|
||||||
return -ETIMEDOUT;
|
return -ETIMEDOUT;
|
||||||
|
|
||||||
@@ -825,12 +822,11 @@ static int gk20a_ioctl_channel_submit_gpfifo(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
gk20a_fence_put(fence_out);
|
gk20a_fence_put(fence_out);
|
||||||
#ifdef CONFIG_DEBUG_FS
|
|
||||||
if (profile) {
|
gk20a_fifo_profile_snapshot(profile, PROFILE_IOCTL_EXIT);
|
||||||
profile->timestamp[PROFILE_IOCTL_EXIT] = nvgpu_current_time_ns();
|
if (profile)
|
||||||
gk20a_fifo_profile_release(ch->g, profile);
|
gk20a_fifo_profile_release(ch->g, profile);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
clean_up:
|
clean_up:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -349,6 +349,21 @@ bool gk20a_is_fault_engine_subid_gpc(struct gk20a *g, u32 engine_subid);
|
|||||||
struct fifo_profile_gk20a *gk20a_fifo_profile_acquire(struct gk20a *g);
|
struct fifo_profile_gk20a *gk20a_fifo_profile_acquire(struct gk20a *g);
|
||||||
void gk20a_fifo_profile_release(struct gk20a *g,
|
void gk20a_fifo_profile_release(struct gk20a *g,
|
||||||
struct fifo_profile_gk20a *profile);
|
struct fifo_profile_gk20a *profile);
|
||||||
|
void gk20a_fifo_profile_snapshot(struct fifo_profile_gk20a *profile, int idx);
|
||||||
|
#else
|
||||||
|
static inline struct fifo_profile_gk20a *
|
||||||
|
gk20a_fifo_profile_acquire(struct gk20a *g)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
static inline void gk20a_fifo_profile_release(struct gk20a *g,
|
||||||
|
struct fifo_profile_gk20a *profile)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
static inline void gk20a_fifo_profile_snapshot(
|
||||||
|
struct fifo_profile_gk20a *profile, int idx)
|
||||||
|
{
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void gk20a_dump_channel_status_ramfc(struct gk20a *g,
|
void gk20a_dump_channel_status_ramfc(struct gk20a *g,
|
||||||
|
|||||||
Reference in New Issue
Block a user