public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: don.hiatt@intel.com
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 01/01] lib/igt_pm: dump runtime pm status on timeout
Date: Wed,  2 Oct 2019 09:58:04 -0700	[thread overview]
Message-ID: <20191002165804.5053-1-don.hiatt@intel.com> (raw)

From: Don Hiatt <don.hiatt@intel.com>

Display the runtime pm status if we timeout waiting for status.

Signed-off-by: Don Hiatt <don.hiatt@intel.com>
---
 lib/igt_pm.c | 16 ++++++++++++----
 lib/igt_pm.h |  2 +-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/lib/igt_pm.c b/lib/igt_pm.c
index 64ce240e093f..0d3561fdf821 100644
--- a/lib/igt_pm.c
+++ b/lib/igt_pm.c
@@ -658,16 +658,17 @@ void igt_disable_runtime_pm(void)
 
 /**
  * igt_get_runtime_pm_status:
+ * @buf: buffer to place pm status string in
+ * @len: length of buf
  *
  * Returns: The current runtime PM status.
  */
-enum igt_runtime_pm_status igt_get_runtime_pm_status(void)
+enum igt_runtime_pm_status igt_get_runtime_pm_status(char *buf, int len)
 {
 	ssize_t n_read;
-	char buf[32];
 
 	lseek(pm_status_fd, 0, SEEK_SET);
-	n_read = read(pm_status_fd, buf, ARRAY_SIZE(buf) - 1);
+	n_read = read(pm_status_fd, buf, len - 1);
 	igt_assert(n_read >= 0);
 	buf[n_read] = '\0';
 
@@ -697,7 +698,14 @@ 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;
+	char buf[32];
+
+	ret = igt_wait(igt_get_runtime_pm_status(buf, ARRAY_SIZE(buf)) == status, 10000, 100);
+	if (!ret)
+		igt_warn("timeout: pm_status=%s", buf);
+
+	return ret;
 }
 
 /**
diff --git a/lib/igt_pm.h b/lib/igt_pm.h
index 7dc241749180..b2ff835e8a33 100644
--- a/lib/igt_pm.h
+++ b/lib/igt_pm.h
@@ -49,7 +49,7 @@ enum igt_runtime_pm_status {
 bool igt_setup_runtime_pm(void);
 void igt_disable_runtime_pm(void);
 void igt_restore_runtime_pm(void);
-enum igt_runtime_pm_status igt_get_runtime_pm_status(void);
+enum igt_runtime_pm_status igt_get_runtime_pm_status(char *buf, int len);
 bool igt_wait_for_pm_status(enum igt_runtime_pm_status status);
 bool igt_pm_dmc_loaded(int debugfs);
 bool igt_pm_pc8_plus_residencies_enabled(int msr_fd);
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

             reply	other threads:[~2019-10-02 16:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 16:58 don.hiatt [this message]
2019-10-02 17:33 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,01/01] lib/igt_pm: dump runtime pm status on timeout Patchwork
2019-10-02 20:56 ` [igt-dev] [PATCH i-g-t 01/01] " Vanshidhar Konda
2019-10-03 21:43   ` Hiatt, Don
2019-10-03 21:53     ` Vanshidhar Konda
2019-10-03  2:07 ` [igt-dev] ✗ Fi.CI.IGT: failure for series starting with [i-g-t,01/01] " 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=20191002165804.5053-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