Skip to content

Commit

Permalink
drm/v3d: Create tracepoints to track the CPU job
Browse files Browse the repository at this point in the history
Create tracepoints to track the three major events of a CPU job
lifetime:
	1. Submission of a `v3d_submit_cpu` IOCTL
	2. Beginning of the execution of a CPU job
	3. Ending of the execution of a CPU job

Signed-off-by: Maíra Canal <[email protected]>
Reviewed-by: Iago Toral Quiroga <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
mairacanal committed Dec 1, 2023
1 parent c5195d0 commit 1fe0879
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/gpu/drm/v3d/v3d_sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,12 @@ v3d_cpu_job_run(struct drm_sched_job *sched_job)
file->start_ns[V3D_CPU] = local_clock();
v3d->queue[V3D_CPU].start_ns = file->start_ns[V3D_CPU];

trace_v3d_cpu_job_begin(&v3d->drm, job->job_type);

cpu_job_function[job->job_type](job);

trace_v3d_cpu_job_end(&v3d->drm, job->job_type);

runtime = local_clock() - file->start_ns[V3D_CPU];

file->enabled_ns[V3D_CPU] += runtime;
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/v3d/v3d_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,8 @@ v3d_submit_cpu_ioctl(struct drm_device *dev, void *data,
goto fail;
}

trace_v3d_submit_cpu_ioctl(&v3d->drm, cpu_job->job_type);

ret = v3d_job_init(v3d, file_priv, &cpu_job->base,
v3d_job_free, 0, &se, V3D_CPU);
if (ret)
Expand Down
57 changes: 57 additions & 0 deletions drivers/gpu/drm/v3d/v3d_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,63 @@ TRACE_EVENT(v3d_submit_csd,
__entry->seqno)
);

TRACE_EVENT(v3d_submit_cpu_ioctl,
TP_PROTO(struct drm_device *dev, enum v3d_cpu_job_type job_type),
TP_ARGS(dev, job_type),

TP_STRUCT__entry(
__field(u32, dev)
__field(enum v3d_cpu_job_type, job_type)
),

TP_fast_assign(
__entry->dev = dev->primary->index;
__entry->job_type = job_type;
),

TP_printk("dev=%u, job_type=%d",
__entry->dev,
__entry->job_type)
);

TRACE_EVENT(v3d_cpu_job_begin,
TP_PROTO(struct drm_device *dev, enum v3d_cpu_job_type job_type),
TP_ARGS(dev, job_type),

TP_STRUCT__entry(
__field(u32, dev)
__field(enum v3d_cpu_job_type, job_type)
),

TP_fast_assign(
__entry->dev = dev->primary->index;
__entry->job_type = job_type;
),

TP_printk("dev=%u, job_type=%d",
__entry->dev,
__entry->job_type)
);

TRACE_EVENT(v3d_cpu_job_end,
TP_PROTO(struct drm_device *dev, enum v3d_cpu_job_type job_type),
TP_ARGS(dev, job_type),

TP_STRUCT__entry(
__field(u32, dev)
__field(enum v3d_cpu_job_type, job_type)
),

TP_fast_assign(
__entry->dev = dev->primary->index;
__entry->job_type = job_type;
),

TP_printk("dev=%u, job_type=%d",
__entry->dev,
__entry->job_type)
);

TRACE_EVENT(v3d_cache_clean_begin,
TP_PROTO(struct drm_device *dev),
TP_ARGS(dev),
Expand Down

0 comments on commit 1fe0879

Please sign in to comment.