public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Danilo Krummrich <dakr@redhat.com>
To: "Christian König" <christian.koenig@amd.com>
Cc: Boris Brezillon <boris.brezillon@collabora.com>,
	airlied@gmail.com, daniel@ffwll.ch, matthew.brost@intel.com,
	faith@gfxstrand.net, luben.tuikov@amd.com,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH drm-misc-next v3] drm/sched: implement dynamic job-flow control
Date: Tue, 31 Oct 2023 16:01:42 +0100	[thread overview]
Message-ID: <ZUEW1mxwGO3bxxGM@pollux> (raw)
In-Reply-To: <e9c6af32-8d2a-4f04-9c12-1170a3aa1236@amd.com>

On Tue, Oct 31, 2023 at 02:20:50PM +0100, Christian König wrote:
> Hi Danilo,
> 
> sorry for splitting up the mail thread. I had to fetch this mail from my
> spam folder for some reason.
> 
> Am 30.10.23 um 18:56 schrieb Danilo Krummrich:
> > Hi Christian,
> > 
> > [SNIP]
> > > > And yes, we can live with the overhead of making jobs
> > > > slightly bigger than they actually are, thus potentially delaying their
> > > > execution. It's just that I don't quite understand the rational behind
> > > > this conservatism, as I don't really see what negative impact this extra
> > > > ->update_job_credits() call in the credit checking path has, other than
> > > > the slight overhead of an if-check for drivers that don't need it.
> > >  From experience it showed that we should not make the scheduler more
> > > complicated than necessary. And I still think that the ring buffers only
> > > need to be filled enough to keep the hardware busy.
> > Right, and this callback contributes to exactly that.
> > 
> > I don't really think there is much to worry about in terms of introducing more
> > complexity. The implementation behind this callback is fairly trivial - it's
> > simply called right before we check whether a job fits on the ring, to fetch
> > the job's actual size.
> > 
> > I would agree if the implementation of that would be bulky, tricky and asking
> > for a compromise. But, since it actually is simple and straight forward I really
> > think that if we implement some kind of dynamic job-flow control it should be
> > implemented as acurate as possible rather than doing it half-baked.
> 
> Yeah, I see the intention here and can perfectly relate to it it's just that
> I have prioritize other things.

I don't see any work being required from your side for this.

> 
> Adding this callback allows for the driver to influence the job submission
> and while this might seems useful now I'm just to much of a burned child to
> do stuff like this without having a really good reason for it.

It does influence the job submission in the exact same way as the initial credit
count set through drm_sched_job_init() does. There is absolutely nothing with
this callback a driver couldn't mess up in the exact same way with the initial
credit count set through drm_sched_job_init(). Following this logic we'd need to
abandon the whole patch.

Hence, I don't really understand why you're so focused on this callback.
Especially, since it's an optional one.

> 
> > > If this here has some measurable positive effect then yeah we should
> > > probably do it, but as long as it's only nice to have I have some objections
> > > to that.
> > Can't answer this, since Nouveau doesn't support native fence waits. However, I
> > guess it depends on how many native fences a job carries. So, if we'd have two
> > jobs with each of them carrying a lot of native fences, but not a lot of actual
> > work, I can very well imagine that over-accounting can have a measureable
> > impact.
> 
> What I can imagine as well is things like the hardware or firmware is
> looking at the fullness of the ring buffer to predict how much pending work
> there is.
> 
> > I just wonder if we really want to ask for real measurements given that the
> > optimization is rather trivial and cheap and we already have enough evidence
> > that it makes sense conceptually.
> 
> Well that's the point I disagree on, this callback isn't trivial. If (for
> example) the driver returns a value larger than initially estimated for the
> job we can run into an endless loop.

I agree it doesn't make sense to increase, but it wouldn't break anything,
unless the job size starts exceeding the capacity of the ring. And this case is
handled anyway.

> 
> It's just one more thing which can go boom. At bare minimum we should check
> that the value is always decreasing.

Considering the above I still agree, such a check makes sense - gonna add one.

- Danilo

> 
> Christian.
> 
> > 
> > - Danilo
> > 
> > > Regards,
> > > Christian.
> > > 
> > > > Regards,
> > > > 
> > > > Boris


  parent reply	other threads:[~2023-10-31 15:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26 16:13 [PATCH drm-misc-next v3] drm/sched: implement dynamic job-flow control 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 [this message]
     [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

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=ZUEW1mxwGO3bxxGM@pollux \
    --to=dakr@redhat.com \
    --cc=airlied@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=faith@gfxstrand.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luben.tuikov@amd.com \
    --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