Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Matthew Brost <matthew.brost@intel.com>
Cc: intel-xe@lists.freedesktop.org
Subject: Re: [Intel-xe] [PATCH] drm/xe: Call __guc_engine_fini_async direct for KERNEL engines
Date: Fri, 4 Aug 2023 16:51:04 -0400	[thread overview]
Message-ID: <ZM1kuCqXCtWtdU48@intel.com> (raw)
In-Reply-To: <20230727174107.532275-1-matthew.brost@intel.com>

On Thu, Jul 27, 2023 at 10:41:07AM -0700, Matthew Brost wrote:
> Usually we call __guc_engine_fini_async via a worker as the engine fini
> can be done from within the GPU scheduler which creates a circular
> dependency without a worker. Kernel engines are fini'd at driver unload
> (not from within the GPU scheduler) so it is safe to directly call
> __guc_engine_fini_async.
> 
> Reported-by: Oded Gabbay <ogabbay@kernel.org>
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>

For some reason the BAT result didn't come out :(
it should be better to get some CI on it.
But the code looks correct to me and indeed better,

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_guc_submit.c | 20 ++++++--------------
>  1 file changed, 6 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> index 911d4965c27c..6cb64a097297 100644
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
> @@ -943,27 +943,19 @@ static void __guc_engine_fini_async(struct work_struct *w)
>  	drm_sched_entity_fini(&ge->entity);
>  	drm_sched_fini(&ge->sched);
>  
> -	if (!(e->flags & ENGINE_FLAG_KERNEL)) {
> -		kfree(ge);
> -		xe_engine_fini(e);
> -	}
> +	kfree(ge);
> +	xe_engine_fini(e);
>  }
>  
>  static void guc_engine_fini_async(struct xe_engine *e)
>  {
> -	bool kernel = e->flags & ENGINE_FLAG_KERNEL;
> -
>  	INIT_WORK(&e->guc->fini_async, __guc_engine_fini_async);
> -	queue_work(system_wq, &e->guc->fini_async);
>  
>  	/* We must block on kernel engines so slabs are empty on driver unload */
> -	if (kernel) {
> -		struct xe_guc_engine *ge = e->guc;
> -
> -		flush_work(&ge->fini_async);
> -		kfree(ge);
> -		xe_engine_fini(e);
> -	}
> +	if (e->flags & ENGINE_FLAG_KERNEL)
> +		__guc_engine_fini_async(&e->guc->fini_async);
> +	else
> +		queue_work(system_wq, &e->guc->fini_async);
>  }
>  
>  static void __guc_engine_fini(struct xe_guc *guc, struct xe_engine *e)
> -- 
> 2.34.1
> 

      parent reply	other threads:[~2023-08-04 20:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 17:41 [Intel-xe] [PATCH] drm/xe: Call __guc_engine_fini_async direct for KERNEL engines Matthew Brost
2023-07-27 18:50 ` [Intel-xe] ✓ CI.Patch_applied: success for " Patchwork
2023-07-27 18:51 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-07-27 18:52 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-07-27 18:56 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-07-27 18:56 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-07-27 18:57 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-08-04 20:51 ` Rodrigo Vivi [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=ZM1kuCqXCtWtdU48@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-xe@lists.freedesktop.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