From: Tvrtko Ursulin <tursulin@ursulin.net>
To: "Pierre-Eric Pelloux-Prayer" <pierre-eric.pelloux-prayer@amd.com>,
"Matthew Brost" <matthew.brost@intel.com>,
"Danilo Krummrich" <dakr@kernel.org>,
"Philipp Stanner" <phasta@kernel.org>,
"Christian König" <ckoenig.leichtzumerken@gmail.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Sumit Semwal" <sumit.semwal@linaro.org>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org
Subject: Re: [PATCH v8 05/10] drm/sched: trace dependencies for gpu jobs
Date: Thu, 20 Mar 2025 10:47:28 +0000 [thread overview]
Message-ID: <d4ef3a3b-eed1-4c15-827b-4a34a8a47dc1@ursulin.net> (raw)
In-Reply-To: <20250320095818.40622-6-pierre-eric.pelloux-prayer@amd.com>
On 20/03/2025 09:58, Pierre-Eric Pelloux-Prayer wrote:
> We can't trace dependencies from drm_sched_job_add_dependency
> because when it's called the job's fence is not available yet.
>
> So instead each dependency is traced individually when
> drm_sched_entity_push_job is used.
>
> Tracing the dependencies allows tools to analyze the dependencies
> between the jobs (previously it was only possible for fences
> traced by drm_sched_job_wait_dep).
>
> Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
> ---
> .../gpu/drm/scheduler/gpu_scheduler_trace.h | 24 ++++++++++++++++++-
> drivers/gpu/drm/scheduler/sched_entity.c | 8 +++++++
> 2 files changed, 31 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h
> index 21a85ee59066..5d9992ad47d3 100644
> --- a/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h
> +++ b/drivers/gpu/drm/scheduler/gpu_scheduler_trace.h
> @@ -54,7 +54,6 @@ DECLARE_EVENT_CLASS(drm_sched_job,
> __assign_str(dev);
> __entry->fence_context = sched_job->s_fence->finished.context;
> __entry->fence_seqno = sched_job->s_fence->finished.seqno;
> -
> ),
> TP_printk("dev=%s, id=%llu, fence=%llu:%llu, ring=%s, job count:%u, hw job count:%d",
> __get_str(dev), __entry->id,
> @@ -88,6 +87,29 @@ TRACE_EVENT(drm_sched_process_job,
> __entry->fence_context, __entry->fence_seqno)
> );
>
> +TRACE_EVENT(drm_sched_job_add_dep,
> + TP_PROTO(struct drm_sched_job *sched_job, struct dma_fence *fence),
> + TP_ARGS(sched_job, fence),
> + TP_STRUCT__entry(
> + __field(u64, fence_context)
> + __field(u64, fence_seqno)
> + __field(u64, id)
> + __field(u64, ctx)
> + __field(u64, seqno)
> + ),
> +
> + TP_fast_assign(
> + __entry->fence_context = sched_job->s_fence->finished.context;
> + __entry->fence_seqno = sched_job->s_fence->finished.seqno;
> + __entry->id = sched_job->id;
> + __entry->ctx = fence->context;
> + __entry->seqno = fence->seqno;
> + ),
> + TP_printk("fence=%llu:%llu, id=%llu depends on fence=%llu:%llu",
> + __entry->fence_context, __entry->fence_seqno, __entry->id,
> + __entry->ctx, __entry->seqno)
> +);
> +
> TRACE_EVENT(drm_sched_job_wait_dep,
> TP_PROTO(struct drm_sched_job *sched_job, struct dma_fence *fence),
> TP_ARGS(sched_job, fence),
> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
> index a6d2a4722d82..047e42cfb129 100644
> --- a/drivers/gpu/drm/scheduler/sched_entity.c
> +++ b/drivers/gpu/drm/scheduler/sched_entity.c
> @@ -580,6 +580,14 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job)
> ktime_t submit_ts;
>
> trace_drm_sched_job(sched_job, entity);
> +
> + if (trace_drm_sched_job_add_dep_enabled()) {
> + struct dma_fence *entry;
> + unsigned long index;
> +
> + xa_for_each(&sched_job->dependencies, index, entry)
> + trace_drm_sched_job_add_dep(sched_job, entry);
> + }
> atomic_inc(entity->rq->sched->score);
> WRITE_ONCE(entity->last_user, current->group_leader);
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Regards,
Tvrtko
next prev parent reply other threads:[~2025-03-20 10:47 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-20 9:57 [PATCH v8 00/10] Improve gpu_scheduler trace events + UAPI Pierre-Eric Pelloux-Prayer
2025-03-20 9:57 ` [PATCH v8 01/10] drm/debugfs: output client_id in in drm_clients_info Pierre-Eric Pelloux-Prayer
2025-03-20 9:57 ` [PATCH v8 02/10] drm/sched: store the drm client_id in drm_sched_fence Pierre-Eric Pelloux-Prayer
2025-03-20 9:57 ` [PATCH v8 03/10] drm/sched: add device name to the drm_sched_process_job event Pierre-Eric Pelloux-Prayer
2025-03-20 9:58 ` [PATCH v8 04/10] drm/sched: cleanup gpu_scheduler trace events Pierre-Eric Pelloux-Prayer
2025-03-20 10:46 ` Tvrtko Ursulin
2025-03-20 9:58 ` [PATCH v8 05/10] drm/sched: trace dependencies for gpu jobs Pierre-Eric Pelloux-Prayer
2025-03-20 10:47 ` Tvrtko Ursulin [this message]
2025-03-20 9:58 ` [PATCH v8 06/10] drm/sched: add the drm_client_id to the drm_sched_run/exec_job events Pierre-Eric Pelloux-Prayer
2025-04-09 7:56 ` Philipp Stanner
2025-03-20 9:58 ` [PATCH v8 07/10] drm/sched: cleanup event names Pierre-Eric Pelloux-Prayer
2025-03-20 10:49 ` Tvrtko Ursulin
2025-03-20 9:58 ` [PATCH v8 08/10] drm/doc: document some tracepoints as uAPI Pierre-Eric Pelloux-Prayer
2025-03-20 9:58 ` [PATCH v8 09/10] drm: get rid of drm_sched_job::id Pierre-Eric Pelloux-Prayer
2025-03-20 10:09 ` Christian König
2025-03-20 10:55 ` Tvrtko Ursulin
2025-03-20 9:58 ` [PATCH v8 10/10] drm/amdgpu: update trace format to match gpu_scheduler_trace Pierre-Eric Pelloux-Prayer
2025-03-20 10:09 ` Christian König
2025-04-09 7:52 ` [PATCH v8 00/10] Improve gpu_scheduler trace events + UAPI Pierre-Eric Pelloux-Prayer
2025-04-09 8:03 ` Philipp Stanner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d4ef3a3b-eed1-4c15-827b-4a34a8a47dc1@ursulin.net \
--to=tursulin@ursulin.net \
--cc=airlied@gmail.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.brost@intel.com \
--cc=mripard@kernel.org \
--cc=phasta@kernel.org \
--cc=pierre-eric.pelloux-prayer@amd.com \
--cc=simona@ffwll.ch \
--cc=sumit.semwal@linaro.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®