Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Luben Tuikov <ltuikov89@gmail.com>
To: Matthew Brost <matthew.brost@intel.com>,
	intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: Thorsten Leemhuis <regressions@leemhuis.info>,
	Mario Limonciello <mario.limonciello@amd.com>,
	daniel@ffwll.ch, Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>,
	airlied@gmail.com, christian.koenig@amd.com,
	Vlastimil Babka <vbabka@suse.cz>
Subject: Re: [PATCH] drm/sched: Drain all entities in DRM sched run job worker
Date: Sun, 28 Jan 2024 23:08:13 -0500	[thread overview]
Message-ID: <2a6dc042-9e40-4c9a-97f4-667a99b3d7bf@gmail.com> (raw)
In-Reply-To: <20240124210811.1639040-1-matthew.brost@intel.com>


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

On 2024-01-24 16:08, Matthew Brost wrote:
> All entities must be drained in the DRM scheduler run job worker to
> avoid the following case. An entity found that is ready, no job found
> ready on entity, and run job worker goes idle with other entities + jobs
> ready. Draining all ready entities (i.e. loop over all ready entities)
> in the run job worker ensures all job that are ready will be scheduled.
> 
> Cc: Thorsten Leemhuis <regressions@leemhuis.info>
> Reported-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
> Closes: https://lore.kernel.org/all/CABXGCsM2VLs489CH-vF-1539-s3in37=bwuOWtoeeE+q26zE+Q@mail.gmail.com/
> Reported-and-tested-by: Mario Limonciello <mario.limonciello@amd.com>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3124
> Link: https://lore.kernel.org/all/20240123021155.2775-1-mario.limonciello@amd.com/
> Reported-by: Vlastimil Babka <vbabka@suse.cz>
> Closes: https://lore.kernel.org/dri-devel/05ddb2da-b182-4791-8ef7-82179fd159a8@amd.com/T/#m0c31d4d1b9ae9995bb880974c4f1dbaddc33a48a
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>

Hi Matthew,

Thanks for working on this and sending the patch.

Could we add a fixes-tag to the tag list,

Fixes: f7fe64ad0f22 ("drm/sched: Split free_job into own work item")

This really drives to point as shown here,
https://gitlab.freedesktop.org/drm/amd/-/issues/3124
which is mentioned in a Closes tag--thanks!
-- 
Regards,
Luben

> ---
>  drivers/gpu/drm/scheduler/sched_main.c | 15 +++++++--------
>  1 file changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index 550492a7a031..85f082396d42 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -1178,21 +1178,20 @@ static void drm_sched_run_job_work(struct work_struct *w)
>  	struct drm_sched_entity *entity;
>  	struct dma_fence *fence;
>  	struct drm_sched_fence *s_fence;
> -	struct drm_sched_job *sched_job;
> +	struct drm_sched_job *sched_job = NULL;
>  	int r;
>  
>  	if (READ_ONCE(sched->pause_submit))
>  		return;
>  
> -	entity = drm_sched_select_entity(sched);
> +	/* Find entity with a ready job */
> +	while (!sched_job && (entity = drm_sched_select_entity(sched))) {
> +		sched_job = drm_sched_entity_pop_job(entity);
> +		if (!sched_job)
> +			complete_all(&entity->entity_idle);
> +	}
>  	if (!entity)
> -		return;
> -
> -	sched_job = drm_sched_entity_pop_job(entity);
> -	if (!sched_job) {
> -		complete_all(&entity->entity_idle);
>  		return;	/* No more work */
> -	}
>  
>  	s_fence = sched_job->s_fence;
>  

[-- 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:[~2024-01-29  4:09 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24 21:08 [PATCH] drm/sched: Drain all entities in DRM sched run job worker Matthew Brost
2024-01-24 21:10 ` ✓ CI.Patch_applied: success for " Patchwork
2024-01-24 21:10 ` ✓ CI.checkpatch: " Patchwork
2024-01-24 21:11 ` ✓ CI.KUnit: " Patchwork
2024-01-24 21:18 ` ✓ CI.Build: " Patchwork
2024-01-24 21:19 ` ✓ CI.Hooks: " Patchwork
2024-01-24 21:20 ` ✓ CI.checksparse: " Patchwork
2024-01-24 21:43 ` ✓ CI.BAT: " Patchwork
2024-01-25  9:24 ` [PATCH] " Vlastimil Babka
2024-01-25 17:30   ` Matthew Brost
2024-01-26  2:45     ` Dave Airlie
2024-01-25 15:12 ` Christian König
2024-01-25 17:30   ` Matthew Brost
2024-01-26 10:32     ` Christian König
2024-01-26 16:29       ` Matthew Brost
2024-01-29  5:29         ` Luben Tuikov
2024-01-29  7:44         ` Christian König
2024-01-29  7:49           ` Vlastimil Babka
2024-01-29 17:10           ` Luben Tuikov
2024-01-29 18:31             ` Matthew Brost
2024-01-29  4:08 ` 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=2a6dc042-9e40-4c9a-97f4-667a99b3d7bf@gmail.com \
    --to=ltuikov89@gmail.com \
    --cc=airlied@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=mario.limonciello@amd.com \
    --cc=matthew.brost@intel.com \
    --cc=mikhail.v.gavrilov@gmail.com \
    --cc=regressions@leemhuis.info \
    --cc=vbabka@suse.cz \
    /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