All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 0/2] Add support to force specific module load
@ 2018-07-07 23:24 ` Rodrigo Siqueira
  0 siblings, 0 replies; 22+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:24 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

This patchset adds support for forcing a specific module to be loaded
via command line. This feature can bring benefits for developers that
need to create a new module since they can use IGT as a base test to
guide their development (Test-driven development - TDD ). The first
patch, expand the size of the module name accepted by IGT to make
possible that modules with larger names can be loaded. The second patch
has the force option implementation.

The discussion about this feature started with an RFC named "[PATCH
i-g-t] [RFC] Add support to force specific module load", link:
https://www.spinics.net/lists/intel-gfx/msg166764.html

Rodrigo Siqueira (2):
  Increase the string size for a module name
  Add support for forcing specific module

 lib/drmtest.c        | 39 +++++++++++++++++++++++++++++++--------
 lib/igt_core.c       | 23 +++++++++++++++++++++++
 lib/igt_core.h       |  4 ++++
 scripts/run-tests.sh |  4 +++-
 4 files changed, 61 insertions(+), 9 deletions(-)

-- 
2.18.0

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

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

* [igt-dev] [PATCH i-g-t 0/2] Add support to force specific module load
@ 2018-07-07 23:24 ` Rodrigo Siqueira
  0 siblings, 0 replies; 22+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:24 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, gustavo, intel-gfx

This patchset adds support for forcing a specific module to be loaded
via command line. This feature can bring benefits for developers that
need to create a new module since they can use IGT as a base test to
guide their development (Test-driven development - TDD ). The first
patch, expand the size of the module name accepted by IGT to make
possible that modules with larger names can be loaded. The second patch
has the force option implementation.

The discussion about this feature started with an RFC named "[PATCH
i-g-t] [RFC] Add support to force specific module load", link:
https://www.spinics.net/lists/intel-gfx/msg166764.html

Rodrigo Siqueira (2):
  Increase the string size for a module name
  Add support for forcing specific module

 lib/drmtest.c        | 39 +++++++++++++++++++++++++++++++--------
 lib/igt_core.c       | 23 +++++++++++++++++++++++
 lib/igt_core.h       |  4 ++++
 scripts/run-tests.sh |  4 +++-
 4 files changed, 61 insertions(+), 9 deletions(-)

-- 
2.18.0

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

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

* [PATCH i-g-t 1/2] Increase the string size for a module name
  2018-07-07 23:24 ` [igt-dev] " Rodrigo Siqueira
@ 2018-07-07 23:24   ` Rodrigo Siqueira
  -1 siblings, 0 replies; 22+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:24 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

Some modules name are larger than 5 characters, this can be a problem to
add support for other modules. This patch, increase the maximum size in
order to enable other modules to use IGT.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/drmtest.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index fae6f86f..eee733eb 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -60,6 +60,8 @@
 #include "ioctl_wrappers.h"
 #include "igt_dummyload.h"
 
+#define NAME_LEN 32
+
 /**
  * SECTION:drmtest
  * @short_description: Base library for drm tests and tools
@@ -82,7 +84,7 @@ static int __get_drm_device_name(int fd, char *name)
 	drm_version_t version;
 
 	memset(&version, 0, sizeof(version));
-	version.name_len = 4;
+	version.name_len = NAME_LEN;
 	version.name = name;
 
 	if (!drmIoctl(fd, DRM_IOCTL_VERSION, &version)){
@@ -94,7 +96,7 @@ static int __get_drm_device_name(int fd, char *name)
 
 static bool __is_device(int fd, const char *expect)
 {
-	char name[5] = "";
+	char name[NAME_LEN] = "";
 
 	if (__get_drm_device_name(fd, name))
 		return false;
-- 
2.18.0

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

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

* [Intel-gfx] [PATCH i-g-t 1/2] Increase the string size for a module name
@ 2018-07-07 23:24   ` Rodrigo Siqueira
  0 siblings, 0 replies; 22+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:24 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

Some modules name are larger than 5 characters, this can be a problem to
add support for other modules. This patch, increase the maximum size in
order to enable other modules to use IGT.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/drmtest.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index fae6f86f..eee733eb 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -60,6 +60,8 @@
 #include "ioctl_wrappers.h"
 #include "igt_dummyload.h"
 
+#define NAME_LEN 32
+
 /**
  * SECTION:drmtest
  * @short_description: Base library for drm tests and tools
@@ -82,7 +84,7 @@ static int __get_drm_device_name(int fd, char *name)
 	drm_version_t version;
 
 	memset(&version, 0, sizeof(version));
-	version.name_len = 4;
+	version.name_len = NAME_LEN;
 	version.name = name;
 
 	if (!drmIoctl(fd, DRM_IOCTL_VERSION, &version)){
@@ -94,7 +96,7 @@ static int __get_drm_device_name(int fd, char *name)
 
 static bool __is_device(int fd, const char *expect)
 {
-	char name[5] = "";
+	char name[NAME_LEN] = "";
 
 	if (__get_drm_device_name(fd, name))
 		return false;
-- 
2.18.0

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

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

* [PATCH i-g-t 2/2] Add support for forcing specific module
  2018-07-07 23:24 ` [igt-dev] " Rodrigo Siqueira
@ 2018-07-07 23:25   ` Rodrigo Siqueira
  -1 siblings, 0 replies; 22+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:25 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

This commit adds a new option for forcing the use of a specific module
indicated via command line.  The force command expects a module name
which will be used on the target test (changing the standard behavior).

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/drmtest.c        | 33 +++++++++++++++++++++++++++------
 lib/igt_core.c       | 23 +++++++++++++++++++++++
 lib/igt_core.h       |  4 ++++
 scripts/run-tests.sh |  4 +++-
 4 files changed, 57 insertions(+), 7 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index eee733eb..a77e2231 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -247,6 +247,20 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
 		if (chipset & DRIVER_AMDGPU && is_amd_device(fd))
 			return fd;
 
+		// Force options
+		if (get_target_module() && chipset == DRIVER_ANY) {
+			if (__is_device(fd, get_target_module())) {
+				return fd;
+			}
+			else {
+				memset(name, 0, sizeof(name));
+				__get_drm_device_name(fd, name);
+				close(fd);
+				igt_kmod_unload(name, 0);
+				return -1;
+			}
+		}
+
 		/* Only VGEM-specific tests should be run on VGEM */
 		if (chipset == DRIVER_ANY && !is_vgem_device(fd))
 			return fd;
@@ -260,6 +274,7 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
 static int __open_driver(const char *base, int offset, unsigned int chipset)
 {
 	static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+	const char* target;
 	static const struct module {
 		unsigned int bit;
 		const char *module;
@@ -278,13 +293,19 @@ static int __open_driver(const char *base, int offset, unsigned int chipset)
 	if (fd != -1)
 		return fd;
 
+	target = get_target_module();
+
 	pthread_mutex_lock(&mutex);
-	for (const struct module *m = modules; m->module; m++) {
-		if (chipset & m->bit) {
-			if (m->modprobe)
-				m->modprobe(m->module);
-			else
-				modprobe(m->module);
+	if (target) {
+		modprobe(target);
+	} else {
+		for (const struct module *m = modules; m->module; m++) {
+			if (chipset & m->bit) {
+				if (m->modprobe)
+					m->modprobe(m->module);
+				else
+					modprobe(m->module);
+			}
 		}
 	}
 	pthread_mutex_unlock(&mutex);
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 5092a3f0..ee085e2a 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -286,6 +286,7 @@ enum {
  OPT_DESCRIPTION,
  OPT_DEBUG,
  OPT_INTERACTIVE_DEBUG,
+ OPT_FORCE_MODULE,
  OPT_HELP = 'h'
 };
 
@@ -303,6 +304,23 @@ static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
 GKeyFile *igt_key_file;
 #endif
 
+char *target_module = NULL;
+
+void set_target_module(char *target)
+{
+	if (!target)
+		igt_warn("No module specified, keep default behaviour");
+
+	target_module = target;
+}
+
+const char *get_target_module(void)
+{
+	if (target_module)
+		return target_module;
+	return NULL;
+}
+
 char *igt_frame_dump_path;
 
 const char *igt_test_name(void)
@@ -555,6 +573,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
 		   "  --debug[=log-domain]\n"
 		   "  --interactive-debug[=domain]\n"
 		   "  --help-description\n"
+		   "  --force-module <module>\n"
 		   "  --help\n");
 	if (help_str)
 		fprintf(f, "%s\n", help_str);
@@ -666,6 +685,7 @@ static int common_init(int *argc, char **argv,
 		{"debug", optional_argument, 0, OPT_DEBUG},
 		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
 		{"help", 0, 0, OPT_HELP},
+		{"force-module", required_argument, 0, OPT_FORCE_MODULE},
 		{0, 0, 0, 0}
 	};
 	char *short_opts;
@@ -763,6 +783,9 @@ static int common_init(int *argc, char **argv,
 			print_test_description();
 			ret = -1;
 			goto out;
+		case OPT_FORCE_MODULE:
+			set_target_module(strdup(optarg));
+			break;
 		case OPT_HELP:
 			print_usage(help_str, false);
 			ret = -1;
diff --git a/lib/igt_core.h b/lib/igt_core.h
index bf8cd66c..6d635ebd 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -50,6 +50,10 @@ extern const char* __igt_test_description __attribute__((weak));
 extern bool __igt_plain_output;
 extern char *igt_frame_dump_path;
 
+extern char *target_module;
+void set_target_module(char *target);
+const char *get_target_module(void);
+
 /**
  * IGT_TEST_DESCRIPTION:
  * @str: description string
diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh
index 4209dd8c..29aa50a8 100755
--- a/scripts/run-tests.sh
+++ b/scripts/run-tests.sh
@@ -80,6 +80,7 @@ function print_help {
 	echo "                  (can be used more than once)"
 	echo "  -T <filename>   run tests listed in testlist"
 	echo "                  (overrides -t and -x)"
+	echo "  -f <module>     force specific module load"
 	echo "  -v              enable verbose mode"
 	echo "  -x <regex>      exclude tests that match the regular expression"
 	echo "                  (can be used more than once)"
@@ -91,7 +92,7 @@ function print_help {
 	echo "Useful patterns for test filtering are described in the API documentation."
 }
 
-while getopts ":dhlr:st:T:vx:Rn" opt; do
+while getopts ":dhlr:st:T:m:vx:Rn" opt; do
 	case $opt in
 		d) download_piglit; exit ;;
 		h) print_help; exit ;;
@@ -100,6 +101,7 @@ while getopts ":dhlr:st:T:vx:Rn" opt; do
 		s) SUMMARY="html" ;;
 		t) FILTER="$FILTER -t $OPTARG" ;;
 		T) FILTER="$FILTER --test-list $OPTARG" ;;
+		f) FILTER="$FILTER --force-module $OPTARG" ;;
 		v) VERBOSE="-v" ;;
 		x) EXCLUDE="$EXCLUDE -x $OPTARG" ;;
 		R) RESUME="true" ;;
-- 
2.18.0

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

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

* [igt-dev] [PATCH i-g-t 2/2] Add support for forcing specific module
@ 2018-07-07 23:25   ` Rodrigo Siqueira
  0 siblings, 0 replies; 22+ messages in thread
From: Rodrigo Siqueira @ 2018-07-07 23:25 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, gustavo, intel-gfx

This commit adds a new option for forcing the use of a specific module
indicated via command line.  The force command expects a module name
which will be used on the target test (changing the standard behavior).

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
---
 lib/drmtest.c        | 33 +++++++++++++++++++++++++++------
 lib/igt_core.c       | 23 +++++++++++++++++++++++
 lib/igt_core.h       |  4 ++++
 scripts/run-tests.sh |  4 +++-
 4 files changed, 57 insertions(+), 7 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index eee733eb..a77e2231 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -247,6 +247,20 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
 		if (chipset & DRIVER_AMDGPU && is_amd_device(fd))
 			return fd;
 
+		// Force options
+		if (get_target_module() && chipset == DRIVER_ANY) {
+			if (__is_device(fd, get_target_module())) {
+				return fd;
+			}
+			else {
+				memset(name, 0, sizeof(name));
+				__get_drm_device_name(fd, name);
+				close(fd);
+				igt_kmod_unload(name, 0);
+				return -1;
+			}
+		}
+
 		/* Only VGEM-specific tests should be run on VGEM */
 		if (chipset == DRIVER_ANY && !is_vgem_device(fd))
 			return fd;
@@ -260,6 +274,7 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
 static int __open_driver(const char *base, int offset, unsigned int chipset)
 {
 	static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+	const char* target;
 	static const struct module {
 		unsigned int bit;
 		const char *module;
@@ -278,13 +293,19 @@ static int __open_driver(const char *base, int offset, unsigned int chipset)
 	if (fd != -1)
 		return fd;
 
+	target = get_target_module();
+
 	pthread_mutex_lock(&mutex);
-	for (const struct module *m = modules; m->module; m++) {
-		if (chipset & m->bit) {
-			if (m->modprobe)
-				m->modprobe(m->module);
-			else
-				modprobe(m->module);
+	if (target) {
+		modprobe(target);
+	} else {
+		for (const struct module *m = modules; m->module; m++) {
+			if (chipset & m->bit) {
+				if (m->modprobe)
+					m->modprobe(m->module);
+				else
+					modprobe(m->module);
+			}
 		}
 	}
 	pthread_mutex_unlock(&mutex);
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 5092a3f0..ee085e2a 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -286,6 +286,7 @@ enum {
  OPT_DESCRIPTION,
  OPT_DEBUG,
  OPT_INTERACTIVE_DEBUG,
+ OPT_FORCE_MODULE,
  OPT_HELP = 'h'
 };
 
@@ -303,6 +304,23 @@ static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
 GKeyFile *igt_key_file;
 #endif
 
+char *target_module = NULL;
+
+void set_target_module(char *target)
+{
+	if (!target)
+		igt_warn("No module specified, keep default behaviour");
+
+	target_module = target;
+}
+
+const char *get_target_module(void)
+{
+	if (target_module)
+		return target_module;
+	return NULL;
+}
+
 char *igt_frame_dump_path;
 
 const char *igt_test_name(void)
@@ -555,6 +573,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
 		   "  --debug[=log-domain]\n"
 		   "  --interactive-debug[=domain]\n"
 		   "  --help-description\n"
+		   "  --force-module <module>\n"
 		   "  --help\n");
 	if (help_str)
 		fprintf(f, "%s\n", help_str);
@@ -666,6 +685,7 @@ static int common_init(int *argc, char **argv,
 		{"debug", optional_argument, 0, OPT_DEBUG},
 		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
 		{"help", 0, 0, OPT_HELP},
+		{"force-module", required_argument, 0, OPT_FORCE_MODULE},
 		{0, 0, 0, 0}
 	};
 	char *short_opts;
@@ -763,6 +783,9 @@ static int common_init(int *argc, char **argv,
 			print_test_description();
 			ret = -1;
 			goto out;
+		case OPT_FORCE_MODULE:
+			set_target_module(strdup(optarg));
+			break;
 		case OPT_HELP:
 			print_usage(help_str, false);
 			ret = -1;
diff --git a/lib/igt_core.h b/lib/igt_core.h
index bf8cd66c..6d635ebd 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -50,6 +50,10 @@ extern const char* __igt_test_description __attribute__((weak));
 extern bool __igt_plain_output;
 extern char *igt_frame_dump_path;
 
+extern char *target_module;
+void set_target_module(char *target);
+const char *get_target_module(void);
+
 /**
  * IGT_TEST_DESCRIPTION:
  * @str: description string
diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh
index 4209dd8c..29aa50a8 100755
--- a/scripts/run-tests.sh
+++ b/scripts/run-tests.sh
@@ -80,6 +80,7 @@ function print_help {
 	echo "                  (can be used more than once)"
 	echo "  -T <filename>   run tests listed in testlist"
 	echo "                  (overrides -t and -x)"
+	echo "  -f <module>     force specific module load"
 	echo "  -v              enable verbose mode"
 	echo "  -x <regex>      exclude tests that match the regular expression"
 	echo "                  (can be used more than once)"
@@ -91,7 +92,7 @@ function print_help {
 	echo "Useful patterns for test filtering are described in the API documentation."
 }
 
-while getopts ":dhlr:st:T:vx:Rn" opt; do
+while getopts ":dhlr:st:T:m:vx:Rn" opt; do
 	case $opt in
 		d) download_piglit; exit ;;
 		h) print_help; exit ;;
@@ -100,6 +101,7 @@ while getopts ":dhlr:st:T:vx:Rn" opt; do
 		s) SUMMARY="html" ;;
 		t) FILTER="$FILTER -t $OPTARG" ;;
 		T) FILTER="$FILTER --test-list $OPTARG" ;;
+		f) FILTER="$FILTER --force-module $OPTARG" ;;
 		v) VERBOSE="-v" ;;
 		x) EXCLUDE="$EXCLUDE -x $OPTARG" ;;
 		R) RESUME="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] 22+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for Add support to force specific module load (rev2)
  2018-07-07 23:24 ` [igt-dev] " Rodrigo Siqueira
                   ` (2 preceding siblings ...)
  (?)
@ 2018-07-08  0:03 ` Patchwork
  -1 siblings, 0 replies; 22+ messages in thread
From: Patchwork @ 2018-07-08  0:03 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev

== Series Details ==

Series: Add support to force specific module load (rev2)
URL   : https://patchwork.freedesktop.org/series/43912/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4445 -> IGTPW_1543 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/43912/revisions/2/mbox/

== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_frontbuffer_tracking@basic:
      fi-bxt-j4205:       PASS -> FAIL (fdo#103167)
      fi-skl-6700hq:      PASS -> FAIL (fdo#103167)
      fi-bxt-dsi:         PASS -> FAIL (fdo#103167)
      fi-skl-6700k2:      PASS -> FAIL (fdo#103167)
      fi-kbl-7560u:       PASS -> FAIL (fdo#103167)
      fi-skl-6600u:       PASS -> FAIL (fdo#103167)
      fi-kbl-r:           PASS -> FAIL (fdo#103167)
      {fi-cfl-8109u}:     NOTRUN -> FAIL (fdo#103167)
      fi-skl-6260u:       PASS -> FAIL (fdo#103167)
      fi-skl-6770hq:      PASS -> FAIL (fdo#103167)
      fi-cfl-guc:         PASS -> FAIL (fdo#103167)
      fi-cfl-s3:          PASS -> FAIL (fdo#103167)
      fi-whl-u:           PASS -> FAIL (fdo#103167)
      fi-cfl-8700k:       PASS -> FAIL (fdo#103167)
      fi-kbl-7500u:       PASS -> FAIL (fdo#103167)
      fi-kbl-7567u:       PASS -> FAIL (fdo#103167)
      fi-skl-guc:         PASS -> FAIL (fdo#103167)
      fi-glk-j4005:       PASS -> FAIL (fdo#103167)
      fi-glk-dsi:         PASS -> FAIL (fdo#103167)
      fi-skl-gvtdvm:      PASS -> FAIL (fdo#103167)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-snb-2520m:       PASS -> INCOMPLETE (fdo#103713)

    
    ==== Possible fixes ====

    igt@gem_exec_suspend@basic-s3:
      {fi-cfl-8109u}:     INCOMPLETE -> PASS

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

  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713


== Participating hosts (47 -> 41) ==

  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-kbl-8809g 


== Build changes ==

    * IGT: IGT_4540 -> IGTPW_1543

  CI_DRM_4445: 366234e5605ce58f732d2aeb83c713dde6b7c85c @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1543: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1543/
  IGT_4540: 78071c2fa53db2f04b8eddc6e6118be4fbc5c2fe @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

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

* [igt-dev] ✗ Fi.CI.IGT: failure for Add support to force specific module load (rev2)
  2018-07-07 23:24 ` [igt-dev] " Rodrigo Siqueira
                   ` (3 preceding siblings ...)
  (?)
@ 2018-07-08  7:45 ` Patchwork
  -1 siblings, 0 replies; 22+ messages in thread
From: Patchwork @ 2018-07-08  7:45 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev

== Series Details ==

Series: Add support to force specific module load (rev2)
URL   : https://patchwork.freedesktop.org/series/43912/
State : failure

== Summary ==

= CI Bug Log - changes from IGT_4540_full -> IGTPW_1543_full =

== Summary - FAILURE ==

  Serious unknown changes coming with IGTPW_1543_full absolutely need to be
  verified manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in IGTPW_1543_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/43912/revisions/2/mbox/

== Possible new issues ==

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

  === IGT changes ===

    ==== Possible regressions ====

    igt@kms_draw_crc@draw-method-xrgb8888-render-untiled:
      shard-glk:          PASS -> FAIL +5
      shard-kbl:          PASS -> FAIL +1

    igt@kms_draw_crc@draw-method-xrgb8888-render-xtiled:
      shard-apl:          PASS -> FAIL +1

    
    ==== Warnings ====

    igt@gem_exec_schedule@deep-bsd1:
      shard-kbl:          PASS -> SKIP +1

    igt@gem_mocs_settings@mocs-rc6-ctx-render:
      shard-kbl:          SKIP -> PASS

    
== Known issues ==

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

  === IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_gtt:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665, fdo#107127)

    igt@gem_busy@busy-bsd2:
      shard-snb:          SKIP -> INCOMPLETE (fdo#105411)

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

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

    igt@kms_draw_crc@draw-method-xrgb2101010-render-untiled:
      shard-apl:          PASS -> FAIL (fdo#103184) +2

    igt@kms_draw_crc@draw-method-xrgb2101010-render-xtiled:
      shard-kbl:          PASS -> FAIL (fdo#103184) +2

    igt@kms_draw_crc@draw-method-xrgb8888-render-ytiled:
      shard-apl:          PASS -> FAIL (fdo#103232)
      shard-glk:          PASS -> FAIL (fdo#103232)
      shard-kbl:          PASS -> FAIL (fdo#103232)

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

    igt@kms_flip@flip-vs-wf_vblank-interruptible:
      shard-glk:          PASS -> FAIL (fdo#103928)

    igt@kms_flip_tiling@flip-x-tiled:
      shard-glk:          PASS -> FAIL (fdo#103822) +1

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-render:
      shard-apl:          PASS -> FAIL (fdo#103167) +5

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-render:
      shard-kbl:          PASS -> FAIL (fdo#103167) +5

    igt@kms_frontbuffer_tracking@fbc-2p-pri-indfb-multidraw:
      shard-glk:          PASS -> FAIL (fdo#103167) +10

    igt@kms_plane_lowres@pipe-a-tiling-x:
      shard-glk:          PASS -> FAIL (fdo#103166)

    igt@kms_rotation_crc@primary-rotation-180:
      shard-snb:          PASS -> FAIL (fdo#103925)

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

    
    ==== Possible fixes ====

    igt@kms_flip@2x-plain-flip-ts-check-interruptible:
      shard-glk:          FAIL (fdo#100368) -> PASS

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

    igt@kms_flip_tiling@flip-to-y-tiled:
      shard-glk:          FAIL (fdo#103822) -> PASS

    igt@kms_frontbuffer_tracking@fbc-1p-indfb-fliptrack:
      shard-snb:          INCOMPLETE (fdo#105411) -> PASS

    igt@testdisplay:
      shard-glk:          INCOMPLETE (k.org#198133, fdo#103359) -> PASS

    
    ==== Warnings ====

    igt@drv_selftest@live_gtt:
      shard-apl:          FAIL (fdo#105347, fdo#107127) -> INCOMPLETE (fdo#103927, fdo#107127)

    
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
  fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
  fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
  fdo#103184 https://bugs.freedesktop.org/show_bug.cgi?id=103184
  fdo#103232 https://bugs.freedesktop.org/show_bug.cgi?id=103232
  fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
  fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
  fdo#103822 https://bugs.freedesktop.org/show_bug.cgi?id=103822
  fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
  fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927
  fdo#103928 https://bugs.freedesktop.org/show_bug.cgi?id=103928
  fdo#105189 https://bugs.freedesktop.org/show_bug.cgi?id=105189
  fdo#105347 https://bugs.freedesktop.org/show_bug.cgi?id=105347
  fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
  fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
  fdo#107127 https://bugs.freedesktop.org/show_bug.cgi?id=107127
  fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
  k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133


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

  No changes in participating hosts


== Build changes ==

    * IGT: IGT_4540 -> IGTPW_1543
    * Linux: CI_DRM_4443 -> CI_DRM_4445

  CI_DRM_4443: 5c43ea095bbd1469a9c767529537ddf0434acc60 @ git://anongit.freedesktop.org/gfx-ci/linux
  CI_DRM_4445: 366234e5605ce58f732d2aeb83c713dde6b7c85c @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_1543: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1543/
  IGT_4540: 78071c2fa53db2f04b8eddc6e6118be4fbc5c2fe @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

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

* Re: [PATCH i-g-t 0/2] Add support to force specific module load
  2018-07-07 23:24 ` [igt-dev] " Rodrigo Siqueira
@ 2018-08-20 13:33   ` Rodrigo Siqueira
  -1 siblings, 0 replies; 22+ messages in thread
From: Rodrigo Siqueira @ 2018-08-20 13:33 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, intel-gfx

Hi,

I would like to know if there is any improvement that I can do for this
patchset.

Thanks

On 07/07, Rodrigo Siqueira wrote:
> This patchset adds support for forcing a specific module to be loaded
> via command line. This feature can bring benefits for developers that
> need to create a new module since they can use IGT as a base test to
> guide their development (Test-driven development - TDD ). The first
> patch, expand the size of the module name accepted by IGT to make
> possible that modules with larger names can be loaded. The second patch
> has the force option implementation.
> 
> The discussion about this feature started with an RFC named "[PATCH
> i-g-t] [RFC] Add support to force specific module load", link:
> https://www.spinics.net/lists/intel-gfx/msg166764.html
> 
> Rodrigo Siqueira (2):
>   Increase the string size for a module name
>   Add support for forcing specific module
> 
>  lib/drmtest.c        | 39 +++++++++++++++++++++++++++++++--------
>  lib/igt_core.c       | 23 +++++++++++++++++++++++
>  lib/igt_core.h       |  4 ++++
>  scripts/run-tests.sh |  4 +++-
>  4 files changed, 61 insertions(+), 9 deletions(-)
> 
> -- 
> 2.18.0
> 

-- 
Rodrigo Siqueira
http://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [PATCH i-g-t 0/2] Add support to force specific module load
@ 2018-08-20 13:33   ` Rodrigo Siqueira
  0 siblings, 0 replies; 22+ messages in thread
From: Rodrigo Siqueira @ 2018-08-20 13:33 UTC (permalink / raw)
  To: Petri Latvala, Arkadiusz Hiler; +Cc: igt-dev, gustavo, intel-gfx

Hi,

I would like to know if there is any improvement that I can do for this
patchset.

Thanks

On 07/07, Rodrigo Siqueira wrote:
> This patchset adds support for forcing a specific module to be loaded
> via command line. This feature can bring benefits for developers that
> need to create a new module since they can use IGT as a base test to
> guide their development (Test-driven development - TDD ). The first
> patch, expand the size of the module name accepted by IGT to make
> possible that modules with larger names can be loaded. The second patch
> has the force option implementation.
> 
> The discussion about this feature started with an RFC named "[PATCH
> i-g-t] [RFC] Add support to force specific module load", link:
> https://www.spinics.net/lists/intel-gfx/msg166764.html
> 
> Rodrigo Siqueira (2):
>   Increase the string size for a module name
>   Add support for forcing specific module
> 
>  lib/drmtest.c        | 39 +++++++++++++++++++++++++++++++--------
>  lib/igt_core.c       | 23 +++++++++++++++++++++++
>  lib/igt_core.h       |  4 ++++
>  scripts/run-tests.sh |  4 +++-
>  4 files changed, 61 insertions(+), 9 deletions(-)
> 
> -- 
> 2.18.0
> 

-- 
Rodrigo Siqueira
http://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [PATCH i-g-t 1/2] Increase the string size for a module name
  2018-07-07 23:24   ` [Intel-gfx] " Rodrigo Siqueira
@ 2018-08-21  9:13     ` Petri Latvala
  -1 siblings, 0 replies; 22+ messages in thread
From: Petri Latvala @ 2018-08-21  9:13 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Sat, Jul 07, 2018 at 08:24:39PM -0300, Rodrigo Siqueira wrote:
> Some modules name are larger than 5 characters, this can be a problem to
> add support for other modules. This patch, increase the maximum size in
> order to enable other modules to use IGT.
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  lib/drmtest.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index fae6f86f..eee733eb 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -60,6 +60,8 @@
>  #include "ioctl_wrappers.h"
>  #include "igt_dummyload.h"
>  
> +#define NAME_LEN 32
> +
>  /**
>   * SECTION:drmtest
>   * @short_description: Base library for drm tests and tools
> @@ -82,7 +84,7 @@ static int __get_drm_device_name(int fd, char *name)
>  	drm_version_t version;
>  
>  	memset(&version, 0, sizeof(version));
> -	version.name_len = 4;
> +	version.name_len = NAME_LEN;
>  	version.name = name;
>  
>  	if (!drmIoctl(fd, DRM_IOCTL_VERSION, &version)){
> @@ -94,7 +96,7 @@ static int __get_drm_device_name(int fd, char *name)
>  
>  static bool __is_device(int fd, const char *expect)
>  {
> -	char name[5] = "";
> +	char name[NAME_LEN] = "";

This would need to be NAME_LEN + 1 to have room for the
null-termination.

But, is this patch really necessary? Are there false matches from
using a substring of 4 to match driver names?



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

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

* Re: [Intel-gfx] [PATCH i-g-t 1/2] Increase the string size for a module name
@ 2018-08-21  9:13     ` Petri Latvala
  0 siblings, 0 replies; 22+ messages in thread
From: Petri Latvala @ 2018-08-21  9:13 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Sat, Jul 07, 2018 at 08:24:39PM -0300, Rodrigo Siqueira wrote:
> Some modules name are larger than 5 characters, this can be a problem to
> add support for other modules. This patch, increase the maximum size in
> order to enable other modules to use IGT.
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  lib/drmtest.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index fae6f86f..eee733eb 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -60,6 +60,8 @@
>  #include "ioctl_wrappers.h"
>  #include "igt_dummyload.h"
>  
> +#define NAME_LEN 32
> +
>  /**
>   * SECTION:drmtest
>   * @short_description: Base library for drm tests and tools
> @@ -82,7 +84,7 @@ static int __get_drm_device_name(int fd, char *name)
>  	drm_version_t version;
>  
>  	memset(&version, 0, sizeof(version));
> -	version.name_len = 4;
> +	version.name_len = NAME_LEN;
>  	version.name = name;
>  
>  	if (!drmIoctl(fd, DRM_IOCTL_VERSION, &version)){
> @@ -94,7 +96,7 @@ static int __get_drm_device_name(int fd, char *name)
>  
>  static bool __is_device(int fd, const char *expect)
>  {
> -	char name[5] = "";
> +	char name[NAME_LEN] = "";

This would need to be NAME_LEN + 1 to have room for the
null-termination.

But, is this patch really necessary? Are there false matches from
using a substring of 4 to match driver names?



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

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

* Re: [PATCH i-g-t 2/2] Add support for forcing specific module
  2018-07-07 23:25   ` [igt-dev] " Rodrigo Siqueira
@ 2018-08-21  9:43     ` Petri Latvala
  -1 siblings, 0 replies; 22+ messages in thread
From: Petri Latvala @ 2018-08-21  9:43 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Sat, Jul 07, 2018 at 08:25:07PM -0300, Rodrigo Siqueira wrote:
> This commit adds a new option for forcing the use of a specific module
> indicated via command line.  The force command expects a module name
> which will be used on the target test (changing the standard behavior).
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  lib/drmtest.c        | 33 +++++++++++++++++++++++++++------
>  lib/igt_core.c       | 23 +++++++++++++++++++++++
>  lib/igt_core.h       |  4 ++++
>  scripts/run-tests.sh |  4 +++-
>  4 files changed, 57 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index eee733eb..a77e2231 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -247,6 +247,20 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
>  		if (chipset & DRIVER_AMDGPU && is_amd_device(fd))
>  			return fd;
>  
> +		// Force options
> +		if (get_target_module() && chipset == DRIVER_ANY) {
> +			if (__is_device(fd, get_target_module())) {
> +				return fd;
> +			}
> +			else {
> +				memset(name, 0, sizeof(name));
> +				__get_drm_device_name(fd, name);
> +				close(fd);
> +				igt_kmod_unload(name, 0);
> +				return -1;
> +			}
> +		}
> +


You're unloading modules (which you shouldn't need to do here anyway),
and even worse, unloading them if the first loop iteration doesn't
land on the forced name.

This chunk needs to be before the matches for the known bits for
DRIVER_ANY or you'll just get one of them when forcing a custom name.



>  		/* Only VGEM-specific tests should be run on VGEM */
>  		if (chipset == DRIVER_ANY && !is_vgem_device(fd))
>  			return fd;
> @@ -260,6 +274,7 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
>  static int __open_driver(const char *base, int offset, unsigned int chipset)
>  {
>  	static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
> +	const char* target;
>  	static const struct module {
>  		unsigned int bit;
>  		const char *module;
> @@ -278,13 +293,19 @@ static int __open_driver(const char *base, int offset, unsigned int chipset)
>  	if (fd != -1)
>  		return fd;
>  
> +	target = get_target_module();
> +
>  	pthread_mutex_lock(&mutex);
> -	for (const struct module *m = modules; m->module; m++) {
> -		if (chipset & m->bit) {
> -			if (m->modprobe)
> -				m->modprobe(m->module);
> -			else
> -				modprobe(m->module);
> +	if (target) {
> +		modprobe(target);
> +	} else {


The name of the driver (as returned by DRM_IOCTL_VERSION) doesn't have
to match the kernel module filename. Case in point: virtio-gpu.ko is
"virtio_gpu".

I would suggest leaving the kernel module loading plans later for now
and get the DRIVER_ANY match forcing in place. Or even forget kernel
module loading entirely. If the user is able to set a parameter to a
module name, the user can load the module themselves before running
tests. It won't get unloaded if IGT doesn't have a test that does it,
and it won't have such a test unless it knows about the
driver/module. And at that point, IGT will know how to load that
module.



> +		for (const struct module *m = modules; m->module; m++) {
> +			if (chipset & m->bit) {
> +				if (m->modprobe)
> +					m->modprobe(m->module);
> +				else
> +					modprobe(m->module);
> +			}
>  		}
>  	}
>  	pthread_mutex_unlock(&mutex);
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 5092a3f0..ee085e2a 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -286,6 +286,7 @@ enum {
>   OPT_DESCRIPTION,
>   OPT_DEBUG,
>   OPT_INTERACTIVE_DEBUG,
> + OPT_FORCE_MODULE,
>   OPT_HELP = 'h'
>  };
>  
> @@ -303,6 +304,23 @@ static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
>  GKeyFile *igt_key_file;
>  #endif
>  
> +char *target_module = NULL;
> +
> +void set_target_module(char *target)
> +{
> +	if (!target)
> +		igt_warn("No module specified, keep default behaviour");
> +
> +	target_module = target;
> +}
> +
> +const char *get_target_module(void)
> +{
> +	if (target_module)
> +		return target_module;
> +	return NULL;
> +}
> +
>  char *igt_frame_dump_path;
>  
>  const char *igt_test_name(void)
> @@ -555,6 +573,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
>  		   "  --debug[=log-domain]\n"
>  		   "  --interactive-debug[=domain]\n"
>  		   "  --help-description\n"
> +		   "  --force-module <module>\n"
>  		   "  --help\n");
>  	if (help_str)
>  		fprintf(f, "%s\n", help_str);
> @@ -666,6 +685,7 @@ static int common_init(int *argc, char **argv,
>  		{"debug", optional_argument, 0, OPT_DEBUG},
>  		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
>  		{"help", 0, 0, OPT_HELP},
> +		{"force-module", required_argument, 0, OPT_FORCE_MODULE},
>  		{0, 0, 0, 0}
>  	};
>  	char *short_opts;
> @@ -763,6 +783,9 @@ static int common_init(int *argc, char **argv,
>  			print_test_description();
>  			ret = -1;
>  			goto out;
> +		case OPT_FORCE_MODULE:
> +			set_target_module(strdup(optarg));
> +			break;
>  		case OPT_HELP:
>  			print_usage(help_str, false);
>  			ret = -1;
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index bf8cd66c..6d635ebd 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -50,6 +50,10 @@ extern const char* __igt_test_description __attribute__((weak));
>  extern bool __igt_plain_output;
>  extern char *igt_frame_dump_path;
>  
> +extern char *target_module;
> +void set_target_module(char *target);
> +const char *get_target_module(void);
> +
>  /**
>   * IGT_TEST_DESCRIPTION:
>   * @str: description string
> diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh
> index 4209dd8c..29aa50a8 100755
> --- a/scripts/run-tests.sh
> +++ b/scripts/run-tests.sh
> @@ -80,6 +80,7 @@ function print_help {
>  	echo "                  (can be used more than once)"
>  	echo "  -T <filename>   run tests listed in testlist"
>  	echo "                  (overrides -t and -x)"
> +	echo "  -f <module>     force specific module load"
>  	echo "  -v              enable verbose mode"
>  	echo "  -x <regex>      exclude tests that match the regular expression"
>  	echo "                  (can be used more than once)"
> @@ -91,7 +92,7 @@ function print_help {
>  	echo "Useful patterns for test filtering are described in the API documentation."
>  }
>  
> -while getopts ":dhlr:st:T:vx:Rn" opt; do
> +while getopts ":dhlr:st:T:m:vx:Rn" opt; do
>  	case $opt in
>  		d) download_piglit; exit ;;
>  		h) print_help; exit ;;
> @@ -100,6 +101,7 @@ while getopts ":dhlr:st:T:vx:Rn" opt; do
>  		s) SUMMARY="html" ;;
>  		t) FILTER="$FILTER -t $OPTARG" ;;
>  		T) FILTER="$FILTER --test-list $OPTARG" ;;
> +		f) FILTER="$FILTER --force-module $OPTARG" ;;


This command line is given to piglit, not the IGT tests.

Furthermore, run-tests.sh is not required to run tests. One can
execute piglit or igt_runner directly.

Rather, consider having the force driver name passed via environment
variables.


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

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

* Re: [Intel-gfx] [PATCH i-g-t 2/2] Add support for forcing specific module
@ 2018-08-21  9:43     ` Petri Latvala
  0 siblings, 0 replies; 22+ messages in thread
From: Petri Latvala @ 2018-08-21  9:43 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Sat, Jul 07, 2018 at 08:25:07PM -0300, Rodrigo Siqueira wrote:
> This commit adds a new option for forcing the use of a specific module
> indicated via command line.  The force command expects a module name
> which will be used on the target test (changing the standard behavior).
> 
> Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> ---
>  lib/drmtest.c        | 33 +++++++++++++++++++++++++++------
>  lib/igt_core.c       | 23 +++++++++++++++++++++++
>  lib/igt_core.h       |  4 ++++
>  scripts/run-tests.sh |  4 +++-
>  4 files changed, 57 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/drmtest.c b/lib/drmtest.c
> index eee733eb..a77e2231 100644
> --- a/lib/drmtest.c
> +++ b/lib/drmtest.c
> @@ -247,6 +247,20 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
>  		if (chipset & DRIVER_AMDGPU && is_amd_device(fd))
>  			return fd;
>  
> +		// Force options
> +		if (get_target_module() && chipset == DRIVER_ANY) {
> +			if (__is_device(fd, get_target_module())) {
> +				return fd;
> +			}
> +			else {
> +				memset(name, 0, sizeof(name));
> +				__get_drm_device_name(fd, name);
> +				close(fd);
> +				igt_kmod_unload(name, 0);
> +				return -1;
> +			}
> +		}
> +


You're unloading modules (which you shouldn't need to do here anyway),
and even worse, unloading them if the first loop iteration doesn't
land on the forced name.

This chunk needs to be before the matches for the known bits for
DRIVER_ANY or you'll just get one of them when forcing a custom name.



>  		/* Only VGEM-specific tests should be run on VGEM */
>  		if (chipset == DRIVER_ANY && !is_vgem_device(fd))
>  			return fd;
> @@ -260,6 +274,7 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
>  static int __open_driver(const char *base, int offset, unsigned int chipset)
>  {
>  	static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
> +	const char* target;
>  	static const struct module {
>  		unsigned int bit;
>  		const char *module;
> @@ -278,13 +293,19 @@ static int __open_driver(const char *base, int offset, unsigned int chipset)
>  	if (fd != -1)
>  		return fd;
>  
> +	target = get_target_module();
> +
>  	pthread_mutex_lock(&mutex);
> -	for (const struct module *m = modules; m->module; m++) {
> -		if (chipset & m->bit) {
> -			if (m->modprobe)
> -				m->modprobe(m->module);
> -			else
> -				modprobe(m->module);
> +	if (target) {
> +		modprobe(target);
> +	} else {


The name of the driver (as returned by DRM_IOCTL_VERSION) doesn't have
to match the kernel module filename. Case in point: virtio-gpu.ko is
"virtio_gpu".

I would suggest leaving the kernel module loading plans later for now
and get the DRIVER_ANY match forcing in place. Or even forget kernel
module loading entirely. If the user is able to set a parameter to a
module name, the user can load the module themselves before running
tests. It won't get unloaded if IGT doesn't have a test that does it,
and it won't have such a test unless it knows about the
driver/module. And at that point, IGT will know how to load that
module.



> +		for (const struct module *m = modules; m->module; m++) {
> +			if (chipset & m->bit) {
> +				if (m->modprobe)
> +					m->modprobe(m->module);
> +				else
> +					modprobe(m->module);
> +			}
>  		}
>  	}
>  	pthread_mutex_unlock(&mutex);
> diff --git a/lib/igt_core.c b/lib/igt_core.c
> index 5092a3f0..ee085e2a 100644
> --- a/lib/igt_core.c
> +++ b/lib/igt_core.c
> @@ -286,6 +286,7 @@ enum {
>   OPT_DESCRIPTION,
>   OPT_DEBUG,
>   OPT_INTERACTIVE_DEBUG,
> + OPT_FORCE_MODULE,
>   OPT_HELP = 'h'
>  };
>  
> @@ -303,6 +304,23 @@ static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
>  GKeyFile *igt_key_file;
>  #endif
>  
> +char *target_module = NULL;
> +
> +void set_target_module(char *target)
> +{
> +	if (!target)
> +		igt_warn("No module specified, keep default behaviour");
> +
> +	target_module = target;
> +}
> +
> +const char *get_target_module(void)
> +{
> +	if (target_module)
> +		return target_module;
> +	return NULL;
> +}
> +
>  char *igt_frame_dump_path;
>  
>  const char *igt_test_name(void)
> @@ -555,6 +573,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
>  		   "  --debug[=log-domain]\n"
>  		   "  --interactive-debug[=domain]\n"
>  		   "  --help-description\n"
> +		   "  --force-module <module>\n"
>  		   "  --help\n");
>  	if (help_str)
>  		fprintf(f, "%s\n", help_str);
> @@ -666,6 +685,7 @@ static int common_init(int *argc, char **argv,
>  		{"debug", optional_argument, 0, OPT_DEBUG},
>  		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
>  		{"help", 0, 0, OPT_HELP},
> +		{"force-module", required_argument, 0, OPT_FORCE_MODULE},
>  		{0, 0, 0, 0}
>  	};
>  	char *short_opts;
> @@ -763,6 +783,9 @@ static int common_init(int *argc, char **argv,
>  			print_test_description();
>  			ret = -1;
>  			goto out;
> +		case OPT_FORCE_MODULE:
> +			set_target_module(strdup(optarg));
> +			break;
>  		case OPT_HELP:
>  			print_usage(help_str, false);
>  			ret = -1;
> diff --git a/lib/igt_core.h b/lib/igt_core.h
> index bf8cd66c..6d635ebd 100644
> --- a/lib/igt_core.h
> +++ b/lib/igt_core.h
> @@ -50,6 +50,10 @@ extern const char* __igt_test_description __attribute__((weak));
>  extern bool __igt_plain_output;
>  extern char *igt_frame_dump_path;
>  
> +extern char *target_module;
> +void set_target_module(char *target);
> +const char *get_target_module(void);
> +
>  /**
>   * IGT_TEST_DESCRIPTION:
>   * @str: description string
> diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh
> index 4209dd8c..29aa50a8 100755
> --- a/scripts/run-tests.sh
> +++ b/scripts/run-tests.sh
> @@ -80,6 +80,7 @@ function print_help {
>  	echo "                  (can be used more than once)"
>  	echo "  -T <filename>   run tests listed in testlist"
>  	echo "                  (overrides -t and -x)"
> +	echo "  -f <module>     force specific module load"
>  	echo "  -v              enable verbose mode"
>  	echo "  -x <regex>      exclude tests that match the regular expression"
>  	echo "                  (can be used more than once)"
> @@ -91,7 +92,7 @@ function print_help {
>  	echo "Useful patterns for test filtering are described in the API documentation."
>  }
>  
> -while getopts ":dhlr:st:T:vx:Rn" opt; do
> +while getopts ":dhlr:st:T:m:vx:Rn" opt; do
>  	case $opt in
>  		d) download_piglit; exit ;;
>  		h) print_help; exit ;;
> @@ -100,6 +101,7 @@ while getopts ":dhlr:st:T:vx:Rn" opt; do
>  		s) SUMMARY="html" ;;
>  		t) FILTER="$FILTER -t $OPTARG" ;;
>  		T) FILTER="$FILTER --test-list $OPTARG" ;;
> +		f) FILTER="$FILTER --force-module $OPTARG" ;;


This command line is given to piglit, not the IGT tests.

Furthermore, run-tests.sh is not required to run tests. One can
execute piglit or igt_runner directly.

Rather, consider having the force driver name passed via environment
variables.


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

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

* Re: [PATCH i-g-t 1/2] Increase the string size for a module name
  2018-08-21  9:13     ` [Intel-gfx] " Petri Latvala
@ 2018-08-21 13:57       ` Rodrigo Siqueira
  -1 siblings, 0 replies; 22+ messages in thread
From: Rodrigo Siqueira @ 2018-08-21 13:57 UTC (permalink / raw)
  To: Arkadiusz Hiler, gustavo, igt-dev, intel-gfx

On 08/21, Petri Latvala wrote:
> On Sat, Jul 07, 2018 at 08:24:39PM -0300, Rodrigo Siqueira wrote:
> > Some modules name are larger than 5 characters, this can be a problem to
> > add support for other modules. This patch, increase the maximum size in
> > order to enable other modules to use IGT.
> > 
> > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > ---
> >  lib/drmtest.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/lib/drmtest.c b/lib/drmtest.c
> > index fae6f86f..eee733eb 100644
> > --- a/lib/drmtest.c
> > +++ b/lib/drmtest.c
> > @@ -60,6 +60,8 @@
> >  #include "ioctl_wrappers.h"
> >  #include "igt_dummyload.h"
> >  
> > +#define NAME_LEN 32
> > +
> >  /**
> >   * SECTION:drmtest
> >   * @short_description: Base library for drm tests and tools
> > @@ -82,7 +84,7 @@ static int __get_drm_device_name(int fd, char *name)
> >  	drm_version_t version;
> >  
> >  	memset(&version, 0, sizeof(version));
> > -	version.name_len = 4;
> > +	version.name_len = NAME_LEN;
> >  	version.name = name;
> >  
> >  	if (!drmIoctl(fd, DRM_IOCTL_VERSION, &version)){
> > @@ -94,7 +96,7 @@ static int __get_drm_device_name(int fd, char *name)
> >  
> >  static bool __is_device(int fd, const char *expect)
> >  {
> > -	char name[5] = "";
> > +	char name[NAME_LEN] = "";
> 
> This would need to be NAME_LEN + 1 to have room for the
> null-termination.
> 
> But, is this patch really necessary? Are there false matches from
> using a substring of 4 to match driver names?

Hi,

To test the force option, I used two drivers: Bochs and VKMS. I noticed
that Bochs failed to load because the module name is "bochs-drm".
Additionally, if we want to add a force option, I assume that someone
can have a module name larger than four characters. Make sense? Or Did I
missed something?

Thanks for your feedback

> 
> -- 
> Petri Latvala

-- 
Rodrigo Siqueira
http://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [PATCH i-g-t 1/2] Increase the string size for a module name
@ 2018-08-21 13:57       ` Rodrigo Siqueira
  0 siblings, 0 replies; 22+ messages in thread
From: Rodrigo Siqueira @ 2018-08-21 13:57 UTC (permalink / raw)
  To: Arkadiusz Hiler, gustavo, igt-dev, intel-gfx

On 08/21, Petri Latvala wrote:
> On Sat, Jul 07, 2018 at 08:24:39PM -0300, Rodrigo Siqueira wrote:
> > Some modules name are larger than 5 characters, this can be a problem to
> > add support for other modules. This patch, increase the maximum size in
> > order to enable other modules to use IGT.
> > 
> > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > ---
> >  lib/drmtest.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/lib/drmtest.c b/lib/drmtest.c
> > index fae6f86f..eee733eb 100644
> > --- a/lib/drmtest.c
> > +++ b/lib/drmtest.c
> > @@ -60,6 +60,8 @@
> >  #include "ioctl_wrappers.h"
> >  #include "igt_dummyload.h"
> >  
> > +#define NAME_LEN 32
> > +
> >  /**
> >   * SECTION:drmtest
> >   * @short_description: Base library for drm tests and tools
> > @@ -82,7 +84,7 @@ static int __get_drm_device_name(int fd, char *name)
> >  	drm_version_t version;
> >  
> >  	memset(&version, 0, sizeof(version));
> > -	version.name_len = 4;
> > +	version.name_len = NAME_LEN;
> >  	version.name = name;
> >  
> >  	if (!drmIoctl(fd, DRM_IOCTL_VERSION, &version)){
> > @@ -94,7 +96,7 @@ static int __get_drm_device_name(int fd, char *name)
> >  
> >  static bool __is_device(int fd, const char *expect)
> >  {
> > -	char name[5] = "";
> > +	char name[NAME_LEN] = "";
> 
> This would need to be NAME_LEN + 1 to have room for the
> null-termination.
> 
> But, is this patch really necessary? Are there false matches from
> using a substring of 4 to match driver names?

Hi,

To test the force option, I used two drivers: Bochs and VKMS. I noticed
that Bochs failed to load because the module name is "bochs-drm".
Additionally, if we want to add a force option, I assume that someone
can have a module name larger than four characters. Make sense? Or Did I
missed something?

Thanks for your feedback

> 
> -- 
> Petri Latvala

-- 
Rodrigo Siqueira
http://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [PATCH i-g-t 2/2] Add support for forcing specific module
  2018-08-21  9:43     ` [Intel-gfx] " Petri Latvala
@ 2018-08-21 14:22       ` Rodrigo Siqueira
  -1 siblings, 0 replies; 22+ messages in thread
From: Rodrigo Siqueira @ 2018-08-21 14:22 UTC (permalink / raw)
  To: Arkadiusz Hiler, gustavo, igt-dev, intel-gfx

On 08/21, Petri Latvala wrote:
> On Sat, Jul 07, 2018 at 08:25:07PM -0300, Rodrigo Siqueira wrote:
> > This commit adds a new option for forcing the use of a specific module
> > indicated via command line.  The force command expects a module name
> > which will be used on the target test (changing the standard behavior).
> > 
> > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > ---
> >  lib/drmtest.c        | 33 +++++++++++++++++++++++++++------
> >  lib/igt_core.c       | 23 +++++++++++++++++++++++
> >  lib/igt_core.h       |  4 ++++
> >  scripts/run-tests.sh |  4 +++-
> >  4 files changed, 57 insertions(+), 7 deletions(-)
> > 
> > diff --git a/lib/drmtest.c b/lib/drmtest.c
> > index eee733eb..a77e2231 100644
> > --- a/lib/drmtest.c
> > +++ b/lib/drmtest.c
> > @@ -247,6 +247,20 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
> >  		if (chipset & DRIVER_AMDGPU && is_amd_device(fd))
> >  			return fd;
> >  
> > +		// Force options
> > +		if (get_target_module() && chipset == DRIVER_ANY) {
> > +			if (__is_device(fd, get_target_module())) {
> > +				return fd;
> > +			}
> > +			else {
> > +				memset(name, 0, sizeof(name));
> > +				__get_drm_device_name(fd, name);
> > +				close(fd);
> > +				igt_kmod_unload(name, 0);
> > +				return -1;
> > +			}
> > +		}
> > +
> 
> 
> You're unloading modules (which you shouldn't need to do here anyway),
> and even worse, unloading them if the first loop iteration doesn't
> land on the forced name.
> 
> This chunk needs to be before the matches for the known bits for
> DRIVER_ANY or you'll just get one of them when forcing a custom name.
Hi,

I think I did not fully understand your point; I'm a little bit confused
with this part:

"[..] or you'll just get one of them when forcing a custom name."

Do we want more than one?
 
> 
> >  		/* Only VGEM-specific tests should be run on VGEM */
> >  		if (chipset == DRIVER_ANY && !is_vgem_device(fd))
> >  			return fd;
> > @@ -260,6 +274,7 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
> >  static int __open_driver(const char *base, int offset, unsigned int chipset)
> >  {
> >  	static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
> > +	const char* target;
> >  	static const struct module {
> >  		unsigned int bit;
> >  		const char *module;
> > @@ -278,13 +293,19 @@ static int __open_driver(const char *base, int offset, unsigned int chipset)
> >  	if (fd != -1)
> >  		return fd;
> >  
> > +	target = get_target_module();
> > +
> >  	pthread_mutex_lock(&mutex);
> > -	for (const struct module *m = modules; m->module; m++) {
> > -		if (chipset & m->bit) {
> > -			if (m->modprobe)
> > -				m->modprobe(m->module);
> > -			else
> > -				modprobe(m->module);
> > +	if (target) {
> > +		modprobe(target);
> > +	} else {
> 
> 
> The name of the driver (as returned by DRM_IOCTL_VERSION) doesn't have
> to match the kernel module filename. Case in point: virtio-gpu.ko is
> "virtio_gpu".
> 
> I would suggest leaving the kernel module loading plans later for now
> and get the DRIVER_ANY match forcing in place. Or even forget kernel
> module loading entirely. If the user is able to set a parameter to a
> module name, the user can load the module themselves before running
> tests. It won't get unloaded if IGT doesn't have a test that does it,
> and it won't have such a test unless it knows about the
> driver/module. And at that point, IGT will know how to load that
> module.

Basically, leave the modprobe part for the user, Right?

> 
> 
> > +		for (const struct module *m = modules; m->module; m++) {
> > +			if (chipset & m->bit) {
> > +				if (m->modprobe)
> > +					m->modprobe(m->module);
> > +				else
> > +					modprobe(m->module);
> > +			}
> >  		}
> >  	}
> >  	pthread_mutex_unlock(&mutex);
> > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > index 5092a3f0..ee085e2a 100644
> > --- a/lib/igt_core.c
> > +++ b/lib/igt_core.c
> > @@ -286,6 +286,7 @@ enum {
> >   OPT_DESCRIPTION,
> >   OPT_DEBUG,
> >   OPT_INTERACTIVE_DEBUG,
> > + OPT_FORCE_MODULE,
> >   OPT_HELP = 'h'
> >  };
> >  
> > @@ -303,6 +304,23 @@ static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
> >  GKeyFile *igt_key_file;
> >  #endif
> >  
> > +char *target_module = NULL;
> > +
> > +void set_target_module(char *target)
> > +{
> > +	if (!target)
> > +		igt_warn("No module specified, keep default behaviour");
> > +
> > +	target_module = target;
> > +}
> > +
> > +const char *get_target_module(void)
> > +{
> > +	if (target_module)
> > +		return target_module;
> > +	return NULL;
> > +}
> > +
> >  char *igt_frame_dump_path;
> >  
> >  const char *igt_test_name(void)
> > @@ -555,6 +573,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
> >  		   "  --debug[=log-domain]\n"
> >  		   "  --interactive-debug[=domain]\n"
> >  		   "  --help-description\n"
> > +		   "  --force-module <module>\n"
> >  		   "  --help\n");
> >  	if (help_str)
> >  		fprintf(f, "%s\n", help_str);
> > @@ -666,6 +685,7 @@ static int common_init(int *argc, char **argv,
> >  		{"debug", optional_argument, 0, OPT_DEBUG},
> >  		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
> >  		{"help", 0, 0, OPT_HELP},
> > +		{"force-module", required_argument, 0, OPT_FORCE_MODULE},
> >  		{0, 0, 0, 0}
> >  	};
> >  	char *short_opts;
> > @@ -763,6 +783,9 @@ static int common_init(int *argc, char **argv,
> >  			print_test_description();
> >  			ret = -1;
> >  			goto out;
> > +		case OPT_FORCE_MODULE:
> > +			set_target_module(strdup(optarg));
> > +			break;
> >  		case OPT_HELP:
> >  			print_usage(help_str, false);
> >  			ret = -1;
> > diff --git a/lib/igt_core.h b/lib/igt_core.h
> > index bf8cd66c..6d635ebd 100644
> > --- a/lib/igt_core.h
> > +++ b/lib/igt_core.h
> > @@ -50,6 +50,10 @@ extern const char* __igt_test_description __attribute__((weak));
> >  extern bool __igt_plain_output;
> >  extern char *igt_frame_dump_path;
> >  
> > +extern char *target_module;
> > +void set_target_module(char *target);
> > +const char *get_target_module(void);
> > +
> >  /**
> >   * IGT_TEST_DESCRIPTION:
> >   * @str: description string
> > diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh
> > index 4209dd8c..29aa50a8 100755
> > --- a/scripts/run-tests.sh
> > +++ b/scripts/run-tests.sh
> > @@ -80,6 +80,7 @@ function print_help {
> >  	echo "                  (can be used more than once)"
> >  	echo "  -T <filename>   run tests listed in testlist"
> >  	echo "                  (overrides -t and -x)"
> > +	echo "  -f <module>     force specific module load"
> >  	echo "  -v              enable verbose mode"
> >  	echo "  -x <regex>      exclude tests that match the regular expression"
> >  	echo "                  (can be used more than once)"
> > @@ -91,7 +92,7 @@ function print_help {
> >  	echo "Useful patterns for test filtering are described in the API documentation."
> >  }
> >  
> > -while getopts ":dhlr:st:T:vx:Rn" opt; do
> > +while getopts ":dhlr:st:T:m:vx:Rn" opt; do
> >  	case $opt in
> >  		d) download_piglit; exit ;;
> >  		h) print_help; exit ;;
> > @@ -100,6 +101,7 @@ while getopts ":dhlr:st:T:vx:Rn" opt; do
> >  		s) SUMMARY="html" ;;
> >  		t) FILTER="$FILTER -t $OPTARG" ;;
> >  		T) FILTER="$FILTER --test-list $OPTARG" ;;
> > +		f) FILTER="$FILTER --force-module $OPTARG" ;;
> 
> 
> This command line is given to piglit, not the IGT tests.
> 
> Furthermore, run-tests.sh is not required to run tests. One can
> execute piglit or igt_runner directly.
> 
> Rather, consider having the force driver name passed via environment
> variables.

Do you mean, something like this:

kms_flip  --run-subtest basic-plain-flip MODULE=vkms
 
Thanks a lot for the review!
Best Regards
> 
> -- 
> Petri Latvala

-- 
Rodrigo Siqueira
http://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [igt-dev] [PATCH i-g-t 2/2] Add support for forcing specific module
@ 2018-08-21 14:22       ` Rodrigo Siqueira
  0 siblings, 0 replies; 22+ messages in thread
From: Rodrigo Siqueira @ 2018-08-21 14:22 UTC (permalink / raw)
  To: Arkadiusz Hiler, gustavo, igt-dev, intel-gfx

On 08/21, Petri Latvala wrote:
> On Sat, Jul 07, 2018 at 08:25:07PM -0300, Rodrigo Siqueira wrote:
> > This commit adds a new option for forcing the use of a specific module
> > indicated via command line.  The force command expects a module name
> > which will be used on the target test (changing the standard behavior).
> > 
> > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > ---
> >  lib/drmtest.c        | 33 +++++++++++++++++++++++++++------
> >  lib/igt_core.c       | 23 +++++++++++++++++++++++
> >  lib/igt_core.h       |  4 ++++
> >  scripts/run-tests.sh |  4 +++-
> >  4 files changed, 57 insertions(+), 7 deletions(-)
> > 
> > diff --git a/lib/drmtest.c b/lib/drmtest.c
> > index eee733eb..a77e2231 100644
> > --- a/lib/drmtest.c
> > +++ b/lib/drmtest.c
> > @@ -247,6 +247,20 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
> >  		if (chipset & DRIVER_AMDGPU && is_amd_device(fd))
> >  			return fd;
> >  
> > +		// Force options
> > +		if (get_target_module() && chipset == DRIVER_ANY) {
> > +			if (__is_device(fd, get_target_module())) {
> > +				return fd;
> > +			}
> > +			else {
> > +				memset(name, 0, sizeof(name));
> > +				__get_drm_device_name(fd, name);
> > +				close(fd);
> > +				igt_kmod_unload(name, 0);
> > +				return -1;
> > +			}
> > +		}
> > +
> 
> 
> You're unloading modules (which you shouldn't need to do here anyway),
> and even worse, unloading them if the first loop iteration doesn't
> land on the forced name.
> 
> This chunk needs to be before the matches for the known bits for
> DRIVER_ANY or you'll just get one of them when forcing a custom name.
Hi,

I think I did not fully understand your point; I'm a little bit confused
with this part:

"[..] or you'll just get one of them when forcing a custom name."

Do we want more than one?
 
> 
> >  		/* Only VGEM-specific tests should be run on VGEM */
> >  		if (chipset == DRIVER_ANY && !is_vgem_device(fd))
> >  			return fd;
> > @@ -260,6 +274,7 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
> >  static int __open_driver(const char *base, int offset, unsigned int chipset)
> >  {
> >  	static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
> > +	const char* target;
> >  	static const struct module {
> >  		unsigned int bit;
> >  		const char *module;
> > @@ -278,13 +293,19 @@ static int __open_driver(const char *base, int offset, unsigned int chipset)
> >  	if (fd != -1)
> >  		return fd;
> >  
> > +	target = get_target_module();
> > +
> >  	pthread_mutex_lock(&mutex);
> > -	for (const struct module *m = modules; m->module; m++) {
> > -		if (chipset & m->bit) {
> > -			if (m->modprobe)
> > -				m->modprobe(m->module);
> > -			else
> > -				modprobe(m->module);
> > +	if (target) {
> > +		modprobe(target);
> > +	} else {
> 
> 
> The name of the driver (as returned by DRM_IOCTL_VERSION) doesn't have
> to match the kernel module filename. Case in point: virtio-gpu.ko is
> "virtio_gpu".
> 
> I would suggest leaving the kernel module loading plans later for now
> and get the DRIVER_ANY match forcing in place. Or even forget kernel
> module loading entirely. If the user is able to set a parameter to a
> module name, the user can load the module themselves before running
> tests. It won't get unloaded if IGT doesn't have a test that does it,
> and it won't have such a test unless it knows about the
> driver/module. And at that point, IGT will know how to load that
> module.

Basically, leave the modprobe part for the user, Right?

> 
> 
> > +		for (const struct module *m = modules; m->module; m++) {
> > +			if (chipset & m->bit) {
> > +				if (m->modprobe)
> > +					m->modprobe(m->module);
> > +				else
> > +					modprobe(m->module);
> > +			}
> >  		}
> >  	}
> >  	pthread_mutex_unlock(&mutex);
> > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > index 5092a3f0..ee085e2a 100644
> > --- a/lib/igt_core.c
> > +++ b/lib/igt_core.c
> > @@ -286,6 +286,7 @@ enum {
> >   OPT_DESCRIPTION,
> >   OPT_DEBUG,
> >   OPT_INTERACTIVE_DEBUG,
> > + OPT_FORCE_MODULE,
> >   OPT_HELP = 'h'
> >  };
> >  
> > @@ -303,6 +304,23 @@ static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
> >  GKeyFile *igt_key_file;
> >  #endif
> >  
> > +char *target_module = NULL;
> > +
> > +void set_target_module(char *target)
> > +{
> > +	if (!target)
> > +		igt_warn("No module specified, keep default behaviour");
> > +
> > +	target_module = target;
> > +}
> > +
> > +const char *get_target_module(void)
> > +{
> > +	if (target_module)
> > +		return target_module;
> > +	return NULL;
> > +}
> > +
> >  char *igt_frame_dump_path;
> >  
> >  const char *igt_test_name(void)
> > @@ -555,6 +573,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
> >  		   "  --debug[=log-domain]\n"
> >  		   "  --interactive-debug[=domain]\n"
> >  		   "  --help-description\n"
> > +		   "  --force-module <module>\n"
> >  		   "  --help\n");
> >  	if (help_str)
> >  		fprintf(f, "%s\n", help_str);
> > @@ -666,6 +685,7 @@ static int common_init(int *argc, char **argv,
> >  		{"debug", optional_argument, 0, OPT_DEBUG},
> >  		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
> >  		{"help", 0, 0, OPT_HELP},
> > +		{"force-module", required_argument, 0, OPT_FORCE_MODULE},
> >  		{0, 0, 0, 0}
> >  	};
> >  	char *short_opts;
> > @@ -763,6 +783,9 @@ static int common_init(int *argc, char **argv,
> >  			print_test_description();
> >  			ret = -1;
> >  			goto out;
> > +		case OPT_FORCE_MODULE:
> > +			set_target_module(strdup(optarg));
> > +			break;
> >  		case OPT_HELP:
> >  			print_usage(help_str, false);
> >  			ret = -1;
> > diff --git a/lib/igt_core.h b/lib/igt_core.h
> > index bf8cd66c..6d635ebd 100644
> > --- a/lib/igt_core.h
> > +++ b/lib/igt_core.h
> > @@ -50,6 +50,10 @@ extern const char* __igt_test_description __attribute__((weak));
> >  extern bool __igt_plain_output;
> >  extern char *igt_frame_dump_path;
> >  
> > +extern char *target_module;
> > +void set_target_module(char *target);
> > +const char *get_target_module(void);
> > +
> >  /**
> >   * IGT_TEST_DESCRIPTION:
> >   * @str: description string
> > diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh
> > index 4209dd8c..29aa50a8 100755
> > --- a/scripts/run-tests.sh
> > +++ b/scripts/run-tests.sh
> > @@ -80,6 +80,7 @@ function print_help {
> >  	echo "                  (can be used more than once)"
> >  	echo "  -T <filename>   run tests listed in testlist"
> >  	echo "                  (overrides -t and -x)"
> > +	echo "  -f <module>     force specific module load"
> >  	echo "  -v              enable verbose mode"
> >  	echo "  -x <regex>      exclude tests that match the regular expression"
> >  	echo "                  (can be used more than once)"
> > @@ -91,7 +92,7 @@ function print_help {
> >  	echo "Useful patterns for test filtering are described in the API documentation."
> >  }
> >  
> > -while getopts ":dhlr:st:T:vx:Rn" opt; do
> > +while getopts ":dhlr:st:T:m:vx:Rn" opt; do
> >  	case $opt in
> >  		d) download_piglit; exit ;;
> >  		h) print_help; exit ;;
> > @@ -100,6 +101,7 @@ while getopts ":dhlr:st:T:vx:Rn" opt; do
> >  		s) SUMMARY="html" ;;
> >  		t) FILTER="$FILTER -t $OPTARG" ;;
> >  		T) FILTER="$FILTER --test-list $OPTARG" ;;
> > +		f) FILTER="$FILTER --force-module $OPTARG" ;;
> 
> 
> This command line is given to piglit, not the IGT tests.
> 
> Furthermore, run-tests.sh is not required to run tests. One can
> execute piglit or igt_runner directly.
> 
> Rather, consider having the force driver name passed via environment
> variables.

Do you mean, something like this:

kms_flip  --run-subtest basic-plain-flip MODULE=vkms
 
Thanks a lot for the review!
Best Regards
> 
> -- 
> Petri Latvala

-- 
Rodrigo Siqueira
http://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 1/2] Increase the string size for a module name
  2018-08-21 13:57       ` [igt-dev] " Rodrigo Siqueira
@ 2018-08-22  8:12         ` Petri Latvala
  -1 siblings, 0 replies; 22+ messages in thread
From: Petri Latvala @ 2018-08-22  8:12 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Tue, Aug 21, 2018 at 10:57:47AM -0300, Rodrigo Siqueira wrote:
> On 08/21, Petri Latvala wrote:
> > On Sat, Jul 07, 2018 at 08:24:39PM -0300, Rodrigo Siqueira wrote:
> > > Some modules name are larger than 5 characters, this can be a problem to
> > > add support for other modules. This patch, increase the maximum size in
> > > order to enable other modules to use IGT.
> > > 
> > > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > > ---
> > >  lib/drmtest.c | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/lib/drmtest.c b/lib/drmtest.c
> > > index fae6f86f..eee733eb 100644
> > > --- a/lib/drmtest.c
> > > +++ b/lib/drmtest.c
> > > @@ -60,6 +60,8 @@
> > >  #include "ioctl_wrappers.h"
> > >  #include "igt_dummyload.h"
> > >  
> > > +#define NAME_LEN 32
> > > +
> > >  /**
> > >   * SECTION:drmtest
> > >   * @short_description: Base library for drm tests and tools
> > > @@ -82,7 +84,7 @@ static int __get_drm_device_name(int fd, char *name)
> > >  	drm_version_t version;
> > >  
> > >  	memset(&version, 0, sizeof(version));
> > > -	version.name_len = 4;
> > > +	version.name_len = NAME_LEN;
> > >  	version.name = name;
> > >  
> > >  	if (!drmIoctl(fd, DRM_IOCTL_VERSION, &version)){
> > > @@ -94,7 +96,7 @@ static int __get_drm_device_name(int fd, char *name)
> > >  
> > >  static bool __is_device(int fd, const char *expect)
> > >  {
> > > -	char name[5] = "";
> > > +	char name[NAME_LEN] = "";
> > 
> > This would need to be NAME_LEN + 1 to have room for the
> > null-termination.
> > 
> > But, is this patch really necessary? Are there false matches from
> > using a substring of 4 to match driver names?
> 
> Hi,
> 
> To test the force option, I used two drivers: Bochs and VKMS. I noticed
> that Bochs failed to load because the module name is "bochs-drm".

Driver name is still not the same as the kernel module name necessarily.


> Additionally, if we want to add a force option, I assume that someone
> can have a module name larger than four characters. Make sense? Or Did I
> missed something?

Sure, names can and are already larger than four characters
(e.g. "amdgpu"). But the driver matching uses the first four
characters of the name. The length of matching the driver name doesn't
need to be lengthened as of yet.

Kernel module name, again, is another thing entirely.


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

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

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 1/2] Increase the string size for a module name
@ 2018-08-22  8:12         ` Petri Latvala
  0 siblings, 0 replies; 22+ messages in thread
From: Petri Latvala @ 2018-08-22  8:12 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Tue, Aug 21, 2018 at 10:57:47AM -0300, Rodrigo Siqueira wrote:
> On 08/21, Petri Latvala wrote:
> > On Sat, Jul 07, 2018 at 08:24:39PM -0300, Rodrigo Siqueira wrote:
> > > Some modules name are larger than 5 characters, this can be a problem to
> > > add support for other modules. This patch, increase the maximum size in
> > > order to enable other modules to use IGT.
> > > 
> > > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > > ---
> > >  lib/drmtest.c | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/lib/drmtest.c b/lib/drmtest.c
> > > index fae6f86f..eee733eb 100644
> > > --- a/lib/drmtest.c
> > > +++ b/lib/drmtest.c
> > > @@ -60,6 +60,8 @@
> > >  #include "ioctl_wrappers.h"
> > >  #include "igt_dummyload.h"
> > >  
> > > +#define NAME_LEN 32
> > > +
> > >  /**
> > >   * SECTION:drmtest
> > >   * @short_description: Base library for drm tests and tools
> > > @@ -82,7 +84,7 @@ static int __get_drm_device_name(int fd, char *name)
> > >  	drm_version_t version;
> > >  
> > >  	memset(&version, 0, sizeof(version));
> > > -	version.name_len = 4;
> > > +	version.name_len = NAME_LEN;
> > >  	version.name = name;
> > >  
> > >  	if (!drmIoctl(fd, DRM_IOCTL_VERSION, &version)){
> > > @@ -94,7 +96,7 @@ static int __get_drm_device_name(int fd, char *name)
> > >  
> > >  static bool __is_device(int fd, const char *expect)
> > >  {
> > > -	char name[5] = "";
> > > +	char name[NAME_LEN] = "";
> > 
> > This would need to be NAME_LEN + 1 to have room for the
> > null-termination.
> > 
> > But, is this patch really necessary? Are there false matches from
> > using a substring of 4 to match driver names?
> 
> Hi,
> 
> To test the force option, I used two drivers: Bochs and VKMS. I noticed
> that Bochs failed to load because the module name is "bochs-drm".

Driver name is still not the same as the kernel module name necessarily.


> Additionally, if we want to add a force option, I assume that someone
> can have a module name larger than four characters. Make sense? Or Did I
> missed something?

Sure, names can and are already larger than four characters
(e.g. "amdgpu"). But the driver matching uses the first four
characters of the name. The length of matching the driver name doesn't
need to be lengthened as of yet.

Kernel module name, again, is another thing entirely.


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

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

* Re: [igt-dev] [PATCH i-g-t 2/2] Add support for forcing specific module
  2018-08-21 14:22       ` [igt-dev] " Rodrigo Siqueira
@ 2018-08-22  8:18         ` Petri Latvala
  -1 siblings, 0 replies; 22+ messages in thread
From: Petri Latvala @ 2018-08-22  8:18 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, intel-gfx

On Tue, Aug 21, 2018 at 11:22:45AM -0300, Rodrigo Siqueira wrote:
> On 08/21, Petri Latvala wrote:
> > On Sat, Jul 07, 2018 at 08:25:07PM -0300, Rodrigo Siqueira wrote:
> > > This commit adds a new option for forcing the use of a specific module
> > > indicated via command line.  The force command expects a module name
> > > which will be used on the target test (changing the standard behavior).
> > > 
> > > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > > ---
> > >  lib/drmtest.c        | 33 +++++++++++++++++++++++++++------
> > >  lib/igt_core.c       | 23 +++++++++++++++++++++++
> > >  lib/igt_core.h       |  4 ++++
> > >  scripts/run-tests.sh |  4 +++-
> > >  4 files changed, 57 insertions(+), 7 deletions(-)
> > > 
> > > diff --git a/lib/drmtest.c b/lib/drmtest.c
> > > index eee733eb..a77e2231 100644
> > > --- a/lib/drmtest.c
> > > +++ b/lib/drmtest.c
> > > @@ -247,6 +247,20 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
> > >  		if (chipset & DRIVER_AMDGPU && is_amd_device(fd))
> > >  			return fd;
> > >  
> > > +		// Force options
> > > +		if (get_target_module() && chipset == DRIVER_ANY) {
> > > +			if (__is_device(fd, get_target_module())) {
> > > +				return fd;
> > > +			}
> > > +			else {
> > > +				memset(name, 0, sizeof(name));
> > > +				__get_drm_device_name(fd, name);
> > > +				close(fd);
> > > +				igt_kmod_unload(name, 0);
> > > +				return -1;
> > > +			}
> > > +		}
> > > +
> > 
> > 
> > You're unloading modules (which you shouldn't need to do here anyway),
> > and even worse, unloading them if the first loop iteration doesn't
> > land on the forced name.
> > 
> > This chunk needs to be before the matches for the known bits for
> > DRIVER_ANY or you'll just get one of them when forcing a custom name.
> Hi,
> 
> I think I did not fully understand your point; I'm a little bit confused
> with this part:
> 
> "[..] or you'll just get one of them when forcing a custom name."
> 
> Do we want more than one?


I mean that when a test calls drm_open_driver(DRIVER_ANY), it will
happily open /dev/dri/card0 and use that if it's, say, an i915
device. Even though you enabled the force option to "vkms".




>  
> > 
> > >  		/* Only VGEM-specific tests should be run on VGEM */
> > >  		if (chipset == DRIVER_ANY && !is_vgem_device(fd))
> > >  			return fd;
> > > @@ -260,6 +274,7 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
> > >  static int __open_driver(const char *base, int offset, unsigned int chipset)
> > >  {
> > >  	static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
> > > +	const char* target;
> > >  	static const struct module {
> > >  		unsigned int bit;
> > >  		const char *module;
> > > @@ -278,13 +293,19 @@ static int __open_driver(const char *base, int offset, unsigned int chipset)
> > >  	if (fd != -1)
> > >  		return fd;
> > >  
> > > +	target = get_target_module();
> > > +
> > >  	pthread_mutex_lock(&mutex);
> > > -	for (const struct module *m = modules; m->module; m++) {
> > > -		if (chipset & m->bit) {
> > > -			if (m->modprobe)
> > > -				m->modprobe(m->module);
> > > -			else
> > > -				modprobe(m->module);
> > > +	if (target) {
> > > +		modprobe(target);
> > > +	} else {
> > 
> > 
> > The name of the driver (as returned by DRM_IOCTL_VERSION) doesn't have
> > to match the kernel module filename. Case in point: virtio-gpu.ko is
> > "virtio_gpu".
> > 
> > I would suggest leaving the kernel module loading plans later for now
> > and get the DRIVER_ANY match forcing in place. Or even forget kernel
> > module loading entirely. If the user is able to set a parameter to a
> > module name, the user can load the module themselves before running
> > tests. It won't get unloaded if IGT doesn't have a test that does it,
> > and it won't have such a test unless it knows about the
> > driver/module. And at that point, IGT will know how to load that
> > module.
> 
> Basically, leave the modprobe part for the user, Right?


Exactly.



> 
> > 
> > 
> > > +		for (const struct module *m = modules; m->module; m++) {
> > > +			if (chipset & m->bit) {
> > > +				if (m->modprobe)
> > > +					m->modprobe(m->module);
> > > +				else
> > > +					modprobe(m->module);
> > > +			}
> > >  		}
> > >  	}
> > >  	pthread_mutex_unlock(&mutex);
> > > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > > index 5092a3f0..ee085e2a 100644
> > > --- a/lib/igt_core.c
> > > +++ b/lib/igt_core.c
> > > @@ -286,6 +286,7 @@ enum {
> > >   OPT_DESCRIPTION,
> > >   OPT_DEBUG,
> > >   OPT_INTERACTIVE_DEBUG,
> > > + OPT_FORCE_MODULE,
> > >   OPT_HELP = 'h'
> > >  };
> > >  
> > > @@ -303,6 +304,23 @@ static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
> > >  GKeyFile *igt_key_file;
> > >  #endif
> > >  
> > > +char *target_module = NULL;
> > > +
> > > +void set_target_module(char *target)
> > > +{
> > > +	if (!target)
> > > +		igt_warn("No module specified, keep default behaviour");
> > > +
> > > +	target_module = target;
> > > +}
> > > +
> > > +const char *get_target_module(void)
> > > +{
> > > +	if (target_module)
> > > +		return target_module;
> > > +	return NULL;
> > > +}
> > > +
> > >  char *igt_frame_dump_path;
> > >  
> > >  const char *igt_test_name(void)
> > > @@ -555,6 +573,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
> > >  		   "  --debug[=log-domain]\n"
> > >  		   "  --interactive-debug[=domain]\n"
> > >  		   "  --help-description\n"
> > > +		   "  --force-module <module>\n"
> > >  		   "  --help\n");
> > >  	if (help_str)
> > >  		fprintf(f, "%s\n", help_str);
> > > @@ -666,6 +685,7 @@ static int common_init(int *argc, char **argv,
> > >  		{"debug", optional_argument, 0, OPT_DEBUG},
> > >  		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
> > >  		{"help", 0, 0, OPT_HELP},
> > > +		{"force-module", required_argument, 0, OPT_FORCE_MODULE},
> > >  		{0, 0, 0, 0}
> > >  	};
> > >  	char *short_opts;
> > > @@ -763,6 +783,9 @@ static int common_init(int *argc, char **argv,
> > >  			print_test_description();
> > >  			ret = -1;
> > >  			goto out;
> > > +		case OPT_FORCE_MODULE:
> > > +			set_target_module(strdup(optarg));
> > > +			break;
> > >  		case OPT_HELP:
> > >  			print_usage(help_str, false);
> > >  			ret = -1;
> > > diff --git a/lib/igt_core.h b/lib/igt_core.h
> > > index bf8cd66c..6d635ebd 100644
> > > --- a/lib/igt_core.h
> > > +++ b/lib/igt_core.h
> > > @@ -50,6 +50,10 @@ extern const char* __igt_test_description __attribute__((weak));
> > >  extern bool __igt_plain_output;
> > >  extern char *igt_frame_dump_path;
> > >  
> > > +extern char *target_module;
> > > +void set_target_module(char *target);
> > > +const char *get_target_module(void);
> > > +
> > >  /**
> > >   * IGT_TEST_DESCRIPTION:
> > >   * @str: description string
> > > diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh
> > > index 4209dd8c..29aa50a8 100755
> > > --- a/scripts/run-tests.sh
> > > +++ b/scripts/run-tests.sh
> > > @@ -80,6 +80,7 @@ function print_help {
> > >  	echo "                  (can be used more than once)"
> > >  	echo "  -T <filename>   run tests listed in testlist"
> > >  	echo "                  (overrides -t and -x)"
> > > +	echo "  -f <module>     force specific module load"
> > >  	echo "  -v              enable verbose mode"
> > >  	echo "  -x <regex>      exclude tests that match the regular expression"
> > >  	echo "                  (can be used more than once)"
> > > @@ -91,7 +92,7 @@ function print_help {
> > >  	echo "Useful patterns for test filtering are described in the API documentation."
> > >  }
> > >  
> > > -while getopts ":dhlr:st:T:vx:Rn" opt; do
> > > +while getopts ":dhlr:st:T:m:vx:Rn" opt; do
> > >  	case $opt in
> > >  		d) download_piglit; exit ;;
> > >  		h) print_help; exit ;;
> > > @@ -100,6 +101,7 @@ while getopts ":dhlr:st:T:vx:Rn" opt; do
> > >  		s) SUMMARY="html" ;;
> > >  		t) FILTER="$FILTER -t $OPTARG" ;;
> > >  		T) FILTER="$FILTER --test-list $OPTARG" ;;
> > > +		f) FILTER="$FILTER --force-module $OPTARG" ;;
> > 
> > 
> > This command line is given to piglit, not the IGT tests.
> > 
> > Furthermore, run-tests.sh is not required to run tests. One can
> > execute piglit or igt_runner directly.
> > 
> > Rather, consider having the force driver name passed via environment
> > variables.
> 
> Do you mean, something like this:
> 
> kms_flip  --run-subtest basic-plain-flip MODULE=vkms


MODULE=vkms kms_flip --run-subtest basic-plain-flip

Or the more usual way of running tests:

IGT_TEST_ROOT=builddir/tests MODULE=vkms piglit run igt -t igt@kms_flip@basic-plain-flip results-directory

or

MODULE=vkms builddir/runner/igt_runner -t igt@kms_flip@basic-plain-flip builddir/tests results-directory



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

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

* Re: [igt-dev] [PATCH i-g-t 2/2] Add support for forcing specific module
@ 2018-08-22  8:18         ` Petri Latvala
  0 siblings, 0 replies; 22+ messages in thread
From: Petri Latvala @ 2018-08-22  8:18 UTC (permalink / raw)
  To: Rodrigo Siqueira; +Cc: igt-dev, gustavo, intel-gfx

On Tue, Aug 21, 2018 at 11:22:45AM -0300, Rodrigo Siqueira wrote:
> On 08/21, Petri Latvala wrote:
> > On Sat, Jul 07, 2018 at 08:25:07PM -0300, Rodrigo Siqueira wrote:
> > > This commit adds a new option for forcing the use of a specific module
> > > indicated via command line.  The force command expects a module name
> > > which will be used on the target test (changing the standard behavior).
> > > 
> > > Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
> > > ---
> > >  lib/drmtest.c        | 33 +++++++++++++++++++++++++++------
> > >  lib/igt_core.c       | 23 +++++++++++++++++++++++
> > >  lib/igt_core.h       |  4 ++++
> > >  scripts/run-tests.sh |  4 +++-
> > >  4 files changed, 57 insertions(+), 7 deletions(-)
> > > 
> > > diff --git a/lib/drmtest.c b/lib/drmtest.c
> > > index eee733eb..a77e2231 100644
> > > --- a/lib/drmtest.c
> > > +++ b/lib/drmtest.c
> > > @@ -247,6 +247,20 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
> > >  		if (chipset & DRIVER_AMDGPU && is_amd_device(fd))
> > >  			return fd;
> > >  
> > > +		// Force options
> > > +		if (get_target_module() && chipset == DRIVER_ANY) {
> > > +			if (__is_device(fd, get_target_module())) {
> > > +				return fd;
> > > +			}
> > > +			else {
> > > +				memset(name, 0, sizeof(name));
> > > +				__get_drm_device_name(fd, name);
> > > +				close(fd);
> > > +				igt_kmod_unload(name, 0);
> > > +				return -1;
> > > +			}
> > > +		}
> > > +
> > 
> > 
> > You're unloading modules (which you shouldn't need to do here anyway),
> > and even worse, unloading them if the first loop iteration doesn't
> > land on the forced name.
> > 
> > This chunk needs to be before the matches for the known bits for
> > DRIVER_ANY or you'll just get one of them when forcing a custom name.
> Hi,
> 
> I think I did not fully understand your point; I'm a little bit confused
> with this part:
> 
> "[..] or you'll just get one of them when forcing a custom name."
> 
> Do we want more than one?


I mean that when a test calls drm_open_driver(DRIVER_ANY), it will
happily open /dev/dri/card0 and use that if it's, say, an i915
device. Even though you enabled the force option to "vkms".




>  
> > 
> > >  		/* Only VGEM-specific tests should be run on VGEM */
> > >  		if (chipset == DRIVER_ANY && !is_vgem_device(fd))
> > >  			return fd;
> > > @@ -260,6 +274,7 @@ static int __open_device(const char *base, int offset, unsigned int chipset)
> > >  static int __open_driver(const char *base, int offset, unsigned int chipset)
> > >  {
> > >  	static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
> > > +	const char* target;
> > >  	static const struct module {
> > >  		unsigned int bit;
> > >  		const char *module;
> > > @@ -278,13 +293,19 @@ static int __open_driver(const char *base, int offset, unsigned int chipset)
> > >  	if (fd != -1)
> > >  		return fd;
> > >  
> > > +	target = get_target_module();
> > > +
> > >  	pthread_mutex_lock(&mutex);
> > > -	for (const struct module *m = modules; m->module; m++) {
> > > -		if (chipset & m->bit) {
> > > -			if (m->modprobe)
> > > -				m->modprobe(m->module);
> > > -			else
> > > -				modprobe(m->module);
> > > +	if (target) {
> > > +		modprobe(target);
> > > +	} else {
> > 
> > 
> > The name of the driver (as returned by DRM_IOCTL_VERSION) doesn't have
> > to match the kernel module filename. Case in point: virtio-gpu.ko is
> > "virtio_gpu".
> > 
> > I would suggest leaving the kernel module loading plans later for now
> > and get the DRIVER_ANY match forcing in place. Or even forget kernel
> > module loading entirely. If the user is able to set a parameter to a
> > module name, the user can load the module themselves before running
> > tests. It won't get unloaded if IGT doesn't have a test that does it,
> > and it won't have such a test unless it knows about the
> > driver/module. And at that point, IGT will know how to load that
> > module.
> 
> Basically, leave the modprobe part for the user, Right?


Exactly.



> 
> > 
> > 
> > > +		for (const struct module *m = modules; m->module; m++) {
> > > +			if (chipset & m->bit) {
> > > +				if (m->modprobe)
> > > +					m->modprobe(m->module);
> > > +				else
> > > +					modprobe(m->module);
> > > +			}
> > >  		}
> > >  	}
> > >  	pthread_mutex_unlock(&mutex);
> > > diff --git a/lib/igt_core.c b/lib/igt_core.c
> > > index 5092a3f0..ee085e2a 100644
> > > --- a/lib/igt_core.c
> > > +++ b/lib/igt_core.c
> > > @@ -286,6 +286,7 @@ enum {
> > >   OPT_DESCRIPTION,
> > >   OPT_DEBUG,
> > >   OPT_INTERACTIVE_DEBUG,
> > > + OPT_FORCE_MODULE,
> > >   OPT_HELP = 'h'
> > >  };
> > >  
> > > @@ -303,6 +304,23 @@ static pthread_mutex_t log_buffer_mutex = PTHREAD_MUTEX_INITIALIZER;
> > >  GKeyFile *igt_key_file;
> > >  #endif
> > >  
> > > +char *target_module = NULL;
> > > +
> > > +void set_target_module(char *target)
> > > +{
> > > +	if (!target)
> > > +		igt_warn("No module specified, keep default behaviour");
> > > +
> > > +	target_module = target;
> > > +}
> > > +
> > > +const char *get_target_module(void)
> > > +{
> > > +	if (target_module)
> > > +		return target_module;
> > > +	return NULL;
> > > +}
> > > +
> > >  char *igt_frame_dump_path;
> > >  
> > >  const char *igt_test_name(void)
> > > @@ -555,6 +573,7 @@ static void print_usage(const char *help_str, bool output_on_stderr)
> > >  		   "  --debug[=log-domain]\n"
> > >  		   "  --interactive-debug[=domain]\n"
> > >  		   "  --help-description\n"
> > > +		   "  --force-module <module>\n"
> > >  		   "  --help\n");
> > >  	if (help_str)
> > >  		fprintf(f, "%s\n", help_str);
> > > @@ -666,6 +685,7 @@ static int common_init(int *argc, char **argv,
> > >  		{"debug", optional_argument, 0, OPT_DEBUG},
> > >  		{"interactive-debug", optional_argument, 0, OPT_INTERACTIVE_DEBUG},
> > >  		{"help", 0, 0, OPT_HELP},
> > > +		{"force-module", required_argument, 0, OPT_FORCE_MODULE},
> > >  		{0, 0, 0, 0}
> > >  	};
> > >  	char *short_opts;
> > > @@ -763,6 +783,9 @@ static int common_init(int *argc, char **argv,
> > >  			print_test_description();
> > >  			ret = -1;
> > >  			goto out;
> > > +		case OPT_FORCE_MODULE:
> > > +			set_target_module(strdup(optarg));
> > > +			break;
> > >  		case OPT_HELP:
> > >  			print_usage(help_str, false);
> > >  			ret = -1;
> > > diff --git a/lib/igt_core.h b/lib/igt_core.h
> > > index bf8cd66c..6d635ebd 100644
> > > --- a/lib/igt_core.h
> > > +++ b/lib/igt_core.h
> > > @@ -50,6 +50,10 @@ extern const char* __igt_test_description __attribute__((weak));
> > >  extern bool __igt_plain_output;
> > >  extern char *igt_frame_dump_path;
> > >  
> > > +extern char *target_module;
> > > +void set_target_module(char *target);
> > > +const char *get_target_module(void);
> > > +
> > >  /**
> > >   * IGT_TEST_DESCRIPTION:
> > >   * @str: description string
> > > diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh
> > > index 4209dd8c..29aa50a8 100755
> > > --- a/scripts/run-tests.sh
> > > +++ b/scripts/run-tests.sh
> > > @@ -80,6 +80,7 @@ function print_help {
> > >  	echo "                  (can be used more than once)"
> > >  	echo "  -T <filename>   run tests listed in testlist"
> > >  	echo "                  (overrides -t and -x)"
> > > +	echo "  -f <module>     force specific module load"
> > >  	echo "  -v              enable verbose mode"
> > >  	echo "  -x <regex>      exclude tests that match the regular expression"
> > >  	echo "                  (can be used more than once)"
> > > @@ -91,7 +92,7 @@ function print_help {
> > >  	echo "Useful patterns for test filtering are described in the API documentation."
> > >  }
> > >  
> > > -while getopts ":dhlr:st:T:vx:Rn" opt; do
> > > +while getopts ":dhlr:st:T:m:vx:Rn" opt; do
> > >  	case $opt in
> > >  		d) download_piglit; exit ;;
> > >  		h) print_help; exit ;;
> > > @@ -100,6 +101,7 @@ while getopts ":dhlr:st:T:vx:Rn" opt; do
> > >  		s) SUMMARY="html" ;;
> > >  		t) FILTER="$FILTER -t $OPTARG" ;;
> > >  		T) FILTER="$FILTER --test-list $OPTARG" ;;
> > > +		f) FILTER="$FILTER --force-module $OPTARG" ;;
> > 
> > 
> > This command line is given to piglit, not the IGT tests.
> > 
> > Furthermore, run-tests.sh is not required to run tests. One can
> > execute piglit or igt_runner directly.
> > 
> > Rather, consider having the force driver name passed via environment
> > variables.
> 
> Do you mean, something like this:
> 
> kms_flip  --run-subtest basic-plain-flip MODULE=vkms


MODULE=vkms kms_flip --run-subtest basic-plain-flip

Or the more usual way of running tests:

IGT_TEST_ROOT=builddir/tests MODULE=vkms piglit run igt -t igt@kms_flip@basic-plain-flip results-directory

or

MODULE=vkms builddir/runner/igt_runner -t igt@kms_flip@basic-plain-flip builddir/tests results-directory



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

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

end of thread, other threads:[~2018-08-22  8:18 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-07 23:24 [PATCH i-g-t 0/2] Add support to force specific module load Rodrigo Siqueira
2018-07-07 23:24 ` [igt-dev] " Rodrigo Siqueira
2018-07-07 23:24 ` [PATCH i-g-t 1/2] Increase the string size for a module name Rodrigo Siqueira
2018-07-07 23:24   ` [Intel-gfx] " Rodrigo Siqueira
2018-08-21  9:13   ` Petri Latvala
2018-08-21  9:13     ` [Intel-gfx] " Petri Latvala
2018-08-21 13:57     ` Rodrigo Siqueira
2018-08-21 13:57       ` [igt-dev] " Rodrigo Siqueira
2018-08-22  8:12       ` Petri Latvala
2018-08-22  8:12         ` [Intel-gfx] " Petri Latvala
2018-07-07 23:25 ` [PATCH i-g-t 2/2] Add support for forcing specific module Rodrigo Siqueira
2018-07-07 23:25   ` [igt-dev] " Rodrigo Siqueira
2018-08-21  9:43   ` Petri Latvala
2018-08-21  9:43     ` [Intel-gfx] " Petri Latvala
2018-08-21 14:22     ` Rodrigo Siqueira
2018-08-21 14:22       ` [igt-dev] " Rodrigo Siqueira
2018-08-22  8:18       ` Petri Latvala
2018-08-22  8:18         ` Petri Latvala
2018-07-08  0:03 ` [igt-dev] ✓ Fi.CI.BAT: success for Add support to force specific module load (rev2) Patchwork
2018-07-08  7:45 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-08-20 13:33 ` [PATCH i-g-t 0/2] Add support to force specific module load Rodrigo Siqueira
2018-08-20 13:33   ` [igt-dev] " Rodrigo Siqueira

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.