mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luben Tuikov <ltuikov89@gmail.com>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Danilo Krummrich <dakr@redhat.com>,
	matthew.brost@intel.com, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, faith@gfxstrand.net,
	christian.koenig@amd.com
Subject: Re: [PATCH drm-misc-next v3] drm/sched: implement dynamic job-flow control
Date: Fri, 27 Oct 2023 23:51:47 -0400	[thread overview]
Message-ID: <df7f500b-f911-4180-adf2-5a8b8bf2b6c7@gmail.com> (raw)
In-Reply-To: <20231027184143.4427edb8@collabora.com>


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

On 2023-10-27 12:41, Boris Brezillon wrote:
> On Fri, 27 Oct 2023 10:32:52 -0400
> Luben Tuikov <ltuikov89@gmail.com> wrote:
> 
>> On 2023-10-27 04:25, Boris Brezillon wrote:
>>> Hi Danilo,
>>>
>>> On Thu, 26 Oct 2023 18:13:00 +0200
>>> Danilo Krummrich <dakr@redhat.com> wrote:
>>>   
>>>> Currently, job flow control is implemented simply by limiting the number
>>>> of jobs in flight. Therefore, a scheduler is initialized with a credit
>>>> limit that corresponds to the number of jobs which can be sent to the
>>>> hardware.
>>>>
>>>> This implies that for each job, drivers need to account for the maximum
>>>> job size possible in order to not overflow the ring buffer.
>>>>
>>>> However, there are drivers, such as Nouveau, where the job size has a
>>>> rather large range. For such drivers it can easily happen that job
>>>> submissions not even filling the ring by 1% can block subsequent
>>>> submissions, which, in the worst case, can lead to the ring run dry.
>>>>
>>>> In order to overcome this issue, allow for tracking the actual job size
>>>> instead of the number of jobs. Therefore, add a field to track a job's
>>>> credit count, which represents the number of credits a job contributes
>>>> to the scheduler's credit limit.
>>>>
>>>> Signed-off-by: Danilo Krummrich <dakr@redhat.com>
>>>> ---
>>>> Changes in V2:
>>>> ==============
>>>>   - fixed up influence on scheduling fairness due to consideration of a job's
>>>>     size
>>>>     - If we reach a ready entity in drm_sched_select_entity() but can't actually
>>>>       queue a job from it due to size limitations, just give up and go to sleep
>>>>       until woken up due to a pending job finishing, rather than continue to try
>>>>       other entities.
>>>>   - added a callback to dynamically update a job's credits (Boris)  
>>>
>>> This callback seems controversial. I'd suggest dropping it, so the
>>> patch can be merged.  
>>
>> Sorry, why is it controversial? (I did read back-and-forth above, but it wasn't clear
>> why it is /controversial/.)
> 
> That's a question for Christian, I guess. I didn't quite get what he
> was worried about, other than this hook introducing a new way for
> drivers to screw things up by returning funky/invalid credits (which we

It's up to the driver--they can test, test, test, and fix their code and so on.
We can only do so much and shouldn't be baby-sitting drivers ad nauseam. Drivers
can also not define this callback. :-)

> can report with WARN_ON()s). But let's be honest, there's probably a
> hundred different ways (if not more) drivers can shoot themselves in the
> foot with drm_sched already...

Yes, that's true. So there's no worries with this hook.

> 
>>
>> I believe only drivers are privy to changes in the credit availability as their
>> firmware and hardware executes new jobs and finishes others, and so this "update"
>> here is essential--leaving it only to prepare_job() wouldn't quite fulfill the vision
>> of why the credit mechanism introduced by this patch in the first place.
> 
> I kinda agree with you, even if I wouldn't so pessimistic as to how
> useful this patch would be without the ->update_job_credits() hook
> (it already makes the situation a lot better for Nouveau and probably
> other drivers too).

Sure, and that's a good thing.

The heart of the dynamic credit scheme this patch is introducing *is* update_job_credits()
callback. Without it, it's just about like the current job flow-control scheme we have with
varied job weights (credits). Remember, it is an optional callback and driver can choose NOT
to define it--simple. :-)

So, I'm very excited about this, and see a wide range of applications and tricks drivers
can do with the credit scheme (albeit had it been an "int" bwha-ha-ha-ha ]:-> ).

Have a good weekend everyone!
-- 
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 --]

      parent reply	other threads:[~2023-10-28  3:52 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26 16:13 Danilo Krummrich
2023-10-26 21:13 ` Luben Tuikov
2023-10-27  1:03   ` Luben Tuikov
2023-10-27  7:17 ` Boris Brezillon
     [not found]   ` <794f9b45-db0d-4261-aefe-7da2ad0ed3b7@redhat.com>
     [not found]     ` <20231027182626.6a8ba090@collabora.com>
2023-10-28  3:34       ` Luben Tuikov
2023-10-27  7:22 ` Christian König
2023-10-27  7:32   ` Boris Brezillon
2023-10-27  7:35     ` Christian König
2023-10-27  7:39       ` Boris Brezillon
     [not found]         ` <98988459-25a8-4ee0-89d4-cb816cbc5bef@amd.com>
2023-10-27  8:22           ` Boris Brezillon
     [not found]             ` <190e3ab7-6440-4d41-a79f-5dd4b7d3ca52@amd.com>
2023-10-27 10:17               ` Boris Brezillon
2023-10-30  7:38                 ` Christian König
2023-10-30 17:56                   ` Danilo Krummrich
     [not found]                     ` <e9c6af32-8d2a-4f04-9c12-1170a3aa1236@amd.com>
2023-10-31 15:01                       ` Danilo Krummrich
     [not found]                         ` <8d4a0870-f7d0-41ee-aa25-6488b6ea037a@amd.com>
     [not found]                           ` <ZUPkfKzgKqhqQhMI@pollux>
     [not found]                             ` <c91cf097-2ed3-4669-b9ae-b16b5f875b02@amd.com>
2023-11-06 16:46                               ` Danilo Krummrich
2023-11-07  9:13                                 ` Christian König
2023-11-07 13:03                                   ` Danilo Krummrich
2023-10-27  8:25 ` Boris Brezillon
     [not found]   ` <8e117f9f-a01c-4242-8781-b2ed4969513b@redhat.com>
     [not found]     ` <20231027183158.2dc4cce4@collabora.com>
2023-10-28  3:37       ` Luben Tuikov
     [not found]   ` <a9215c37-61cd-4fbc-9f80-217daacd96bd@gmail.com>
     [not found]     ` <20231027184143.4427edb8@collabora.com>
2023-10-28  3:51       ` Luben Tuikov [this message]

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=df7f500b-f911-4180-adf2-5a8b8bf2b6c7@gmail.com \
    --to=ltuikov89@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=christian.koenig@amd.com \
    --cc=dakr@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=faith@gfxstrand.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew.brost@intel.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

all inboxes | Powered by JetHome®