Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Suraj Kandpal <suraj.kandpal@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: uma.shankar@intel.com, Suraj Kandpal <suraj.kandpal@intel.com>
Subject: [PATCH] drm/xe/pm: Move xe_rpm_lockmap_acquire
Date: Wed, 11 Sep 2024 15:00:25 +0530	[thread overview]
Message-ID: <20240911093026.643605-1-suraj.kandpal@intel.com> (raw)

Move xe_rpm_lockmap_acquire after display_pm_suspend and resume
funtions to avoid cirular locking dependency because of locks
being taken in intel_fbdev, intel_dp_mst_mgr suspend and resume
functions.

Signed-off-by: Suraj Kandpal <suraj.kandpal@intel.com>
---
 drivers/gpu/drm/xe/xe_pm.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
index a3d1509066f7..7f33e553728a 100644
--- a/drivers/gpu/drm/xe/xe_pm.c
+++ b/drivers/gpu/drm/xe/xe_pm.c
@@ -363,6 +363,18 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
 	/* Disable access_ongoing asserts and prevent recursive pm calls */
 	xe_pm_write_callback_task(xe, current);
 
+	/*
+	 * Applying lock for entire list op as xe_ttm_bo_destroy and xe_bo_move_notify
+	 * also checks and delets bo entry from user fault list.
+	 */
+	mutex_lock(&xe->mem_access.vram_userfault.lock);
+	list_for_each_entry_safe(bo, on,
+				 &xe->mem_access.vram_userfault.list, vram_userfault_link)
+		xe_bo_runtime_pm_release_mmap_offset(bo);
+	mutex_unlock(&xe->mem_access.vram_userfault.lock);
+
+	xe_display_pm_runtime_suspend(xe);
+
 	/*
 	 * The actual xe_pm_runtime_put() is always async underneath, so
 	 * exactly where that is called should makes no difference to us. However
@@ -386,18 +398,6 @@ int xe_pm_runtime_suspend(struct xe_device *xe)
 	 */
 	xe_rpm_lockmap_acquire(xe);
 
-	/*
-	 * Applying lock for entire list op as xe_ttm_bo_destroy and xe_bo_move_notify
-	 * also checks and delets bo entry from user fault list.
-	 */
-	mutex_lock(&xe->mem_access.vram_userfault.lock);
-	list_for_each_entry_safe(bo, on,
-				 &xe->mem_access.vram_userfault.list, vram_userfault_link)
-		xe_bo_runtime_pm_release_mmap_offset(bo);
-	mutex_unlock(&xe->mem_access.vram_userfault.lock);
-
-	xe_display_pm_runtime_suspend(xe);
-
 	if (xe->d3cold.allowed) {
 		err = xe_bo_evict_all(xe);
 		if (err)
@@ -438,8 +438,6 @@ int xe_pm_runtime_resume(struct xe_device *xe)
 	/* Disable access_ongoing asserts and prevent recursive pm calls */
 	xe_pm_write_callback_task(xe, current);
 
-	xe_rpm_lockmap_acquire(xe);
-
 	if (xe->d3cold.allowed) {
 		err = xe_pcode_ready(xe, true);
 		if (err)
@@ -463,6 +461,8 @@ int xe_pm_runtime_resume(struct xe_device *xe)
 
 	xe_display_pm_runtime_resume(xe);
 
+	xe_rpm_lockmap_acquire(xe);
+
 	if (xe->d3cold.allowed) {
 		err = xe_bo_restore_user(xe);
 		if (err)
-- 
2.43.2


             reply	other threads:[~2024-09-11  9:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11  9:30 Suraj Kandpal [this message]
2024-09-11 10:41 ` [PATCH] drm/xe/pm: Move xe_rpm_lockmap_acquire Matthew Auld
2024-09-11 10:58   ` Kandpal, Suraj
2024-09-11 11:05 ` ✓ CI.Patch_applied: success for " Patchwork
2024-09-11 11:05 ` ✗ CI.checkpatch: warning " Patchwork
2024-09-11 11:06 ` ✓ CI.KUnit: success " Patchwork
2024-09-11 11:18 ` ✓ CI.Build: " Patchwork
2024-09-11 11:21 ` ✓ CI.Hooks: " Patchwork
2024-09-11 11:22 ` ✓ CI.checksparse: " Patchwork
2024-09-11 11:34 ` [PATCH] " Imre Deak
2024-09-11 12:01   ` Kandpal, Suraj
2024-09-11 12:05     ` Imre Deak
2024-09-11 12:20       ` Kandpal, Suraj
2024-09-11 11:39 ` ✗ CI.BAT: failure for " Patchwork
2024-09-11 13:12 ` ✗ CI.FULL: " 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=20240911093026.643605-1-suraj.kandpal@intel.com \
    --to=suraj.kandpal@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=uma.shankar@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