From: Anshuman Gupta <anshuman.gupta@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: badal.nilawar@intel.com
Subject: [igt-dev] [PATCH i-g-t v2] test/perf_pmu: Dump drpc on C6 failure
Date: Wed, 9 Aug 2023 18:38:02 +0530 [thread overview]
Message-ID: <20230809130802.1182409-1-anshuman.gupta@intel.com> (raw)
Dump drpc debugfs on RC6/MC6 failure, it will be useful to
debug any C6 failure issue by using drpc debugfs debug info.
v2:
- Fixes few nit. [Riana]
Co-developed-by: Badal Nilawar <badal.nilawar@intel.com>
Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
Reviewed-by: Riana Tauro <riana.tauro@intel.com>
---
tests/i915/perf_pmu.c | 61 +++++++++++++++++++++++++++++--------------
1 file changed, 42 insertions(+), 19 deletions(-)
diff --git a/tests/i915/perf_pmu.c b/tests/i915/perf_pmu.c
index 58f4a82a20..c6e6a8b776 100644
--- a/tests/i915/perf_pmu.c
+++ b/tests/i915/perf_pmu.c
@@ -256,6 +256,18 @@ IGT_TEST_DESCRIPTION("Test the i915 pmu perf interface");
const double tolerance = 0.05f;
const unsigned long batch_duration_ns = 500e6;
+char *drpc;
+const char *no_debug_data = "\0";
+
+static char *get_drpc(int i915, int gt_id)
+{
+ int gt_dir;
+
+ gt_dir = igt_debugfs_gt_dir(i915, gt_id);
+ igt_assert(gt_dir != -1);
+ return igt_sysfs_get(gt_dir, "drpc");
+}
+
static int open_pmu(int i915, uint64_t config)
{
int fd;
@@ -336,17 +348,19 @@ static uint64_t pmu_read_multi(int fd, unsigned int num, uint64_t *val)
return buf[1];
}
-#define __assert_within_epsilon(x, ref, tol_up, tol_down) \
+#define __assert_within_epsilon(x, ref, tol_up, tol_down, debug_data) \
igt_assert_f((double)(x) <= (1.0 + (tol_up)) * (double)(ref) && \
(double)(x) >= (1.0 - (tol_down)) * (double)(ref), \
- "'%s' != '%s' (%f not within +%.1f%%/-%.1f%% tolerance of %f)\n",\
+ "'%s' != '%s' (%f not within +%.1f%%/-%.1f%% tolerance of %f)\n%s\n",\
#x, #ref, (double)(x), \
(tol_up) * 100.0, (tol_down) * 100.0, \
- (double)(ref))
+ (double)(ref), debug_data)
#define assert_within_epsilon(x, ref, tolerance) \
- __assert_within_epsilon(x, ref, tolerance, tolerance)
+ __assert_within_epsilon(x, ref, tolerance, tolerance, no_debug_data)
+#define assert_within_epsilon_debug(x, ref, tolerance, debug_data) \
+ __assert_within_epsilon(x, ref, tolerance, tolerance, debug_data)
/*
* Helper for cases where we assert on time spent sleeping (directly or
* indirectly), so make it more robust by ensuring the system sleep time
@@ -1822,7 +1836,7 @@ test_frequency(int gem_fd, unsigned int gt)
* On thermally throttled devices we cannot be sure maximum frequency
* can be reached so use larger tolerance downards.
*/
- __assert_within_epsilon(max[0], max_freq, tolerance, 0.15f);
+ __assert_within_epsilon(max[0], max_freq, tolerance, 0.15f, no_debug_data);
}
static void
@@ -1967,7 +1981,8 @@ test_rc6(int gem_fd, unsigned int gt, unsigned int num_gt, unsigned int flags)
}
}
- igt_require(wait_for_rc6(fd[0], 1, pmus, test_idx));
+ igt_require_f(wait_for_rc6(fd[0], 1, pmus, test_idx),
+ "failed to enter c6 \n%s\n", drpc = get_drpc(gem_fd, test_idx));
/* While idle check full RC6. */
ts[0] = pmu_read_multi(fd[0], pmus, prev);
@@ -1977,9 +1992,11 @@ test_rc6(int gem_fd, unsigned int gt, unsigned int num_gt, unsigned int flags)
for (gt_ = 0; gt_ < pmus; gt_++) {
igt_debug("gt%u: idle rc6=%"PRIu64", slept=%lu, perf=%"PRIu64"\n",
gt_, idle[gt_] - prev[gt_], slept, ts[1] - ts[0]);
- assert_within_epsilon(idle[gt_] - prev[gt_],
- ts[1] - ts[0],
- tolerance);
+ drpc = get_drpc(gem_fd, gt_);
+ assert_within_epsilon_debug(idle[gt_] - prev[gt_],
+ ts[1] - ts[0],
+ tolerance, drpc);
+ free(drpc);
}
if (flags & TEST_S3) {
@@ -2005,7 +2022,8 @@ test_rc6(int gem_fd, unsigned int gt, unsigned int num_gt, unsigned int flags)
}
}
- igt_assert(wait_for_rc6(fd[0], 5, pmus, test_idx));
+ igt_require_f(wait_for_rc6(fd[0], 5, pmus, test_idx),
+ "failed to enter c6 \n%s\n", drpc = get_drpc(gem_fd, test_idx));
ts[0] = pmu_read_multi(fd[0], pmus, prev);
slept = measured_usleep(duration_ns / 1000);
@@ -2014,9 +2032,11 @@ test_rc6(int gem_fd, unsigned int gt, unsigned int num_gt, unsigned int flags)
for (gt_ = 0; gt_ < pmus; gt_++) {
igt_debug("gt%u: idle rc6=%"PRIu64", slept=%lu, perf=%"PRIu64"\n",
gt_, idle[gt_] - prev[gt_], slept, ts[1] - ts[0]);
- assert_within_epsilon(idle[gt_] - prev[gt_],
- ts[1] - ts[0],
- tolerance);
+ drpc = get_drpc(gem_fd, gt_);
+ assert_within_epsilon_debug(idle[gt_] - prev[gt_],
+ ts[1] - ts[0],
+ tolerance, drpc);
+ free(drpc);
}
/* Wake up device and check no RC6. */
@@ -2048,14 +2068,16 @@ test_rc6(int gem_fd, unsigned int gt, unsigned int num_gt, unsigned int flags)
for (gt_ = 0; gt_ < pmus; gt_++) {
igt_debug("gt%u: busy rc6=%"PRIu64", slept=%lu, perf=%"PRIu64"\n",
gt_, busy[gt_] - prev[gt_], slept, ts[1] - ts[0]);
+ drpc = get_drpc(gem_fd, gt_);
if (gt_ == test_idx || (flags & TEST_ALL))
- assert_within_epsilon(busy[gt_] - prev[gt_],
- 0.0,
- tolerance);
+ assert_within_epsilon_debug(busy[gt_] - prev[gt_],
+ 0.0,
+ tolerance, drpc);
else
- assert_within_epsilon(busy[gt_] - prev[gt_],
- ts[1] - ts[0],
- tolerance);
+ assert_within_epsilon_debug(busy[gt_] - prev[gt_],
+ ts[1] - ts[0],
+ tolerance, drpc);
+ free(drpc);
}
}
@@ -2720,6 +2742,7 @@ igt_main
igt_fixture {
intel_ctx_destroy(fd, ctx);
drm_close_driver(fd);
+ free(drpc);
}
igt_subtest("module-unload") {
--
2.25.1
next reply other threads:[~2023-08-09 13:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-09 13:08 Anshuman Gupta [this message]
2023-08-09 15:02 ` [igt-dev] ○ CI.xeBAT: info for test/perf_pmu: Dump drpc on C6 failure (rev2) 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=20230809130802.1182409-1-anshuman.gupta@intel.com \
--to=anshuman.gupta@intel.com \
--cc=badal.nilawar@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