From: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
To: Lucas Stach <l.stach@pengutronix.de>,
etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: patchwork-lst@pengutronix.de, kernel@pengutronix.de,
Russell King <linux+etnaviv@armlinux.org.uk>
Subject: Re: [PATCH 1/3] drm/scheduler: track GPU active time per entity
Date: Thu, 8 Sep 2022 14:33:07 -0400 [thread overview]
Message-ID: <69924bc6-d249-35b2-a942-a43a9293558e@amd.com> (raw)
In-Reply-To: <20220908181013.3214205-1-l.stach@pengutronix.de>
On 2022-09-08 14:10, Lucas Stach wrote:
> Track the accumulated time that jobs from this entity were active
> on the GPU. This allows drivers using the scheduler to trivially
> implement the DRM fdinfo when the hardware doesn't provide more
> specific information than signalling job completion anyways.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> drivers/gpu/drm/scheduler/sched_main.c | 6 ++++++
> include/drm/gpu_scheduler.h | 7 +++++++
> 2 files changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index 76fd2904c7c6..24c77a6a157f 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -847,6 +847,12 @@ drm_sched_get_cleanup_job(struct drm_gpu_scheduler *sched)
>
> spin_unlock(&sched->job_list_lock);
>
> + if (job) {
> + job->entity->elapsed_ns += ktime_to_ns(
> + ktime_sub(job->s_fence->finished.timestamp,
> + job->s_fence->scheduled.timestamp));
> + }
> +
> return job;
Looks like you making as assumption that drm_sched_entity will always be
allocated using kzalloc ? Isn't it a bit dangerous assumption ?
Andrey
> }
>
> diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
> index addb135eeea6..573bef640664 100644
> --- a/include/drm/gpu_scheduler.h
> +++ b/include/drm/gpu_scheduler.h
> @@ -196,6 +196,13 @@ struct drm_sched_entity {
> * drm_sched_entity_fini().
> */
> struct completion entity_idle;
> + /**
> + * @elapsed_ns
> + *
> + * Records the amount of time where jobs from this entity were active
> + * on the GPU.
> + */
> + uint64_t elapsed_ns;
> };
>
> /**
next prev parent reply other threads:[~2022-09-08 18:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 18:10 [PATCH 1/3] drm/scheduler: track GPU active time per entity Lucas Stach
2022-09-08 18:10 ` [PATCH 2/3] drm/etnaviv: allocate unique ID per drm_file Lucas Stach
2022-09-08 18:10 ` [PATCH 3/3] drm/etnaviv: export client GPU usage statistics via fdinfo Lucas Stach
2022-09-16 9:31 ` Tvrtko Ursulin
2022-09-16 9:50 ` Lucas Stach
2022-09-16 12:18 ` Tvrtko Ursulin
2022-09-08 18:33 ` Andrey Grodzovsky [this message]
2022-09-16 9:12 ` [PATCH 1/3] drm/scheduler: track GPU active time per entity Lucas Stach
2022-09-16 13:37 ` Andrey Grodzovsky
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=69924bc6-d249-35b2-a942-a43a9293558e@amd.com \
--to=andrey.grodzovsky@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=etnaviv@lists.freedesktop.org \
--cc=kernel@pengutronix.de \
--cc=l.stach@pengutronix.de \
--cc=linux+etnaviv@armlinux.org.uk \
--cc=patchwork-lst@pengutronix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.