All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anshuman Gupta <anshuman.gupta@intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: Chris Wilson <chris.p.wilson@intel.com>, rodrigo.vivi@intel.com
Subject: [Intel-gfx] [PATCH v2] drm/i915/debugfs: Dump i915 children runtime status
Date: Fri,  1 Apr 2022 13:27:20 +0530	[thread overview]
Message-ID: <20220401075720.21614-1-anshuman.gupta@intel.com> (raw)
In-Reply-To: <20220328102227.14545-1-anshuman.gupta@intel.com>

i915 doesn't use pm_suspend_ignore_children(), which warrants that
any runtime active child of i915 will block the runtime suspend
of i915.
i915_runtime_pm_status only exposes i915 runtime pm usage_count,
which is not sufficient to debug in the scenarios when i915 has
zero usage_count but there are runtime active children.
Dump i915 child's runtime pm status to debug such
i915 runtime suspend issues.

v2:
- Added const array of rpm_status strings to avoid switch. [Ashutosh]

Cc: Chris Wilson <chris.p.wilson@intel.com>
Reviewed-by: Badal Nilawar <badal.nilawar@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 32 +++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 445b4da23950..930815c8b978 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -483,6 +483,34 @@ static int i915_rps_boost_info(struct seq_file *m, void *data)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int i915_runtime_dump_child_status(struct device *dev, void *data)
+{
+	struct seq_file *m = data;
+	const char *rpm_status;
+
+	static const char * const status_lookup[] = {
+		[RPM_ACTIVE] = "active",
+		[RPM_RESUMING] = "resuming",
+		[RPM_SUSPENDED] = "suspended",
+		[RPM_SUSPENDING] = "suspending"
+	};
+
+	/* Early return if runtime_pm is disabled */
+	if (dev->power.disable_depth)
+		return 0;
+	else if (dev->power.runtime_status < ARRAY_SIZE(status_lookup))
+		rpm_status = status_lookup[dev->power.runtime_status];
+	else
+		rpm_status = "unknown";
+
+	seq_printf(m, "\t%s %s: Runtime status: %s\n", dev_driver_string(dev),
+		   dev_name(dev), rpm_status);
+
+	return 0;
+}
+#endif
+
 static int i915_runtime_pm_status(struct seq_file *m, void *unused)
 {
 	struct drm_i915_private *dev_priv = node_to_i915(m->private);
@@ -500,6 +528,10 @@ static int i915_runtime_pm_status(struct seq_file *m, void *unused)
 #ifdef CONFIG_PM
 	seq_printf(m, "Usage count: %d\n",
 		   atomic_read(&dev_priv->drm.dev->power.usage_count));
+	seq_printf(m, "Runtime active children: %d\n",
+		   atomic_read(&dev_priv->drm.dev->power.child_count));
+	device_for_each_child(&pdev->dev, m, i915_runtime_dump_child_status);
+
 #else
 	seq_printf(m, "Device Power Management (CONFIG_PM) disabled\n");
 #endif
-- 
2.26.2


  parent reply	other threads:[~2022-04-01  7:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 10:22 [Intel-gfx] [PATCH] drm/i915/debugfs: Dump i915 children runtime status Anshuman Gupta
2022-03-28 16:14 ` [Intel-gfx] ✗ Fi.CI.DOCS: warning for " Patchwork
2022-03-28 16:45 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-03-28 19:28 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-03-29 17:13 ` [Intel-gfx] [PATCH] " Nilawar, Badal
2022-03-29 23:09 ` Dixit, Ashutosh
2022-04-01 12:01   ` Jani Nikula
2022-04-01 12:40     ` Gupta, Anshuman
2022-04-01 12:55       ` Jani Nikula
2022-04-01 13:07         ` Gupta, Anshuman
2022-04-01 14:09           ` Jani Nikula
2022-04-01 15:42             ` Gupta, Anshuman
2022-04-01  7:57 ` Anshuman Gupta [this message]
2022-04-01 10:34 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/debugfs: Dump i915 children runtime status (rev2) Patchwork
2022-04-01 12:09 ` [Intel-gfx] ✗ Fi.CI.IGT: 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=20220401075720.21614-1-anshuman.gupta@intel.com \
    --to=anshuman.gupta@intel.com \
    --cc=chris.p.wilson@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --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.