Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Matthew Brost <matthew.brost@intel.com>, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH v2 3/3] drm/xe/guc: Flush G2H handler when turning off CTs
Date: Thu, 11 Jan 2024 13:29:41 +0100	[thread overview]
Message-ID: <39c71ec0-36b9-45c2-94c0-d4dce0a6f849@intel.com> (raw)
In-Reply-To: <20240109230149.1399302-4-matthew.brost@intel.com>



On 10.01.2024 00:01, Matthew Brost wrote:
> Make sure G2H handler is not running when changing the CT state to drop
> messages or disabled. This will help prevent races in the code ensuring
> that G2H are not being processed after changing the state.

nit: we should also assert that during fini the CT was already disabled,
but that's for another patch

> 
> Signed-off-by: Matthew Brost <matthew.brost@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_guc_ct.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
> index 5b122a926ccf..6a2baa9034c8 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
> @@ -333,14 +333,21 @@ int xe_guc_ct_enable(struct xe_guc_ct *ct)
>  	return err;
>  }
>  
> +static void flush_g2h_handler(struct xe_guc_ct *ct)

you're cancelling a in-flight work, not flushing it, so maybe:

	static void stop_g2h_handler(struct xe_guc_ct *ct) ?

with that fixed,

Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>

> +{
> +	cancel_work_sync(&ct->g2h_worker);
> +}
> +
>  void xe_guc_ct_disable(struct xe_guc_ct *ct)
>  {
>  	xe_guc_ct_set_state(ct, XE_GUC_CT_STATE_DISABLED);
> +	flush_g2h_handler(ct);
>  }
>  
>  void xe_guc_ct_stop(struct xe_guc_ct *ct)
>  {
>  	xe_guc_ct_set_state(ct, XE_GUC_CT_STATE_STOPPED);
> +	flush_g2h_handler(ct);
>  	xa_destroy(&ct->fence_lookup);
>  }
>  

  reply	other threads:[~2024-01-11 12:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 23:01 [PATCH v2 0/3] GuC CT tweaks Matthew Brost
2024-01-09 23:01 ` [PATCH v2 1/3] drm/xe/guc: Add more GuC CT states Matthew Brost
2024-01-11 11:01   ` Michal Wajdeczko
2024-01-12 17:50     ` Matthew Brost
2024-01-09 23:01 ` [PATCH v2 2/3] drm/xe: Move TLB invalidation reset before HW reset Matthew Brost
2024-01-11 11:24   ` Michal Wajdeczko
2024-01-09 23:01 ` [PATCH v2 3/3] drm/xe/guc: Flush G2H handler when turning off CTs Matthew Brost
2024-01-11 12:29   ` Michal Wajdeczko [this message]
2024-01-10  1:00 ` ✓ CI.Patch_applied: success for GuC CT tweaks (rev2) Patchwork
2024-01-10  1:00 ` ✗ CI.checkpatch: warning " Patchwork
2024-01-10  1:01 ` ✓ CI.KUnit: success " Patchwork
2024-01-10  1:08 ` ✓ CI.Build: " Patchwork
2024-01-10  1:09 ` ✓ CI.Hooks: " Patchwork
2024-01-10  1:10 ` ✓ CI.checksparse: " Patchwork
2024-01-10  1:46 ` ✓ CI.BAT: " Patchwork

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=39c71ec0-36b9-45c2-94c0-d4dce0a6f849@intel.com \
    --to=michal.wajdeczko@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