From: "Maíra Canal" <mcanal@igalia.com>
To: phasta@kernel.org, Sidong Yang <sidong.yang@furiosa.ai>,
Tomeu Vizoso <tomeu@tomeuvizoso.net>,
Oded Gabbay <ogabbay@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Matthew Brost <matthew.brost@intel.com>,
ckoenig.leichtzumerken@gmail.com
Cc: Tvrtko Ursulin <tursulin@ursulin.net>,
Heiko Stuebner <heiko@sntech.de>,
Gyeyoung Baek <gye976@gmail.com>,
dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 1/2] drm/sched: Add drm_sched_entity_get_runtime()
Date: Wed, 18 Nov 2026 14:39:05 -0300 [thread overview]
Message-ID: <1b78ef4b-011e-4174-800e-425c94fddf3a@igalia.com> (raw)
In-Reply-To: <34494226eb920bdbd7f3257ef6f9b20f4e8ffd6a.camel@mailbox.org>
On 18/11/26 14:13, Philipp Stanner wrote:
> On Fri, 2026-11-13 at 02:11 +0900, Sidong Yang wrote:
>> The scheduler accumulates the time each entity's jobs spend on the
>> hardware for the fair policy, but drivers cannot read it. Export it so
>> drivers can report per-client engine time through fdinfo without
>> keeping their own counter.
>>
>> The stats object is refcounted and held by the entity and its jobs, so
>> unlike commit df622729ddbf ("drm/scheduler: track GPU active time per
>> entity"), which was reverted, accounting a job does not touch the
>> entity.
>
> In general looks good to me, no objections.
>
> But a question below:
>
>>
>> Suggested-by: Tvrtko Ursulin <tursulin@ursulin.net>
>> Signed-off-by: Sidong Yang <sidong.yang@furiosa.ai>
>
>
>> +u64 drm_sched_entity_get_runtime(struct drm_sched_entity *entity)
>> +{
>> + struct drm_sched_entity_stats *stats = entity->stats;
>> + ktime_t runtime;
>> +
>> + spin_lock(&stats->lock);
>> + runtime = stats->runtime;
>> + spin_unlock(&stats->lock);
>> +
>> + return ktime_to_ns(runtime);
>
> Why not return it as ktime_t?
>
> ktime_t, I suppose, is the universal time unit in the kernel, and the
> user can use one of the converters to turn it into whatever is desired.
>
> With ns you would have to write the converters yourself.
Considering that the main use of this function by the drivers would be
fdinfo, I believe that ns makes more sense. Otherwise, all drivers would
need to convert to ns locally.
Maybe we could name it drm_sched_entity_get_runtime_ns()?
Best regards,
- Maíra
>
> P.
next prev parent reply other threads:[~2026-11-18 17:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 17:11 [PATCH v5 0/2] accel/rocket: Report NPU usage through fdinfo Sidong Yang
2026-11-12 17:11 ` [PATCH v5 1/2] drm/sched: Add drm_sched_entity_get_runtime() Sidong Yang
2026-11-18 16:34 ` Tvrtko Ursulin
2026-11-18 17:13 ` Philipp Stanner
2026-11-18 17:39 ` Maíra Canal [this message]
2026-11-12 17:11 ` [PATCH v5 2/2] accel/rocket: Report NPU usage through fdinfo Sidong Yang
2026-11-18 16:42 ` Tvrtko Ursulin
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=1b78ef4b-011e-4174-800e-425c94fddf3a@igalia.com \
--to=mcanal@igalia.com \
--cc=ckoenig.leichtzumerken@gmail.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gye976@gmail.com \
--cc=heiko@sntech.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew.brost@intel.com \
--cc=ogabbay@kernel.org \
--cc=phasta@kernel.org \
--cc=sidong.yang@furiosa.ai \
--cc=tomeu@tomeuvizoso.net \
--cc=tursulin@ursulin.net \
/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®