dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Luben Tuikov <ltuikov89@gmail.com>
To: Danilo Krummrich <dakr@redhat.com>,
	Luben Tuikov <luben.tuikov@amd.com>,
	Direct Rendering Infrastructure - Development
	<dri-devel@lists.freedesktop.org>
Cc: "Matthew Brost" <matthew.brost@intel.com>,
	lima@lists.freedesktop.org, "Emma Anholt" <emma@anholt.net>,
	nouveau@lists.freedesktop.org,
	"Russell King" <linux+etnaviv@armlinux.org.uk>,
	"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
	etnaviv@lists.freedesktop.org,
	"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
	"Boris Brezillon" <boris.brezillon@collabora.com>,
	"Qiang Yu" <yuq825@gmail.com>,
	linux-arm-msm@vger.kernel.org,
	"Alex Deucher" <alexander.deucher@amd.com>,
	freedreno@lists.freedesktop.org,
	"Christian König" <christian.koenig@amd.com>
Subject: Re: [PATCH] drm/sched: Convert the GPU scheduler to variable number of run-queues
Date: Tue, 31 Oct 2023 21:46:00 -0400	[thread overview]
Message-ID: <bef15942-9543-4118-89c9-62c63c6215d4@gmail.com> (raw)
In-Reply-To: <c57c7217-bfb9-4770-b17e-587f3b8a038c@redhat.com>


[-- Attachment #1.1.1: Type: text/plain, Size: 3109 bytes --]

On 2023-10-31 09:33, Danilo Krummrich wrote:
> 
> On 10/26/23 19:25, Luben Tuikov wrote:
>> On 2023-10-26 12:39, Danilo Krummrich wrote:
>>> On 10/23/23 05:22, Luben Tuikov wrote:
>>>> The GPU scheduler has now a variable number of run-queues, which are set up at
>>>> drm_sched_init() time. This way, each driver announces how many run-queues it
>>>> requires (supports) per each GPU scheduler it creates. Note, that run-queues
>>>> correspond to scheduler "priorities", thus if the number of run-queues is set
>>>> to 1 at drm_sched_init(), then that scheduler supports a single run-queue,
>>>> i.e. single "priority". If a driver further sets a single entity per
>>>> run-queue, then this creates a 1-to-1 correspondence between a scheduler and
>>>> a scheduled entity.
>>>
>>> Generally, I'm fine with this patch and how it replaces / generalizes the single
>>> entity approach.
>>
>> Great!
>>
>>> However, I'm not quite sure how to properly use this. What is a driver supposed to
>>> do, which previously took advantage of DRM_SCHED_POLICY_SINGLE_ENTITY?
>>>
>>> Is it supposed to call drm_sched_init() with num_rqs=1? If so, what's the correct way
>>
>> Yes, you call drm_sched_init() with num_rqs set to 1.
>>
>>> to initialize the drm_sched_entity then? Calling drm_sched_entity_init() with priority=0?
>>
>> Yes, with priority set to 0.
>>
>> One unfortunate fact I noticed when doing this patch is that the numerical values
>> assigned to enum drm_sched_priority is that the names to values are upside down.
>> Instead of min being 0, normal:1, high:2, kernel:3, it should've been kernel:0 (highest),
>> high:1, normal:2, low:4, and so on.
>>
>> The reason for this is absolutely clear: if you had a single priority, it would be
>> 0, the kernel, one, highest one. This is similar to how lanes in a highway are counted:
>> you always have lane 1. Similarly to nice(1) and kernel priorities...
>>
>>> Any other priority consequently faults in drm_sched_job_arm().
>>
>> drm_sched_job_arm() faults on !ENTITY, but the "priority" is just
>> assigned to s_priority:
>> 	job->s_priority = entity->priority;
>>
>>
>>> While I might sound like a broken record (sorry for that), I really think everything
>>> related to Matt's series needs documentation, as in:
>>
>> Yes, I agree.
> 
> Great! Do you plan to send a subsequent patch adding some documentation for this one? I
> think it'd be good to get all the above documented.

A lot of this would be the magic sauce of drivers and hardware--as we've seen with Xe,
and it would be presumptuous of me to write down to the detail of what and how this
and that should be used.

So long as things are dynamic--as we've seen with the latest change in sched_rq--we let
drivers and hardware set the numbers and do their magic in their drivers and hardware.

Having said this, if something fundamental comes up to mind, I'd be sure to add a comment
there in--this applies to anyone else guys--don't be shy to post a patch adding comments
where you think there should be some.
-- 
Regards,
Luben

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 677 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  reply	other threads:[~2023-11-01  1:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23  3:22 [PATCH] drm/sched: Convert the GPU scheduler to variable number of run-queues Luben Tuikov
2023-10-26 15:20 ` Luben Tuikov
2023-10-26 16:09   ` Luben Tuikov
2023-10-26 16:39 ` Danilo Krummrich
2023-10-26 17:25   ` Luben Tuikov
2023-10-31 13:33     ` Danilo Krummrich
2023-11-01  1:46       ` Luben Tuikov [this message]
2023-11-01  2:37         ` Dave Airlie

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=bef15942-9543-4118-89c9-62c63c6215d4@gmail.com \
    --to=ltuikov89@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=boris.brezillon@collabora.com \
    --cc=christian.koenig@amd.com \
    --cc=dakr@redhat.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emma@anholt.net \
    --cc=etnaviv@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=lima@lists.freedesktop.org \
    --cc=linux+etnaviv@armlinux.org.uk \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=luben.tuikov@amd.com \
    --cc=matthew.brost@intel.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=yuq825@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).