From: don.hiatt@intel.com
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] lib/igt_pm: dump runtime pm status on timeout
Date: Thu, 10 Oct 2019 10:07:59 -0700 [thread overview]
Message-ID: <20191010170759.26811-1-don.hiatt@intel.com> (raw)
From: Don Hiatt <don.hiatt@intel.com>
Display the runtime pm status if we timeout waiting for status.
v2: Add helper to map runtime pm status enum to string.
Signed-off-by: Don Hiatt <don.hiatt@intel.com>
Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Reviewed-by: Vanshidhar Konda <vanshidhar.r.konda@intel.com>
---
lib/igt_pm.c | 33 ++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/lib/igt_pm.c b/lib/igt_pm.c
index 64ce240e093f..d96fee7a2eb4 100644
--- a/lib/igt_pm.c
+++ b/lib/igt_pm.c
@@ -684,6 +684,28 @@ enum igt_runtime_pm_status igt_get_runtime_pm_status(void)
return IGT_RUNTIME_PM_STATUS_UNKNOWN;
}
+/**
+ * _pm_status_name
+ * @status: runtime PM status to stringify
+ *
+ * Returns: The current runtime PM status as a string
+ */
+static const char *_pm_status_name(enum igt_runtime_pm_status status)
+{
+ switch (status) {
+ case IGT_RUNTIME_PM_STATUS_ACTIVE:
+ return "active";
+ case IGT_RUNTIME_PM_STATUS_RESUMING:
+ return "resuming";
+ case IGT_RUNTIME_PM_STATUS_SUSPENDED:
+ return "suspended";
+ case IGT_RUNTIME_PM_STATUS_SUSPENDING:
+ return "suspending";
+ default:
+ return "unknown";
+ }
+}
+
/**
* igt_wait_for_pm_status:
* @status: desired runtime PM status
@@ -697,7 +719,16 @@ enum igt_runtime_pm_status igt_get_runtime_pm_status(void)
*/
bool igt_wait_for_pm_status(enum igt_runtime_pm_status status)
{
- return igt_wait(igt_get_runtime_pm_status() == status, 10000, 100);
+ bool ret;
+ enum igt_runtime_pm_status expected = status;
+
+ ret = igt_wait((status = igt_get_runtime_pm_status()) == expected, 10000, 100);
+ if (!ret)
+ igt_warn("timeout: pm_status expected:%s, got:%s\n",
+ _pm_status_name(expected),
+ _pm_status_name(status));
+
+ return ret;
}
/**
--
2.20.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2019-10-10 17:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 17:07 don.hiatt [this message]
2019-10-10 17:53 ` [igt-dev] ✓ Fi.CI.BAT: success for lib/igt_pm: dump runtime pm status on timeout (rev2) Patchwork
2019-10-11 7:58 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-10-11 13:23 ` [igt-dev] [PATCH i-g-t] lib/igt_pm: dump runtime pm status on timeout Arkadiusz Hiler
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=20191010170759.26811-1-don.hiatt@intel.com \
--to=don.hiatt@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/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