mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Philipp Stanner <pstanner@redhat.com>
To: "Christian König" <christian.koenig@amd.com>,
	"Luben Tuikov" <ltuikov89@gmail.com>,
	"Matthew Brost" <matthew.brost@intel.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] drm/sched: Fix docu of drm_sched_entity_flush()
Date: Tue, 19 Nov 2024 16:49:56 +0100	[thread overview]
Message-ID: <0ba134e8a902da1b916469e760c36c3588f8bc71.camel@redhat.com> (raw)
In-Reply-To: <919d1a3b-6757-4902-ac1a-b056c9fdad06@amd.com>

On Tue, 2024-11-19 at 15:27 +0100, Christian König wrote:
> Am 19.11.24 um 14:41 schrieb Philipp Stanner:
> > drm_sched_entity_flush()'s documentation states that an error is
> > being
> > returned when "the process was killed". That is not what the
> > function
> > actually does.
> > 
> > Furthermore, it contains an inprecise statement about how the
> > function
> > is part of a convenience wrapper.
> > 
> > Move that statement to drm_sched_entity_destroy().
> > 
> > Correct drm_sched_entity_flush()'s documentation.
> > 
> > Cc: Christian König <christian.koenig@amd.com>
> > Signed-off-by: Philipp Stanner <pstanner@redhat.com>
> > ---
> >   drivers/gpu/drm/scheduler/sched_entity.c | 18 +++++++++---------
> >   1 file changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/scheduler/sched_entity.c
> > b/drivers/gpu/drm/scheduler/sched_entity.c
> > index 16b172aee453..7af7b448ad06 100644
> > --- a/drivers/gpu/drm/scheduler/sched_entity.c
> > +++ b/drivers/gpu/drm/scheduler/sched_entity.c
> > @@ -270,15 +270,12 @@ static void drm_sched_entity_kill(struct
> > drm_sched_entity *entity)
> >   
> >   /**
> >    * drm_sched_entity_flush - Flush a context entity
> > - *
> >    * @entity: scheduler entity
> > - * @timeout: time to wait in for Q to become empty in jiffies.
> > - *
> > - * Splitting drm_sched_entity_fini() into two functions, The first
> > one does the
> > - * waiting, removes the entity from the runqueue and returns an
> > error when the
> > - * process was killed.
> > + * @timeout: time to wait in jiffies
> >    *
> >    * Returns: 0 if the timeout ellapsed, the remaining time
> > otherwise.
> > +
> > + * Waits at most @timeout jiffies for the entity's job queue to
> > become empty.
> >    */
> >   long drm_sched_entity_flush(struct drm_sched_entity *entity, long
> > timeout)
> >   {
> > @@ -290,7 +287,7 @@ long drm_sched_entity_flush(struct
> > drm_sched_entity *entity, long timeout)
> >   		return 0;
> >   
> >   	sched = entity->rq->sched;
> > -	/**
> > +	/*
> >   	 * The client will not queue more IBs during this fini,
> > consume existing
> >   	 * queued IBs or discard them on SIGKILL
> 
> That comment is actually not correct either.
> 
> drm_sched_entity_flush() should be used from the file_operations-
> >flush 
> function and that one can be used even without destroying the entity.
> 
> So it is perfectly possible that more and more IBs are pumped into
> the 
> entity while we wait for it to become idle.

Which would just result in drm_sched_entity_flush() timing out and
effectively not having done anything, right?

I guess we could touch that topic again when writing some docu for
scheduler teardown.

Would it be the best to just remove the comment, what do you think?

P.

> 
> Regards,
> Christian.
> 
> >   	 */
> > @@ -359,8 +356,11 @@ EXPORT_SYMBOL(drm_sched_entity_fini);
> >    * drm_sched_entity_destroy - Destroy a context entity
> >    * @entity: scheduler entity
> >    *
> > - * Calls drm_sched_entity_flush() and drm_sched_entity_fini() as a
> > - * convenience wrapper.
> > + * Convenience wrapper for entity teardown.
> > + *
> > + * Teardown of entities is split into two functions. The first
> > one,
> > + * drm_sched_entity_flush(), waits for the entity to become empty.
> > The second
> > + * one, drm_sched_entity_fini(), does the actual cleanup of the
> > entity object.
> >    */
> >   void drm_sched_entity_destroy(struct drm_sched_entity *entity)
> >   {
> 


  reply	other threads:[~2024-11-19 15:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19 13:41 [PATCH 1/2] drm/sched: Fix drm_sched_entity_flush() return val Philipp Stanner
2024-11-19 13:41 ` [PATCH 2/2] drm/sched: Fix docu of drm_sched_entity_flush() Philipp Stanner
2024-11-19 14:27   ` Christian König
2024-11-19 15:49     ` Philipp Stanner [this message]
2024-11-21 21:01   ` kernel test robot
2024-11-19 13:48 ` [PATCH 1/2] drm/sched: Fix drm_sched_entity_flush() return val Philipp Stanner

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=0ba134e8a902da1b916469e760c36c3588f8bc71.camel@redhat.com \
    --to=pstanner@redhat.com \
    --cc=airlied@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=dakr@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ltuikov89@gmail.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.brost@intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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®