All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
	<intel-gfx@lists.freexdesktop.org>,
	Matthew Auld <matthew.auld@intel.com>
Subject: Re: [PATCH 10/10] drm/xe: Kill xe_device_mem_access_{get*,put}
Date: Fri, 26 Apr 2024 18:30:44 -0700	[thread overview]
Message-ID: <85r0ery4l7.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <20240307001554.162153-10-rodrigo.vivi@intel.com>

On Wed, 06 Mar 2024 16:15:54 -0800, Rodrigo Vivi wrote:
>

Hi Rodrigo/Matt,

> @@ -409,14 +410,14 @@ static int __xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo,
>	if (err)
>		return err;
>
> -	xe_device_mem_access_get(tile_to_xe(ggtt->tile));
> +	xe_pm_runtime_get_noresume(tile_to_xe(ggtt->tile));
>	mutex_lock(&ggtt->lock);
>	err = drm_mm_insert_node_in_range(&ggtt->mm, &bo->ggtt_node, bo->size,
>					  alignment, 0, start, end, 0);
>	if (!err)
>		xe_ggtt_map_bo(ggtt, bo);
>	mutex_unlock(&ggtt->lock);
> -	xe_device_mem_access_put(tile_to_xe(ggtt->tile));
> +	xe_pm_runtime_put(tile_to_xe(ggtt->tile));
>
>	return err;
>  }
> @@ -434,7 +435,7 @@ int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo)
>
>  void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node)
>  {
> -	xe_device_mem_access_get(tile_to_xe(ggtt->tile));
> +	xe_pm_runtime_get_noresume(tile_to_xe(ggtt->tile));
>	mutex_lock(&ggtt->lock);
>
>	xe_ggtt_clear(ggtt, node->start, node->size);
> @@ -444,7 +445,7 @@ void xe_ggtt_remove_node(struct xe_ggtt *ggtt, struct drm_mm_node *node)
>	xe_ggtt_invalidate(ggtt);
>
>	mutex_unlock(&ggtt->lock);
> -	xe_device_mem_access_put(tile_to_xe(ggtt->tile));
> +	xe_pm_runtime_put(tile_to_xe(ggtt->tile));

Do __xe_ggtt_insert_bo_at and xe_ggtt_insert_bo need a runtime_pm reference
held?

In this series: https://patchwork.freedesktop.org/series/121084/

I am not holding a runtime_pm reference when these functions are called and
it was fine with xe_device_mem_access_get/put (see
xe_oa_alloc_oa_buffer/xe_oa_free_oa_buffer if needed). But after changing
to xe_pm_runtime_get/put I now get this WARN:

[11614.356168] xe 0000:00:02.0: Missing outer runtime PM protection
[11614.356187] WARNING: CPU: 1 PID: 13075 at drivers/gpu/drm/xe/xe_pm.c:549 xe_pm_runtime_get_noresume+0x60/0x80 [xe]
...
[11614.356377] Call Trace:
[11614.356379]  <TASK>
[11614.356381]  ? __warn+0x7e/0x180
[11614.356387]  ? xe_pm_runtime_get_noresume+0x60/0x80 [xe]
[11614.356437]  ? report_bug+0x1c7/0x1d0
[11614.356442]  ? prb_read_valid+0x16/0x20
[11614.356447]  ? handle_bug+0x3c/0x70
[11614.356451]  ? exc_invalid_op+0x18/0x70
[11614.356453]  ? asm_exc_invalid_op+0x1a/0x20
[11614.356460]  ? xe_pm_runtime_get_noresume+0x60/0x80 [xe]
[11614.356507]  xe_ggtt_remove_node+0x22/0x80 [xe]
[11614.356546]  xe_ttm_bo_destroy+0xea/0xf0 [xe]
[11614.356579]  xe_oa_stream_destroy+0xf7/0x120 [xe]
[11614.356627]  xe_oa_release+0x35/0xc0 [xe]
[11614.356673]  __fput+0xa1/0x2d0
[11614.356679]  __x64_sys_close+0x37/0x80
[11614.356697]  do_syscall_64+0x6d/0x140
[11614.356700]  entry_SYSCALL_64_after_hwframe+0x71/0x79
[11614.356702] RIP: 0033:0x7f2b37314f67

Also, the WARN above happens only for 'free' but not for 'alloc' (so not
sure who gets the runtime_pm reference for 'alloc').

Holding the runtime_pm reference across alloc and free seems to be fine and
makes this WARN disappear. So maybe I should just do that? Just trying to
confirm.

Thanks.
--
Ashutosh

  reply	other threads:[~2024-04-27  1:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07  0:15 [PATCH 01/10] drm/i915/display: convert inner wakeref get towards get_if_in_use Rodrigo Vivi
2024-03-07  0:15 ` [PATCH 02/10] drm/xe: Move lockdep protection from mem_access to xe_pm_runtime Rodrigo Vivi
2024-03-07  0:15 ` [PATCH 03/10] drm/xe: Convert GSC HDCP from mem_access to direct xe_pm_runtime calls Rodrigo Vivi
2024-03-07  0:15 ` [PATCH 04/10] drm/xe: Remove useless mem_access during probe Rodrigo Vivi
2024-03-07  0:15 ` [PATCH 05/10] drm/xe: Convert xe_gem_fault to use direct xe_pm_runtime calls Rodrigo Vivi
2024-03-07  0:15 ` [PATCH 06/10] drm/xe: Removing extra mem_access protection from runtime pm Rodrigo Vivi
2024-03-07  0:15 ` [PATCH 07/10] drm/xe: Introduce xe_pm_runtime_get_noresume for inner callers Rodrigo Vivi
2024-03-07  0:15 ` [PATCH 08/10] drm/xe: Convert mem_access_if_ongoing to direct xe_pm_runtime_get_if_active Rodrigo Vivi
2024-03-07  0:15 ` [PATCH 09/10] drm/xe: Ensure all the inner access are using the _noresume variant Rodrigo Vivi
2024-03-07  0:15 ` [PATCH 10/10] drm/xe: Kill xe_device_mem_access_{get*,put} Rodrigo Vivi
2024-04-27  1:30   ` Dixit, Ashutosh [this message]
2024-04-29 20:12     ` Vivi, Rodrigo
2024-03-07  0:30 ` [PATCH 01/10] drm/i915/display: convert inner wakeref get towards get_if_in_use Ville Syrjälä
2024-03-07 14:46   ` Rodrigo Vivi
2024-03-07 20:14     ` Imre Deak
2024-03-08 15:19       ` Rodrigo Vivi
2024-03-11 15:06         ` Imre Deak
2024-03-11 18:36           ` Rodrigo Vivi
2024-03-15 11:16     ` Ville Syrjälä
2024-03-07  1:02 ` ✓ CI.Patch_applied: success for series starting with [01/10] " Patchwork
2024-03-07  1:02 ` ✗ CI.checkpatch: warning " Patchwork
2024-03-07  1:03 ` ✓ CI.KUnit: success " Patchwork
2024-03-07  1:14 ` ✓ CI.Build: " Patchwork
2024-03-07  1:14 ` ✗ CI.Hooks: failure " Patchwork
2024-03-07  1:16 ` ✗ CI.checksparse: warning " Patchwork
2024-03-07  1:45 ` ✗ CI.BAT: failure " 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=85r0ery4l7.wl-ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=intel-gfx@lists.freexdesktop.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.