All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH i-g-t] lib: Cleanup __igt_params_open()
@ 2020-05-18 20:50 ` Chris Wilson
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2020-05-18 20:50 UTC (permalink / raw)
  To: igt-dev; +Cc: Jani Nikula, intel-gfx, Chris Wilson

The device always exist, so use it to derive the module name required to
lookup either the debugfs params directory or the sysfs module parameters.

Fixes: 2f5cee33ce55 ("igt/params: use igt_params_set_save for igt_set_module_param*")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 lib/igt_params.c | 116 +++++++----------------------------------------
 1 file changed, 17 insertions(+), 99 deletions(-)

diff --git a/lib/igt_params.c b/lib/igt_params.c
index d8649dfd9..9d9a11c0b 100644
--- a/lib/igt_params.c
+++ b/lib/igt_params.c
@@ -131,117 +131,35 @@ static void igt_params_save(int dir, const char *path, const char *name)
  */
 static int __igt_params_open(int device, char **outpath, const char *param)
 {
+	drm_version_t version;
 	int dir, params = -1;
-	struct stat buffer;
-	char searchname[64];
-	char searchpath[PATH_MAX];
-	char *foundname, *ctx;
+	char path[PATH_MAX];
+	char name[32];
+
+	memset(&version, 0, sizeof(version));
+	version.name_len = sizeof(name);
+	version.name = name;
+	if (ioctl(device, DRM_IOCTL_VERSION, &version))
+		return -1;
 
 	dir = igt_debugfs_dir(device);
 	if (dir >= 0) {
-		int devname;
-
-		devname = openat(dir, "name", O_RDONLY);
-		igt_require_f(devname >= 0,
-		              "Driver need to name itself in debugfs!");
-
-		read(devname, searchname, sizeof(searchname));
-		close(devname);
-
-		foundname = strtok_r(searchname, " ", &ctx);
-		igt_require_f(foundname,
-		              "Driver need to name itself in debugfs!");
-
-		snprintf(searchpath, PATH_MAX, "%s_params", foundname);
-		params = openat(dir, searchpath, O_RDONLY);
-
-		if (params >= 0) {
-			char *debugfspath = malloc(PATH_MAX);
-
-			igt_debugfs_path(device, debugfspath, PATH_MAX);
-			if (param != NULL) {
-				char filepath[PATH_MAX];
-
-				snprintf(filepath, PATH_MAX, "%s/%s",
-					 debugfspath, param);
-
-				if (stat(filepath, &buffer) == 0) {
-					if (outpath != NULL)
-						*outpath = debugfspath;
-					else
-						free(debugfspath);
-				} else {
-					free(debugfspath);
-					close(params);
-					params = -1;
-				}
-			} else if (outpath != NULL) {
-				/*
-				 * Caller is responsible to free this.
-				 */
-				*outpath = debugfspath;
-			} else {
-				free(debugfspath);
-			}
-		}
+		snprintf(path, PATH_MAX, "%s_params", name);
+		params = openat(dir, path, O_RDONLY);
 		close(dir);
 	}
 
 	if (params < 0) { /* builtin? */
-		drm_version_t version;
-		char name[32] = "";
-		char path[PATH_MAX];
-
-		if (device == -1) {
-			/*
-			 * find default device
-			 */
-			int file, i;
-			const char *debugfs_root = igt_debugfs_mount();
-
-			igt_assert(debugfs_root);
-
-			for (i = 0; i < 63; i++) {
-				char testpath[PATH_MAX];
-
-				snprintf(searchpath, PATH_MAX,
-					 "%s/dri/%d/name", debugfs_root, i);
-
-				file = open(searchpath, O_RDONLY);
-
-				if (file < 0)
-					continue;
-
-				read(file, searchname, sizeof(searchname));
-				close(file);
-
-				foundname = strtok_r(searchname, " ", &ctx);
-				if (!foundname)
-					continue;
-
-				snprintf(testpath, PATH_MAX,
-					 "/sys/module/%s/parameters",
-					 foundname);
-
-				if (stat(testpath, &buffer) == 0 &&
-				    S_ISDIR(buffer.st_mode)) {
-					snprintf(name, sizeof(name), "%s",
-						 foundname);
-					break;
-				}
-			}
-		} else {
-			memset(&version, 0, sizeof(version));
-			version.name_len = sizeof(name);
-			version.name = name;
-			ioctl(device, DRM_IOCTL_VERSION, &version);
-		}
 		snprintf(path, sizeof(path), "/sys/module/%s/parameters", name);
 		params = open(path, O_RDONLY);
-		if (params >= 0 && outpath)
-			*outpath = strdup(path);
 	}
 
+	/*
+	 * Caller is responsible to free this.
+	 */
+	if (params >= 0 && outpath)
+		*outpath = strdup(path);
+
 	return params;
 }
 
-- 
2.26.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [igt-dev] [PATCH i-g-t] lib: Cleanup __igt_params_open()
@ 2020-05-18 20:50 ` Chris Wilson
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2020-05-18 20:50 UTC (permalink / raw)
  To: igt-dev; +Cc: Jani Nikula, intel-gfx, Chris Wilson

The device always exist, so use it to derive the module name required to
lookup either the debugfs params directory or the sysfs module parameters.

Fixes: 2f5cee33ce55 ("igt/params: use igt_params_set_save for igt_set_module_param*")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 lib/igt_params.c | 116 +++++++----------------------------------------
 1 file changed, 17 insertions(+), 99 deletions(-)

diff --git a/lib/igt_params.c b/lib/igt_params.c
index d8649dfd9..9d9a11c0b 100644
--- a/lib/igt_params.c
+++ b/lib/igt_params.c
@@ -131,117 +131,35 @@ static void igt_params_save(int dir, const char *path, const char *name)
  */
 static int __igt_params_open(int device, char **outpath, const char *param)
 {
+	drm_version_t version;
 	int dir, params = -1;
-	struct stat buffer;
-	char searchname[64];
-	char searchpath[PATH_MAX];
-	char *foundname, *ctx;
+	char path[PATH_MAX];
+	char name[32];
+
+	memset(&version, 0, sizeof(version));
+	version.name_len = sizeof(name);
+	version.name = name;
+	if (ioctl(device, DRM_IOCTL_VERSION, &version))
+		return -1;
 
 	dir = igt_debugfs_dir(device);
 	if (dir >= 0) {
-		int devname;
-
-		devname = openat(dir, "name", O_RDONLY);
-		igt_require_f(devname >= 0,
-		              "Driver need to name itself in debugfs!");
-
-		read(devname, searchname, sizeof(searchname));
-		close(devname);
-
-		foundname = strtok_r(searchname, " ", &ctx);
-		igt_require_f(foundname,
-		              "Driver need to name itself in debugfs!");
-
-		snprintf(searchpath, PATH_MAX, "%s_params", foundname);
-		params = openat(dir, searchpath, O_RDONLY);
-
-		if (params >= 0) {
-			char *debugfspath = malloc(PATH_MAX);
-
-			igt_debugfs_path(device, debugfspath, PATH_MAX);
-			if (param != NULL) {
-				char filepath[PATH_MAX];
-
-				snprintf(filepath, PATH_MAX, "%s/%s",
-					 debugfspath, param);
-
-				if (stat(filepath, &buffer) == 0) {
-					if (outpath != NULL)
-						*outpath = debugfspath;
-					else
-						free(debugfspath);
-				} else {
-					free(debugfspath);
-					close(params);
-					params = -1;
-				}
-			} else if (outpath != NULL) {
-				/*
-				 * Caller is responsible to free this.
-				 */
-				*outpath = debugfspath;
-			} else {
-				free(debugfspath);
-			}
-		}
+		snprintf(path, PATH_MAX, "%s_params", name);
+		params = openat(dir, path, O_RDONLY);
 		close(dir);
 	}
 
 	if (params < 0) { /* builtin? */
-		drm_version_t version;
-		char name[32] = "";
-		char path[PATH_MAX];
-
-		if (device == -1) {
-			/*
-			 * find default device
-			 */
-			int file, i;
-			const char *debugfs_root = igt_debugfs_mount();
-
-			igt_assert(debugfs_root);
-
-			for (i = 0; i < 63; i++) {
-				char testpath[PATH_MAX];
-
-				snprintf(searchpath, PATH_MAX,
-					 "%s/dri/%d/name", debugfs_root, i);
-
-				file = open(searchpath, O_RDONLY);
-
-				if (file < 0)
-					continue;
-
-				read(file, searchname, sizeof(searchname));
-				close(file);
-
-				foundname = strtok_r(searchname, " ", &ctx);
-				if (!foundname)
-					continue;
-
-				snprintf(testpath, PATH_MAX,
-					 "/sys/module/%s/parameters",
-					 foundname);
-
-				if (stat(testpath, &buffer) == 0 &&
-				    S_ISDIR(buffer.st_mode)) {
-					snprintf(name, sizeof(name), "%s",
-						 foundname);
-					break;
-				}
-			}
-		} else {
-			memset(&version, 0, sizeof(version));
-			version.name_len = sizeof(name);
-			version.name = name;
-			ioctl(device, DRM_IOCTL_VERSION, &version);
-		}
 		snprintf(path, sizeof(path), "/sys/module/%s/parameters", name);
 		params = open(path, O_RDONLY);
-		if (params >= 0 && outpath)
-			*outpath = strdup(path);
 	}
 
+	/*
+	 * Caller is responsible to free this.
+	 */
+	if (params >= 0 && outpath)
+		*outpath = strdup(path);
+
 	return params;
 }
 
-- 
2.26.2

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

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

* [igt-dev] ✗ Fi.CI.BAT: failure for lib: Cleanup __igt_params_open()
  2020-05-18 20:50 ` [igt-dev] " Chris Wilson
  (?)
@ 2020-05-18 21:34 ` Patchwork
  -1 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2020-05-18 21:34 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: lib: Cleanup __igt_params_open()
URL   : https://patchwork.freedesktop.org/series/77374/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_8498 -> IGTPW_4576
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_4576 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_4576, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

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

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

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

### IGT changes ###

#### Possible regressions ####

  * igt@gem_close_race@basic-process:
    - fi-ivb-3770:        [PASS][1] -> [FAIL][2] +6 similar issues
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-ivb-3770/igt@gem_close_race@basic-process.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-ivb-3770/igt@gem_close_race@basic-process.html
    - fi-ilk-650:         [PASS][3] -> [FAIL][4] +6 similar issues
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-ilk-650/igt@gem_close_race@basic-process.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-ilk-650/igt@gem_close_race@basic-process.html
    - fi-elk-e7500:       [PASS][5] -> [FAIL][6] +5 similar issues
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-elk-e7500/igt@gem_close_race@basic-process.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-elk-e7500/igt@gem_close_race@basic-process.html
    - fi-skl-6700k2:      [PASS][7] -> [FAIL][8] +3 similar issues
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-skl-6700k2/igt@gem_close_race@basic-process.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-skl-6700k2/igt@gem_close_race@basic-process.html

  * igt@gem_close_race@basic-threads:
    - fi-skl-6600u:       [PASS][9] -> [FAIL][10] +5 similar issues
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-skl-6600u/igt@gem_close_race@basic-threads.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-skl-6600u/igt@gem_close_race@basic-threads.html
    - fi-whl-u:           [PASS][11] -> [FAIL][12] +5 similar issues
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-whl-u/igt@gem_close_race@basic-threads.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-whl-u/igt@gem_close_race@basic-threads.html
    - fi-skl-guc:         [PASS][13] -> [FAIL][14] +5 similar issues
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-skl-guc/igt@gem_close_race@basic-threads.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-skl-guc/igt@gem_close_race@basic-threads.html
    - fi-bwr-2160:        [PASS][15] -> [FAIL][16] +4 similar issues
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-bwr-2160/igt@gem_close_race@basic-threads.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-bwr-2160/igt@gem_close_race@basic-threads.html
    - fi-icl-y:           [PASS][17] -> [FAIL][18] +5 similar issues
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-icl-y/igt@gem_close_race@basic-threads.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-icl-y/igt@gem_close_race@basic-threads.html
    - fi-pnv-d510:        [PASS][19] -> [FAIL][20] +6 similar issues
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-pnv-d510/igt@gem_close_race@basic-threads.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-pnv-d510/igt@gem_close_race@basic-threads.html
    - fi-kbl-7500u:       [PASS][21] -> [FAIL][22] +3 similar issues
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-kbl-7500u/igt@gem_close_race@basic-threads.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-kbl-7500u/igt@gem_close_race@basic-threads.html

  * igt@gem_exec_create@basic:
    - fi-bsw-kefka:       [PASS][23] -> [FAIL][24] +5 similar issues
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-bsw-kefka/igt@gem_exec_create@basic.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-bsw-kefka/igt@gem_exec_create@basic.html
    - fi-kbl-x1275:       [PASS][25] -> [FAIL][26] +4 similar issues
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-kbl-x1275/igt@gem_exec_create@basic.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-kbl-x1275/igt@gem_exec_create@basic.html
    - fi-snb-2600:        [PASS][27] -> [FAIL][28] +6 similar issues
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-snb-2600/igt@gem_exec_create@basic.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-snb-2600/igt@gem_exec_create@basic.html
    - fi-gdg-551:         [PASS][29] -> [FAIL][30] +4 similar issues
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-gdg-551/igt@gem_exec_create@basic.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-gdg-551/igt@gem_exec_create@basic.html
    - fi-tgl-y:           [PASS][31] -> [FAIL][32] +4 similar issues
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-tgl-y/igt@gem_exec_create@basic.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-tgl-y/igt@gem_exec_create@basic.html
    - fi-glk-dsi:         [PASS][33] -> [FAIL][34] +3 similar issues
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-glk-dsi/igt@gem_exec_create@basic.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-glk-dsi/igt@gem_exec_create@basic.html

  * igt@gem_exec_suspend@basic-s0:
    - fi-kbl-r:           [PASS][35] -> [FAIL][36] +5 similar issues
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-kbl-r/igt@gem_exec_suspend@basic-s0.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-kbl-r/igt@gem_exec_suspend@basic-s0.html
    - fi-skl-lmem:        [PASS][37] -> [FAIL][38] +5 similar issues
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-skl-lmem/igt@gem_exec_suspend@basic-s0.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-skl-lmem/igt@gem_exec_suspend@basic-s0.html
    - fi-bsw-nick:        [PASS][39] -> [FAIL][40] +5 similar issues
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-bsw-nick/igt@gem_exec_suspend@basic-s0.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-bsw-nick/igt@gem_exec_suspend@basic-s0.html

  * igt@gem_exec_suspend@basic-s3:
    - fi-kbl-guc:         [PASS][41] -> [FAIL][42] +5 similar issues
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-kbl-guc/igt@gem_exec_suspend@basic-s3.html
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-kbl-guc/igt@gem_exec_suspend@basic-s3.html
    - fi-kbl-8809g:       [PASS][43] -> [FAIL][44] +5 similar issues
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-kbl-8809g/igt@gem_exec_suspend@basic-s3.html
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-kbl-8809g/igt@gem_exec_suspend@basic-s3.html
    - fi-bdw-5557u:       [PASS][45] -> [FAIL][46] +5 similar issues
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-bdw-5557u/igt@gem_exec_suspend@basic-s3.html
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-bdw-5557u/igt@gem_exec_suspend@basic-s3.html
    - fi-kbl-soraka:      [PASS][47] -> [FAIL][48] +5 similar issues
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-kbl-soraka/igt@gem_exec_suspend@basic-s3.html
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-kbl-soraka/igt@gem_exec_suspend@basic-s3.html
    - fi-icl-guc:         [PASS][49] -> [FAIL][50] +5 similar issues
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-icl-guc/igt@gem_exec_suspend@basic-s3.html
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-icl-guc/igt@gem_exec_suspend@basic-s3.html
    - fi-byt-n2820:       [PASS][51] -> [FAIL][52] +5 similar issues
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-byt-n2820/igt@gem_exec_suspend@basic-s3.html
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-byt-n2820/igt@gem_exec_suspend@basic-s3.html
    - fi-cfl-8109u:       [PASS][53] -> [FAIL][54] +5 similar issues
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-cfl-8109u/igt@gem_exec_suspend@basic-s3.html
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-cfl-8109u/igt@gem_exec_suspend@basic-s3.html
    - fi-bxt-dsi:         [PASS][55] -> [FAIL][56] +5 similar issues
   [55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-bxt-dsi/igt@gem_exec_suspend@basic-s3.html
   [56]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-bxt-dsi/igt@gem_exec_suspend@basic-s3.html
    - fi-bsw-n3050:       [PASS][57] -> [FAIL][58] +5 similar issues
   [57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-bsw-n3050/igt@gem_exec_suspend@basic-s3.html
   [58]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-bsw-n3050/igt@gem_exec_suspend@basic-s3.html

  * igt@i915_module_load@reload:
    - fi-icl-u2:          [PASS][59] -> [FAIL][60] +3 similar issues
   [59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-icl-u2/igt@i915_module_load@reload.html
   [60]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-icl-u2/igt@i915_module_load@reload.html
    - fi-cml-u2:          [PASS][61] -> [FAIL][62] +4 similar issues
   [61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-cml-u2/igt@i915_module_load@reload.html
   [62]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-cml-u2/igt@i915_module_load@reload.html
    - fi-blb-e6850:       [PASS][63] -> [FAIL][64] +6 similar issues
   [63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-blb-e6850/igt@i915_module_load@reload.html
   [64]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-blb-e6850/igt@i915_module_load@reload.html
    - fi-byt-j1900:       [PASS][65] -> [FAIL][66] +6 similar issues
   [65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-byt-j1900/igt@i915_module_load@reload.html
   [66]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-byt-j1900/igt@i915_module_load@reload.html
    - fi-cfl-8700k:       [PASS][67] -> [FAIL][68] +5 similar issues
   [67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-cfl-8700k/igt@i915_module_load@reload.html
   [68]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-cfl-8700k/igt@i915_module_load@reload.html
    - fi-apl-guc:         [PASS][69] -> [FAIL][70] +5 similar issues
   [69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-apl-guc/igt@i915_module_load@reload.html
   [70]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-apl-guc/igt@i915_module_load@reload.html
    - fi-snb-2520m:       [PASS][71] -> [FAIL][72] +6 similar issues
   [71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-snb-2520m/igt@i915_module_load@reload.html
   [72]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-snb-2520m/igt@i915_module_load@reload.html
    - fi-cml-s:           [PASS][73] -> [FAIL][74] +5 similar issues
   [73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-cml-s/igt@i915_module_load@reload.html
   [74]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-cml-s/igt@i915_module_load@reload.html
    - fi-cfl-guc:         [PASS][75] -> [FAIL][76] +5 similar issues
   [75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-cfl-guc/igt@i915_module_load@reload.html
   [76]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-cfl-guc/igt@i915_module_load@reload.html

  
#### Suppressed ####

  The following results come from untrusted machines, tests, or statuses.
  They do not affect the overall result.

  * igt@gem_exec_create@basic:
    - {fi-ehl-1}:         [PASS][77] -> [FAIL][78] +5 similar issues
   [77]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-ehl-1/igt@gem_exec_create@basic.html
   [78]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-ehl-1/igt@gem_exec_create@basic.html

  * igt@gem_exec_suspend@basic-s3:
    - {fi-tgl-u}:         [PASS][79] -> [FAIL][80] +5 similar issues
   [79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-tgl-u/igt@gem_exec_suspend@basic-s3.html
   [80]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-tgl-u/igt@gem_exec_suspend@basic-s3.html

  * {igt@gem_wait@busy}:
    - fi-cfl-guc:         NOTRUN -> [FAIL][81]
   [81]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-cfl-guc/igt@gem_wait@busy.html
    - fi-tgl-y:           NOTRUN -> [FAIL][82] +1 similar issue
   [82]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-tgl-y/igt@gem_wait@busy.html
    - fi-glk-dsi:         NOTRUN -> [FAIL][83] +1 similar issue
   [83]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-glk-dsi/igt@gem_wait@busy.html
    - fi-bsw-kefka:       NOTRUN -> [FAIL][84] +1 similar issue
   [84]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-bsw-kefka/igt@gem_wait@busy.html
    - fi-icl-guc:         NOTRUN -> [FAIL][85] +1 similar issue
   [85]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-icl-guc/igt@gem_wait@busy.html
    - fi-byt-n2820:       NOTRUN -> [FAIL][86] +1 similar issue
   [86]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-byt-n2820/igt@gem_wait@busy.html
    - {fi-ehl-1}:         NOTRUN -> [FAIL][87] +1 similar issue
   [87]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-ehl-1/igt@gem_wait@busy.html
    - fi-gdg-551:         NOTRUN -> [FAIL][88]
   [88]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-gdg-551/igt@gem_wait@busy.html
    - fi-skl-lmem:        NOTRUN -> [FAIL][89] +1 similar issue
   [89]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-skl-lmem/igt@gem_wait@busy.html
    - fi-kbl-soraka:      NOTRUN -> [FAIL][90]
   [90]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-kbl-soraka/igt@gem_wait@busy.html
    - fi-whl-u:           NOTRUN -> [FAIL][91]
   [91]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-whl-u/igt@gem_wait@busy.html
    - {fi-tgl-u}:         NOTRUN -> [FAIL][92] +1 similar issue
   [92]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-tgl-u/igt@gem_wait@busy.html
    - fi-bxt-dsi:         NOTRUN -> [FAIL][93] +1 similar issue
   [93]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-bxt-dsi/igt@gem_wait@busy.html
    - fi-byt-j1900:       NOTRUN -> [FAIL][94] +1 similar issue
   [94]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-byt-j1900/igt@gem_wait@busy.html
    - fi-cml-s:           NOTRUN -> [FAIL][95]
   [95]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-cml-s/igt@gem_wait@busy.html

  * {igt@gem_wait@wait}:
    - fi-skl-6600u:       NOTRUN -> [FAIL][96]
   [96]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-skl-6600u/igt@gem_wait@wait.html
    - fi-icl-u2:          NOTRUN -> [FAIL][97] +1 similar issue
   [97]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-icl-u2/igt@gem_wait@wait.html
    - {fi-tgl-dsi}:       NOTRUN -> [FAIL][98] +1 similar issue
   [98]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-tgl-dsi/igt@gem_wait@wait.html
    - fi-bsw-nick:        NOTRUN -> [FAIL][99] +1 similar issue
   [99]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-bsw-nick/igt@gem_wait@wait.html
    - fi-icl-y:           NOTRUN -> [FAIL][100] +1 similar issue
   [100]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-icl-y/igt@gem_wait@wait.html
    - fi-apl-guc:         NOTRUN -> [FAIL][101] +1 similar issue
   [101]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-apl-guc/igt@gem_wait@wait.html
    - fi-kbl-r:           NOTRUN -> [FAIL][102]
   [102]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-kbl-r/igt@gem_wait@wait.html
    - fi-bwr-2160:        NOTRUN -> [FAIL][103] +1 similar issue
   [103]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-bwr-2160/igt@gem_wait@wait.html
    - fi-blb-e6850:       NOTRUN -> [FAIL][104] +1 similar issue
   [104]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-blb-e6850/igt@gem_wait@wait.html
    - fi-kbl-guc:         NOTRUN -> [FAIL][105]
   [105]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-kbl-guc/igt@gem_wait@wait.html
    - fi-elk-e7500:       NOTRUN -> [FAIL][106]
   [106]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-elk-e7500/igt@gem_wait@wait.html
    - fi-bsw-n3050:       NOTRUN -> [FAIL][107] +1 similar issue
   [107]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-bsw-n3050/igt@gem_wait@wait.html
    - fi-ilk-650:         NOTRUN -> [FAIL][108] +1 similar issue
   [108]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-ilk-650/igt@gem_wait@wait.html
    - fi-pnv-d510:        NOTRUN -> [FAIL][109] +1 similar issue
   [109]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-pnv-d510/igt@gem_wait@wait.html
    - fi-cfl-8700k:       NOTRUN -> [FAIL][110]
   [110]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-cfl-8700k/igt@gem_wait@wait.html

  * igt@i915_module_load@reload:
    - {fi-tgl-dsi}:       [PASS][111] -> [FAIL][112] +5 similar issues
   [111]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-tgl-dsi/igt@i915_module_load@reload.html
   [112]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-tgl-dsi/igt@i915_module_load@reload.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@i915_module_load@reload:
    - fi-kbl-x1275:       [PASS][113] -> [FAIL][114] ([i915#62] / [i915#95])
   [113]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-kbl-x1275/igt@i915_module_load@reload.html
   [114]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-kbl-x1275/igt@i915_module_load@reload.html

  * igt@i915_selftest@live@execlists:
    - fi-tgl-y:           [PASS][115] -> [INCOMPLETE][116] ([i915#1803])
   [115]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-tgl-y/igt@i915_selftest@live@execlists.html
   [116]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-tgl-y/igt@i915_selftest@live@execlists.html
    - fi-cfl-8700k:       [PASS][117] -> [INCOMPLETE][118] ([i915#656])
   [117]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-cfl-8700k/igt@i915_selftest@live@execlists.html
   [118]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-cfl-8700k/igt@i915_selftest@live@execlists.html
    - fi-cfl-guc:         [PASS][119] -> [INCOMPLETE][120] ([i915#656])
   [119]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-cfl-guc/igt@i915_selftest@live@execlists.html
   [120]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-cfl-guc/igt@i915_selftest@live@execlists.html

  
#### Warnings ####

  * igt@gem_exec_suspend@basic-s3:
    - fi-tgl-y:           [FAIL][121] ([fdo#103375] / [i915#1592]) -> [FAIL][122] ([i915#402])
   [121]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-tgl-y/igt@gem_exec_suspend@basic-s3.html
   [122]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-tgl-y/igt@gem_exec_suspend@basic-s3.html

  * igt@i915_pm_rpm@module-reload:
    - fi-kbl-x1275:       [SKIP][123] ([fdo#109271]) -> [FAIL][124] ([i915#62])
   [123]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-kbl-x1275/igt@i915_pm_rpm@module-reload.html
   [124]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/fi-kbl-x1275/igt@i915_pm_rpm@module-reload.html

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

  [fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [i915#1592]: https://gitlab.freedesktop.org/drm/intel/issues/1592
  [i915#1803]: https://gitlab.freedesktop.org/drm/intel/issues/1803
  [i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
  [i915#62]: https://gitlab.freedesktop.org/drm/intel/issues/62
  [i915#656]: https://gitlab.freedesktop.org/drm/intel/issues/656
  [i915#95]: https://gitlab.freedesktop.org/drm/intel/issues/95


Participating hosts (52 -> 43)
------------------------------

  Missing    (9): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-hsw-4770 fi-kbl-7560u fi-byt-clapper fi-bdw-samus 


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

  * CI: CI-20190529 -> None
  * IGT: IGT_5659 -> IGTPW_4576

  CI-20190529: 20190529
  CI_DRM_8498: 1493c649ae92207a758afa50a639275bd6c80e2e @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_4576: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/index.html
  IGT_5659: 66ab5e42811fee3dea8c21ab29e70e323a0650de @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4576/index.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [Intel-gfx] [PATCH i-g-t] perf: Hide any leak in gen8-unprivileged-single-ctx-counters
  2020-05-18 20:50 ` [igt-dev] " Chris Wilson
@ 2020-05-18 22:14   ` Chris Wilson
  -1 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2020-05-18 22:14 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Chris Wilson

gen8-unprivileged-single-counters appears to leak contexts, and does not
appear to be doing so intentionally.. Let's assume it's a bug in the
test and see if the contexts are released along with the device fd.
(If they are not released, that is more clearly an issue.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_exec_fence.c | 2 +-
 tests/perf.c                | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_exec_fence.c b/tests/i915/gem_exec_fence.c
index 5b504e5c8..b88472c3a 100644
--- a/tests/i915/gem_exec_fence.c
+++ b/tests/i915/gem_exec_fence.c
@@ -1479,7 +1479,7 @@ static void test_syncobj_future_submit(int i915, unsigned int engine)
 	/*
 	 * Here we submit client A waiting on client B, but internally client
 	 * B has a semaphore that waits on client A. This relies on timeslicing
-	 * to reorder B before A, even though userspace has asked to submit
+	 * to reorder A before B, even though userspace has asked to submit
 	 * A & B simultaneously (and due to the sequence we will submit B
 	 * then A).
 	 */
diff --git a/tests/perf.c b/tests/perf.c
index d4ebae30d..c78f02a8d 100644
--- a/tests/perf.c
+++ b/tests/perf.c
@@ -3428,6 +3428,8 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
 				.format = test_set->perf_oa_format
 			};
 
+			drm_fd = gem_reopen_driver(drm_fd);
+
 			bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
 			drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 
-- 
2.26.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [igt-dev] [PATCH i-g-t] perf: Hide any leak in gen8-unprivileged-single-ctx-counters
@ 2020-05-18 22:14   ` Chris Wilson
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2020-05-18 22:14 UTC (permalink / raw)
  To: igt-dev; +Cc: intel-gfx, Chris Wilson

gen8-unprivileged-single-counters appears to leak contexts, and does not
appear to be doing so intentionally.. Let's assume it's a bug in the
test and see if the contexts are released along with the device fd.
(If they are not released, that is more clearly an issue.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/i915/gem_exec_fence.c | 2 +-
 tests/perf.c                | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/i915/gem_exec_fence.c b/tests/i915/gem_exec_fence.c
index 5b504e5c8..b88472c3a 100644
--- a/tests/i915/gem_exec_fence.c
+++ b/tests/i915/gem_exec_fence.c
@@ -1479,7 +1479,7 @@ static void test_syncobj_future_submit(int i915, unsigned int engine)
 	/*
 	 * Here we submit client A waiting on client B, but internally client
 	 * B has a semaphore that waits on client A. This relies on timeslicing
-	 * to reorder B before A, even though userspace has asked to submit
+	 * to reorder A before B, even though userspace has asked to submit
 	 * A & B simultaneously (and due to the sequence we will submit B
 	 * then A).
 	 */
diff --git a/tests/perf.c b/tests/perf.c
index d4ebae30d..c78f02a8d 100644
--- a/tests/perf.c
+++ b/tests/perf.c
@@ -3428,6 +3428,8 @@ gen8_test_single_ctx_render_target_writes_a_counter(void)
 				.format = test_set->perf_oa_format
 			};
 
+			drm_fd = gem_reopen_driver(drm_fd);
+
 			bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
 			drm_intel_bufmgr_gem_enable_reuse(bufmgr);
 
-- 
2.26.2

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

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

* [Intel-gfx] [PATCH i-g-t] lib: Cleanup __igt_params_open()
  2020-05-18 20:50 ` [igt-dev] " Chris Wilson
@ 2020-05-18 22:15   ` Chris Wilson
  -1 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2020-05-18 22:15 UTC (permalink / raw)
  To: igt-dev; +Cc: Jani Nikula, intel-gfx, Chris Wilson

The device always exist, so use it to derive the module name required to
lookup either the debugfs params directory or the sysfs module parameters.

Fixes: 2f5cee33ce55 ("igt/params: use igt_params_set_save for igt_set_module_param*")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 lib/igt_params.c | 165 +++++++++--------------------------------------
 1 file changed, 29 insertions(+), 136 deletions(-)

diff --git a/lib/igt_params.c b/lib/igt_params.c
index d8649dfd9..23660f445 100644
--- a/lib/igt_params.c
+++ b/lib/igt_params.c
@@ -80,9 +80,18 @@ static void igt_params_exit_handler(int sig)
  * Notice that this function is called by igt_set_module_param(), so that one -
  * or one of its wrappers - is the only function the test programs need to call.
  */
-static void igt_params_save(int dir, const char *path, const char *name)
+static void igt_params_save(int dir, const char *name)
 {
 	struct module_param_data *data;
+	char path[PATH_MAX];
+	char buf[80];
+	int len;
+
+	snprintf(buf, sizeof(buf), "/proc/self/fd/%d", dir);
+	len = readlink(buf, path, sizeof(path) - 1);
+	if (len < 0)
+		return;
+	path[len] = '\0';
 
 	/* Check if this parameter is already saved. */
 	for (data = module_params; data != NULL; data = data->next)
@@ -110,175 +119,59 @@ static void igt_params_save(int dir, const char *path, const char *name)
 }
 
 /**
- * __igt_params_open:
- * @device: fd of the device or -1 for default
- * @outpath: full path to the sysfs directory if not NULL
- * @param: name of parameter of interest
- *
- * Find parameter of interest and return parameter directory fd, parameter
- * is first searched at debugfs/dri/N/<device>_params and if not found will
- * look for parameter at /sys/module/<device>/parameters.
- *
- * Giving -1 here for default device will search for matching device from
- * debugfs/dri/N where N go from 0 to 63. First device found from debugfs
- * which exist also at /sys/module/<device> will be 'default'.
- * Default device will only be used for sysfs, not for debugfs.
+ * igt_params_open:
+ * @device: fd of the device
  *
- * If outpath is not NULL caller is responsible to free given pointer.
+ * This opens the module parameters directory (under sysfs) corresponding
+ * to the device for use with igt_sysfs_set() and igt_sysfs_get().
  *
  * Returns:
- * Directory fd, or -1 on failure.
+ * The directory fd, or -1 on failure.
  */
-static int __igt_params_open(int device, char **outpath, const char *param)
+int igt_params_open(int device)
 {
+	drm_version_t version;
 	int dir, params = -1;
-	struct stat buffer;
-	char searchname[64];
-	char searchpath[PATH_MAX];
-	char *foundname, *ctx;
+	char path[PATH_MAX];
+	char name[32] = "";
+
+	memset(&version, 0, sizeof(version));
+	version.name_len = sizeof(name);
+	version.name = name;
+	if (ioctl(device, DRM_IOCTL_VERSION, &version))
+		return -1;
 
 	dir = igt_debugfs_dir(device);
 	if (dir >= 0) {
-		int devname;
-
-		devname = openat(dir, "name", O_RDONLY);
-		igt_require_f(devname >= 0,
-		              "Driver need to name itself in debugfs!");
-
-		read(devname, searchname, sizeof(searchname));
-		close(devname);
-
-		foundname = strtok_r(searchname, " ", &ctx);
-		igt_require_f(foundname,
-		              "Driver need to name itself in debugfs!");
-
-		snprintf(searchpath, PATH_MAX, "%s_params", foundname);
-		params = openat(dir, searchpath, O_RDONLY);
-
-		if (params >= 0) {
-			char *debugfspath = malloc(PATH_MAX);
-
-			igt_debugfs_path(device, debugfspath, PATH_MAX);
-			if (param != NULL) {
-				char filepath[PATH_MAX];
-
-				snprintf(filepath, PATH_MAX, "%s/%s",
-					 debugfspath, param);
-
-				if (stat(filepath, &buffer) == 0) {
-					if (outpath != NULL)
-						*outpath = debugfspath;
-					else
-						free(debugfspath);
-				} else {
-					free(debugfspath);
-					close(params);
-					params = -1;
-				}
-			} else if (outpath != NULL) {
-				/*
-				 * Caller is responsible to free this.
-				 */
-				*outpath = debugfspath;
-			} else {
-				free(debugfspath);
-			}
-		}
+		snprintf(path, PATH_MAX, "%s_params", name);
+		params = openat(dir, path, O_RDONLY);
 		close(dir);
 	}
 
 	if (params < 0) { /* builtin? */
-		drm_version_t version;
-		char name[32] = "";
-		char path[PATH_MAX];
-
-		if (device == -1) {
-			/*
-			 * find default device
-			 */
-			int file, i;
-			const char *debugfs_root = igt_debugfs_mount();
-
-			igt_assert(debugfs_root);
-
-			for (i = 0; i < 63; i++) {
-				char testpath[PATH_MAX];
-
-				snprintf(searchpath, PATH_MAX,
-					 "%s/dri/%d/name", debugfs_root, i);
-
-				file = open(searchpath, O_RDONLY);
-
-				if (file < 0)
-					continue;
-
-				read(file, searchname, sizeof(searchname));
-				close(file);
-
-				foundname = strtok_r(searchname, " ", &ctx);
-				if (!foundname)
-					continue;
-
-				snprintf(testpath, PATH_MAX,
-					 "/sys/module/%s/parameters",
-					 foundname);
-
-				if (stat(testpath, &buffer) == 0 &&
-				    S_ISDIR(buffer.st_mode)) {
-					snprintf(name, sizeof(name), "%s",
-						 foundname);
-					break;
-				}
-			}
-		} else {
-			memset(&version, 0, sizeof(version));
-			version.name_len = sizeof(name);
-			version.name = name;
-			ioctl(device, DRM_IOCTL_VERSION, &version);
-		}
 		snprintf(path, sizeof(path), "/sys/module/%s/parameters", name);
 		params = open(path, O_RDONLY);
-		if (params >= 0 && outpath)
-			*outpath = strdup(path);
 	}
 
 	return params;
 }
 
-/**
- * igt_params_open:
- * @device: fd of the device
- *
- * This opens the module parameters directory (under sysfs) corresponding
- * to the device for use with igt_sysfs_set() and igt_sysfs_get().
- *
- * Returns:
- * The directory fd, or -1 on failure.
- */
-int igt_params_open(int device)
-{
-	return __igt_params_open(device, NULL, NULL);
-}
-
 __attribute__((format(printf, 3, 0)))
 static bool __igt_params_set(int device, const char *parameter,
 			     const char *fmt, va_list ap, bool save)
 {
-	char *path = NULL;
 	int dir;
 	int ret;
 
-	dir = __igt_params_open(device, save ? &path : NULL, parameter);
+	dir = igt_params_open(device);
 	if (dir < 0)
 		return false;
 
 	if (save)
-		igt_params_save(dir, path, parameter);
+		igt_params_save(dir, parameter);
 
 	ret = igt_sysfs_vprintf(dir, parameter, fmt, ap);
-
 	close(dir);
-	free(path);
 
 	return ret > 0;
 }
-- 
2.26.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [igt-dev] [PATCH i-g-t] lib: Cleanup __igt_params_open()
@ 2020-05-18 22:15   ` Chris Wilson
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2020-05-18 22:15 UTC (permalink / raw)
  To: igt-dev; +Cc: Jani Nikula, intel-gfx, Chris Wilson

The device always exist, so use it to derive the module name required to
lookup either the debugfs params directory or the sysfs module parameters.

Fixes: 2f5cee33ce55 ("igt/params: use igt_params_set_save for igt_set_module_param*")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
---
 lib/igt_params.c | 165 +++++++++--------------------------------------
 1 file changed, 29 insertions(+), 136 deletions(-)

diff --git a/lib/igt_params.c b/lib/igt_params.c
index d8649dfd9..23660f445 100644
--- a/lib/igt_params.c
+++ b/lib/igt_params.c
@@ -80,9 +80,18 @@ static void igt_params_exit_handler(int sig)
  * Notice that this function is called by igt_set_module_param(), so that one -
  * or one of its wrappers - is the only function the test programs need to call.
  */
-static void igt_params_save(int dir, const char *path, const char *name)
+static void igt_params_save(int dir, const char *name)
 {
 	struct module_param_data *data;
+	char path[PATH_MAX];
+	char buf[80];
+	int len;
+
+	snprintf(buf, sizeof(buf), "/proc/self/fd/%d", dir);
+	len = readlink(buf, path, sizeof(path) - 1);
+	if (len < 0)
+		return;
+	path[len] = '\0';
 
 	/* Check if this parameter is already saved. */
 	for (data = module_params; data != NULL; data = data->next)
@@ -110,175 +119,59 @@ static void igt_params_save(int dir, const char *path, const char *name)
 }
 
 /**
- * __igt_params_open:
- * @device: fd of the device or -1 for default
- * @outpath: full path to the sysfs directory if not NULL
- * @param: name of parameter of interest
- *
- * Find parameter of interest and return parameter directory fd, parameter
- * is first searched at debugfs/dri/N/<device>_params and if not found will
- * look for parameter at /sys/module/<device>/parameters.
- *
- * Giving -1 here for default device will search for matching device from
- * debugfs/dri/N where N go from 0 to 63. First device found from debugfs
- * which exist also at /sys/module/<device> will be 'default'.
- * Default device will only be used for sysfs, not for debugfs.
+ * igt_params_open:
+ * @device: fd of the device
  *
- * If outpath is not NULL caller is responsible to free given pointer.
+ * This opens the module parameters directory (under sysfs) corresponding
+ * to the device for use with igt_sysfs_set() and igt_sysfs_get().
  *
  * Returns:
- * Directory fd, or -1 on failure.
+ * The directory fd, or -1 on failure.
  */
-static int __igt_params_open(int device, char **outpath, const char *param)
+int igt_params_open(int device)
 {
+	drm_version_t version;
 	int dir, params = -1;
-	struct stat buffer;
-	char searchname[64];
-	char searchpath[PATH_MAX];
-	char *foundname, *ctx;
+	char path[PATH_MAX];
+	char name[32] = "";
+
+	memset(&version, 0, sizeof(version));
+	version.name_len = sizeof(name);
+	version.name = name;
+	if (ioctl(device, DRM_IOCTL_VERSION, &version))
+		return -1;
 
 	dir = igt_debugfs_dir(device);
 	if (dir >= 0) {
-		int devname;
-
-		devname = openat(dir, "name", O_RDONLY);
-		igt_require_f(devname >= 0,
-		              "Driver need to name itself in debugfs!");
-
-		read(devname, searchname, sizeof(searchname));
-		close(devname);
-
-		foundname = strtok_r(searchname, " ", &ctx);
-		igt_require_f(foundname,
-		              "Driver need to name itself in debugfs!");
-
-		snprintf(searchpath, PATH_MAX, "%s_params", foundname);
-		params = openat(dir, searchpath, O_RDONLY);
-
-		if (params >= 0) {
-			char *debugfspath = malloc(PATH_MAX);
-
-			igt_debugfs_path(device, debugfspath, PATH_MAX);
-			if (param != NULL) {
-				char filepath[PATH_MAX];
-
-				snprintf(filepath, PATH_MAX, "%s/%s",
-					 debugfspath, param);
-
-				if (stat(filepath, &buffer) == 0) {
-					if (outpath != NULL)
-						*outpath = debugfspath;
-					else
-						free(debugfspath);
-				} else {
-					free(debugfspath);
-					close(params);
-					params = -1;
-				}
-			} else if (outpath != NULL) {
-				/*
-				 * Caller is responsible to free this.
-				 */
-				*outpath = debugfspath;
-			} else {
-				free(debugfspath);
-			}
-		}
+		snprintf(path, PATH_MAX, "%s_params", name);
+		params = openat(dir, path, O_RDONLY);
 		close(dir);
 	}
 
 	if (params < 0) { /* builtin? */
-		drm_version_t version;
-		char name[32] = "";
-		char path[PATH_MAX];
-
-		if (device == -1) {
-			/*
-			 * find default device
-			 */
-			int file, i;
-			const char *debugfs_root = igt_debugfs_mount();
-
-			igt_assert(debugfs_root);
-
-			for (i = 0; i < 63; i++) {
-				char testpath[PATH_MAX];
-
-				snprintf(searchpath, PATH_MAX,
-					 "%s/dri/%d/name", debugfs_root, i);
-
-				file = open(searchpath, O_RDONLY);
-
-				if (file < 0)
-					continue;
-
-				read(file, searchname, sizeof(searchname));
-				close(file);
-
-				foundname = strtok_r(searchname, " ", &ctx);
-				if (!foundname)
-					continue;
-
-				snprintf(testpath, PATH_MAX,
-					 "/sys/module/%s/parameters",
-					 foundname);
-
-				if (stat(testpath, &buffer) == 0 &&
-				    S_ISDIR(buffer.st_mode)) {
-					snprintf(name, sizeof(name), "%s",
-						 foundname);
-					break;
-				}
-			}
-		} else {
-			memset(&version, 0, sizeof(version));
-			version.name_len = sizeof(name);
-			version.name = name;
-			ioctl(device, DRM_IOCTL_VERSION, &version);
-		}
 		snprintf(path, sizeof(path), "/sys/module/%s/parameters", name);
 		params = open(path, O_RDONLY);
-		if (params >= 0 && outpath)
-			*outpath = strdup(path);
 	}
 
 	return params;
 }
 
-/**
- * igt_params_open:
- * @device: fd of the device
- *
- * This opens the module parameters directory (under sysfs) corresponding
- * to the device for use with igt_sysfs_set() and igt_sysfs_get().
- *
- * Returns:
- * The directory fd, or -1 on failure.
- */
-int igt_params_open(int device)
-{
-	return __igt_params_open(device, NULL, NULL);
-}
-
 __attribute__((format(printf, 3, 0)))
 static bool __igt_params_set(int device, const char *parameter,
 			     const char *fmt, va_list ap, bool save)
 {
-	char *path = NULL;
 	int dir;
 	int ret;
 
-	dir = __igt_params_open(device, save ? &path : NULL, parameter);
+	dir = igt_params_open(device);
 	if (dir < 0)
 		return false;
 
 	if (save)
-		igt_params_save(dir, path, parameter);
+		igt_params_save(dir, parameter);
 
 	ret = igt_sysfs_vprintf(dir, parameter, fmt, ap);
-
 	close(dir);
-	free(path);
 
 	return ret > 0;
 }
-- 
2.26.2

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

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

* [igt-dev] ✗ Fi.CI.BAT: failure for lib: Cleanup __igt_params_open() (rev3)
  2020-05-18 20:50 ` [igt-dev] " Chris Wilson
                   ` (3 preceding siblings ...)
  (?)
@ 2020-05-18 23:06 ` Patchwork
  -1 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2020-05-18 23:06 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev

== Series Details ==

Series: lib: Cleanup __igt_params_open() (rev3)
URL   : https://patchwork.freedesktop.org/series/77374/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_8498 -> IGTPW_4578
====================================================

Summary
-------

  **FAILURE**

  Serious unknown changes coming with IGTPW_4578 absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_4578, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

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

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

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

### IGT changes ###

#### Possible regressions ####

  * igt@kms_force_connector_basic@force-load-detect:
    - fi-elk-e7500:       [PASS][1] -> [FAIL][2]
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-elk-e7500/igt@kms_force_connector_basic@force-load-detect.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4578/fi-elk-e7500/igt@kms_force_connector_basic@force-load-detect.html
    - fi-ivb-3770:        [PASS][3] -> [FAIL][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-ivb-3770/igt@kms_force_connector_basic@force-load-detect.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4578/fi-ivb-3770/igt@kms_force_connector_basic@force-load-detect.html
    - fi-byt-j1900:       [PASS][5] -> [FAIL][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-byt-j1900/igt@kms_force_connector_basic@force-load-detect.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4578/fi-byt-j1900/igt@kms_force_connector_basic@force-load-detect.html
    - fi-blb-e6850:       [PASS][7] -> [FAIL][8]
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-blb-e6850/igt@kms_force_connector_basic@force-load-detect.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4578/fi-blb-e6850/igt@kms_force_connector_basic@force-load-detect.html
    - fi-ilk-650:         [PASS][9] -> [FAIL][10]
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-ilk-650/igt@kms_force_connector_basic@force-load-detect.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4578/fi-ilk-650/igt@kms_force_connector_basic@force-load-detect.html
    - fi-pnv-d510:        [PASS][11] -> [FAIL][12]
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-pnv-d510/igt@kms_force_connector_basic@force-load-detect.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4578/fi-pnv-d510/igt@kms_force_connector_basic@force-load-detect.html
    - fi-snb-2520m:       [PASS][13] -> [FAIL][14]
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-snb-2520m/igt@kms_force_connector_basic@force-load-detect.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4578/fi-snb-2520m/igt@kms_force_connector_basic@force-load-detect.html
    - fi-gdg-551:         [PASS][15] -> [FAIL][16]
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-gdg-551/igt@kms_force_connector_basic@force-load-detect.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4578/fi-gdg-551/igt@kms_force_connector_basic@force-load-detect.html
    - fi-bwr-2160:        [PASS][17] -> [FAIL][18]
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-bwr-2160/igt@kms_force_connector_basic@force-load-detect.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4578/fi-bwr-2160/igt@kms_force_connector_basic@force-load-detect.html
    - fi-snb-2600:        [PASS][19] -> [FAIL][20]
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-snb-2600/igt@kms_force_connector_basic@force-load-detect.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4578/fi-snb-2600/igt@kms_force_connector_basic@force-load-detect.html

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

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

### IGT changes ###

#### Issues hit ####

  * igt@i915_selftest@live@execlists:
    - fi-whl-u:           [PASS][21] -> [INCOMPLETE][22] ([i915#656])
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_8498/fi-whl-u/igt@i915_selftest@live@execlists.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4578/fi-whl-u/igt@i915_selftest@live@execlists.html

  
  [i915#656]: https://gitlab.freedesktop.org/drm/intel/issues/656


Participating hosts (52 -> 44)
------------------------------

  Missing    (8): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-hsw-4770 fi-byt-clapper fi-bdw-samus 


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

  * CI: CI-20190529 -> None
  * IGT: IGT_5659 -> IGTPW_4578

  CI-20190529: 20190529
  CI_DRM_8498: 1493c649ae92207a758afa50a639275bd6c80e2e @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_4578: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4578/index.html
  IGT_5659: 66ab5e42811fee3dea8c21ab29e70e323a0650de @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_4578/index.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2020-05-18 23:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18 20:50 [Intel-gfx] [PATCH i-g-t] lib: Cleanup __igt_params_open() Chris Wilson
2020-05-18 20:50 ` [igt-dev] " Chris Wilson
2020-05-18 21:34 ` [igt-dev] ✗ Fi.CI.BAT: failure for " Patchwork
2020-05-18 22:14 ` [Intel-gfx] [PATCH i-g-t] perf: Hide any leak in gen8-unprivileged-single-ctx-counters Chris Wilson
2020-05-18 22:14   ` [igt-dev] " Chris Wilson
2020-05-18 22:15 ` [Intel-gfx] [PATCH i-g-t] lib: Cleanup __igt_params_open() Chris Wilson
2020-05-18 22:15   ` [igt-dev] " Chris Wilson
2020-05-18 23:06 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib: Cleanup __igt_params_open() (rev3) Patchwork

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.