All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Danilo Krummrich <dakr@redhat.com>
Cc: matthew.brost@intel.com, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, luben.tuikov@amd.com,
	christian.koenig@amd.com, faith.ekstrand@collabora.com
Subject: Re: [PATCH drm-misc-next v2] drm/sched: implement dynamic job-flow control
Date: Fri, 27 Oct 2023 09:16:40 +0200	[thread overview]
Message-ID: <20231027091640.50d68251@collabora.com> (raw)
In-Reply-To: <ZTb6azSfTV+LRGYu@pollux>

Hi Danilo,

On Tue, 24 Oct 2023 00:57:47 +0200
Danilo Krummrich <dakr@redhat.com> wrote:

> > > +
> > > +	/**
> > > +	 * @update_job_credits: Called once the scheduler is considering this
> > > +	 * job for execution.
> > > +	 *
> > > +	 * Drivers may use this to update the job's submission credits, which is
> > > +	 * useful to e.g. deduct the number of native fences which have been
> > > +	 * signaled meanwhile.
> > > +	 *
> > > +	 * The callback must either return the new number of submission credits
> > > +	 * for the given job, or zero if no update is required.  
> > 
> > Any reason for having this special zero-means-no-update case? I mean,
> > drivers could just return sched_job->submission_credits if nothing
> > changed, and that would simplify the semantics IMHO. Another option, if  
> 
> I think I just did this because I thought it's a clever way to get rid of the
> need to deal with zero-sized jobs, which do not make much sense. In
> drm_sched_job_init() passing a zero job size defaults to one, which I think is
> reasonable. Doing the same thing here is more likely to hide a bug. However, the
> same is probably true for 'zero means no update' though. Maybe we should just
> WARN() in such a case.
> 
> > we want to avoid the sched_job->submission_credits assignment when
> > nothing changes would be to make it a void function and let it update
> > the sched_job->submission_credits directly.  
> 
> Sure, that's an option as well. However, I'd probably prefer the new job size to
> be the return value. Having to sanity check job->submission_credits afterwards
> isn't that nice either.

Uh, sorry for the late reply, I see you've sent a v3 already :-/. I keep
thinking it'd be simpler to make this a void function that updates
s_job->submission_credits directly. I also don't see the problem with
doing a sanity check on job->submission_credits. I mean, if the driver
is doing something silly, you can't do much to prevent it anyway,
except warn the user that something wrong has happened. If you want to

	WARN_ON(job->submission_credits == 0 ||
		job->submission_credits > job_old_submission_credits);

that's fine. But none of this sanity checking has to do with the
function prototype/semantics, and I'm still not comfortable with this 0
=> no-change. If there's no change, we should just leave
job->submission_credits unchanged (or return job->submission_credits)
instead of inventing a new special case.

Regards,

Boris

WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Danilo Krummrich <dakr@redhat.com>
Cc: airlied@gmail.com, daniel@ffwll.ch, matthew.brost@intel.com,
	christian.koenig@amd.com, faith.ekstrand@collabora.com,
	luben.tuikov@amd.com, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH drm-misc-next v2] drm/sched: implement dynamic job-flow control
Date: Fri, 27 Oct 2023 09:16:40 +0200	[thread overview]
Message-ID: <20231027091640.50d68251@collabora.com> (raw)
In-Reply-To: <ZTb6azSfTV+LRGYu@pollux>

Hi Danilo,

On Tue, 24 Oct 2023 00:57:47 +0200
Danilo Krummrich <dakr@redhat.com> wrote:

> > > +
> > > +	/**
> > > +	 * @update_job_credits: Called once the scheduler is considering this
> > > +	 * job for execution.
> > > +	 *
> > > +	 * Drivers may use this to update the job's submission credits, which is
> > > +	 * useful to e.g. deduct the number of native fences which have been
> > > +	 * signaled meanwhile.
> > > +	 *
> > > +	 * The callback must either return the new number of submission credits
> > > +	 * for the given job, or zero if no update is required.  
> > 
> > Any reason for having this special zero-means-no-update case? I mean,
> > drivers could just return sched_job->submission_credits if nothing
> > changed, and that would simplify the semantics IMHO. Another option, if  
> 
> I think I just did this because I thought it's a clever way to get rid of the
> need to deal with zero-sized jobs, which do not make much sense. In
> drm_sched_job_init() passing a zero job size defaults to one, which I think is
> reasonable. Doing the same thing here is more likely to hide a bug. However, the
> same is probably true for 'zero means no update' though. Maybe we should just
> WARN() in such a case.
> 
> > we want to avoid the sched_job->submission_credits assignment when
> > nothing changes would be to make it a void function and let it update
> > the sched_job->submission_credits directly.  
> 
> Sure, that's an option as well. However, I'd probably prefer the new job size to
> be the return value. Having to sanity check job->submission_credits afterwards
> isn't that nice either.

Uh, sorry for the late reply, I see you've sent a v3 already :-/. I keep
thinking it'd be simpler to make this a void function that updates
s_job->submission_credits directly. I also don't see the problem with
doing a sanity check on job->submission_credits. I mean, if the driver
is doing something silly, you can't do much to prevent it anyway,
except warn the user that something wrong has happened. If you want to

	WARN_ON(job->submission_credits == 0 ||
		job->submission_credits > job_old_submission_credits);

that's fine. But none of this sanity checking has to do with the
function prototype/semantics, and I'm still not comfortable with this 0
=> no-change. If there's no change, we should just leave
job->submission_credits unchanged (or return job->submission_credits)
instead of inventing a new special case.

Regards,

Boris

  parent reply	other threads:[~2023-10-27  7:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-09 22:35 [PATCH drm-misc-next v2] drm/sched: implement dynamic job-flow control Danilo Krummrich
2023-10-09 22:35 ` Danilo Krummrich
2023-10-10  7:41 ` Boris Brezillon
2023-10-10  7:41   ` Boris Brezillon
2023-10-23 22:57   ` Danilo Krummrich
2023-10-23 22:57     ` Danilo Krummrich
2023-10-24  1:30     ` Luben Tuikov
2023-10-24  1:30       ` Luben Tuikov
2023-10-27  7:16     ` Boris Brezillon [this message]
2023-10-27  7:16       ` Boris Brezillon
2023-10-12  1:52 ` Luben Tuikov
2023-10-12  1:52   ` Luben Tuikov
2023-10-12  2:10   ` Danilo Krummrich
2023-10-12  2:10     ` Danilo Krummrich
2023-10-14  1:17     ` Luben Tuikov
2023-10-14  1:17       ` Luben Tuikov
2023-10-23 22:35   ` Danilo Krummrich
2023-10-23 22:35     ` Danilo Krummrich
2023-10-24  1:43     ` Luben Tuikov
2023-10-24  1:43       ` 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=20231027091640.50d68251@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=christian.koenig@amd.com \
    --cc=dakr@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=faith.ekstrand@collabora.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.