mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Stanner <phasta@mailbox.org>
To: Sidong Yang <sidong.yang@furiosa.ai>,
	Tomeu Vizoso <tomeu@tomeuvizoso.net>,
	 Oded Gabbay <ogabbay@kernel.org>,
	Philipp Stanner <phasta@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	 Matthew Brost <matthew.brost@intel.com>,
	ckoenig.leichtzumerken@gmail.com
Cc: Tvrtko Ursulin <tursulin@ursulin.net>,
	mcanal@igalia.com, 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 18:13:43 +0100	[thread overview]
Message-ID: <34494226eb920bdbd7f3257ef6f9b20f4e8ffd6a.camel@mailbox.org> (raw)
In-Reply-To: <20261112171144.3151554-2-sidong.yang@furiosa.ai>

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.

P.

  parent reply	other threads:[~2026-11-18 17:13 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 [this message]
2026-11-18 17:39     ` Maíra Canal
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=34494226eb920bdbd7f3257ef6f9b20f4e8ffd6a.camel@mailbox.org \
    --to=phasta@mailbox.org \
    --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=mcanal@igalia.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®