All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/3] lib: Add functions to read parameters
@ 2018-09-05 21:05 José Roberto de Souza
  2018-09-05 21:05 ` [igt-dev] [PATCH i-g-t 2/3] lib/psr: Read enable_psr instead of relly in a value assumption José Roberto de Souza
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: José Roberto de Souza @ 2018-09-05 21:05 UTC (permalink / raw)
  To: igt-dev

This functions allow us to read i915 parameters, that is userful to
know the current state of the loaded driver.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 lib/igt_aux.c  | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/igt_aux.h  |  2 ++
 lib/igt_core.h | 34 +++++++++++++++++++++++++++++
 3 files changed, 94 insertions(+)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 1250d5c5..5451f51c 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1228,6 +1228,40 @@ void igt_set_module_param(const char *name, const char *val)
 	igt_assert(close(fd) == 0);
 }
 
+/**
+ * igt_get_module_param:
+ * @name: i915.ko parameter name
+ * @val: i915.ko parameter value
+ * @val_len: the length of val buffer
+ * Returns: 0 in success
+ *
+ * This function gets the value of the given i915.ko parameter.
+ *
+ * Please consider using igt_get_module_param_int() for the integer and bool
+ * parameters.
+ */
+int igt_get_module_param(const char *name, char *val, size_t val_len)
+{
+	char file_path[PARAM_FILE_PATH_MAX_SZ];
+	size_t n;
+	int fd;
+
+	igt_assert_return_f(strlen(name) < PARAM_NAME_MAX_SZ, -1,
+			    "Need to increase PARAM_NAME_MAX_SZ\n");
+	snprintf(file_path, sizeof(file_path), "%s%s", MODULE_PARAM_DIR, name);
+
+	fd = open(file_path, O_RDONLY);
+	igt_assert_return(fd >= 0, -1);
+
+	n = read(fd, val, val_len);
+	igt_assert(close(fd) == 0);
+
+	igt_assert_return_f(n > 0 && n < PARAM_VALUE_MAX_SZ, -1,
+			    "Need to increase PARAM_VALUE_MAX_SZ\n");
+
+	return 0;
+}
+
 /**
  * igt_set_module_param_int:
  * @name: i915.ko parameter name
@@ -1248,6 +1282,30 @@ void igt_set_module_param_int(const char *name, int val)
 	igt_set_module_param(name, str);
 }
 
+/**
+ * igt_get_module_param_int:
+ * @name: i915.ko parameter name
+ * @val: i915.ko parameter value
+ * Returns: 0 in success
+ *
+ * This is a wrapper for igt_get_module_param() that takes an integer instead of
+ * a string. Please see igt_get_module_param().
+ */
+int igt_get_module_param_int(const char *name, int *val)
+{
+	char str[PARAM_VALUE_MAX_SZ];
+	long int ret;
+
+	ret = igt_get_module_param(name, str, sizeof(str));
+	if (ret)
+		return ret;
+
+	ret = strtol(str, NULL, 10);
+	*val = ret;
+
+	return 0;
+}
+
 /**
  * igt_terminate_process:
  * @sig: Signal to send
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index ef89faa9..fc948265 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -276,6 +276,8 @@ double igt_stop_siglatency(struct igt_mean *result);
 
 void igt_set_module_param(const char *name, const char *val);
 void igt_set_module_param_int(const char *name, int val);
+int igt_get_module_param(const char *name, char *val, size_t val_len);
+int igt_get_module_param_int(const char *name, int *val);
 
 int igt_terminate_process(int sig, const char *comm);
 void igt_lsof(const char *dpath);
diff --git a/lib/igt_core.h b/lib/igt_core.h
index b80e1702..59cbab21 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -337,6 +337,21 @@ static inline void igt_ignore_warn(bool value)
 		__igt_fail_assert(IGT_LOG_DOMAIN, __FILE__, __LINE__, __func__, #expr , NULL); \
 	} while (0)
 
+/**
+ * igt_assert_return:
+ * @expr: condition to test
+ * @ret: returns value if condition is not met
+ *
+ * Fails (sub-)test if the condition is not met.
+ *
+ * Should be used everywhere where a test checks results.
+ */
+#define igt_assert_return(expr, ret) \
+	if (!(expr)) { \
+		__igt_fail_assert(IGT_LOG_DOMAIN, __FILE__, __LINE__, __func__, #expr , NULL); \
+		return ret; \
+	}
+
 /**
  * igt_assert_f:
  * @expr: condition to test
@@ -354,6 +369,25 @@ static inline void igt_ignore_warn(bool value)
 		__igt_fail_assert(IGT_LOG_DOMAIN, __FILE__, __LINE__, __func__, #expr , f); \
 	} while (0)
 
+/**
+ * igt_assert_return_f:
+ * @expr: condition to test
+ * @ret: returns value if condition is not met
+ * @...: format string and optional arguments
+ *
+ * Fails (sub-)test if the condition is not met.
+ *
+ * Should be used everywhere where a test checks results.
+ *
+ * In addition to the plain igt_assert() helper this allows to print additional
+ * information to help debugging test failures.
+ */
+#define igt_assert_return_f(expr, ret, f...) \
+	if (!(expr)) { \
+		__igt_fail_assert(IGT_LOG_DOMAIN, __FILE__, __LINE__, __func__, #expr , f); \
+		return ret; \
+	}
+
 /**
  * igt_fail_on:
  * @expr: condition to test
-- 
2.18.0

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

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

* [igt-dev] [PATCH i-g-t 2/3] lib/psr: Read enable_psr instead of relly in a value assumption
  2018-09-05 21:05 [igt-dev] [PATCH i-g-t 1/3] lib: Add functions to read parameters José Roberto de Souza
@ 2018-09-05 21:05 ` José Roberto de Souza
  2018-09-05 21:05 ` [igt-dev] [PATCH i-g-t 3/3] lib: Use newly added igt_get_module_param() in igt_save_module_param() José Roberto de Souza
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: José Roberto de Souza @ 2018-09-05 21:05 UTC (permalink / raw)
  To: igt-dev; +Cc: Maarten

Instead of having a static variable with a assumed value lets be more
accurate and read the parameter.

Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 lib/igt_psr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index bc142632..75200342 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -68,14 +68,14 @@ static int has_psr_debugfs(int fd)
 
 static bool psr_modparam_set(int val)
 {
-	static int oldval = -1;
+	int oldval = -1;
 
+	igt_get_module_param_int("enable_psr", &oldval);
 	igt_set_module_param_int("enable_psr", val);
 
 	if (val == oldval)
 		return false;
 
-	oldval = val;
 	return true;
 }
 
-- 
2.18.0

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

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

* [igt-dev] [PATCH i-g-t 3/3] lib: Use newly added igt_get_module_param() in igt_save_module_param()
  2018-09-05 21:05 [igt-dev] [PATCH i-g-t 1/3] lib: Add functions to read parameters José Roberto de Souza
  2018-09-05 21:05 ` [igt-dev] [PATCH i-g-t 2/3] lib/psr: Read enable_psr instead of relly in a value assumption José Roberto de Souza
@ 2018-09-05 21:05 ` José Roberto de Souza
  2018-09-05 21:36 ` [igt-dev] [PATCH i-g-t 1/3] lib: Add functions to read parameters Chris Wilson
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: José Roberto de Souza @ 2018-09-05 21:05 UTC (permalink / raw)
  To: igt-dev

igt_get_module_param() is doing the same thing as part of
igt_save_module_param() so lets share code here.

Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 lib/igt_aux.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 5451f51c..7bb0b2d1 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -1169,8 +1169,6 @@ static void igt_module_param_exit_handler(int sig)
 static void igt_save_module_param(const char *name, const char *file_path)
 {
 	struct module_param_data *data;
-	size_t n;
-	int fd;
 
 	/* Check if this parameter is already saved. */
 	for (data = module_params; data != NULL; data = data->next)
@@ -1185,14 +1183,7 @@ static void igt_save_module_param(const char *name, const char *file_path)
 
 	strncpy(data->name, name, PARAM_NAME_MAX_SZ - 1);
 
-	fd = open(file_path, O_RDONLY);
-	igt_assert(fd >= 0);
-
-	n = read(fd, data->original_value, PARAM_VALUE_MAX_SZ);
-	igt_assert_f(n > 0 && n < PARAM_VALUE_MAX_SZ,
-		     "Need to increase PARAM_VALUE_MAX_SZ\n");
-
-	igt_assert(close(fd) == 0);
+	igt_get_module_param(name, data->original_value, PARAM_VALUE_MAX_SZ);
 
 	data->next = module_params;
 	module_params = data;
-- 
2.18.0

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

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

* Re: [igt-dev] [PATCH i-g-t 1/3] lib: Add functions to read parameters
  2018-09-05 21:05 [igt-dev] [PATCH i-g-t 1/3] lib: Add functions to read parameters José Roberto de Souza
  2018-09-05 21:05 ` [igt-dev] [PATCH i-g-t 2/3] lib/psr: Read enable_psr instead of relly in a value assumption José Roberto de Souza
  2018-09-05 21:05 ` [igt-dev] [PATCH i-g-t 3/3] lib: Use newly added igt_get_module_param() in igt_save_module_param() José Roberto de Souza
@ 2018-09-05 21:36 ` Chris Wilson
  2018-09-05 22:42 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
  2018-09-06  7:29 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  4 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2018-09-05 21:36 UTC (permalink / raw)
  To: José Roberto de Souza, igt-dev

Quoting José Roberto de Souza (2018-09-05 22:05:03)
> This functions allow us to read i915 parameters, that is userful to
> know the current state of the loaded driver.

Please consider igt_sysfs.c No point having multiple wheels.
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib: Add functions to read parameters
  2018-09-05 21:05 [igt-dev] [PATCH i-g-t 1/3] lib: Add functions to read parameters José Roberto de Souza
                   ` (2 preceding siblings ...)
  2018-09-05 21:36 ` [igt-dev] [PATCH i-g-t 1/3] lib: Add functions to read parameters Chris Wilson
@ 2018-09-05 22:42 ` Patchwork
  2018-09-06  7:29 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  4 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2018-09-05 22:42 UTC (permalink / raw)
  To: Souza, Jose; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,1/3] lib: Add functions to read parameters
URL   : https://patchwork.freedesktop.org/series/49235/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4772 -> IGTPW_1796 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/49235/revisions/1/mbox/

== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@debugfs_test@read_all_entries:
      fi-snb-2520m:       PASS -> INCOMPLETE (fdo#103713)

    igt@gem_exec_suspend@basic-s3:
      fi-blb-e6850:       PASS -> INCOMPLETE (fdo#107718)

    igt@kms_frontbuffer_tracking@basic:
      fi-byt-clapper:     PASS -> FAIL (fdo#103167)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-c:
      fi-bxt-dsi:         PASS -> INCOMPLETE (fdo#103927)

    igt@pm_backlight@basic-brightness:
      fi-glk-dsi:         PASS -> INCOMPLETE (k.org#198133, fdo#103359)

    
    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s4-devices:
      fi-kbl-7500u:       DMESG-WARN (fdo#107139, fdo#105128) -> PASS

    igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence:
      fi-ilk-650:         DMESG-WARN (fdo#106387) -> PASS

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-byt-clapper:     FAIL (fdo#107362, fdo#103191) -> PASS

    
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
  fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
  fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128
  fdo#106387 https://bugs.freedesktop.org/show_bug.cgi?id=106387
  fdo#107139 https://bugs.freedesktop.org/show_bug.cgi?id=107139
  fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
  fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
  k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133


== Participating hosts (54 -> 49) ==

  Missing    (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u 


== Build changes ==

    * IGT: IGT_4629 -> IGTPW_1796

  CI_DRM_4772: 1351ee8f3aacdb8f4a71cd17a7035556065c59a9 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1796: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1796/
  IGT_4629: c3b6d69aa3dd2d1a6c1f2e787670a0aef78f2ea5 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

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

* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/3] lib: Add functions to read parameters
  2018-09-05 21:05 [igt-dev] [PATCH i-g-t 1/3] lib: Add functions to read parameters José Roberto de Souza
                   ` (3 preceding siblings ...)
  2018-09-05 22:42 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
@ 2018-09-06  7:29 ` Patchwork
  4 siblings, 0 replies; 6+ messages in thread
From: Patchwork @ 2018-09-06  7:29 UTC (permalink / raw)
  To: José Roberto de Souza; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,1/3] lib: Add functions to read parameters
URL   : https://patchwork.freedesktop.org/series/49235/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4629_full -> IGTPW_1796_full =

== Summary - WARNING ==

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

  External URL: https://patchwork.freedesktop.org/api/1.0/series/49235/revisions/1/mbox/

== Possible new issues ==

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

  === IGT changes ===

    ==== Warnings ====

    igt@perf_pmu@rc6:
      shard-kbl:          PASS -> SKIP

    igt@pm_rc6_residency@rc6-accuracy:
      shard-kbl:          SKIP -> PASS

    
== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_ppgtt@blt-vs-render-ctxn:
      shard-kbl:          PASS -> INCOMPLETE (fdo#106023, fdo#103665)

    igt@gem_userptr_blits@dmabuf-unsync:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@kms_available_modes_crc@available_mode_test_crc:
      shard-snb:          PASS -> FAIL (fdo#106641)

    igt@kms_cursor_crc@cursor-256x256-suspend:
      shard-apl:          PASS -> FAIL (fdo#103232, fdo#103191)

    igt@kms_flip@flip-vs-expired-vblank:
      shard-glk:          PASS -> FAIL (fdo#105363)

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-pri-shrfb-draw-blt:
      shard-glk:          PASS -> FAIL (fdo#103167)

    igt@kms_properties@connector-properties-atomic:
      shard-apl:          PASS -> DMESG-WARN (fdo#105602, fdo#103558) +2

    igt@kms_setmode@basic:
      shard-apl:          PASS -> FAIL (fdo#99912)

    igt@kms_vblank@pipe-b-ts-continuation-dpms-suspend:
      shard-apl:          PASS -> INCOMPLETE (fdo#103927)

    igt@perf_pmu@rc6-runtime-pm-long:
      shard-apl:          PASS -> FAIL (fdo#105010)
      shard-glk:          PASS -> FAIL (fdo#105010)
      shard-kbl:          PASS -> FAIL (fdo#105010)

    
    ==== Possible fixes ====

    igt@gem_ppgtt@blt-vs-render-ctx0:
      shard-kbl:          INCOMPLETE (fdo#106023, fdo#103665) -> PASS

    igt@kms_flip@2x-flip-vs-expired-vblank-interruptible:
      shard-glk:          FAIL (fdo#105363) -> PASS

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-indfb-plflip-blt:
      shard-glk:          FAIL (fdo#103167) -> PASS

    igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
      shard-apl:          FAIL (fdo#103375) -> PASS

    igt@perf_pmu@rc6-runtime-pm:
      shard-kbl:          FAIL (fdo#105010) -> PASS

    igt@prime_busy@before-bsd1:
      shard-snb:          INCOMPLETE (fdo#105411) -> SKIP

    
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
  fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
  fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
  fdo#103558 https://bugs.freedesktop.org/show_bug.cgi?id=103558
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
  fdo#105010 https://bugs.freedesktop.org/show_bug.cgi?id=105010
  fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
  fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
  fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912


== Participating hosts (5 -> 5) ==

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4629 -> IGTPW_1796
    * Linux: CI_DRM_4770 -> CI_DRM_4772

  CI_DRM_4770: 0c3535cf60140d017a5df73d84d06e8b1a5b5d3b @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4772: 1351ee8f3aacdb8f4a71cd17a7035556065c59a9 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1796: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1796/
  IGT_4629: c3b6d69aa3dd2d1a6c1f2e787670a0aef78f2ea5 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

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

end of thread, other threads:[~2018-09-06  7:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-05 21:05 [igt-dev] [PATCH i-g-t 1/3] lib: Add functions to read parameters José Roberto de Souza
2018-09-05 21:05 ` [igt-dev] [PATCH i-g-t 2/3] lib/psr: Read enable_psr instead of relly in a value assumption José Roberto de Souza
2018-09-05 21:05 ` [igt-dev] [PATCH i-g-t 3/3] lib: Use newly added igt_get_module_param() in igt_save_module_param() José Roberto de Souza
2018-09-05 21:36 ` [igt-dev] [PATCH i-g-t 1/3] lib: Add functions to read parameters Chris Wilson
2018-09-05 22:42 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] " Patchwork
2018-09-06  7:29 ` [igt-dev] ✓ Fi.CI.IGT: " 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.