Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@kernel.org>
To: Matthew Auld <matthew.auld@intel.com>
Cc: intel-xe@lists.freedesktop.org, Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [Intel-xe] [PATCH v9 6/8] drm/xe/ct: drop mem_access_get from g2h_worker_func()
Date: Tue, 23 May 2023 09:04:08 -0400	[thread overview]
Message-ID: <ZGy5yFMJdo511ljs@rdvivi-mobl4> (raw)
In-Reply-To: <20230523094727.162266-6-matthew.auld@intel.com>

On Tue, May 23, 2023 at 10:47:25AM +0100, Matthew Auld wrote:
> In the next patch we track the current task executing the runtime_pm
> callbacks, if any, in order to prevent the runtime_pm code waiting for
> itself and deadlocking when called from the callbacks. However with
> g2h_worker_func() we are processing g2h packets from a workqueue when
> receiving an interrupt. The runtime callbacks needs to talk to the GuC
> and so rely on this, however since these are processed from a workqueue
> the current task will be different and when calling something like
> mem_access_get() we deadlock. Callers should 

> in theory

should we at least add an assert?

> already be
> holding an access.ref when talking to the GuC (CT communication looks to
> be disabled when suspending the GT).
> 
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> ---
>  drivers/gpu/drm/xe/xe_guc_ct.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
> index 7a8c9d6a03f3..6e0d2d06b7f5 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
> @@ -1081,7 +1081,6 @@ static void g2h_worker_func(struct work_struct *w)
>  	struct xe_guc_ct *ct = container_of(w, struct xe_guc_ct, g2h_worker);
>  	int ret;
>  
> -	xe_device_mem_access_get(ct_to_xe(ct));
>  	do {
>  		mutex_lock(&ct->lock);
>  		ret = dequeue_one_g2h(ct);
> @@ -1095,7 +1094,6 @@ static void g2h_worker_func(struct work_struct *w)
>  			kick_reset(ct);
>  		}
>  	} while (ret == 1);
> -	xe_device_mem_access_put(ct_to_xe(ct));
>  }
>  
>  static void guc_ctb_snapshot_capture(struct xe_device *xe, struct guc_ctb *ctb,
> -- 
> 2.40.1
> 

  reply	other threads:[~2023-05-23 13:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23  9:47 [Intel-xe] [PATCH v9 1/8] Revert "drm/xe: Use atomic instead of mutex for xe_device_mem_access_ongoing" Matthew Auld
2023-05-23  9:47 ` [Intel-xe] [PATCH v9 2/8] drm/xe: don't allocate under ct->lock Matthew Auld
2023-05-23  9:47 ` [Intel-xe] [PATCH v9 3/8] drm/xe: keep pulling mem_access_get further back Matthew Auld
2023-05-23  9:47 ` [Intel-xe] [PATCH v9 4/8] drm/xe: tweak lock ordering for freq_lock Matthew Auld
2023-05-23 13:07   ` Rodrigo Vivi
2023-05-23 13:13     ` Matthew Auld
2023-05-23  9:47 ` [Intel-xe] [PATCH v9 5/8] drm/xe/ggtt: prime ggtt->lock against FS_RECLAIM Matthew Auld
2023-05-23  9:47 ` [Intel-xe] [PATCH v9 6/8] drm/xe/ct: drop mem_access_get from g2h_worker_func() Matthew Auld
2023-05-23 13:04   ` Rodrigo Vivi [this message]
2023-05-23 13:10     ` Matthew Auld
2023-05-23  9:47 ` [Intel-xe] [PATCH v9 7/8] drm/xe: fix xe_device_mem_access_get() races Matthew Auld
2023-05-23  9:47 ` [Intel-xe] [PATCH v9 8/8] drm/xe: Use atomic for mem_access.ref Matthew Auld
2023-05-23  9:49 ` [Intel-xe] ✓ CI.Patch_applied: success for series starting with [v9,1/8] Revert "drm/xe: Use atomic instead of mutex for xe_device_mem_access_ongoing" Patchwork
2023-05-23  9:51 ` [Intel-xe] ✓ CI.KUnit: " Patchwork
2023-05-23  9:55 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-05-23 10:19 ` [Intel-xe] ○ CI.BAT: info " 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=ZGy5yFMJdo511ljs@rdvivi-mobl4 \
    --to=rodrigo.vivi@kernel.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=rodrigo.vivi@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