All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH v6 i-g-t 0/4] tests/slpc: Add basic IGT test
@ 2023-04-14 19:16 ` Vinay Belgaumkar
  0 siblings, 0 replies; 27+ messages in thread
From: Vinay Belgaumkar @ 2023-04-14 19:16 UTC (permalink / raw)
  To: intel-gfx, igt-dev

Borrow some subtests from xe_guc_pc. Also add per GT debugfs helpers.

v3: Review comments and add HAX patch
v4: Modify the condition for skipping the test
v5: Update the SLPC helper to per GT
v6: Review comments (Ashutosh)

Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>

Vinay Belgaumkar (4):
  lib/debugfs: Add per GT debugfs helpers
  lib: Make SLPC helper function per GT
  i915_pm_freq_api: Add some basic SLPC igt tests
  HAX: tests/i915: Try out the SLPC IGT tests

 lib/igt_debugfs.c                     |  60 ++++++++++
 lib/igt_debugfs.h                     |   4 +
 lib/igt_pm.c                          |  36 ++++--
 lib/igt_pm.h                          |   3 +-
 tests/i915/i915_pm_freq_api.c         | 152 ++++++++++++++++++++++++++
 tests/intel-ci/fast-feedback.testlist |   2 +
 tests/meson.build                     |   1 +
 7 files changed, 247 insertions(+), 11 deletions(-)
 create mode 100644 tests/i915/i915_pm_freq_api.c

-- 
2.38.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [igt-dev] [PATCH v6 i-g-t 0/4] tests/slpc: Add basic IGT test
@ 2023-04-14 19:16 ` Vinay Belgaumkar
  0 siblings, 0 replies; 27+ messages in thread
From: Vinay Belgaumkar @ 2023-04-14 19:16 UTC (permalink / raw)
  To: intel-gfx, igt-dev

Borrow some subtests from xe_guc_pc. Also add per GT debugfs helpers.

v3: Review comments and add HAX patch
v4: Modify the condition for skipping the test
v5: Update the SLPC helper to per GT
v6: Review comments (Ashutosh)

Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>

Vinay Belgaumkar (4):
  lib/debugfs: Add per GT debugfs helpers
  lib: Make SLPC helper function per GT
  i915_pm_freq_api: Add some basic SLPC igt tests
  HAX: tests/i915: Try out the SLPC IGT tests

 lib/igt_debugfs.c                     |  60 ++++++++++
 lib/igt_debugfs.h                     |   4 +
 lib/igt_pm.c                          |  36 ++++--
 lib/igt_pm.h                          |   3 +-
 tests/i915/i915_pm_freq_api.c         | 152 ++++++++++++++++++++++++++
 tests/intel-ci/fast-feedback.testlist |   2 +
 tests/meson.build                     |   1 +
 7 files changed, 247 insertions(+), 11 deletions(-)
 create mode 100644 tests/i915/i915_pm_freq_api.c

-- 
2.38.1

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Intel-gfx] [PATCH i-g-t 1/4] lib/debugfs: Add per GT debugfs helpers
  2023-04-14 19:16 ` [igt-dev] " Vinay Belgaumkar
@ 2023-04-14 19:16   ` Vinay Belgaumkar
  -1 siblings, 0 replies; 27+ messages in thread
From: Vinay Belgaumkar @ 2023-04-14 19:16 UTC (permalink / raw)
  To: intel-gfx, igt-dev

These can be used to open per-gt debugfs files.

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Vinay Belgaumkar <viay.belgaumkar@intel.com>
---
 lib/igt_debugfs.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_debugfs.h |  4 ++++
 2 files changed, 64 insertions(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 05889bbe..afde2da6 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -217,6 +217,37 @@ int igt_debugfs_dir(int device)
 	return open(path, O_RDONLY);
 }
 
+/**
+ * igt_debugfs_gt_dir:
+ * @device: fd of the device
+ * @gt: GT instance number
+ *
+ * This opens the debugfs directory corresponding to device for use
+ * with igt_sysfs_get() and related functions.
+ *
+ * Returns:
+ * The directory fd, or -1 on failure.
+ */
+int igt_debugfs_gt_dir(int device, unsigned int gt)
+{
+	int debugfs_gt_dir_fd;
+	char path[PATH_MAX];
+	char gtpath[16];
+	int ret;
+
+	if (!igt_debugfs_path(device, path, sizeof(path)))
+		return -1;
+
+	ret = snprintf(gtpath, sizeof(gtpath), "/gt%u", gt);
+	igt_assert(ret < sizeof(gtpath));
+	strncat(path, gtpath, sizeof(path) - 1);
+
+	debugfs_gt_dir_fd = open(path, O_RDONLY);
+	igt_debug_on_f(debugfs_gt_dir_fd < 0, "path: %s\n", path);
+
+	return debugfs_gt_dir_fd;
+}
+
 /**
  * igt_debugfs_connector_dir:
  * @device: fd of the device
@@ -313,6 +344,35 @@ bool igt_debugfs_exists(int device, const char *filename, int mode)
 	return false;
 }
 
+/**
+ * igt_debugfs_gt_open:
+ * @device: open i915 drm fd
+ * @gt: gt instance number
+ * @filename: name of the debugfs node to open
+ * @mode: mode bits as used by open()
+ *
+ * This opens a debugfs file as a Unix file descriptor. The filename should be
+ * relative to the drm device's root, i.e. without "drm/$minor".
+ *
+ * Returns:
+ * The Unix file descriptor for the debugfs file or -1 if that didn't work out.
+ */
+int
+igt_debugfs_gt_open(int device, unsigned int gt, const char *filename, int mode)
+{
+	int dir, ret;
+
+	dir = igt_debugfs_gt_dir(device, gt);
+	if (dir < 0)
+		return dir;
+
+	ret = openat(dir, filename, mode);
+
+	close(dir);
+
+	return ret;
+}
+
 /**
  * igt_debugfs_simple_read:
  * @dir: fd of the debugfs directory
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index 4824344a..3e6194ad 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -45,6 +45,10 @@ void __igt_debugfs_write(int fd, const char *filename, const char *buf, int size
 int igt_debugfs_simple_read(int dir, const char *filename, char *buf, int size);
 bool igt_debugfs_search(int fd, const char *filename, const char *substring);
 
+int igt_debugfs_gt_dir(int device, unsigned int gt);
+int igt_debugfs_gt_open(int device, unsigned int gt, const char *filename,
+			int mode);
+
 /**
  * igt_debugfs_read:
  * @filename: name of the debugfs file
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [igt-dev] [PATCH i-g-t 1/4] lib/debugfs: Add per GT debugfs helpers
@ 2023-04-14 19:16   ` Vinay Belgaumkar
  0 siblings, 0 replies; 27+ messages in thread
From: Vinay Belgaumkar @ 2023-04-14 19:16 UTC (permalink / raw)
  To: intel-gfx, igt-dev

These can be used to open per-gt debugfs files.

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Vinay Belgaumkar <viay.belgaumkar@intel.com>
---
 lib/igt_debugfs.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_debugfs.h |  4 ++++
 2 files changed, 64 insertions(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 05889bbe..afde2da6 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -217,6 +217,37 @@ int igt_debugfs_dir(int device)
 	return open(path, O_RDONLY);
 }
 
+/**
+ * igt_debugfs_gt_dir:
+ * @device: fd of the device
+ * @gt: GT instance number
+ *
+ * This opens the debugfs directory corresponding to device for use
+ * with igt_sysfs_get() and related functions.
+ *
+ * Returns:
+ * The directory fd, or -1 on failure.
+ */
+int igt_debugfs_gt_dir(int device, unsigned int gt)
+{
+	int debugfs_gt_dir_fd;
+	char path[PATH_MAX];
+	char gtpath[16];
+	int ret;
+
+	if (!igt_debugfs_path(device, path, sizeof(path)))
+		return -1;
+
+	ret = snprintf(gtpath, sizeof(gtpath), "/gt%u", gt);
+	igt_assert(ret < sizeof(gtpath));
+	strncat(path, gtpath, sizeof(path) - 1);
+
+	debugfs_gt_dir_fd = open(path, O_RDONLY);
+	igt_debug_on_f(debugfs_gt_dir_fd < 0, "path: %s\n", path);
+
+	return debugfs_gt_dir_fd;
+}
+
 /**
  * igt_debugfs_connector_dir:
  * @device: fd of the device
@@ -313,6 +344,35 @@ bool igt_debugfs_exists(int device, const char *filename, int mode)
 	return false;
 }
 
+/**
+ * igt_debugfs_gt_open:
+ * @device: open i915 drm fd
+ * @gt: gt instance number
+ * @filename: name of the debugfs node to open
+ * @mode: mode bits as used by open()
+ *
+ * This opens a debugfs file as a Unix file descriptor. The filename should be
+ * relative to the drm device's root, i.e. without "drm/$minor".
+ *
+ * Returns:
+ * The Unix file descriptor for the debugfs file or -1 if that didn't work out.
+ */
+int
+igt_debugfs_gt_open(int device, unsigned int gt, const char *filename, int mode)
+{
+	int dir, ret;
+
+	dir = igt_debugfs_gt_dir(device, gt);
+	if (dir < 0)
+		return dir;
+
+	ret = openat(dir, filename, mode);
+
+	close(dir);
+
+	return ret;
+}
+
 /**
  * igt_debugfs_simple_read:
  * @dir: fd of the debugfs directory
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index 4824344a..3e6194ad 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -45,6 +45,10 @@ void __igt_debugfs_write(int fd, const char *filename, const char *buf, int size
 int igt_debugfs_simple_read(int dir, const char *filename, char *buf, int size);
 bool igt_debugfs_search(int fd, const char *filename, const char *substring);
 
+int igt_debugfs_gt_dir(int device, unsigned int gt);
+int igt_debugfs_gt_open(int device, unsigned int gt, const char *filename,
+			int mode);
+
 /**
  * igt_debugfs_read:
  * @filename: name of the debugfs file
-- 
2.38.1

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Intel-gfx] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT
  2023-04-14 19:16 ` [igt-dev] " Vinay Belgaumkar
@ 2023-04-14 19:16   ` Vinay Belgaumkar
  -1 siblings, 0 replies; 27+ messages in thread
From: Vinay Belgaumkar @ 2023-04-14 19:16 UTC (permalink / raw)
  To: intel-gfx, igt-dev

Use default of 0 where GT id is not being used.

v2: Add a helper for GT 0 (Ashutosh)

Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
---
 lib/igt_pm.c | 36 ++++++++++++++++++++++++++----------
 lib/igt_pm.h |  3 ++-
 2 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/lib/igt_pm.c b/lib/igt_pm.c
index 704acf7d..8a30bb3b 100644
--- a/lib/igt_pm.c
+++ b/lib/igt_pm.c
@@ -1329,21 +1329,37 @@ void igt_pm_print_pci_card_runtime_status(void)
 	}
 }
 
-bool i915_is_slpc_enabled(int fd)
+/**
+ * i915_is_slpc_enabled_gt:
+ * @drm_fd: DRM file descriptor
+ * @gt: GT id
+ * Check if SLPC is enabled on a GT
+ */
+bool i915_is_slpc_enabled_gt(int drm_fd, int gt)
 {
-	int debugfs_fd = igt_debugfs_dir(fd);
-	char buf[4096] = {};
-	int len;
+	int debugfs_fd;
+	char buf[256] = {};
 
-	igt_require(debugfs_fd != -1);
+	debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY);
+
+	/* if guc_slpc_info not present then return false */
+	if (debugfs_fd < 0)
+		return false;
+	read(debugfs_fd, buf, sizeof(buf)-1);
 
-	len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf));
 	close(debugfs_fd);
 
-	if (len < 0)
-		return false;
-	else
-		return strstr(buf, "SLPC state: running");
+	return strstr(buf, "SLPC state: running");
+}
+
+/**
+ * i915_is_slpc_enabled:
+ * @drm_fd: DRM file descriptor
+ * Check if SLPC is enabled on GT 0
+ */
+bool i915_is_slpc_enabled(int drm_fd)
+{
+	return i915_is_slpc_enabled_gt(drm_fd, 0);
 }
 
 int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
diff --git a/lib/igt_pm.h b/lib/igt_pm.h
index d0d6d673..448cf42d 100644
--- a/lib/igt_pm.h
+++ b/lib/igt_pm.h
@@ -84,7 +84,8 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val);
 void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev);
 void igt_pm_restore_pci_card_runtime_pm(void);
 void igt_pm_print_pci_card_runtime_status(void);
-bool i915_is_slpc_enabled(int fd);
+bool i915_is_slpc_enabled_gt(int drm_fd, int gt);
+bool i915_is_slpc_enabled(int drm_fd);
 int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
 int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
 
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [igt-dev] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT
@ 2023-04-14 19:16   ` Vinay Belgaumkar
  0 siblings, 0 replies; 27+ messages in thread
From: Vinay Belgaumkar @ 2023-04-14 19:16 UTC (permalink / raw)
  To: intel-gfx, igt-dev

Use default of 0 where GT id is not being used.

v2: Add a helper for GT 0 (Ashutosh)

Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
---
 lib/igt_pm.c | 36 ++++++++++++++++++++++++++----------
 lib/igt_pm.h |  3 ++-
 2 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/lib/igt_pm.c b/lib/igt_pm.c
index 704acf7d..8a30bb3b 100644
--- a/lib/igt_pm.c
+++ b/lib/igt_pm.c
@@ -1329,21 +1329,37 @@ void igt_pm_print_pci_card_runtime_status(void)
 	}
 }
 
-bool i915_is_slpc_enabled(int fd)
+/**
+ * i915_is_slpc_enabled_gt:
+ * @drm_fd: DRM file descriptor
+ * @gt: GT id
+ * Check if SLPC is enabled on a GT
+ */
+bool i915_is_slpc_enabled_gt(int drm_fd, int gt)
 {
-	int debugfs_fd = igt_debugfs_dir(fd);
-	char buf[4096] = {};
-	int len;
+	int debugfs_fd;
+	char buf[256] = {};
 
-	igt_require(debugfs_fd != -1);
+	debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY);
+
+	/* if guc_slpc_info not present then return false */
+	if (debugfs_fd < 0)
+		return false;
+	read(debugfs_fd, buf, sizeof(buf)-1);
 
-	len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf));
 	close(debugfs_fd);
 
-	if (len < 0)
-		return false;
-	else
-		return strstr(buf, "SLPC state: running");
+	return strstr(buf, "SLPC state: running");
+}
+
+/**
+ * i915_is_slpc_enabled:
+ * @drm_fd: DRM file descriptor
+ * Check if SLPC is enabled on GT 0
+ */
+bool i915_is_slpc_enabled(int drm_fd)
+{
+	return i915_is_slpc_enabled_gt(drm_fd, 0);
 }
 
 int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
diff --git a/lib/igt_pm.h b/lib/igt_pm.h
index d0d6d673..448cf42d 100644
--- a/lib/igt_pm.h
+++ b/lib/igt_pm.h
@@ -84,7 +84,8 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val);
 void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev);
 void igt_pm_restore_pci_card_runtime_pm(void);
 void igt_pm_print_pci_card_runtime_status(void);
-bool i915_is_slpc_enabled(int fd);
+bool i915_is_slpc_enabled_gt(int drm_fd, int gt);
+bool i915_is_slpc_enabled(int drm_fd);
 int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
 int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
 
-- 
2.38.1

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Intel-gfx] [PATCH i-g-t 3/4] i915_pm_freq_api: Add some basic SLPC igt tests
  2023-04-14 19:16 ` [igt-dev] " Vinay Belgaumkar
@ 2023-04-14 19:16   ` Vinay Belgaumkar
  -1 siblings, 0 replies; 27+ messages in thread
From: Vinay Belgaumkar @ 2023-04-14 19:16 UTC (permalink / raw)
  To: intel-gfx, igt-dev

Validate basic api for GT freq control. Also test
interaction with GT reset. We skip rps tests with
SLPC enabled, this will re-introduce some coverage.
SLPC selftests are already covering some other workload
related scenarios.

v2: Rename test (Rodrigo)
v3: Review comments (Ashutosh)
v4: Skip when SLPC is disabled. Check for enable_guc is
not sufficient as kernel config may have it but the
platform doesn't actually support it.
v5: Use the updated SLPC helper

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
---
 tests/i915/i915_pm_freq_api.c | 152 ++++++++++++++++++++++++++++++++++
 tests/meson.build             |   1 +
 2 files changed, 153 insertions(+)
 create mode 100644 tests/i915/i915_pm_freq_api.c

diff --git a/tests/i915/i915_pm_freq_api.c b/tests/i915/i915_pm_freq_api.c
new file mode 100644
index 00000000..f0f4e3f9
--- /dev/null
+++ b/tests/i915/i915_pm_freq_api.c
@@ -0,0 +1,152 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "drmtest.h"
+#include "i915/gem.h"
+#include "igt_sysfs.h"
+#include "igt.h"
+
+IGT_TEST_DESCRIPTION("Test SLPC freq API");
+/*
+ * Too many intermediate components and steps before freq is adjusted
+ * Specially if workload is under execution, so let's wait 100 ms.
+ */
+#define ACT_FREQ_LATENCY_US 100000
+
+static uint32_t get_freq(int dirfd, uint8_t id)
+{
+	uint32_t val;
+
+	igt_assert(igt_sysfs_rps_scanf(dirfd, id, "%u", &val) == 1);
+
+	return val;
+}
+
+static int set_freq(int dirfd, uint8_t id, uint32_t val)
+{
+	return igt_sysfs_rps_printf(dirfd, id, "%u", val);
+}
+
+static void test_freq_basic_api(int dirfd, int gt)
+{
+	uint32_t rpn, rp0, rpe;
+
+	/* Save frequencies */
+	rpn = get_freq(dirfd, RPS_RPn_FREQ_MHZ);
+	rp0 = get_freq(dirfd, RPS_RP0_FREQ_MHZ);
+	rpe = get_freq(dirfd, RPS_RP1_FREQ_MHZ);
+	igt_info("System min freq: %dMHz; max freq: %dMHz\n", rpn, rp0);
+
+	/*
+	 * Negative bound tests
+	 * RPn is the floor
+	 * RP0 is the ceiling
+	 */
+	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn - 1) < 0);
+	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rp0 + 1) < 0);
+	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn - 1) < 0);
+	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rp0 + 1) < 0);
+
+	/* Assert min requests are respected from rp0 to rpn */
+	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rp0) > 0);
+	igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rp0);
+	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpe) > 0);
+	igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rpe);
+	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0);
+	igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rpn);
+
+	/* Assert max requests are respected from rpn to rp0 */
+	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0);
+	igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) == rpn);
+	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpe) > 0);
+	igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) == rpe);
+	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rp0) > 0);
+	igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) == rp0);
+
+}
+
+static void test_reset(int i915, int dirfd, int gt)
+{
+	uint32_t rpn = get_freq(dirfd, RPS_RPn_FREQ_MHZ);
+	int fd;
+
+	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0);
+	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0);
+	usleep(ACT_FREQ_LATENCY_US);
+	igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rpn);
+
+	/* Manually trigger a GT reset */
+	fd = igt_debugfs_gt_open(i915, gt, "reset", O_WRONLY);
+	igt_require(fd >= 0);
+	igt_ignore_warn(write(fd, "1\n", 2));
+	close(fd);
+
+	igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rpn);
+	igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) == rpn);
+}
+
+igt_main
+{
+	int i915 = -1;
+	uint32_t *stash_min, *stash_max;
+
+	igt_fixture {
+		int num_gts, dirfd, gt;
+
+		i915 = drm_open_driver(DRIVER_INTEL);
+		igt_require_gem(i915);
+		/* i915_pm_rps already covers execlist path */
+		igt_skip_on_f(!i915_is_slpc_enabled(i915),
+			      "This test is supported only with SLPC enabled\n");
+
+		num_gts = igt_sysfs_get_num_gt(i915);
+		stash_min = (uint32_t*)malloc(sizeof(uint32_t) * num_gts);
+		stash_max = (uint32_t*)malloc(sizeof(uint32_t) * num_gts);
+
+		/* Save curr min and max across GTs */
+		for_each_sysfs_gt_dirfd(i915, dirfd, gt) {
+			stash_min[gt] = get_freq(dirfd, RPS_MIN_FREQ_MHZ);
+			stash_max[gt] = get_freq(dirfd, RPS_MAX_FREQ_MHZ);
+		}
+	}
+
+	igt_describe("Test basic API for controlling min/max GT frequency");
+	igt_subtest_with_dynamic_f("freq-basic-api") {
+		int dirfd, gt;
+
+		for_each_sysfs_gt_dirfd(i915, dirfd, gt)
+			igt_dynamic_f("gt%u", gt)
+				test_freq_basic_api(dirfd, gt);
+	}
+
+	igt_describe("Test basic freq API works after a reset");
+	igt_subtest_with_dynamic_f("freq-reset") {
+		int dirfd, gt;
+
+		for_each_sysfs_gt_dirfd(i915, dirfd, gt)
+			igt_dynamic_f("gt%u", gt)
+				test_reset(i915, dirfd, gt);
+	}
+
+	igt_fixture {
+		int dirfd, gt;
+		/* Restore frequencies */
+		for_each_sysfs_gt_dirfd(i915, dirfd, gt) {
+			igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, stash_max[gt]) > 0);
+			igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, stash_min[gt]) > 0);
+		}
+		close(i915);
+	}
+}
diff --git a/tests/meson.build b/tests/meson.build
index da31e782..46109f10 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -202,6 +202,7 @@ i915_progs = [
 	'gem_workarounds',
 	'i915_fb_tiling',
 	'i915_getparams_basic',
+	'i915_pm_freq_api',
 	'i915_hangman',
 	'i915_hwmon',
 	'i915_module_load',
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [igt-dev] [PATCH i-g-t 3/4] i915_pm_freq_api: Add some basic SLPC igt tests
@ 2023-04-14 19:16   ` Vinay Belgaumkar
  0 siblings, 0 replies; 27+ messages in thread
From: Vinay Belgaumkar @ 2023-04-14 19:16 UTC (permalink / raw)
  To: intel-gfx, igt-dev

Validate basic api for GT freq control. Also test
interaction with GT reset. We skip rps tests with
SLPC enabled, this will re-introduce some coverage.
SLPC selftests are already covering some other workload
related scenarios.

v2: Rename test (Rodrigo)
v3: Review comments (Ashutosh)
v4: Skip when SLPC is disabled. Check for enable_guc is
not sufficient as kernel config may have it but the
platform doesn't actually support it.
v5: Use the updated SLPC helper

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
---
 tests/i915/i915_pm_freq_api.c | 152 ++++++++++++++++++++++++++++++++++
 tests/meson.build             |   1 +
 2 files changed, 153 insertions(+)
 create mode 100644 tests/i915/i915_pm_freq_api.c

diff --git a/tests/i915/i915_pm_freq_api.c b/tests/i915/i915_pm_freq_api.c
new file mode 100644
index 00000000..f0f4e3f9
--- /dev/null
+++ b/tests/i915/i915_pm_freq_api.c
@@ -0,0 +1,152 @@
+// SPDX-License-Identifier: MIT
+/*
+ * Copyright © 2023 Intel Corporation
+ */
+
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "drmtest.h"
+#include "i915/gem.h"
+#include "igt_sysfs.h"
+#include "igt.h"
+
+IGT_TEST_DESCRIPTION("Test SLPC freq API");
+/*
+ * Too many intermediate components and steps before freq is adjusted
+ * Specially if workload is under execution, so let's wait 100 ms.
+ */
+#define ACT_FREQ_LATENCY_US 100000
+
+static uint32_t get_freq(int dirfd, uint8_t id)
+{
+	uint32_t val;
+
+	igt_assert(igt_sysfs_rps_scanf(dirfd, id, "%u", &val) == 1);
+
+	return val;
+}
+
+static int set_freq(int dirfd, uint8_t id, uint32_t val)
+{
+	return igt_sysfs_rps_printf(dirfd, id, "%u", val);
+}
+
+static void test_freq_basic_api(int dirfd, int gt)
+{
+	uint32_t rpn, rp0, rpe;
+
+	/* Save frequencies */
+	rpn = get_freq(dirfd, RPS_RPn_FREQ_MHZ);
+	rp0 = get_freq(dirfd, RPS_RP0_FREQ_MHZ);
+	rpe = get_freq(dirfd, RPS_RP1_FREQ_MHZ);
+	igt_info("System min freq: %dMHz; max freq: %dMHz\n", rpn, rp0);
+
+	/*
+	 * Negative bound tests
+	 * RPn is the floor
+	 * RP0 is the ceiling
+	 */
+	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn - 1) < 0);
+	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rp0 + 1) < 0);
+	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn - 1) < 0);
+	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rp0 + 1) < 0);
+
+	/* Assert min requests are respected from rp0 to rpn */
+	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rp0) > 0);
+	igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rp0);
+	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpe) > 0);
+	igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rpe);
+	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0);
+	igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rpn);
+
+	/* Assert max requests are respected from rpn to rp0 */
+	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0);
+	igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) == rpn);
+	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpe) > 0);
+	igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) == rpe);
+	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rp0) > 0);
+	igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) == rp0);
+
+}
+
+static void test_reset(int i915, int dirfd, int gt)
+{
+	uint32_t rpn = get_freq(dirfd, RPS_RPn_FREQ_MHZ);
+	int fd;
+
+	igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, rpn) > 0);
+	igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, rpn) > 0);
+	usleep(ACT_FREQ_LATENCY_US);
+	igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rpn);
+
+	/* Manually trigger a GT reset */
+	fd = igt_debugfs_gt_open(i915, gt, "reset", O_WRONLY);
+	igt_require(fd >= 0);
+	igt_ignore_warn(write(fd, "1\n", 2));
+	close(fd);
+
+	igt_assert(get_freq(dirfd, RPS_MIN_FREQ_MHZ) == rpn);
+	igt_assert(get_freq(dirfd, RPS_MAX_FREQ_MHZ) == rpn);
+}
+
+igt_main
+{
+	int i915 = -1;
+	uint32_t *stash_min, *stash_max;
+
+	igt_fixture {
+		int num_gts, dirfd, gt;
+
+		i915 = drm_open_driver(DRIVER_INTEL);
+		igt_require_gem(i915);
+		/* i915_pm_rps already covers execlist path */
+		igt_skip_on_f(!i915_is_slpc_enabled(i915),
+			      "This test is supported only with SLPC enabled\n");
+
+		num_gts = igt_sysfs_get_num_gt(i915);
+		stash_min = (uint32_t*)malloc(sizeof(uint32_t) * num_gts);
+		stash_max = (uint32_t*)malloc(sizeof(uint32_t) * num_gts);
+
+		/* Save curr min and max across GTs */
+		for_each_sysfs_gt_dirfd(i915, dirfd, gt) {
+			stash_min[gt] = get_freq(dirfd, RPS_MIN_FREQ_MHZ);
+			stash_max[gt] = get_freq(dirfd, RPS_MAX_FREQ_MHZ);
+		}
+	}
+
+	igt_describe("Test basic API for controlling min/max GT frequency");
+	igt_subtest_with_dynamic_f("freq-basic-api") {
+		int dirfd, gt;
+
+		for_each_sysfs_gt_dirfd(i915, dirfd, gt)
+			igt_dynamic_f("gt%u", gt)
+				test_freq_basic_api(dirfd, gt);
+	}
+
+	igt_describe("Test basic freq API works after a reset");
+	igt_subtest_with_dynamic_f("freq-reset") {
+		int dirfd, gt;
+
+		for_each_sysfs_gt_dirfd(i915, dirfd, gt)
+			igt_dynamic_f("gt%u", gt)
+				test_reset(i915, dirfd, gt);
+	}
+
+	igt_fixture {
+		int dirfd, gt;
+		/* Restore frequencies */
+		for_each_sysfs_gt_dirfd(i915, dirfd, gt) {
+			igt_assert(set_freq(dirfd, RPS_MAX_FREQ_MHZ, stash_max[gt]) > 0);
+			igt_assert(set_freq(dirfd, RPS_MIN_FREQ_MHZ, stash_min[gt]) > 0);
+		}
+		close(i915);
+	}
+}
diff --git a/tests/meson.build b/tests/meson.build
index da31e782..46109f10 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -202,6 +202,7 @@ i915_progs = [
 	'gem_workarounds',
 	'i915_fb_tiling',
 	'i915_getparams_basic',
+	'i915_pm_freq_api',
 	'i915_hangman',
 	'i915_hwmon',
 	'i915_module_load',
-- 
2.38.1

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Intel-gfx] [PATCH i-g-t 4/4] HAX: tests/i915: Try out the SLPC IGT tests
  2023-04-14 19:16 ` [igt-dev] " Vinay Belgaumkar
@ 2023-04-14 19:16   ` Vinay Belgaumkar
  -1 siblings, 0 replies; 27+ messages in thread
From: Vinay Belgaumkar @ 2023-04-14 19:16 UTC (permalink / raw)
  To: intel-gfx, igt-dev

Trying out for CI. Do not review.

Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
---
 tests/intel-ci/fast-feedback.testlist | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/intel-ci/fast-feedback.testlist b/tests/intel-ci/fast-feedback.testlist
index d9fcb62d..653668dd 100644
--- a/tests/intel-ci/fast-feedback.testlist
+++ b/tests/intel-ci/fast-feedback.testlist
@@ -139,6 +139,8 @@ igt@prime_self_import@basic-with_fd_dup
 igt@prime_self_import@basic-with_one_bo
 igt@prime_self_import@basic-with_one_bo_two_files
 igt@prime_self_import@basic-with_two_bos
+igt@i915_pm_freq_api@freq-basic-api
+igt@i915_pm_freq_api@freq-reset
 igt@prime_vgem@basic-fence-flip
 igt@prime_vgem@basic-fence-mmap
 igt@prime_vgem@basic-fence-read
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [igt-dev] [PATCH i-g-t 4/4] HAX: tests/i915: Try out the SLPC IGT tests
@ 2023-04-14 19:16   ` Vinay Belgaumkar
  0 siblings, 0 replies; 27+ messages in thread
From: Vinay Belgaumkar @ 2023-04-14 19:16 UTC (permalink / raw)
  To: intel-gfx, igt-dev

Trying out for CI. Do not review.

Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
---
 tests/intel-ci/fast-feedback.testlist | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/intel-ci/fast-feedback.testlist b/tests/intel-ci/fast-feedback.testlist
index d9fcb62d..653668dd 100644
--- a/tests/intel-ci/fast-feedback.testlist
+++ b/tests/intel-ci/fast-feedback.testlist
@@ -139,6 +139,8 @@ igt@prime_self_import@basic-with_fd_dup
 igt@prime_self_import@basic-with_one_bo
 igt@prime_self_import@basic-with_one_bo_two_files
 igt@prime_self_import@basic-with_two_bos
+igt@i915_pm_freq_api@freq-basic-api
+igt@i915_pm_freq_api@freq-reset
 igt@prime_vgem@basic-fence-flip
 igt@prime_vgem@basic-fence-mmap
 igt@prime_vgem@basic-fence-read
-- 
2.38.1

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT
  2023-04-14 19:16   ` [igt-dev] " Vinay Belgaumkar
@ 2023-04-14 20:25     ` Dixit, Ashutosh
  -1 siblings, 0 replies; 27+ messages in thread
From: Dixit, Ashutosh @ 2023-04-14 20:25 UTC (permalink / raw)
  To: Vinay Belgaumkar; +Cc: igt-dev, intel-gfx

On Fri, 14 Apr 2023 12:16:37 -0700, Vinay Belgaumkar wrote:
>

Hi Vinay,

> Use default of 0 where GT id is not being used.
>
> v2: Add a helper for GT 0 (Ashutosh)
>
> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
> ---
>  lib/igt_pm.c | 36 ++++++++++++++++++++++++++----------
>  lib/igt_pm.h |  3 ++-
>  2 files changed, 28 insertions(+), 11 deletions(-)
>
> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
> index 704acf7d..8a30bb3b 100644
> --- a/lib/igt_pm.c
> +++ b/lib/igt_pm.c
> @@ -1329,21 +1329,37 @@ void igt_pm_print_pci_card_runtime_status(void)
>	}
>  }
>
> -bool i915_is_slpc_enabled(int fd)
> +/**
> + * i915_is_slpc_enabled_gt:
> + * @drm_fd: DRM file descriptor
> + * @gt: GT id
> + * Check if SLPC is enabled on a GT
> + */
> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt)
>  {
> -	int debugfs_fd = igt_debugfs_dir(fd);
> -	char buf[4096] = {};
> -	int len;
> +	int debugfs_fd;
> +	char buf[256] = {};

Shouldn't this be 4096 as before?

>
> -	igt_require(debugfs_fd != -1);
> +	debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY);
> +
> +	/* if guc_slpc_info not present then return false */
> +	if (debugfs_fd < 0)
> +		return false;

I think this should just be:

	igt_require_fd(debugfs_fd);

Basically we cannot determine if SLPC is enabled or not if say debugfs is
not mounted, so it's not correct return false from here.

> +	read(debugfs_fd, buf, sizeof(buf)-1);
>
> -	len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf));
>	close(debugfs_fd);
>
> -	if (len < 0)
> -		return false;
> -	else
> -		return strstr(buf, "SLPC state: running");
> +	return strstr(buf, "SLPC state: running");
> +}
> +
> +/**
> + * i915_is_slpc_enabled:
> + * @drm_fd: DRM file descriptor
> + * Check if SLPC is enabled on GT 0

Hmm, not sure why we are not using the i915_for_each_gt() loop here since
that is the correct way of doing it.

At the min let's remove the GT 0 in the comment above. This function
doesn't check for GT0, it checks if "slpc is enabled for the device". We
can check only on GT0 if we are certain that checking on GT0 is sufficient,
that is if SLPC is disabled on GT0 it's disabled for the device. But then
someone can ask the question in that case why are we exposing slpc_enabled
for each gt from the kernel rather than at the device level.

In any case for now let's change the above comment to:

"Check if SLPC is enabled" or ""Check if SLPC is enabled for the i915
device".

With the above comments addressed this is:

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>

Also, why is igt@i915_pm_rps@basic-api still skipping on DG2/ATSM in
pre-merge CI even after this series?

Thanks.
--
Ashutosh


> + */
> +bool i915_is_slpc_enabled(int drm_fd)
> +{
> +	return i915_is_slpc_enabled_gt(drm_fd, 0);
>  }

>
>  int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
> index d0d6d673..448cf42d 100644
> --- a/lib/igt_pm.h
> +++ b/lib/igt_pm.h
> @@ -84,7 +84,8 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val);
>  void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev);
>  void igt_pm_restore_pci_card_runtime_pm(void);
>  void igt_pm_print_pci_card_runtime_status(void);
> -bool i915_is_slpc_enabled(int fd);
> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt);
> +bool i915_is_slpc_enabled(int drm_fd);
>  int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
>  int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
>
> --
> 2.38.1
>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT
@ 2023-04-14 20:25     ` Dixit, Ashutosh
  0 siblings, 0 replies; 27+ messages in thread
From: Dixit, Ashutosh @ 2023-04-14 20:25 UTC (permalink / raw)
  To: Vinay Belgaumkar; +Cc: igt-dev, intel-gfx

On Fri, 14 Apr 2023 12:16:37 -0700, Vinay Belgaumkar wrote:
>

Hi Vinay,

> Use default of 0 where GT id is not being used.
>
> v2: Add a helper for GT 0 (Ashutosh)
>
> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
> ---
>  lib/igt_pm.c | 36 ++++++++++++++++++++++++++----------
>  lib/igt_pm.h |  3 ++-
>  2 files changed, 28 insertions(+), 11 deletions(-)
>
> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
> index 704acf7d..8a30bb3b 100644
> --- a/lib/igt_pm.c
> +++ b/lib/igt_pm.c
> @@ -1329,21 +1329,37 @@ void igt_pm_print_pci_card_runtime_status(void)
>	}
>  }
>
> -bool i915_is_slpc_enabled(int fd)
> +/**
> + * i915_is_slpc_enabled_gt:
> + * @drm_fd: DRM file descriptor
> + * @gt: GT id
> + * Check if SLPC is enabled on a GT
> + */
> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt)
>  {
> -	int debugfs_fd = igt_debugfs_dir(fd);
> -	char buf[4096] = {};
> -	int len;
> +	int debugfs_fd;
> +	char buf[256] = {};

Shouldn't this be 4096 as before?

>
> -	igt_require(debugfs_fd != -1);
> +	debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY);
> +
> +	/* if guc_slpc_info not present then return false */
> +	if (debugfs_fd < 0)
> +		return false;

I think this should just be:

	igt_require_fd(debugfs_fd);

Basically we cannot determine if SLPC is enabled or not if say debugfs is
not mounted, so it's not correct return false from here.

> +	read(debugfs_fd, buf, sizeof(buf)-1);
>
> -	len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf));
>	close(debugfs_fd);
>
> -	if (len < 0)
> -		return false;
> -	else
> -		return strstr(buf, "SLPC state: running");
> +	return strstr(buf, "SLPC state: running");
> +}
> +
> +/**
> + * i915_is_slpc_enabled:
> + * @drm_fd: DRM file descriptor
> + * Check if SLPC is enabled on GT 0

Hmm, not sure why we are not using the i915_for_each_gt() loop here since
that is the correct way of doing it.

At the min let's remove the GT 0 in the comment above. This function
doesn't check for GT0, it checks if "slpc is enabled for the device". We
can check only on GT0 if we are certain that checking on GT0 is sufficient,
that is if SLPC is disabled on GT0 it's disabled for the device. But then
someone can ask the question in that case why are we exposing slpc_enabled
for each gt from the kernel rather than at the device level.

In any case for now let's change the above comment to:

"Check if SLPC is enabled" or ""Check if SLPC is enabled for the i915
device".

With the above comments addressed this is:

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>

Also, why is igt@i915_pm_rps@basic-api still skipping on DG2/ATSM in
pre-merge CI even after this series?

Thanks.
--
Ashutosh


> + */
> +bool i915_is_slpc_enabled(int drm_fd)
> +{
> +	return i915_is_slpc_enabled_gt(drm_fd, 0);
>  }

>
>  int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
> index d0d6d673..448cf42d 100644
> --- a/lib/igt_pm.h
> +++ b/lib/igt_pm.h
> @@ -84,7 +84,8 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val);
>  void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev);
>  void igt_pm_restore_pci_card_runtime_pm(void);
>  void igt_pm_print_pci_card_runtime_status(void);
> -bool i915_is_slpc_enabled(int fd);
> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt);
> +bool i915_is_slpc_enabled(int drm_fd);
>  int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
>  int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
>
> --
> 2.38.1
>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for tests/slpc: Add basic IGT test (rev6)
  2023-04-14 19:16 ` [igt-dev] " Vinay Belgaumkar
                   ` (4 preceding siblings ...)
  (?)
@ 2023-04-14 20:29 ` Patchwork
  -1 siblings, 0 replies; 27+ messages in thread
From: Patchwork @ 2023-04-14 20:29 UTC (permalink / raw)
  To: Vinay Belgaumkar; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 13154 bytes --]

== Series Details ==

Series: tests/slpc: Add basic IGT test (rev6)
URL   : https://patchwork.freedesktop.org/series/115698/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13008 -> IGTPW_8807
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/index.html

Participating hosts (37 -> 36)
------------------------------

  Missing    (1): fi-snb-2520m 

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_8807:

### IGT changes ###

#### Possible regressions ####

  * {igt@i915_pm_freq_api@freq-basic-api} (NEW):
    - bat-jsl-3:          NOTRUN -> [SKIP][1] +1 similar issue
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-jsl-3/igt@i915_pm_freq_api@freq-basic-api.html
    - fi-tgl-1115g4:      NOTRUN -> [SKIP][2] +1 similar issue
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-tgl-1115g4/igt@i915_pm_freq_api@freq-basic-api.html
    - bat-jsl-1:          NOTRUN -> [SKIP][3] +1 similar issue
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-jsl-1/igt@i915_pm_freq_api@freq-basic-api.html

  * {igt@i915_pm_freq_api@freq-reset} (NEW):
    - fi-rkl-11600:       NOTRUN -> [SKIP][4] +1 similar issue
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-rkl-11600/igt@i915_pm_freq_api@freq-reset.html
    - bat-adls-5:         NOTRUN -> [SKIP][5] +1 similar issue
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-adls-5/igt@i915_pm_freq_api@freq-reset.html

  
New tests
---------

  New tests have been introduced between CI_DRM_13008 and IGTPW_8807:

### New IGT tests (4) ###

  * igt@i915_pm_freq_api@freq-basic-api:
    - Statuses : 23 skip(s)
    - Exec time: [0.0] s

  * igt@i915_pm_freq_api@freq-basic-api@gt0:
    - Statuses : 12 pass(s)
    - Exec time: [0.0] s

  * igt@i915_pm_freq_api@freq-reset:
    - Statuses : 23 skip(s)
    - Exec time: [0.0] s

  * igt@i915_pm_freq_api@freq-reset@gt0:
    - Statuses : 12 pass(s)
    - Exec time: [0.0] s

  

Known issues
------------

  Here are the changes found in IGTPW_8807 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_module_load@reload:
    - fi-bsw-n3050:       [PASS][6] -> [DMESG-WARN][7] ([i915#1982])
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/fi-bsw-n3050/igt@i915_module_load@reload.html
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-bsw-n3050/igt@i915_module_load@reload.html

  * {igt@i915_pm_freq_api@freq-basic-api} (NEW):
    - fi-glk-j4005:       NOTRUN -> [SKIP][8] ([fdo#109271]) +1 similar issue
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-glk-j4005/igt@i915_pm_freq_api@freq-basic-api.html
    - fi-skl-guc:         NOTRUN -> [SKIP][9] ([fdo#109271]) +1 similar issue
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-skl-guc/igt@i915_pm_freq_api@freq-basic-api.html
    - fi-cfl-8109u:       NOTRUN -> [SKIP][10] ([fdo#109271]) +1 similar issue
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-cfl-8109u/igt@i915_pm_freq_api@freq-basic-api.html
    - fi-kbl-7567u:       NOTRUN -> [SKIP][11] ([fdo#109271]) +1 similar issue
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-kbl-7567u/igt@i915_pm_freq_api@freq-basic-api.html
    - fi-cfl-8700k:       NOTRUN -> [SKIP][12] ([fdo#109271]) +1 similar issue
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-cfl-8700k/igt@i915_pm_freq_api@freq-basic-api.html
    - fi-kbl-8809g:       NOTRUN -> [SKIP][13] ([fdo#109271]) +1 similar issue
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-kbl-8809g/igt@i915_pm_freq_api@freq-basic-api.html
    - fi-ivb-3770:        NOTRUN -> [SKIP][14] ([fdo#109271]) +1 similar issue
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-ivb-3770/igt@i915_pm_freq_api@freq-basic-api.html
    - fi-elk-e7500:       NOTRUN -> [SKIP][15] ([fdo#109271]) +1 similar issue
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-elk-e7500/igt@i915_pm_freq_api@freq-basic-api.html
    - fi-bsw-nick:        NOTRUN -> [SKIP][16] ([fdo#109271]) +1 similar issue
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-bsw-nick/igt@i915_pm_freq_api@freq-basic-api.html
    - fi-kbl-guc:         NOTRUN -> [SKIP][17] ([fdo#109271]) +1 similar issue
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-kbl-guc/igt@i915_pm_freq_api@freq-basic-api.html
    - fi-ilk-650:         NOTRUN -> [SKIP][18] ([fdo#109271]) +1 similar issue
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-ilk-650/igt@i915_pm_freq_api@freq-basic-api.html
    - fi-cfl-guc:         NOTRUN -> [SKIP][19] ([fdo#109271]) +1 similar issue
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-cfl-guc/igt@i915_pm_freq_api@freq-basic-api.html
    - fi-kbl-x1275:       NOTRUN -> [SKIP][20] ([fdo#109271]) +1 similar issue
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-kbl-x1275/igt@i915_pm_freq_api@freq-basic-api.html
    - fi-hsw-4770:        NOTRUN -> [SKIP][21] ([fdo#109271]) +1 similar issue
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-hsw-4770/igt@i915_pm_freq_api@freq-basic-api.html

  * {igt@i915_pm_freq_api@freq-reset} (NEW):
    - fi-bsw-n3050:       NOTRUN -> [SKIP][22] ([fdo#109271]) +1 similar issue
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-bsw-n3050/igt@i915_pm_freq_api@freq-reset.html
    - {bat-kbl-2}:        NOTRUN -> [SKIP][23] ([fdo#109271]) +1 similar issue
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-kbl-2/igt@i915_pm_freq_api@freq-reset.html
    - fi-skl-6600u:       NOTRUN -> [SKIP][24] ([fdo#109271]) +1 similar issue
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-skl-6600u/igt@i915_pm_freq_api@freq-reset.html
    - fi-apl-guc:         NOTRUN -> [SKIP][25] ([fdo#109271]) +1 similar issue
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/fi-apl-guc/igt@i915_pm_freq_api@freq-reset.html

  * igt@i915_pm_rps@basic-api:
    - bat-dg1-7:          [PASS][26] -> [SKIP][27] ([i915#6621])
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-dg1-7/igt@i915_pm_rps@basic-api.html
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-dg1-7/igt@i915_pm_rps@basic-api.html
    - bat-rpls-2:         [PASS][28] -> [SKIP][29] ([i915#6621])
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-rpls-2/igt@i915_pm_rps@basic-api.html
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-rpls-2/igt@i915_pm_rps@basic-api.html
    - bat-adlp-9:         [PASS][30] -> [SKIP][31] ([i915#6621])
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-adlp-9/igt@i915_pm_rps@basic-api.html
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-adlp-9/igt@i915_pm_rps@basic-api.html
    - bat-adlp-6:         [PASS][32] -> [SKIP][33] ([i915#6621])
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-adlp-6/igt@i915_pm_rps@basic-api.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-adlp-6/igt@i915_pm_rps@basic-api.html
    - bat-rplp-1:         [PASS][34] -> [SKIP][35] ([i915#6621])
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-rplp-1/igt@i915_pm_rps@basic-api.html
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-rplp-1/igt@i915_pm_rps@basic-api.html
    - bat-dg1-5:          [PASS][36] -> [SKIP][37] ([i915#6621])
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-dg1-5/igt@i915_pm_rps@basic-api.html
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-dg1-5/igt@i915_pm_rps@basic-api.html
    - bat-atsm-1:         [PASS][38] -> [SKIP][39] ([i915#6621])
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-atsm-1/igt@i915_pm_rps@basic-api.html
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-atsm-1/igt@i915_pm_rps@basic-api.html
    - bat-dg2-9:          [PASS][40] -> [SKIP][41] ([i915#6621])
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-dg2-9/igt@i915_pm_rps@basic-api.html
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-dg2-9/igt@i915_pm_rps@basic-api.html
    - bat-dg2-11:         [PASS][42] -> [SKIP][43] ([i915#6621])
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-dg2-11/igt@i915_pm_rps@basic-api.html
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-dg2-11/igt@i915_pm_rps@basic-api.html
    - bat-adln-1:         [PASS][44] -> [SKIP][45] ([i915#6621])
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-adln-1/igt@i915_pm_rps@basic-api.html
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-adln-1/igt@i915_pm_rps@basic-api.html
    - bat-dg2-8:          [PASS][46] -> [SKIP][47] ([i915#6621])
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-dg2-8/igt@i915_pm_rps@basic-api.html
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-dg2-8/igt@i915_pm_rps@basic-api.html
    - bat-rpls-1:         [PASS][48] -> [SKIP][49] ([i915#6621])
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-rpls-1/igt@i915_pm_rps@basic-api.html
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-rpls-1/igt@i915_pm_rps@basic-api.html

  * igt@i915_selftest@live@migrate:
    - bat-atsm-1:         [PASS][50] -> [DMESG-FAIL][51] ([i915#7699])
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-atsm-1/igt@i915_selftest@live@migrate.html
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-atsm-1/igt@i915_selftest@live@migrate.html

  * igt@i915_selftest@live@requests:
    - bat-rpls-1:         [PASS][52] -> [ABORT][53] ([i915#7911] / [i915#7982])
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-rpls-1/igt@i915_selftest@live@requests.html
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-rpls-1/igt@i915_selftest@live@requests.html

  * igt@i915_selftest@live@workarounds:
    - bat-rplp-1:         [PASS][54] -> [INCOMPLETE][55] ([i915#4983] / [i915#7913])
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-rplp-1/igt@i915_selftest@live@workarounds.html
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-rplp-1/igt@i915_selftest@live@workarounds.html

  * igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence:
    - bat-dg2-11:         NOTRUN -> [SKIP][56] ([i915#5354]) +1 similar issue
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-dg2-11/igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence.html

  
#### Possible fixes ####

  * igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-c-dp-1:
    - bat-dg2-8:          [FAIL][57] ([i915#7932]) -> [PASS][58]
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-c-dp-1.html
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-dg2-8/igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-c-dp-1.html

  
#### Warnings ####

  * igt@i915_selftest@live@slpc:
    - bat-rpls-2:         [DMESG-FAIL][59] ([i915#6997] / [i915#7913]) -> [DMESG-FAIL][60] ([i915#6367] / [i915#7913])
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/bat-rpls-2/igt@i915_selftest@live@slpc.html
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/bat-rpls-2/igt@i915_selftest@live@slpc.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [i915#1982]: https://gitlab.freedesktop.org/drm/intel/issues/1982
  [i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
  [i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
  [i915#6367]: https://gitlab.freedesktop.org/drm/intel/issues/6367
  [i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
  [i915#6997]: https://gitlab.freedesktop.org/drm/intel/issues/6997
  [i915#7699]: https://gitlab.freedesktop.org/drm/intel/issues/7699
  [i915#7911]: https://gitlab.freedesktop.org/drm/intel/issues/7911
  [i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
  [i915#7932]: https://gitlab.freedesktop.org/drm/intel/issues/7932
  [i915#7982]: https://gitlab.freedesktop.org/drm/intel/issues/7982


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_7256 -> IGTPW_8807

  CI-20190529: 20190529
  CI_DRM_13008: 7862c60adcb74785d0063f6d978adf8c38cda97c @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_8807: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/index.html
  IGT_7256: 066fa5410180730b85f61e4f3073da9a2055dc49 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git


Testlist changes
----------------

+igt@i915_pm_freq_api@freq-basic-api
+igt@i915_pm_freq_api@freq-reset

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/index.html

[-- Attachment #2: Type: text/html, Size: 16562 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for tests/slpc: Add basic IGT test (rev6)
  2023-04-14 19:16 ` [igt-dev] " Vinay Belgaumkar
                   ` (5 preceding siblings ...)
  (?)
@ 2023-04-15  4:01 ` Patchwork
  -1 siblings, 0 replies; 27+ messages in thread
From: Patchwork @ 2023-04-15  4:01 UTC (permalink / raw)
  To: Vinay Belgaumkar; +Cc: igt-dev

[-- Attachment #1: Type: text/plain, Size: 17561 bytes --]

== Series Details ==

Series: tests/slpc: Add basic IGT test (rev6)
URL   : https://patchwork.freedesktop.org/series/115698/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_13008_full -> IGTPW_8807_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/index.html

Participating hosts (7 -> 7)
------------------------------

  No changes in participating hosts

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in IGTPW_8807_full:

### IGT changes ###

#### Possible regressions ####

  * {igt@i915_pm_freq_api@freq-basic-api} (NEW):
    - {shard-tglu}:       NOTRUN -> [SKIP][1] +1 similar issue
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-tglu-6/igt@i915_pm_freq_api@freq-basic-api.html
    - {shard-rkl}:        NOTRUN -> [SKIP][2] +1 similar issue
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-rkl-2/igt@i915_pm_freq_api@freq-basic-api.html

  
New tests
---------

  New tests have been introduced between CI_DRM_13008_full and IGTPW_8807_full:

### New IGT tests (2) ###

  * igt@i915_pm_freq_api@freq-basic-api:
    - Statuses : 5 skip(s)
    - Exec time: [0.0] s

  * igt@i915_pm_freq_api@freq-reset:
    - Statuses : 5 skip(s)
    - Exec time: [0.0] s

  

Known issues
------------

  Here are the changes found in IGTPW_8807_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_exec_fair@basic-deadline:
    - shard-glk:          [PASS][3] -> [FAIL][4] ([i915#2846])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/shard-glk2/igt@gem_exec_fair@basic-deadline.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-glk5/igt@gem_exec_fair@basic-deadline.html

  * igt@gem_exec_fair@basic-pace-share@rcs0:
    - shard-glk:          [PASS][5] -> [FAIL][6] ([i915#2842])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/shard-glk9/igt@gem_exec_fair@basic-pace-share@rcs0.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-glk4/igt@gem_exec_fair@basic-pace-share@rcs0.html

  * igt@gem_lmem_swapping@parallel-random-verify-ccs:
    - shard-apl:          NOTRUN -> [SKIP][7] ([fdo#109271] / [i915#4613]) +1 similar issue
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-apl3/igt@gem_lmem_swapping@parallel-random-verify-ccs.html

  * igt@gen9_exec_parse@basic-rejected-ctx-param:
    - shard-snb:          NOTRUN -> [SKIP][8] ([fdo#109271]) +46 similar issues
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-snb2/igt@gen9_exec_parse@basic-rejected-ctx-param.html

  * igt@kms_ccs@pipe-a-bad-pixel-format-4_tiled_dg2_rc_ccs_cc:
    - shard-apl:          NOTRUN -> [SKIP][9] ([fdo#109271]) +71 similar issues
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-apl6/igt@kms_ccs@pipe-a-bad-pixel-format-4_tiled_dg2_rc_ccs_cc.html

  * igt@kms_ccs@pipe-a-missing-ccs-buffer-y_tiled_gen12_rc_ccs_cc:
    - shard-apl:          NOTRUN -> [SKIP][10] ([fdo#109271] / [i915#3886]) +3 similar issues
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-apl6/igt@kms_ccs@pipe-a-missing-ccs-buffer-y_tiled_gen12_rc_ccs_cc.html

  * igt@kms_ccs@pipe-c-bad-aux-stride-y_tiled_gen12_rc_ccs_cc:
    - shard-glk:          NOTRUN -> [SKIP][11] ([fdo#109271] / [i915#3886])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-glk1/igt@kms_ccs@pipe-c-bad-aux-stride-y_tiled_gen12_rc_ccs_cc.html

  * igt@kms_content_protection@uevent@pipe-a-dp-1:
    - shard-apl:          NOTRUN -> [FAIL][12] ([i915#1339])
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-apl1/igt@kms_content_protection@uevent@pipe-a-dp-1.html

  * igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions:
    - shard-glk:          [PASS][13] -> [FAIL][14] ([i915#2346])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/shard-glk6/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-glk9/igt@kms_cursor_legacy@flip-vs-cursor-atomic-transitions.html

  * igt@kms_flip@flip-vs-suspend@b-dp1:
    - shard-apl:          [PASS][15] -> [ABORT][16] ([i915#180]) +1 similar issue
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/shard-apl1/igt@kms_flip@flip-vs-suspend@b-dp1.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-apl2/igt@kms_flip@flip-vs-suspend@b-dp1.html

  * igt@kms_plane_alpha_blend@alpha-opaque-fb@pipe-a-hdmi-a-1:
    - shard-glk:          NOTRUN -> [FAIL][17] ([i915#4573]) +1 similar issue
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-glk9/igt@kms_plane_alpha_blend@alpha-opaque-fb@pipe-a-hdmi-a-1.html

  * igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area:
    - shard-apl:          NOTRUN -> [SKIP][18] ([fdo#109271] / [i915#658])
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-apl4/igt@kms_psr2_sf@overlay-plane-update-sf-dmg-area.html

  * igt@perf@oa-exponents@0-rcs0:
    - shard-glk:          [PASS][19] -> [ABORT][20] ([i915#5213])
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/shard-glk6/igt@perf@oa-exponents@0-rcs0.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-glk2/igt@perf@oa-exponents@0-rcs0.html

  * igt@v3d/v3d_perfmon@create-perfmon-exceed:
    - shard-glk:          NOTRUN -> [SKIP][21] ([fdo#109271]) +42 similar issues
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-glk5/igt@v3d/v3d_perfmon@create-perfmon-exceed.html

  
#### Possible fixes ####

  * igt@gem_ctx_exec@basic-nohangcheck:
    - {shard-rkl}:        [FAIL][22] ([i915#6268]) -> [PASS][23]
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/shard-rkl-1/igt@gem_ctx_exec@basic-nohangcheck.html
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-rkl-3/igt@gem_ctx_exec@basic-nohangcheck.html

  * igt@gem_exec_fair@basic-flow@rcs0:
    - {shard-tglu}:       [FAIL][24] ([i915#2842]) -> [PASS][25]
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/shard-tglu-10/igt@gem_exec_fair@basic-flow@rcs0.html
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-tglu-9/igt@gem_exec_fair@basic-flow@rcs0.html

  * igt@gen9_exec_parse@allowed-single:
    - shard-glk:          [ABORT][26] ([i915#5566]) -> [PASS][27]
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/shard-glk4/igt@gen9_exec_parse@allowed-single.html
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-glk1/igt@gen9_exec_parse@allowed-single.html

  * igt@i915_pm_rpm@modeset-lpsp:
    - {shard-dg1}:        [SKIP][28] ([i915#1397]) -> [PASS][29]
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/shard-dg1-18/igt@i915_pm_rpm@modeset-lpsp.html
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-dg1-14/igt@i915_pm_rpm@modeset-lpsp.html

  * igt@i915_pm_rpm@modeset-lpsp-stress:
    - {shard-rkl}:        [SKIP][30] ([i915#1397]) -> [PASS][31] +2 similar issues
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/shard-rkl-2/igt@i915_pm_rpm@modeset-lpsp-stress.html
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-rkl-7/igt@i915_pm_rpm@modeset-lpsp-stress.html

  * igt@i915_selftest@live@gt_pm:
    - {shard-rkl}:        [DMESG-FAIL][32] ([i915#4258]) -> [PASS][33]
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/shard-rkl-4/igt@i915_selftest@live@gt_pm.html
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-rkl-3/igt@i915_selftest@live@gt_pm.html

  * igt@i915_selftest@mock@sanitycheck:
    - shard-snb:          [ABORT][34] ([i915#4528]) -> [PASS][35]
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/shard-snb5/igt@i915_selftest@mock@sanitycheck.html
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-snb2/igt@i915_selftest@mock@sanitycheck.html

  * igt@kms_plane_scaling@i915-max-src-size@pipe-a-hdmi-a-2:
    - {shard-rkl}:        [FAIL][36] ([i915#8292]) -> [PASS][37]
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_13008/shard-rkl-2/igt@kms_plane_scaling@i915-max-src-size@pipe-a-hdmi-a-2.html
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/shard-rkl-4/igt@kms_plane_scaling@i915-max-src-size@pipe-a-hdmi-a-2.html

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109274]: https://bugs.freedesktop.org/show_bug.cgi?id=109274
  [fdo#109280]: https://bugs.freedesktop.org/show_bug.cgi?id=109280
  [fdo#109283]: https://bugs.freedesktop.org/show_bug.cgi?id=109283
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109295]: https://bugs.freedesktop.org/show_bug.cgi?id=109295
  [fdo#109302]: https://bugs.freedesktop.org/show_bug.cgi?id=109302
  [fdo#109312]: https://bugs.freedesktop.org/show_bug.cgi?id=109312
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
  [fdo#110189]: https://bugs.freedesktop.org/show_bug.cgi?id=110189
  [fdo#110723]: https://bugs.freedesktop.org/show_bug.cgi?id=110723
  [fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
  [fdo#111614]: https://bugs.freedesktop.org/show_bug.cgi?id=111614
  [fdo#111615]: https://bugs.freedesktop.org/show_bug.cgi?id=111615
  [fdo#111656]: https://bugs.freedesktop.org/show_bug.cgi?id=111656
  [fdo#111825]: https://bugs.freedesktop.org/show_bug.cgi?id=111825
  [fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
  [fdo#112054]: https://bugs.freedesktop.org/show_bug.cgi?id=112054
  [i915#1072]: https://gitlab.freedesktop.org/drm/intel/issues/1072
  [i915#1339]: https://gitlab.freedesktop.org/drm/intel/issues/1339
  [i915#1397]: https://gitlab.freedesktop.org/drm/intel/issues/1397
  [i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
  [i915#1825]: https://gitlab.freedesktop.org/drm/intel/issues/1825
  [i915#1839]: https://gitlab.freedesktop.org/drm/intel/issues/1839
  [i915#1902]: https://gitlab.freedesktop.org/drm/intel/issues/1902
  [i915#2346]: https://gitlab.freedesktop.org/drm/intel/issues/2346
  [i915#2437]: https://gitlab.freedesktop.org/drm/intel/issues/2437
  [i915#2527]: https://gitlab.freedesktop.org/drm/intel/issues/2527
  [i915#2575]: https://gitlab.freedesktop.org/drm/intel/issues/2575
  [i915#2587]: https://gitlab.freedesktop.org/drm/intel/issues/2587
  [i915#2672]: https://gitlab.freedesktop.org/drm/intel/issues/2672
  [i915#2705]: https://gitlab.freedesktop.org/drm/intel/issues/2705
  [i915#280]: https://gitlab.freedesktop.org/drm/intel/issues/280
  [i915#284]: https://gitlab.freedesktop.org/drm/intel/issues/284
  [i915#2842]: https://gitlab.freedesktop.org/drm/intel/issues/2842
  [i915#2846]: https://gitlab.freedesktop.org/drm/intel/issues/2846
  [i915#3023]: https://gitlab.freedesktop.org/drm/intel/issues/3023
  [i915#315]: https://gitlab.freedesktop.org/drm/intel/issues/315
  [i915#3281]: https://gitlab.freedesktop.org/drm/intel/issues/3281
  [i915#3282]: https://gitlab.freedesktop.org/drm/intel/issues/3282
  [i915#3297]: https://gitlab.freedesktop.org/drm/intel/issues/3297
  [i915#3299]: https://gitlab.freedesktop.org/drm/intel/issues/3299
  [i915#3318]: https://gitlab.freedesktop.org/drm/intel/issues/3318
  [i915#3359]: https://gitlab.freedesktop.org/drm/intel/issues/3359
  [i915#3458]: https://gitlab.freedesktop.org/drm/intel/issues/3458
  [i915#3539]: https://gitlab.freedesktop.org/drm/intel/issues/3539
  [i915#3555]: https://gitlab.freedesktop.org/drm/intel/issues/3555
  [i915#3591]: https://gitlab.freedesktop.org/drm/intel/issues/3591
  [i915#3637]: https://gitlab.freedesktop.org/drm/intel/issues/3637
  [i915#3638]: https://gitlab.freedesktop.org/drm/intel/issues/3638
  [i915#3689]: https://gitlab.freedesktop.org/drm/intel/issues/3689
  [i915#3708]: https://gitlab.freedesktop.org/drm/intel/issues/3708
  [i915#3734]: https://gitlab.freedesktop.org/drm/intel/issues/3734
  [i915#3742]: https://gitlab.freedesktop.org/drm/intel/issues/3742
  [i915#3804]: https://gitlab.freedesktop.org/drm/intel/issues/3804
  [i915#3886]: https://gitlab.freedesktop.org/drm/intel/issues/3886
  [i915#3952]: https://gitlab.freedesktop.org/drm/intel/issues/3952
  [i915#3989]: https://gitlab.freedesktop.org/drm/intel/issues/3989
  [i915#4070]: https://gitlab.freedesktop.org/drm/intel/issues/4070
  [i915#4077]: https://gitlab.freedesktop.org/drm/intel/issues/4077
  [i915#4079]: https://gitlab.freedesktop.org/drm/intel/issues/4079
  [i915#4083]: https://gitlab.freedesktop.org/drm/intel/issues/4083
  [i915#4212]: https://gitlab.freedesktop.org/drm/intel/issues/4212
  [i915#4215]: https://gitlab.freedesktop.org/drm/intel/issues/4215
  [i915#4258]: https://gitlab.freedesktop.org/drm/intel/issues/4258
  [i915#4270]: https://gitlab.freedesktop.org/drm/intel/issues/4270
  [i915#4387]: https://gitlab.freedesktop.org/drm/intel/issues/4387
  [i915#4525]: https://gitlab.freedesktop.org/drm/intel/issues/4525
  [i915#4528]: https://gitlab.freedesktop.org/drm/intel/issues/4528
  [i915#4538]: https://gitlab.freedesktop.org/drm/intel/issues/4538
  [i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
  [i915#4565]: https://gitlab.freedesktop.org/drm/intel/issues/4565
  [i915#4573]: https://gitlab.freedesktop.org/drm/intel/issues/4573
  [i915#4579]: https://gitlab.freedesktop.org/drm/intel/issues/4579
  [i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
  [i915#4812]: https://gitlab.freedesktop.org/drm/intel/issues/4812
  [i915#4816]: https://gitlab.freedesktop.org/drm/intel/issues/4816
  [i915#4833]: https://gitlab.freedesktop.org/drm/intel/issues/4833
  [i915#4852]: https://gitlab.freedesktop.org/drm/intel/issues/4852
  [i915#4859]: https://gitlab.freedesktop.org/drm/intel/issues/4859
  [i915#4860]: https://gitlab.freedesktop.org/drm/intel/issues/4860
  [i915#4880]: https://gitlab.freedesktop.org/drm/intel/issues/4880
  [i915#4885]: https://gitlab.freedesktop.org/drm/intel/issues/4885
  [i915#4958]: https://gitlab.freedesktop.org/drm/intel/issues/4958
  [i915#5176]: https://gitlab.freedesktop.org/drm/intel/issues/5176
  [i915#5213]: https://gitlab.freedesktop.org/drm/intel/issues/5213
  [i915#5235]: https://gitlab.freedesktop.org/drm/intel/issues/5235
  [i915#5286]: https://gitlab.freedesktop.org/drm/intel/issues/5286
  [i915#5288]: https://gitlab.freedesktop.org/drm/intel/issues/5288
  [i915#5289]: https://gitlab.freedesktop.org/drm/intel/issues/5289
  [i915#5325]: https://gitlab.freedesktop.org/drm/intel/issues/5325
  [i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533
  [i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
  [i915#5439]: https://gitlab.freedesktop.org/drm/intel/issues/5439
  [i915#5461]: https://gitlab.freedesktop.org/drm/intel/issues/5461
  [i915#5563]: https://gitlab.freedesktop.org/drm/intel/issues/5563
  [i915#5566]: https://gitlab.freedesktop.org/drm/intel/issues/5566
  [i915#5723]: https://gitlab.freedesktop.org/drm/intel/issues/5723
  [i915#6095]: https://gitlab.freedesktop.org/drm/intel/issues/6095
  [i915#6230]: https://gitlab.freedesktop.org/drm/intel/issues/6230
  [i915#6268]: https://gitlab.freedesktop.org/drm/intel/issues/6268
  [i915#6301]: https://gitlab.freedesktop.org/drm/intel/issues/6301
  [i915#6334]: https://gitlab.freedesktop.org/drm/intel/issues/6334
  [i915#6335]: https://gitlab.freedesktop.org/drm/intel/issues/6335
  [i915#658]: https://gitlab.freedesktop.org/drm/intel/issues/658
  [i915#6590]: https://gitlab.freedesktop.org/drm/intel/issues/6590
  [i915#6621]: https://gitlab.freedesktop.org/drm/intel/issues/6621
  [i915#6768]: https://gitlab.freedesktop.org/drm/intel/issues/6768
  [i915#6944]: https://gitlab.freedesktop.org/drm/intel/issues/6944
  [i915#6946]: https://gitlab.freedesktop.org/drm/intel/issues/6946
  [i915#7116]: https://gitlab.freedesktop.org/drm/intel/issues/7116
  [i915#7118]: https://gitlab.freedesktop.org/drm/intel/issues/7118
  [i915#7178]: https://gitlab.freedesktop.org/drm/intel/issues/7178
  [i915#7697]: https://gitlab.freedesktop.org/drm/intel/issues/7697
  [i915#7711]: https://gitlab.freedesktop.org/drm/intel/issues/7711
  [i915#7828]: https://gitlab.freedesktop.org/drm/intel/issues/7828
  [i915#7975]: https://gitlab.freedesktop.org/drm/intel/issues/7975
  [i915#8011]: https://gitlab.freedesktop.org/drm/intel/issues/8011
  [i915#8228]: https://gitlab.freedesktop.org/drm/intel/issues/8228
  [i915#8292]: https://gitlab.freedesktop.org/drm/intel/issues/8292
  [i915#8308]: https://gitlab.freedesktop.org/drm/intel/issues/8308
  [i915#8347]: https://gitlab.freedesktop.org/drm/intel/issues/8347


Build changes
-------------

  * CI: CI-20190529 -> None
  * IGT: IGT_7256 -> IGTPW_8807
  * Piglit: piglit_4509 -> None

  CI-20190529: 20190529
  CI_DRM_13008: 7862c60adcb74785d0063f6d978adf8c38cda97c @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_8807: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/index.html
  IGT_7256: 066fa5410180730b85f61e4f3073da9a2055dc49 @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8807/index.html

[-- Attachment #2: Type: text/html, Size: 12250 bytes --]

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT
  2023-04-14 20:25     ` Dixit, Ashutosh
@ 2023-04-18  0:26       ` Belgaumkar, Vinay
  -1 siblings, 0 replies; 27+ messages in thread
From: Belgaumkar, Vinay @ 2023-04-18  0:26 UTC (permalink / raw)
  To: Dixit, Ashutosh; +Cc: igt-dev, intel-gfx


On 4/14/2023 1:25 PM, Dixit, Ashutosh wrote:
> On Fri, 14 Apr 2023 12:16:37 -0700, Vinay Belgaumkar wrote:
> Hi Vinay,
>
>> Use default of 0 where GT id is not being used.
>>
>> v2: Add a helper for GT 0 (Ashutosh)
>>
>> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
>> ---
>>   lib/igt_pm.c | 36 ++++++++++++++++++++++++++----------
>>   lib/igt_pm.h |  3 ++-
>>   2 files changed, 28 insertions(+), 11 deletions(-)
>>
>> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
>> index 704acf7d..8a30bb3b 100644
>> --- a/lib/igt_pm.c
>> +++ b/lib/igt_pm.c
>> @@ -1329,21 +1329,37 @@ void igt_pm_print_pci_card_runtime_status(void)
>> 	}
>>   }
>>
>> -bool i915_is_slpc_enabled(int fd)
>> +/**
>> + * i915_is_slpc_enabled_gt:
>> + * @drm_fd: DRM file descriptor
>> + * @gt: GT id
>> + * Check if SLPC is enabled on a GT
>> + */
>> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt)
>>   {
>> -	int debugfs_fd = igt_debugfs_dir(fd);
>> -	char buf[4096] = {};
>> -	int len;
>> +	int debugfs_fd;
>> +	char buf[256] = {};
> Shouldn't this be 4096 as before?
ok.
>
>> -	igt_require(debugfs_fd != -1);
>> +	debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY);
>> +
>> +	/* if guc_slpc_info not present then return false */
>> +	if (debugfs_fd < 0)
>> +		return false;
> I think this should just be:
>
> 	igt_require_fd(debugfs_fd);
>
> Basically we cannot determine if SLPC is enabled or not if say debugfs is
> not mounted, so it's not correct return false from here.
yup, makes sense.
>
>> +	read(debugfs_fd, buf, sizeof(buf)-1);
>>
>> -	len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf));
>> 	close(debugfs_fd);
>>
>> -	if (len < 0)
>> -		return false;
>> -	else
>> -		return strstr(buf, "SLPC state: running");
>> +	return strstr(buf, "SLPC state: running");
>> +}
>> +
>> +/**
>> + * i915_is_slpc_enabled:
>> + * @drm_fd: DRM file descriptor
>> + * Check if SLPC is enabled on GT 0
> Hmm, not sure why we are not using the i915_for_each_gt() loop here since
> that is the correct way of doing it.
Didn't want to introduce another aggregation here. If SLPC is enabled on 
GT0, it is obviously enabled on all other tiles on that device. There is 
no per tile SLPC/GuC control.
>
> At the min let's remove the GT 0 in the comment above. This function
> doesn't check for GT0, it checks if "slpc is enabled for the device". We
> can check only on GT0 if we are certain that checking on GT0 is sufficient,
> that is if SLPC is disabled on GT0 it's disabled for the device. But then
> someone can ask the question in that case why are we exposing slpc_enabled
> for each gt from the kernel rather than at the device level.
>
> In any case for now let's change the above comment to:
>
> "Check if SLPC is enabled" or ""Check if SLPC is enabled for the i915
> device".
ok.
>
> With the above comments addressed this is:
>
> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
>
> Also, why is igt@i915_pm_rps@basic-api still skipping on DG2/ATSM in
> pre-merge CI even after this series?

basic-api is supposed to skip on GuC platforms. It wasn't due to the 
test incorrectly reading the SLPC enabled status from debugfs (which is 
being fixed here).

Thanks for the review,

Vinay.

>
> Thanks.
> --
> Ashutosh
>
>
>> + */
>> +bool i915_is_slpc_enabled(int drm_fd)
>> +{
>> +	return i915_is_slpc_enabled_gt(drm_fd, 0);
>>   }
>>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
>> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
>> index d0d6d673..448cf42d 100644
>> --- a/lib/igt_pm.h
>> +++ b/lib/igt_pm.h
>> @@ -84,7 +84,8 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val);
>>   void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev);
>>   void igt_pm_restore_pci_card_runtime_pm(void);
>>   void igt_pm_print_pci_card_runtime_status(void);
>> -bool i915_is_slpc_enabled(int fd);
>> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt);
>> +bool i915_is_slpc_enabled(int drm_fd);
>>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
>>   int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
>>
>> --
>> 2.38.1
>>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT
@ 2023-04-18  0:26       ` Belgaumkar, Vinay
  0 siblings, 0 replies; 27+ messages in thread
From: Belgaumkar, Vinay @ 2023-04-18  0:26 UTC (permalink / raw)
  To: Dixit, Ashutosh; +Cc: igt-dev, intel-gfx


On 4/14/2023 1:25 PM, Dixit, Ashutosh wrote:
> On Fri, 14 Apr 2023 12:16:37 -0700, Vinay Belgaumkar wrote:
> Hi Vinay,
>
>> Use default of 0 where GT id is not being used.
>>
>> v2: Add a helper for GT 0 (Ashutosh)
>>
>> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
>> ---
>>   lib/igt_pm.c | 36 ++++++++++++++++++++++++++----------
>>   lib/igt_pm.h |  3 ++-
>>   2 files changed, 28 insertions(+), 11 deletions(-)
>>
>> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
>> index 704acf7d..8a30bb3b 100644
>> --- a/lib/igt_pm.c
>> +++ b/lib/igt_pm.c
>> @@ -1329,21 +1329,37 @@ void igt_pm_print_pci_card_runtime_status(void)
>> 	}
>>   }
>>
>> -bool i915_is_slpc_enabled(int fd)
>> +/**
>> + * i915_is_slpc_enabled_gt:
>> + * @drm_fd: DRM file descriptor
>> + * @gt: GT id
>> + * Check if SLPC is enabled on a GT
>> + */
>> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt)
>>   {
>> -	int debugfs_fd = igt_debugfs_dir(fd);
>> -	char buf[4096] = {};
>> -	int len;
>> +	int debugfs_fd;
>> +	char buf[256] = {};
> Shouldn't this be 4096 as before?
ok.
>
>> -	igt_require(debugfs_fd != -1);
>> +	debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY);
>> +
>> +	/* if guc_slpc_info not present then return false */
>> +	if (debugfs_fd < 0)
>> +		return false;
> I think this should just be:
>
> 	igt_require_fd(debugfs_fd);
>
> Basically we cannot determine if SLPC is enabled or not if say debugfs is
> not mounted, so it's not correct return false from here.
yup, makes sense.
>
>> +	read(debugfs_fd, buf, sizeof(buf)-1);
>>
>> -	len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf));
>> 	close(debugfs_fd);
>>
>> -	if (len < 0)
>> -		return false;
>> -	else
>> -		return strstr(buf, "SLPC state: running");
>> +	return strstr(buf, "SLPC state: running");
>> +}
>> +
>> +/**
>> + * i915_is_slpc_enabled:
>> + * @drm_fd: DRM file descriptor
>> + * Check if SLPC is enabled on GT 0
> Hmm, not sure why we are not using the i915_for_each_gt() loop here since
> that is the correct way of doing it.
Didn't want to introduce another aggregation here. If SLPC is enabled on 
GT0, it is obviously enabled on all other tiles on that device. There is 
no per tile SLPC/GuC control.
>
> At the min let's remove the GT 0 in the comment above. This function
> doesn't check for GT0, it checks if "slpc is enabled for the device". We
> can check only on GT0 if we are certain that checking on GT0 is sufficient,
> that is if SLPC is disabled on GT0 it's disabled for the device. But then
> someone can ask the question in that case why are we exposing slpc_enabled
> for each gt from the kernel rather than at the device level.
>
> In any case for now let's change the above comment to:
>
> "Check if SLPC is enabled" or ""Check if SLPC is enabled for the i915
> device".
ok.
>
> With the above comments addressed this is:
>
> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
>
> Also, why is igt@i915_pm_rps@basic-api still skipping on DG2/ATSM in
> pre-merge CI even after this series?

basic-api is supposed to skip on GuC platforms. It wasn't due to the 
test incorrectly reading the SLPC enabled status from debugfs (which is 
being fixed here).

Thanks for the review,

Vinay.

>
> Thanks.
> --
> Ashutosh
>
>
>> + */
>> +bool i915_is_slpc_enabled(int drm_fd)
>> +{
>> +	return i915_is_slpc_enabled_gt(drm_fd, 0);
>>   }
>>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
>> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
>> index d0d6d673..448cf42d 100644
>> --- a/lib/igt_pm.h
>> +++ b/lib/igt_pm.h
>> @@ -84,7 +84,8 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val);
>>   void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev);
>>   void igt_pm_restore_pci_card_runtime_pm(void);
>>   void igt_pm_print_pci_card_runtime_status(void);
>> -bool i915_is_slpc_enabled(int fd);
>> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt);
>> +bool i915_is_slpc_enabled(int drm_fd);
>>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
>>   int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
>>
>> --
>> 2.38.1
>>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT
  2023-04-14 20:25     ` Dixit, Ashutosh
@ 2023-04-23 20:16       ` Belgaumkar, Vinay
  -1 siblings, 0 replies; 27+ messages in thread
From: Belgaumkar, Vinay @ 2023-04-23 20:16 UTC (permalink / raw)
  To: Dixit, Ashutosh; +Cc: igt-dev, intel-gfx


On 4/14/2023 1:25 PM, Dixit, Ashutosh wrote:
> On Fri, 14 Apr 2023 12:16:37 -0700, Vinay Belgaumkar wrote:
> Hi Vinay,
>
>> Use default of 0 where GT id is not being used.
>>
>> v2: Add a helper for GT 0 (Ashutosh)
>>
>> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
>> ---
>>   lib/igt_pm.c | 36 ++++++++++++++++++++++++++----------
>>   lib/igt_pm.h |  3 ++-
>>   2 files changed, 28 insertions(+), 11 deletions(-)
>>
>> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
>> index 704acf7d..8a30bb3b 100644
>> --- a/lib/igt_pm.c
>> +++ b/lib/igt_pm.c
>> @@ -1329,21 +1329,37 @@ void igt_pm_print_pci_card_runtime_status(void)
>> 	}
>>   }
>>
>> -bool i915_is_slpc_enabled(int fd)
>> +/**
>> + * i915_is_slpc_enabled_gt:
>> + * @drm_fd: DRM file descriptor
>> + * @gt: GT id
>> + * Check if SLPC is enabled on a GT
>> + */
>> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt)
>>   {
>> -	int debugfs_fd = igt_debugfs_dir(fd);
>> -	char buf[4096] = {};
>> -	int len;
>> +	int debugfs_fd;
>> +	char buf[256] = {};
> Shouldn't this be 4096 as before?
>
>> -	igt_require(debugfs_fd != -1);
>> +	debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY);
>> +
>> +	/* if guc_slpc_info not present then return false */
>> +	if (debugfs_fd < 0)
>> +		return false;
> I think this should just be:
>
> 	igt_require_fd(debugfs_fd);
>
> Basically we cannot determine if SLPC is enabled or not if say debugfs is
> not mounted, so it's not correct return false from here.

Actually, rethinking on this, we should keep it to return false. This is 
making tests skip on platforms where it shouldn't. Debugfs will not be 
mounted only when driver load fails, which would cause the test to fail 
when we try to create the drm fd before this. Case in point - 
https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8839/fi-tgl-1115g4/igt@i915_pm_rps@basic-api.html 
- here, the test should have run (guc disabled platform) but it skipped.

Thanks,

Vinay.

>
>> +	read(debugfs_fd, buf, sizeof(buf)-1);
>>
>> -	len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf));
>> 	close(debugfs_fd);
>>
>> -	if (len < 0)
>> -		return false;
>> -	else
>> -		return strstr(buf, "SLPC state: running");
>> +	return strstr(buf, "SLPC state: running");
>> +}
>> +
>> +/**
>> + * i915_is_slpc_enabled:
>> + * @drm_fd: DRM file descriptor
>> + * Check if SLPC is enabled on GT 0
> Hmm, not sure why we are not using the i915_for_each_gt() loop here since
> that is the correct way of doing it.
>
> At the min let's remove the GT 0 in the comment above. This function
> doesn't check for GT0, it checks if "slpc is enabled for the device". We
> can check only on GT0 if we are certain that checking on GT0 is sufficient,
> that is if SLPC is disabled on GT0 it's disabled for the device. But then
> someone can ask the question in that case why are we exposing slpc_enabled
> for each gt from the kernel rather than at the device level.
>
> In any case for now let's change the above comment to:
>
> "Check if SLPC is enabled" or ""Check if SLPC is enabled for the i915
> device".
>
> With the above comments addressed this is:
>
> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
>
> Also, why is igt@i915_pm_rps@basic-api still skipping on DG2/ATSM in
> pre-merge CI even after this series?
>
> Thanks.
> --
> Ashutosh
>
>
>> + */
>> +bool i915_is_slpc_enabled(int drm_fd)
>> +{
>> +	return i915_is_slpc_enabled_gt(drm_fd, 0);
>>   }
>>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
>> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
>> index d0d6d673..448cf42d 100644
>> --- a/lib/igt_pm.h
>> +++ b/lib/igt_pm.h
>> @@ -84,7 +84,8 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val);
>>   void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev);
>>   void igt_pm_restore_pci_card_runtime_pm(void);
>>   void igt_pm_print_pci_card_runtime_status(void);
>> -bool i915_is_slpc_enabled(int fd);
>> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt);
>> +bool i915_is_slpc_enabled(int drm_fd);
>>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
>>   int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
>>
>> --
>> 2.38.1
>>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT
@ 2023-04-23 20:16       ` Belgaumkar, Vinay
  0 siblings, 0 replies; 27+ messages in thread
From: Belgaumkar, Vinay @ 2023-04-23 20:16 UTC (permalink / raw)
  To: Dixit, Ashutosh; +Cc: igt-dev, intel-gfx


On 4/14/2023 1:25 PM, Dixit, Ashutosh wrote:
> On Fri, 14 Apr 2023 12:16:37 -0700, Vinay Belgaumkar wrote:
> Hi Vinay,
>
>> Use default of 0 where GT id is not being used.
>>
>> v2: Add a helper for GT 0 (Ashutosh)
>>
>> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
>> ---
>>   lib/igt_pm.c | 36 ++++++++++++++++++++++++++----------
>>   lib/igt_pm.h |  3 ++-
>>   2 files changed, 28 insertions(+), 11 deletions(-)
>>
>> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
>> index 704acf7d..8a30bb3b 100644
>> --- a/lib/igt_pm.c
>> +++ b/lib/igt_pm.c
>> @@ -1329,21 +1329,37 @@ void igt_pm_print_pci_card_runtime_status(void)
>> 	}
>>   }
>>
>> -bool i915_is_slpc_enabled(int fd)
>> +/**
>> + * i915_is_slpc_enabled_gt:
>> + * @drm_fd: DRM file descriptor
>> + * @gt: GT id
>> + * Check if SLPC is enabled on a GT
>> + */
>> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt)
>>   {
>> -	int debugfs_fd = igt_debugfs_dir(fd);
>> -	char buf[4096] = {};
>> -	int len;
>> +	int debugfs_fd;
>> +	char buf[256] = {};
> Shouldn't this be 4096 as before?
>
>> -	igt_require(debugfs_fd != -1);
>> +	debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY);
>> +
>> +	/* if guc_slpc_info not present then return false */
>> +	if (debugfs_fd < 0)
>> +		return false;
> I think this should just be:
>
> 	igt_require_fd(debugfs_fd);
>
> Basically we cannot determine if SLPC is enabled or not if say debugfs is
> not mounted, so it's not correct return false from here.

Actually, rethinking on this, we should keep it to return false. This is 
making tests skip on platforms where it shouldn't. Debugfs will not be 
mounted only when driver load fails, which would cause the test to fail 
when we try to create the drm fd before this. Case in point - 
https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8839/fi-tgl-1115g4/igt@i915_pm_rps@basic-api.html 
- here, the test should have run (guc disabled platform) but it skipped.

Thanks,

Vinay.

>
>> +	read(debugfs_fd, buf, sizeof(buf)-1);
>>
>> -	len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf));
>> 	close(debugfs_fd);
>>
>> -	if (len < 0)
>> -		return false;
>> -	else
>> -		return strstr(buf, "SLPC state: running");
>> +	return strstr(buf, "SLPC state: running");
>> +}
>> +
>> +/**
>> + * i915_is_slpc_enabled:
>> + * @drm_fd: DRM file descriptor
>> + * Check if SLPC is enabled on GT 0
> Hmm, not sure why we are not using the i915_for_each_gt() loop here since
> that is the correct way of doing it.
>
> At the min let's remove the GT 0 in the comment above. This function
> doesn't check for GT0, it checks if "slpc is enabled for the device". We
> can check only on GT0 if we are certain that checking on GT0 is sufficient,
> that is if SLPC is disabled on GT0 it's disabled for the device. But then
> someone can ask the question in that case why are we exposing slpc_enabled
> for each gt from the kernel rather than at the device level.
>
> In any case for now let's change the above comment to:
>
> "Check if SLPC is enabled" or ""Check if SLPC is enabled for the i915
> device".
>
> With the above comments addressed this is:
>
> Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
>
> Also, why is igt@i915_pm_rps@basic-api still skipping on DG2/ATSM in
> pre-merge CI even after this series?
>
> Thanks.
> --
> Ashutosh
>
>
>> + */
>> +bool i915_is_slpc_enabled(int drm_fd)
>> +{
>> +	return i915_is_slpc_enabled_gt(drm_fd, 0);
>>   }
>>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
>> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
>> index d0d6d673..448cf42d 100644
>> --- a/lib/igt_pm.h
>> +++ b/lib/igt_pm.h
>> @@ -84,7 +84,8 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val);
>>   void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev);
>>   void igt_pm_restore_pci_card_runtime_pm(void);
>>   void igt_pm_print_pci_card_runtime_status(void);
>> -bool i915_is_slpc_enabled(int fd);
>> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt);
>> +bool i915_is_slpc_enabled(int drm_fd);
>>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
>>   int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
>>
>> --
>> 2.38.1
>>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT
  2023-04-23 20:16       ` Belgaumkar, Vinay
@ 2023-04-24 16:55         ` Dixit, Ashutosh
  -1 siblings, 0 replies; 27+ messages in thread
From: Dixit, Ashutosh @ 2023-04-24 16:55 UTC (permalink / raw)
  To: Belgaumkar, Vinay; +Cc: igt-dev, intel-gfx

On Sun, 23 Apr 2023 13:16:44 -0700, Belgaumkar, Vinay wrote:
>

Hi Vinay,

> On 4/14/2023 1:25 PM, Dixit, Ashutosh wrote:
> > On Fri, 14 Apr 2023 12:16:37 -0700, Vinay Belgaumkar wrote:
> > Hi Vinay,
> >
> >> Use default of 0 where GT id is not being used.
> >>
> >> v2: Add a helper for GT 0 (Ashutosh)
> >>
> >> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
> >> ---
> >>   lib/igt_pm.c | 36 ++++++++++++++++++++++++++----------
> >>   lib/igt_pm.h |  3 ++-
> >>   2 files changed, 28 insertions(+), 11 deletions(-)
> >>
> >> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
> >> index 704acf7d..8a30bb3b 100644
> >> --- a/lib/igt_pm.c
> >> +++ b/lib/igt_pm.c
> >> @@ -1329,21 +1329,37 @@ void igt_pm_print_pci_card_runtime_status(void)
> >>	}
> >>   }
> >>
> >> -bool i915_is_slpc_enabled(int fd)
> >> +/**
> >> + * i915_is_slpc_enabled_gt:
> >> + * @drm_fd: DRM file descriptor
> >> + * @gt: GT id
> >> + * Check if SLPC is enabled on a GT
> >> + */
> >> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt)
> >>   {
> >> -	int debugfs_fd = igt_debugfs_dir(fd);
> >> -	char buf[4096] = {};
> >> -	int len;
> >> +	int debugfs_fd;
> >> +	char buf[256] = {};
> > Shouldn't this be 4096 as before?
> >
> >> -	igt_require(debugfs_fd != -1);
> >> +	debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY);
> >> +
> >> +	/* if guc_slpc_info not present then return false */
> >> +	if (debugfs_fd < 0)
> >> +		return false;
> > I think this should just be:
> >
> >	igt_require_fd(debugfs_fd);
> >
> > Basically we cannot determine if SLPC is enabled or not if say debugfs is
> > not mounted, so it's not correct return false from here.
>
> Actually, rethinking on this, we should keep it to return false. This is
> making tests skip on platforms where it shouldn't. Debugfs will not be
> mounted only when driver load fails,

Debugfs not being mounted has nothing to do with driver load, it is just
that this command has not been run before running the tests (the system
would typically be configured to run this after boot):

	mount -t debugfs none /sys/kernel/debug/

Ah, igt_debugfs_path() will mount debugfs if not mounted and assert if
mount fails. So IGT itself is mounting debugfs if not mounted.

> which would cause the test to fail
> when we try to create the drm fd before this. Case in point -
> https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8839/fi-tgl-1115g4/igt@i915_pm_rps@basic-api.html
> - here, the test should have run (guc disabled platform) but it skipped.

OK, sorry yes because it is checking for guc_slpc_info, which would
indicate whether or not slpc is enabled.

But the issue is still there, whether or not we solve it. Say SLPC is
enabled but debugfs was not mounted. In the code above we will conclude
that slpc is not enabled. Because mulitple conditions have been combined
into one and there is no way to check for them separately (debugfs being
mounted and guc_slpc_info being present).

The original code above has this check:

	igt_require(debugfs_fd != -1);

Which is checking for whether or not debugfs is mounted. Where does this
check move in this series?

Anyway maybe for now just change the code to return false.

Thanks.
--
Ashutosh

> >> +	read(debugfs_fd, buf, sizeof(buf)-1);
> >>
> >> -	len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf));
> >>	close(debugfs_fd);
> >>
> >> -	if (len < 0)
> >> -		return false;
> >> -	else
> >> -		return strstr(buf, "SLPC state: running");
> >> +	return strstr(buf, "SLPC state: running");
> >> +}
> >> +
> >> +/**
> >> + * i915_is_slpc_enabled:
> >> + * @drm_fd: DRM file descriptor
> >> + * Check if SLPC is enabled on GT 0
> > Hmm, not sure why we are not using the i915_for_each_gt() loop here since
> > that is the correct way of doing it.
> >
> > At the min let's remove the GT 0 in the comment above. This function
> > doesn't check for GT0, it checks if "slpc is enabled for the device". We
> > can check only on GT0 if we are certain that checking on GT0 is sufficient,
> > that is if SLPC is disabled on GT0 it's disabled for the device. But then
> > someone can ask the question in that case why are we exposing slpc_enabled
> > for each gt from the kernel rather than at the device level.
> >
> > In any case for now let's change the above comment to:
> >
> > "Check if SLPC is enabled" or ""Check if SLPC is enabled for the i915
> > device".
> >
> > With the above comments addressed this is:
> >
> > Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> >
> > Also, why is igt@i915_pm_rps@basic-api still skipping on DG2/ATSM in
> > pre-merge CI even after this series?
> >
> > Thanks.
> > --
> > Ashutosh
> >
> >
> >> + */
> >> +bool i915_is_slpc_enabled(int drm_fd)
> >> +{
> >> +	return i915_is_slpc_enabled_gt(drm_fd, 0);
> >>   }
> >>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
> >> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
> >> index d0d6d673..448cf42d 100644
> >> --- a/lib/igt_pm.h
> >> +++ b/lib/igt_pm.h
> >> @@ -84,7 +84,8 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val);
> >>   void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev);
> >>   void igt_pm_restore_pci_card_runtime_pm(void);
> >>   void igt_pm_print_pci_card_runtime_status(void);
> >> -bool i915_is_slpc_enabled(int fd);
> >> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt);
> >> +bool i915_is_slpc_enabled(int drm_fd);
> >>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
> >>   int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
> >>
> >> --
> >> 2.38.1
> >>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT
@ 2023-04-24 16:55         ` Dixit, Ashutosh
  0 siblings, 0 replies; 27+ messages in thread
From: Dixit, Ashutosh @ 2023-04-24 16:55 UTC (permalink / raw)
  To: Belgaumkar, Vinay; +Cc: igt-dev, intel-gfx

On Sun, 23 Apr 2023 13:16:44 -0700, Belgaumkar, Vinay wrote:
>

Hi Vinay,

> On 4/14/2023 1:25 PM, Dixit, Ashutosh wrote:
> > On Fri, 14 Apr 2023 12:16:37 -0700, Vinay Belgaumkar wrote:
> > Hi Vinay,
> >
> >> Use default of 0 where GT id is not being used.
> >>
> >> v2: Add a helper for GT 0 (Ashutosh)
> >>
> >> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
> >> ---
> >>   lib/igt_pm.c | 36 ++++++++++++++++++++++++++----------
> >>   lib/igt_pm.h |  3 ++-
> >>   2 files changed, 28 insertions(+), 11 deletions(-)
> >>
> >> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
> >> index 704acf7d..8a30bb3b 100644
> >> --- a/lib/igt_pm.c
> >> +++ b/lib/igt_pm.c
> >> @@ -1329,21 +1329,37 @@ void igt_pm_print_pci_card_runtime_status(void)
> >>	}
> >>   }
> >>
> >> -bool i915_is_slpc_enabled(int fd)
> >> +/**
> >> + * i915_is_slpc_enabled_gt:
> >> + * @drm_fd: DRM file descriptor
> >> + * @gt: GT id
> >> + * Check if SLPC is enabled on a GT
> >> + */
> >> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt)
> >>   {
> >> -	int debugfs_fd = igt_debugfs_dir(fd);
> >> -	char buf[4096] = {};
> >> -	int len;
> >> +	int debugfs_fd;
> >> +	char buf[256] = {};
> > Shouldn't this be 4096 as before?
> >
> >> -	igt_require(debugfs_fd != -1);
> >> +	debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY);
> >> +
> >> +	/* if guc_slpc_info not present then return false */
> >> +	if (debugfs_fd < 0)
> >> +		return false;
> > I think this should just be:
> >
> >	igt_require_fd(debugfs_fd);
> >
> > Basically we cannot determine if SLPC is enabled or not if say debugfs is
> > not mounted, so it's not correct return false from here.
>
> Actually, rethinking on this, we should keep it to return false. This is
> making tests skip on platforms where it shouldn't. Debugfs will not be
> mounted only when driver load fails,

Debugfs not being mounted has nothing to do with driver load, it is just
that this command has not been run before running the tests (the system
would typically be configured to run this after boot):

	mount -t debugfs none /sys/kernel/debug/

Ah, igt_debugfs_path() will mount debugfs if not mounted and assert if
mount fails. So IGT itself is mounting debugfs if not mounted.

> which would cause the test to fail
> when we try to create the drm fd before this. Case in point -
> https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8839/fi-tgl-1115g4/igt@i915_pm_rps@basic-api.html
> - here, the test should have run (guc disabled platform) but it skipped.

OK, sorry yes because it is checking for guc_slpc_info, which would
indicate whether or not slpc is enabled.

But the issue is still there, whether or not we solve it. Say SLPC is
enabled but debugfs was not mounted. In the code above we will conclude
that slpc is not enabled. Because mulitple conditions have been combined
into one and there is no way to check for them separately (debugfs being
mounted and guc_slpc_info being present).

The original code above has this check:

	igt_require(debugfs_fd != -1);

Which is checking for whether or not debugfs is mounted. Where does this
check move in this series?

Anyway maybe for now just change the code to return false.

Thanks.
--
Ashutosh

> >> +	read(debugfs_fd, buf, sizeof(buf)-1);
> >>
> >> -	len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf));
> >>	close(debugfs_fd);
> >>
> >> -	if (len < 0)
> >> -		return false;
> >> -	else
> >> -		return strstr(buf, "SLPC state: running");
> >> +	return strstr(buf, "SLPC state: running");
> >> +}
> >> +
> >> +/**
> >> + * i915_is_slpc_enabled:
> >> + * @drm_fd: DRM file descriptor
> >> + * Check if SLPC is enabled on GT 0
> > Hmm, not sure why we are not using the i915_for_each_gt() loop here since
> > that is the correct way of doing it.
> >
> > At the min let's remove the GT 0 in the comment above. This function
> > doesn't check for GT0, it checks if "slpc is enabled for the device". We
> > can check only on GT0 if we are certain that checking on GT0 is sufficient,
> > that is if SLPC is disabled on GT0 it's disabled for the device. But then
> > someone can ask the question in that case why are we exposing slpc_enabled
> > for each gt from the kernel rather than at the device level.
> >
> > In any case for now let's change the above comment to:
> >
> > "Check if SLPC is enabled" or ""Check if SLPC is enabled for the i915
> > device".
> >
> > With the above comments addressed this is:
> >
> > Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> >
> > Also, why is igt@i915_pm_rps@basic-api still skipping on DG2/ATSM in
> > pre-merge CI even after this series?
> >
> > Thanks.
> > --
> > Ashutosh
> >
> >
> >> + */
> >> +bool i915_is_slpc_enabled(int drm_fd)
> >> +{
> >> +	return i915_is_slpc_enabled_gt(drm_fd, 0);
> >>   }
> >>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
> >> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
> >> index d0d6d673..448cf42d 100644
> >> --- a/lib/igt_pm.h
> >> +++ b/lib/igt_pm.h
> >> @@ -84,7 +84,8 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val);
> >>   void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev);
> >>   void igt_pm_restore_pci_card_runtime_pm(void);
> >>   void igt_pm_print_pci_card_runtime_status(void);
> >> -bool i915_is_slpc_enabled(int fd);
> >> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt);
> >> +bool i915_is_slpc_enabled(int drm_fd);
> >>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
> >>   int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
> >>
> >> --
> >> 2.38.1
> >>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT
  2023-04-24 16:55         ` Dixit, Ashutosh
@ 2023-04-24 17:07           ` Dixit, Ashutosh
  -1 siblings, 0 replies; 27+ messages in thread
From: Dixit, Ashutosh @ 2023-04-24 17:07 UTC (permalink / raw)
  To: Belgaumkar, Vinay; +Cc: igt-dev, intel-gfx

On Mon, 24 Apr 2023 09:55:14 -0700, Dixit, Ashutosh wrote:
>
> On Sun, 23 Apr 2023 13:16:44 -0700, Belgaumkar, Vinay wrote:
> >
>
> Hi Vinay,
>
> > On 4/14/2023 1:25 PM, Dixit, Ashutosh wrote:
> > > On Fri, 14 Apr 2023 12:16:37 -0700, Vinay Belgaumkar wrote:
> > > Hi Vinay,
> > >
> > >> Use default of 0 where GT id is not being used.
> > >>
> > >> v2: Add a helper for GT 0 (Ashutosh)
> > >>
> > >> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
> > >> ---
> > >>   lib/igt_pm.c | 36 ++++++++++++++++++++++++++----------
> > >>   lib/igt_pm.h |  3 ++-
> > >>   2 files changed, 28 insertions(+), 11 deletions(-)
> > >>
> > >> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
> > >> index 704acf7d..8a30bb3b 100644
> > >> --- a/lib/igt_pm.c
> > >> +++ b/lib/igt_pm.c
> > >> @@ -1329,21 +1329,37 @@ void igt_pm_print_pci_card_runtime_status(void)
> > >>	}
> > >>   }
> > >>
> > >> -bool i915_is_slpc_enabled(int fd)
> > >> +/**
> > >> + * i915_is_slpc_enabled_gt:
> > >> + * @drm_fd: DRM file descriptor
> > >> + * @gt: GT id
> > >> + * Check if SLPC is enabled on a GT
> > >> + */
> > >> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt)
> > >>   {
> > >> -	int debugfs_fd = igt_debugfs_dir(fd);
> > >> -	char buf[4096] = {};
> > >> -	int len;
> > >> +	int debugfs_fd;
> > >> +	char buf[256] = {};
> > > Shouldn't this be 4096 as before?
> > >
> > >> -	igt_require(debugfs_fd != -1);
> > >> +	debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY);
> > >> +
> > >> +	/* if guc_slpc_info not present then return false */
> > >> +	if (debugfs_fd < 0)
> > >> +		return false;
> > > I think this should just be:
> > >
> > >	igt_require_fd(debugfs_fd);
> > >
> > > Basically we cannot determine if SLPC is enabled or not if say debugfs is
> > > not mounted, so it's not correct return false from here.
> >
> > Actually, rethinking on this, we should keep it to return false. This is
> > making tests skip on platforms where it shouldn't. Debugfs will not be
> > mounted only when driver load fails,
>
> Debugfs not being mounted has nothing to do with driver load, it is just
> that this command has not been run before running the tests (the system
> would typically be configured to run this after boot):
>
>	mount -t debugfs none /sys/kernel/debug/
>
> Ah, igt_debugfs_path() will mount debugfs if not mounted and assert if
> mount fails. So IGT itself is mounting debugfs if not mounted.
>
> > which would cause the test to fail
> > when we try to create the drm fd before this. Case in point -
> > https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8839/fi-tgl-1115g4/igt@i915_pm_rps@basic-api.html
> > - here, the test should have run (guc disabled platform) but it skipped.
>
> OK, sorry yes because it is checking for guc_slpc_info, which would
> indicate whether or not slpc is enabled.
>
> But the issue is still there, whether or not we solve it. Say SLPC is
> enabled but debugfs was not mounted. In the code above we will conclude
> that slpc is not enabled. Because mulitple conditions have been combined
> into one and there is no way to check for them separately (debugfs being
> mounted and guc_slpc_info being present).
>
> The original code above has this check:
>
>	igt_require(debugfs_fd != -1);
>
> Which is checking for whether or not debugfs is mounted. Where does this
> check move in this series?
>
> Anyway maybe for now just change the code to return false.

I think the correct way to do it would be remove igt_debugfs_gt_open from
Patch 1 and call the sequence in igt_debugfs_gt_open directly from
i915_is_slpc_enabled_gt, something like:

	dir = igt_debugfs_gt_dir(device, gt);
	igt_require(dir);

	debugfs_fd = openat(dir, "uc/guc_slpc_info", O_RDONLY);
	if (debugfs_fd < 0)
		return false;

>
> Thanks.
> --
> Ashutosh
>
> > >> +	read(debugfs_fd, buf, sizeof(buf)-1);
> > >>
> > >> -	len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf));
> > >>	close(debugfs_fd);
> > >>
> > >> -	if (len < 0)
> > >> -		return false;
> > >> -	else
> > >> -		return strstr(buf, "SLPC state: running");
> > >> +	return strstr(buf, "SLPC state: running");
> > >> +}
> > >> +
> > >> +/**
> > >> + * i915_is_slpc_enabled:
> > >> + * @drm_fd: DRM file descriptor
> > >> + * Check if SLPC is enabled on GT 0
> > > Hmm, not sure why we are not using the i915_for_each_gt() loop here since
> > > that is the correct way of doing it.
> > >
> > > At the min let's remove the GT 0 in the comment above. This function
> > > doesn't check for GT0, it checks if "slpc is enabled for the device". We
> > > can check only on GT0 if we are certain that checking on GT0 is sufficient,
> > > that is if SLPC is disabled on GT0 it's disabled for the device. But then
> > > someone can ask the question in that case why are we exposing slpc_enabled
> > > for each gt from the kernel rather than at the device level.
> > >
> > > In any case for now let's change the above comment to:
> > >
> > > "Check if SLPC is enabled" or ""Check if SLPC is enabled for the i915
> > > device".
> > >
> > > With the above comments addressed this is:
> > >
> > > Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> > >
> > > Also, why is igt@i915_pm_rps@basic-api still skipping on DG2/ATSM in
> > > pre-merge CI even after this series?
> > >
> > > Thanks.
> > > --
> > > Ashutosh
> > >
> > >
> > >> + */
> > >> +bool i915_is_slpc_enabled(int drm_fd)
> > >> +{
> > >> +	return i915_is_slpc_enabled_gt(drm_fd, 0);
> > >>   }
> > >>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
> > >> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
> > >> index d0d6d673..448cf42d 100644
> > >> --- a/lib/igt_pm.h
> > >> +++ b/lib/igt_pm.h
> > >> @@ -84,7 +84,8 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val);
> > >>   void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev);
> > >>   void igt_pm_restore_pci_card_runtime_pm(void);
> > >>   void igt_pm_print_pci_card_runtime_status(void);
> > >> -bool i915_is_slpc_enabled(int fd);
> > >> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt);
> > >> +bool i915_is_slpc_enabled(int drm_fd);
> > >>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
> > >>   int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
> > >>
> > >> --
> > >> 2.38.1
> > >>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT
@ 2023-04-24 17:07           ` Dixit, Ashutosh
  0 siblings, 0 replies; 27+ messages in thread
From: Dixit, Ashutosh @ 2023-04-24 17:07 UTC (permalink / raw)
  To: Belgaumkar, Vinay; +Cc: igt-dev, intel-gfx

On Mon, 24 Apr 2023 09:55:14 -0700, Dixit, Ashutosh wrote:
>
> On Sun, 23 Apr 2023 13:16:44 -0700, Belgaumkar, Vinay wrote:
> >
>
> Hi Vinay,
>
> > On 4/14/2023 1:25 PM, Dixit, Ashutosh wrote:
> > > On Fri, 14 Apr 2023 12:16:37 -0700, Vinay Belgaumkar wrote:
> > > Hi Vinay,
> > >
> > >> Use default of 0 where GT id is not being used.
> > >>
> > >> v2: Add a helper for GT 0 (Ashutosh)
> > >>
> > >> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
> > >> ---
> > >>   lib/igt_pm.c | 36 ++++++++++++++++++++++++++----------
> > >>   lib/igt_pm.h |  3 ++-
> > >>   2 files changed, 28 insertions(+), 11 deletions(-)
> > >>
> > >> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
> > >> index 704acf7d..8a30bb3b 100644
> > >> --- a/lib/igt_pm.c
> > >> +++ b/lib/igt_pm.c
> > >> @@ -1329,21 +1329,37 @@ void igt_pm_print_pci_card_runtime_status(void)
> > >>	}
> > >>   }
> > >>
> > >> -bool i915_is_slpc_enabled(int fd)
> > >> +/**
> > >> + * i915_is_slpc_enabled_gt:
> > >> + * @drm_fd: DRM file descriptor
> > >> + * @gt: GT id
> > >> + * Check if SLPC is enabled on a GT
> > >> + */
> > >> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt)
> > >>   {
> > >> -	int debugfs_fd = igt_debugfs_dir(fd);
> > >> -	char buf[4096] = {};
> > >> -	int len;
> > >> +	int debugfs_fd;
> > >> +	char buf[256] = {};
> > > Shouldn't this be 4096 as before?
> > >
> > >> -	igt_require(debugfs_fd != -1);
> > >> +	debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY);
> > >> +
> > >> +	/* if guc_slpc_info not present then return false */
> > >> +	if (debugfs_fd < 0)
> > >> +		return false;
> > > I think this should just be:
> > >
> > >	igt_require_fd(debugfs_fd);
> > >
> > > Basically we cannot determine if SLPC is enabled or not if say debugfs is
> > > not mounted, so it's not correct return false from here.
> >
> > Actually, rethinking on this, we should keep it to return false. This is
> > making tests skip on platforms where it shouldn't. Debugfs will not be
> > mounted only when driver load fails,
>
> Debugfs not being mounted has nothing to do with driver load, it is just
> that this command has not been run before running the tests (the system
> would typically be configured to run this after boot):
>
>	mount -t debugfs none /sys/kernel/debug/
>
> Ah, igt_debugfs_path() will mount debugfs if not mounted and assert if
> mount fails. So IGT itself is mounting debugfs if not mounted.
>
> > which would cause the test to fail
> > when we try to create the drm fd before this. Case in point -
> > https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8839/fi-tgl-1115g4/igt@i915_pm_rps@basic-api.html
> > - here, the test should have run (guc disabled platform) but it skipped.
>
> OK, sorry yes because it is checking for guc_slpc_info, which would
> indicate whether or not slpc is enabled.
>
> But the issue is still there, whether or not we solve it. Say SLPC is
> enabled but debugfs was not mounted. In the code above we will conclude
> that slpc is not enabled. Because mulitple conditions have been combined
> into one and there is no way to check for them separately (debugfs being
> mounted and guc_slpc_info being present).
>
> The original code above has this check:
>
>	igt_require(debugfs_fd != -1);
>
> Which is checking for whether or not debugfs is mounted. Where does this
> check move in this series?
>
> Anyway maybe for now just change the code to return false.

I think the correct way to do it would be remove igt_debugfs_gt_open from
Patch 1 and call the sequence in igt_debugfs_gt_open directly from
i915_is_slpc_enabled_gt, something like:

	dir = igt_debugfs_gt_dir(device, gt);
	igt_require(dir);

	debugfs_fd = openat(dir, "uc/guc_slpc_info", O_RDONLY);
	if (debugfs_fd < 0)
		return false;

>
> Thanks.
> --
> Ashutosh
>
> > >> +	read(debugfs_fd, buf, sizeof(buf)-1);
> > >>
> > >> -	len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf));
> > >>	close(debugfs_fd);
> > >>
> > >> -	if (len < 0)
> > >> -		return false;
> > >> -	else
> > >> -		return strstr(buf, "SLPC state: running");
> > >> +	return strstr(buf, "SLPC state: running");
> > >> +}
> > >> +
> > >> +/**
> > >> + * i915_is_slpc_enabled:
> > >> + * @drm_fd: DRM file descriptor
> > >> + * Check if SLPC is enabled on GT 0
> > > Hmm, not sure why we are not using the i915_for_each_gt() loop here since
> > > that is the correct way of doing it.
> > >
> > > At the min let's remove the GT 0 in the comment above. This function
> > > doesn't check for GT0, it checks if "slpc is enabled for the device". We
> > > can check only on GT0 if we are certain that checking on GT0 is sufficient,
> > > that is if SLPC is disabled on GT0 it's disabled for the device. But then
> > > someone can ask the question in that case why are we exposing slpc_enabled
> > > for each gt from the kernel rather than at the device level.
> > >
> > > In any case for now let's change the above comment to:
> > >
> > > "Check if SLPC is enabled" or ""Check if SLPC is enabled for the i915
> > > device".
> > >
> > > With the above comments addressed this is:
> > >
> > > Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> > >
> > > Also, why is igt@i915_pm_rps@basic-api still skipping on DG2/ATSM in
> > > pre-merge CI even after this series?
> > >
> > > Thanks.
> > > --
> > > Ashutosh
> > >
> > >
> > >> + */
> > >> +bool i915_is_slpc_enabled(int drm_fd)
> > >> +{
> > >> +	return i915_is_slpc_enabled_gt(drm_fd, 0);
> > >>   }
> > >>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
> > >> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
> > >> index d0d6d673..448cf42d 100644
> > >> --- a/lib/igt_pm.h
> > >> +++ b/lib/igt_pm.h
> > >> @@ -84,7 +84,8 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val);
> > >>   void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev);
> > >>   void igt_pm_restore_pci_card_runtime_pm(void);
> > >>   void igt_pm_print_pci_card_runtime_status(void);
> > >> -bool i915_is_slpc_enabled(int fd);
> > >> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt);
> > >> +bool i915_is_slpc_enabled(int drm_fd);
> > >>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
> > >>   int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
> > >>
> > >> --
> > >> 2.38.1
> > >>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT
  2023-04-24 17:07           ` Dixit, Ashutosh
@ 2023-04-24 17:13             ` Dixit, Ashutosh
  -1 siblings, 0 replies; 27+ messages in thread
From: Dixit, Ashutosh @ 2023-04-24 17:13 UTC (permalink / raw)
  To: Belgaumkar, Vinay; +Cc: igt-dev, intel-gfx

On Mon, 24 Apr 2023 10:07:26 -0700, Dixit, Ashutosh wrote:
>
> On Mon, 24 Apr 2023 09:55:14 -0700, Dixit, Ashutosh wrote:
> >
> > On Sun, 23 Apr 2023 13:16:44 -0700, Belgaumkar, Vinay wrote:
> > >
> >
> > Hi Vinay,
> >
> > > On 4/14/2023 1:25 PM, Dixit, Ashutosh wrote:
> > > > On Fri, 14 Apr 2023 12:16:37 -0700, Vinay Belgaumkar wrote:
> > > > Hi Vinay,
> > > >
> > > >> Use default of 0 where GT id is not being used.
> > > >>
> > > >> v2: Add a helper for GT 0 (Ashutosh)
> > > >>
> > > >> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
> > > >> ---
> > > >>   lib/igt_pm.c | 36 ++++++++++++++++++++++++++----------
> > > >>   lib/igt_pm.h |  3 ++-
> > > >>   2 files changed, 28 insertions(+), 11 deletions(-)
> > > >>
> > > >> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
> > > >> index 704acf7d..8a30bb3b 100644
> > > >> --- a/lib/igt_pm.c
> > > >> +++ b/lib/igt_pm.c
> > > >> @@ -1329,21 +1329,37 @@ void igt_pm_print_pci_card_runtime_status(void)
> > > >>	}
> > > >>   }
> > > >>
> > > >> -bool i915_is_slpc_enabled(int fd)
> > > >> +/**
> > > >> + * i915_is_slpc_enabled_gt:
> > > >> + * @drm_fd: DRM file descriptor
> > > >> + * @gt: GT id
> > > >> + * Check if SLPC is enabled on a GT
> > > >> + */
> > > >> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt)
> > > >>   {
> > > >> -	int debugfs_fd = igt_debugfs_dir(fd);
> > > >> -	char buf[4096] = {};
> > > >> -	int len;
> > > >> +	int debugfs_fd;
> > > >> +	char buf[256] = {};
> > > > Shouldn't this be 4096 as before?
> > > >
> > > >> -	igt_require(debugfs_fd != -1);
> > > >> +	debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY);
> > > >> +
> > > >> +	/* if guc_slpc_info not present then return false */
> > > >> +	if (debugfs_fd < 0)
> > > >> +		return false;
> > > > I think this should just be:
> > > >
> > > >	igt_require_fd(debugfs_fd);
> > > >
> > > > Basically we cannot determine if SLPC is enabled or not if say debugfs is
> > > > not mounted, so it's not correct return false from here.
> > >
> > > Actually, rethinking on this, we should keep it to return false. This is
> > > making tests skip on platforms where it shouldn't. Debugfs will not be
> > > mounted only when driver load fails,
> >
> > Debugfs not being mounted has nothing to do with driver load, it is just
> > that this command has not been run before running the tests (the system
> > would typically be configured to run this after boot):
> >
> >	mount -t debugfs none /sys/kernel/debug/
> >
> > Ah, igt_debugfs_path() will mount debugfs if not mounted and assert if
> > mount fails. So IGT itself is mounting debugfs if not mounted.
> >
> > > which would cause the test to fail
> > > when we try to create the drm fd before this. Case in point -
> > > https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8839/fi-tgl-1115g4/igt@i915_pm_rps@basic-api.html
> > > - here, the test should have run (guc disabled platform) but it skipped.
> >
> > OK, sorry yes because it is checking for guc_slpc_info, which would
> > indicate whether or not slpc is enabled.
> >
> > But the issue is still there, whether or not we solve it. Say SLPC is
> > enabled but debugfs was not mounted. In the code above we will conclude
> > that slpc is not enabled. Because mulitple conditions have been combined
> > into one and there is no way to check for them separately (debugfs being
> > mounted and guc_slpc_info being present).
> >
> > The original code above has this check:
> >
> >	igt_require(debugfs_fd != -1);
> >
> > Which is checking for whether or not debugfs is mounted. Where does this
> > check move in this series?
> >
> > Anyway maybe for now just change the code to return false.
>
> I think the correct way to do it would be remove igt_debugfs_gt_open from
> Patch 1

Or retain the function but don't use it.

> and call the sequence in igt_debugfs_gt_open directly from
> i915_is_slpc_enabled_gt, something like:
>
>	dir = igt_debugfs_gt_dir(device, gt);
>	igt_require(dir);
>
>	debugfs_fd = openat(dir, "uc/guc_slpc_info", O_RDONLY);
>	if (debugfs_fd < 0)
>		return false;
>
> >
> > Thanks.
> > --
> > Ashutosh
> >
> > > >> +	read(debugfs_fd, buf, sizeof(buf)-1);
> > > >>
> > > >> -	len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf));
> > > >>	close(debugfs_fd);
> > > >>
> > > >> -	if (len < 0)
> > > >> -		return false;
> > > >> -	else
> > > >> -		return strstr(buf, "SLPC state: running");
> > > >> +	return strstr(buf, "SLPC state: running");
> > > >> +}
> > > >> +
> > > >> +/**
> > > >> + * i915_is_slpc_enabled:
> > > >> + * @drm_fd: DRM file descriptor
> > > >> + * Check if SLPC is enabled on GT 0
> > > > Hmm, not sure why we are not using the i915_for_each_gt() loop here since
> > > > that is the correct way of doing it.
> > > >
> > > > At the min let's remove the GT 0 in the comment above. This function
> > > > doesn't check for GT0, it checks if "slpc is enabled for the device". We
> > > > can check only on GT0 if we are certain that checking on GT0 is sufficient,
> > > > that is if SLPC is disabled on GT0 it's disabled for the device. But then
> > > > someone can ask the question in that case why are we exposing slpc_enabled
> > > > for each gt from the kernel rather than at the device level.
> > > >
> > > > In any case for now let's change the above comment to:
> > > >
> > > > "Check if SLPC is enabled" or ""Check if SLPC is enabled for the i915
> > > > device".
> > > >
> > > > With the above comments addressed this is:
> > > >
> > > > Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> > > >
> > > > Also, why is igt@i915_pm_rps@basic-api still skipping on DG2/ATSM in
> > > > pre-merge CI even after this series?
> > > >
> > > > Thanks.
> > > > --
> > > > Ashutosh
> > > >
> > > >
> > > >> + */
> > > >> +bool i915_is_slpc_enabled(int drm_fd)
> > > >> +{
> > > >> +	return i915_is_slpc_enabled_gt(drm_fd, 0);
> > > >>   }
> > > >>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
> > > >> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
> > > >> index d0d6d673..448cf42d 100644
> > > >> --- a/lib/igt_pm.h
> > > >> +++ b/lib/igt_pm.h
> > > >> @@ -84,7 +84,8 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val);
> > > >>   void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev);
> > > >>   void igt_pm_restore_pci_card_runtime_pm(void);
> > > >>   void igt_pm_print_pci_card_runtime_status(void);
> > > >> -bool i915_is_slpc_enabled(int fd);
> > > >> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt);
> > > >> +bool i915_is_slpc_enabled(int drm_fd);
> > > >>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
> > > >>   int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
> > > >>
> > > >> --
> > > >> 2.38.1
> > > >>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT
@ 2023-04-24 17:13             ` Dixit, Ashutosh
  0 siblings, 0 replies; 27+ messages in thread
From: Dixit, Ashutosh @ 2023-04-24 17:13 UTC (permalink / raw)
  To: Belgaumkar, Vinay; +Cc: igt-dev, intel-gfx

On Mon, 24 Apr 2023 10:07:26 -0700, Dixit, Ashutosh wrote:
>
> On Mon, 24 Apr 2023 09:55:14 -0700, Dixit, Ashutosh wrote:
> >
> > On Sun, 23 Apr 2023 13:16:44 -0700, Belgaumkar, Vinay wrote:
> > >
> >
> > Hi Vinay,
> >
> > > On 4/14/2023 1:25 PM, Dixit, Ashutosh wrote:
> > > > On Fri, 14 Apr 2023 12:16:37 -0700, Vinay Belgaumkar wrote:
> > > > Hi Vinay,
> > > >
> > > >> Use default of 0 where GT id is not being used.
> > > >>
> > > >> v2: Add a helper for GT 0 (Ashutosh)
> > > >>
> > > >> Signed-off-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
> > > >> ---
> > > >>   lib/igt_pm.c | 36 ++++++++++++++++++++++++++----------
> > > >>   lib/igt_pm.h |  3 ++-
> > > >>   2 files changed, 28 insertions(+), 11 deletions(-)
> > > >>
> > > >> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
> > > >> index 704acf7d..8a30bb3b 100644
> > > >> --- a/lib/igt_pm.c
> > > >> +++ b/lib/igt_pm.c
> > > >> @@ -1329,21 +1329,37 @@ void igt_pm_print_pci_card_runtime_status(void)
> > > >>	}
> > > >>   }
> > > >>
> > > >> -bool i915_is_slpc_enabled(int fd)
> > > >> +/**
> > > >> + * i915_is_slpc_enabled_gt:
> > > >> + * @drm_fd: DRM file descriptor
> > > >> + * @gt: GT id
> > > >> + * Check if SLPC is enabled on a GT
> > > >> + */
> > > >> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt)
> > > >>   {
> > > >> -	int debugfs_fd = igt_debugfs_dir(fd);
> > > >> -	char buf[4096] = {};
> > > >> -	int len;
> > > >> +	int debugfs_fd;
> > > >> +	char buf[256] = {};
> > > > Shouldn't this be 4096 as before?
> > > >
> > > >> -	igt_require(debugfs_fd != -1);
> > > >> +	debugfs_fd = igt_debugfs_gt_open(drm_fd, gt, "uc/guc_slpc_info", O_RDONLY);
> > > >> +
> > > >> +	/* if guc_slpc_info not present then return false */
> > > >> +	if (debugfs_fd < 0)
> > > >> +		return false;
> > > > I think this should just be:
> > > >
> > > >	igt_require_fd(debugfs_fd);
> > > >
> > > > Basically we cannot determine if SLPC is enabled or not if say debugfs is
> > > > not mounted, so it's not correct return false from here.
> > >
> > > Actually, rethinking on this, we should keep it to return false. This is
> > > making tests skip on platforms where it shouldn't. Debugfs will not be
> > > mounted only when driver load fails,
> >
> > Debugfs not being mounted has nothing to do with driver load, it is just
> > that this command has not been run before running the tests (the system
> > would typically be configured to run this after boot):
> >
> >	mount -t debugfs none /sys/kernel/debug/
> >
> > Ah, igt_debugfs_path() will mount debugfs if not mounted and assert if
> > mount fails. So IGT itself is mounting debugfs if not mounted.
> >
> > > which would cause the test to fail
> > > when we try to create the drm fd before this. Case in point -
> > > https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8839/fi-tgl-1115g4/igt@i915_pm_rps@basic-api.html
> > > - here, the test should have run (guc disabled platform) but it skipped.
> >
> > OK, sorry yes because it is checking for guc_slpc_info, which would
> > indicate whether or not slpc is enabled.
> >
> > But the issue is still there, whether or not we solve it. Say SLPC is
> > enabled but debugfs was not mounted. In the code above we will conclude
> > that slpc is not enabled. Because mulitple conditions have been combined
> > into one and there is no way to check for them separately (debugfs being
> > mounted and guc_slpc_info being present).
> >
> > The original code above has this check:
> >
> >	igt_require(debugfs_fd != -1);
> >
> > Which is checking for whether or not debugfs is mounted. Where does this
> > check move in this series?
> >
> > Anyway maybe for now just change the code to return false.
>
> I think the correct way to do it would be remove igt_debugfs_gt_open from
> Patch 1

Or retain the function but don't use it.

> and call the sequence in igt_debugfs_gt_open directly from
> i915_is_slpc_enabled_gt, something like:
>
>	dir = igt_debugfs_gt_dir(device, gt);
>	igt_require(dir);
>
>	debugfs_fd = openat(dir, "uc/guc_slpc_info", O_RDONLY);
>	if (debugfs_fd < 0)
>		return false;
>
> >
> > Thanks.
> > --
> > Ashutosh
> >
> > > >> +	read(debugfs_fd, buf, sizeof(buf)-1);
> > > >>
> > > >> -	len = igt_debugfs_simple_read(debugfs_fd, "gt/uc/guc_slpc_info", buf, sizeof(buf));
> > > >>	close(debugfs_fd);
> > > >>
> > > >> -	if (len < 0)
> > > >> -		return false;
> > > >> -	else
> > > >> -		return strstr(buf, "SLPC state: running");
> > > >> +	return strstr(buf, "SLPC state: running");
> > > >> +}
> > > >> +
> > > >> +/**
> > > >> + * i915_is_slpc_enabled:
> > > >> + * @drm_fd: DRM file descriptor
> > > >> + * Check if SLPC is enabled on GT 0
> > > > Hmm, not sure why we are not using the i915_for_each_gt() loop here since
> > > > that is the correct way of doing it.
> > > >
> > > > At the min let's remove the GT 0 in the comment above. This function
> > > > doesn't check for GT0, it checks if "slpc is enabled for the device". We
> > > > can check only on GT0 if we are certain that checking on GT0 is sufficient,
> > > > that is if SLPC is disabled on GT0 it's disabled for the device. But then
> > > > someone can ask the question in that case why are we exposing slpc_enabled
> > > > for each gt from the kernel rather than at the device level.
> > > >
> > > > In any case for now let's change the above comment to:
> > > >
> > > > "Check if SLPC is enabled" or ""Check if SLPC is enabled for the i915
> > > > device".
> > > >
> > > > With the above comments addressed this is:
> > > >
> > > > Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> > > >
> > > > Also, why is igt@i915_pm_rps@basic-api still skipping on DG2/ATSM in
> > > > pre-merge CI even after this series?
> > > >
> > > > Thanks.
> > > > --
> > > > Ashutosh
> > > >
> > > >
> > > >> + */
> > > >> +bool i915_is_slpc_enabled(int drm_fd)
> > > >> +{
> > > >> +	return i915_is_slpc_enabled_gt(drm_fd, 0);
> > > >>   }
> > > >>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev)
> > > >> diff --git a/lib/igt_pm.h b/lib/igt_pm.h
> > > >> index d0d6d673..448cf42d 100644
> > > >> --- a/lib/igt_pm.h
> > > >> +++ b/lib/igt_pm.h
> > > >> @@ -84,7 +84,8 @@ void igt_pm_set_d3cold_allowed(struct igt_device_card *card, const char *val);
> > > >>   void igt_pm_setup_pci_card_runtime_pm(struct pci_device *pci_dev);
> > > >>   void igt_pm_restore_pci_card_runtime_pm(void);
> > > >>   void igt_pm_print_pci_card_runtime_status(void);
> > > >> -bool i915_is_slpc_enabled(int fd);
> > > >> +bool i915_is_slpc_enabled_gt(int drm_fd, int gt);
> > > >> +bool i915_is_slpc_enabled(int drm_fd);
> > > >>   int igt_pm_get_runtime_suspended_time(struct pci_device *pci_dev);
> > > >>   int igt_pm_get_runtime_usage(struct pci_device *pci_dev);
> > > >>
> > > >> --
> > > >> 2.38.1
> > > >>

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [Intel-gfx] [PATCH i-g-t 1/4] lib/debugfs: Add per GT debugfs helpers
  2023-04-25 16:24 [Intel-gfx] [PATCH v7 i-g-t 0/4] tests/slpc: Add basic IGT test Vinay Belgaumkar
@ 2023-04-25 16:24 ` Vinay Belgaumkar
  0 siblings, 0 replies; 27+ messages in thread
From: Vinay Belgaumkar @ 2023-04-25 16:24 UTC (permalink / raw)
  To: intel-gfx, igt-dev

These can be used to open per-gt debugfs files.

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Vinay Belgaumkar <viay.belgaumkar@intel.com>
---
 lib/igt_debugfs.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_debugfs.h |  4 ++++
 2 files changed, 64 insertions(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 05889bbe..afde2da6 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -217,6 +217,37 @@ int igt_debugfs_dir(int device)
 	return open(path, O_RDONLY);
 }
 
+/**
+ * igt_debugfs_gt_dir:
+ * @device: fd of the device
+ * @gt: GT instance number
+ *
+ * This opens the debugfs directory corresponding to device for use
+ * with igt_sysfs_get() and related functions.
+ *
+ * Returns:
+ * The directory fd, or -1 on failure.
+ */
+int igt_debugfs_gt_dir(int device, unsigned int gt)
+{
+	int debugfs_gt_dir_fd;
+	char path[PATH_MAX];
+	char gtpath[16];
+	int ret;
+
+	if (!igt_debugfs_path(device, path, sizeof(path)))
+		return -1;
+
+	ret = snprintf(gtpath, sizeof(gtpath), "/gt%u", gt);
+	igt_assert(ret < sizeof(gtpath));
+	strncat(path, gtpath, sizeof(path) - 1);
+
+	debugfs_gt_dir_fd = open(path, O_RDONLY);
+	igt_debug_on_f(debugfs_gt_dir_fd < 0, "path: %s\n", path);
+
+	return debugfs_gt_dir_fd;
+}
+
 /**
  * igt_debugfs_connector_dir:
  * @device: fd of the device
@@ -313,6 +344,35 @@ bool igt_debugfs_exists(int device, const char *filename, int mode)
 	return false;
 }
 
+/**
+ * igt_debugfs_gt_open:
+ * @device: open i915 drm fd
+ * @gt: gt instance number
+ * @filename: name of the debugfs node to open
+ * @mode: mode bits as used by open()
+ *
+ * This opens a debugfs file as a Unix file descriptor. The filename should be
+ * relative to the drm device's root, i.e. without "drm/$minor".
+ *
+ * Returns:
+ * The Unix file descriptor for the debugfs file or -1 if that didn't work out.
+ */
+int
+igt_debugfs_gt_open(int device, unsigned int gt, const char *filename, int mode)
+{
+	int dir, ret;
+
+	dir = igt_debugfs_gt_dir(device, gt);
+	if (dir < 0)
+		return dir;
+
+	ret = openat(dir, filename, mode);
+
+	close(dir);
+
+	return ret;
+}
+
 /**
  * igt_debugfs_simple_read:
  * @dir: fd of the debugfs directory
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index 4824344a..3e6194ad 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -45,6 +45,10 @@ void __igt_debugfs_write(int fd, const char *filename, const char *buf, int size
 int igt_debugfs_simple_read(int dir, const char *filename, char *buf, int size);
 bool igt_debugfs_search(int fd, const char *filename, const char *substring);
 
+int igt_debugfs_gt_dir(int device, unsigned int gt);
+int igt_debugfs_gt_open(int device, unsigned int gt, const char *filename,
+			int mode);
+
 /**
  * igt_debugfs_read:
  * @filename: name of the debugfs file
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Intel-gfx] [PATCH i-g-t 1/4] lib/debugfs: Add per GT debugfs helpers
  2023-04-22  1:00 [Intel-gfx] [PATCH v7 i-g-t 0/4] tests/slpc: Add basic IGT test Vinay Belgaumkar
@ 2023-04-22  1:01 ` Vinay Belgaumkar
  0 siblings, 0 replies; 27+ messages in thread
From: Vinay Belgaumkar @ 2023-04-22  1:01 UTC (permalink / raw)
  To: intel-gfx, igt-dev

These can be used to open per-gt debugfs files.

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Vinay Belgaumkar <viay.belgaumkar@intel.com>
---
 lib/igt_debugfs.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_debugfs.h |  4 ++++
 2 files changed, 64 insertions(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 05889bbe..afde2da6 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -217,6 +217,37 @@ int igt_debugfs_dir(int device)
 	return open(path, O_RDONLY);
 }
 
+/**
+ * igt_debugfs_gt_dir:
+ * @device: fd of the device
+ * @gt: GT instance number
+ *
+ * This opens the debugfs directory corresponding to device for use
+ * with igt_sysfs_get() and related functions.
+ *
+ * Returns:
+ * The directory fd, or -1 on failure.
+ */
+int igt_debugfs_gt_dir(int device, unsigned int gt)
+{
+	int debugfs_gt_dir_fd;
+	char path[PATH_MAX];
+	char gtpath[16];
+	int ret;
+
+	if (!igt_debugfs_path(device, path, sizeof(path)))
+		return -1;
+
+	ret = snprintf(gtpath, sizeof(gtpath), "/gt%u", gt);
+	igt_assert(ret < sizeof(gtpath));
+	strncat(path, gtpath, sizeof(path) - 1);
+
+	debugfs_gt_dir_fd = open(path, O_RDONLY);
+	igt_debug_on_f(debugfs_gt_dir_fd < 0, "path: %s\n", path);
+
+	return debugfs_gt_dir_fd;
+}
+
 /**
  * igt_debugfs_connector_dir:
  * @device: fd of the device
@@ -313,6 +344,35 @@ bool igt_debugfs_exists(int device, const char *filename, int mode)
 	return false;
 }
 
+/**
+ * igt_debugfs_gt_open:
+ * @device: open i915 drm fd
+ * @gt: gt instance number
+ * @filename: name of the debugfs node to open
+ * @mode: mode bits as used by open()
+ *
+ * This opens a debugfs file as a Unix file descriptor. The filename should be
+ * relative to the drm device's root, i.e. without "drm/$minor".
+ *
+ * Returns:
+ * The Unix file descriptor for the debugfs file or -1 if that didn't work out.
+ */
+int
+igt_debugfs_gt_open(int device, unsigned int gt, const char *filename, int mode)
+{
+	int dir, ret;
+
+	dir = igt_debugfs_gt_dir(device, gt);
+	if (dir < 0)
+		return dir;
+
+	ret = openat(dir, filename, mode);
+
+	close(dir);
+
+	return ret;
+}
+
 /**
  * igt_debugfs_simple_read:
  * @dir: fd of the debugfs directory
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index 4824344a..3e6194ad 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -45,6 +45,10 @@ void __igt_debugfs_write(int fd, const char *filename, const char *buf, int size
 int igt_debugfs_simple_read(int dir, const char *filename, char *buf, int size);
 bool igt_debugfs_search(int fd, const char *filename, const char *substring);
 
+int igt_debugfs_gt_dir(int device, unsigned int gt);
+int igt_debugfs_gt_open(int device, unsigned int gt, const char *filename,
+			int mode);
+
 /**
  * igt_debugfs_read:
  * @filename: name of the debugfs file
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [Intel-gfx] [PATCH i-g-t 1/4] lib/debugfs: Add per GT debugfs helpers
  2023-04-13 22:44 [Intel-gfx] [PATCH v5 i-g-t 0/4] tests/slpc: Add basic IGT test Vinay Belgaumkar
@ 2023-04-13 22:44 ` Vinay Belgaumkar
  0 siblings, 0 replies; 27+ messages in thread
From: Vinay Belgaumkar @ 2023-04-13 22:44 UTC (permalink / raw)
  To: intel-gfx, igt-dev

These can be used to open per-gt debugfs files.

Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Vinay Belgaumkar <viay.belgaumkar@intel.com>
---
 lib/igt_debugfs.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_debugfs.h |  4 ++++
 2 files changed, 64 insertions(+)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index 05889bbe..afde2da6 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -217,6 +217,37 @@ int igt_debugfs_dir(int device)
 	return open(path, O_RDONLY);
 }
 
+/**
+ * igt_debugfs_gt_dir:
+ * @device: fd of the device
+ * @gt: GT instance number
+ *
+ * This opens the debugfs directory corresponding to device for use
+ * with igt_sysfs_get() and related functions.
+ *
+ * Returns:
+ * The directory fd, or -1 on failure.
+ */
+int igt_debugfs_gt_dir(int device, unsigned int gt)
+{
+	int debugfs_gt_dir_fd;
+	char path[PATH_MAX];
+	char gtpath[16];
+	int ret;
+
+	if (!igt_debugfs_path(device, path, sizeof(path)))
+		return -1;
+
+	ret = snprintf(gtpath, sizeof(gtpath), "/gt%u", gt);
+	igt_assert(ret < sizeof(gtpath));
+	strncat(path, gtpath, sizeof(path) - 1);
+
+	debugfs_gt_dir_fd = open(path, O_RDONLY);
+	igt_debug_on_f(debugfs_gt_dir_fd < 0, "path: %s\n", path);
+
+	return debugfs_gt_dir_fd;
+}
+
 /**
  * igt_debugfs_connector_dir:
  * @device: fd of the device
@@ -313,6 +344,35 @@ bool igt_debugfs_exists(int device, const char *filename, int mode)
 	return false;
 }
 
+/**
+ * igt_debugfs_gt_open:
+ * @device: open i915 drm fd
+ * @gt: gt instance number
+ * @filename: name of the debugfs node to open
+ * @mode: mode bits as used by open()
+ *
+ * This opens a debugfs file as a Unix file descriptor. The filename should be
+ * relative to the drm device's root, i.e. without "drm/$minor".
+ *
+ * Returns:
+ * The Unix file descriptor for the debugfs file or -1 if that didn't work out.
+ */
+int
+igt_debugfs_gt_open(int device, unsigned int gt, const char *filename, int mode)
+{
+	int dir, ret;
+
+	dir = igt_debugfs_gt_dir(device, gt);
+	if (dir < 0)
+		return dir;
+
+	ret = openat(dir, filename, mode);
+
+	close(dir);
+
+	return ret;
+}
+
 /**
  * igt_debugfs_simple_read:
  * @dir: fd of the debugfs directory
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index 4824344a..3e6194ad 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -45,6 +45,10 @@ void __igt_debugfs_write(int fd, const char *filename, const char *buf, int size
 int igt_debugfs_simple_read(int dir, const char *filename, char *buf, int size);
 bool igt_debugfs_search(int fd, const char *filename, const char *substring);
 
+int igt_debugfs_gt_dir(int device, unsigned int gt);
+int igt_debugfs_gt_open(int device, unsigned int gt, const char *filename,
+			int mode);
+
 /**
  * igt_debugfs_read:
  * @filename: name of the debugfs file
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2023-04-25 16:30 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14 19:16 [Intel-gfx] [PATCH v6 i-g-t 0/4] tests/slpc: Add basic IGT test Vinay Belgaumkar
2023-04-14 19:16 ` [igt-dev] " Vinay Belgaumkar
2023-04-14 19:16 ` [Intel-gfx] [PATCH i-g-t 1/4] lib/debugfs: Add per GT debugfs helpers Vinay Belgaumkar
2023-04-14 19:16   ` [igt-dev] " Vinay Belgaumkar
2023-04-14 19:16 ` [Intel-gfx] [PATCH i-g-t 2/4] lib: Make SLPC helper function per GT Vinay Belgaumkar
2023-04-14 19:16   ` [igt-dev] " Vinay Belgaumkar
2023-04-14 20:25   ` [Intel-gfx] " Dixit, Ashutosh
2023-04-14 20:25     ` Dixit, Ashutosh
2023-04-18  0:26     ` [Intel-gfx] " Belgaumkar, Vinay
2023-04-18  0:26       ` Belgaumkar, Vinay
2023-04-23 20:16     ` [Intel-gfx] " Belgaumkar, Vinay
2023-04-23 20:16       ` Belgaumkar, Vinay
2023-04-24 16:55       ` [Intel-gfx] " Dixit, Ashutosh
2023-04-24 16:55         ` Dixit, Ashutosh
2023-04-24 17:07         ` [Intel-gfx] " Dixit, Ashutosh
2023-04-24 17:07           ` Dixit, Ashutosh
2023-04-24 17:13           ` [Intel-gfx] " Dixit, Ashutosh
2023-04-24 17:13             ` Dixit, Ashutosh
2023-04-14 19:16 ` [Intel-gfx] [PATCH i-g-t 3/4] i915_pm_freq_api: Add some basic SLPC igt tests Vinay Belgaumkar
2023-04-14 19:16   ` [igt-dev] " Vinay Belgaumkar
2023-04-14 19:16 ` [Intel-gfx] [PATCH i-g-t 4/4] HAX: tests/i915: Try out the SLPC IGT tests Vinay Belgaumkar
2023-04-14 19:16   ` [igt-dev] " Vinay Belgaumkar
2023-04-14 20:29 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/slpc: Add basic IGT test (rev6) Patchwork
2023-04-15  4:01 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  -- strict thread matches above, loose matches on Subject: below --
2023-04-25 16:24 [Intel-gfx] [PATCH v7 i-g-t 0/4] tests/slpc: Add basic IGT test Vinay Belgaumkar
2023-04-25 16:24 ` [Intel-gfx] [PATCH i-g-t 1/4] lib/debugfs: Add per GT debugfs helpers Vinay Belgaumkar
2023-04-22  1:00 [Intel-gfx] [PATCH v7 i-g-t 0/4] tests/slpc: Add basic IGT test Vinay Belgaumkar
2023-04-22  1:01 ` [Intel-gfx] [PATCH i-g-t 1/4] lib/debugfs: Add per GT debugfs helpers Vinay Belgaumkar
2023-04-13 22:44 [Intel-gfx] [PATCH v5 i-g-t 0/4] tests/slpc: Add basic IGT test Vinay Belgaumkar
2023-04-13 22:44 ` [Intel-gfx] [PATCH i-g-t 1/4] lib/debugfs: Add per GT debugfs helpers Vinay Belgaumkar

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.