Add support for forcing specific module
PATCH v2 1/1 Add support for forcing specific module
This commit adds a new option for forcing the use of a specific driver indicated via an environment variable.
Changes since V1:
Petri:
- Use an environment variable instead of command line
- Refactor the loop in __search_and_open to accept forced module
- Don't try to load kernel modules
--- lib/drmtest.c | 44 ++++++++++++++++++++++++++++++++++++++++++-- lib/drmtest.h | 2 ++ lib/igt_core.c | 5 +++++ 3 files changed, 49 insertions(+), 2 deletions(-)
lib/drmtest.c +42 -2
@@ -123,6 +123,36 @@ static bool has_known_intel_chipset(int fd)return true; } +static char _forced_driver[5 ] ="" ; + +/** +* __set_forced_driver: +* @name: name of driver to forcibly use +* +* Set the name of a driver to use when calling #drm_open_driver with +* the #DRIVER_ANY flag. +*/ +void __set_forced_driver (const char *name) +{ +if (!strcmp (name,"" )) { +igt_warn ("IGT_FORCE_DRIVER flag specified without a value," +"ignoring force option\n" ); +return ; + } + +igt_info ("Attempt to force module %s\n" , name); + +strncpy (_forced_driver, name,4 ); +} + +static const char *forced_driver (void ) +{ +if (_forced_driver[0 ]) +return _forced_driver; + +return NULL ; +} +#define LOCAL_I915_EXEC_VEBOX (4 << 0)/** * gem_quiescent_gpu:
@@ -250,8 +280,18 @@ static int __search_and_open(const char *base, int offset, unsigned int chipset)sprintf (name,"%s%u" , base, i + offset); fd =open_device (name, chipset); -if (fd !=-1 ) -return fd; +if (fd ==-1 ) +continue ; + +// Force module +if (chipset ==DRIVER_ANY &&forced_driver ()) { +if (__is_device (fd,forced_driver ())) +return fd; +close (fd); +continue ; + } + +return fd; }return -1 ;
lib/drmtest.h +2 -0
@@ -51,6 +51,8 @@*/ #define DRIVER_ANY ~(DRIVER_VGEM) +void __set_forced_driver (const char *name); +/** * ARRAY_SIZE: * @arr: static array
lib/igt_core.c +5 -0
@@ -647,6 +647,11 @@ static void common_init_env(void) igt_frame_dump_path =getenv ("IGT_FRAME_DUMP_PATH" ); stderr_needs_sentinel =getenv ("IGT_SENTINEL_ON_STDERR" ) !=NULL ; + + env =getenv ("IGT_FORCE_DRIVER" ); +if (env) { +__set_forced_driver (env); + } } static int common_init(int *argc, char **argv,
Signature · 13 lines
2.18.0 -- Rodrigo Siqueira http://siqueira.tech Graduate Student Department of Computer Science University of São Paulo _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ Fi.CI.BAT: failure for Add support for forcing specific module
== Series Details ==
== Series Details ==
Series: Add support for forcing specific module
URL : https://patchwork.freedesktop.org/series/49233/
State : failure
== Summary ==
= CI Bug Log - changes from CI_DRM_4772 -> IGTPW_1795 =
== Summary - FAILURE ==
Serious unknown changes coming with IGTPW_1795 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_1795, 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/49233/revisions/1/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in IGTPW_1795:
=== IGT changes ===
==== Possible regressions ====
igt@gem_exec_suspend@basic-s3:
fi-snb-2600: PASS -> INCOMPLETE
fi-icl-u: PASS -> INCOMPLETE== Known issues ==
Here are the changes found in IGTPW_1795 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@kms_frontbuffer_tracking@basic:
fi-byt-clapper: PASS -> FAIL (fdo#103167)
==== Possible fixes ====
igt@gem_exec_suspend@basic-s4-devices:
fi-kbl-7500u: DMESG-WARN (fdo#105128, fdo#107139) -> PASS
igt@kms_pipe_crc_basic@read-crc-pipe-b-frame-sequence:
fi-ilk-650: DMESG-WARN (fdo#106387) -> PASS
igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
fi-byt-clapper: FAIL (fdo#103191, fdo#107362) -> PASS
fi-blb-e6850: INCOMPLETE (fdo#107718) -> PASS fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103191 https://bugs.freedesktop.org/show_bug.cgi?id=103191
fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128
fdo#106387 https://bugs.freedesktop.org/show_bug.cgi?id=106387
fdo#107139 https://bugs.freedesktop.org/show_bug.cgi?id=107139
fdo#107362 https://bugs.freedesktop.org/show_bug.cgi?id=107362
fdo#107718 https://bugs.freedesktop.org/show_bug.cgi?id=107718
== Participating hosts (54 -> 49) ==
Missing (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u
== Build changes ==
* IGT: IGT_4629 -> IGTPW_1795
CI_DRM_4772: 1351ee8f3aacdb8f4a71cd17a7035556065c59a9 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1795: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1795/
IGT_4629: c3b6d69aa3dd2d1a6c1f2e787670a0aef78f2ea5 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1795/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoting Rodrigo Siqueira (2018-09-05 21:38:27)
Quoted 8 lines
This commit adds a new option for forcing the use of a specific driver indicated via an environment variable.
Changes since V1:
Petri:
- Use an environment variable instead of command line
- Refactor the loop in__search_and_opento accept forced module
- Don't try to load kernel modules
I am still not convinced this is a good solution to the problem of running tests against all applicable devices, along with generic filtering of that set (both from the test profile and user config).
Short term wise I'd rather see DRIVER_ANY translated into a known DRIVER_X selector (so that we have a complete list of drivers for later exploitation), say
lib/drmtest.c +23 -0
@@ -257,11 +257,16 @@ static int __search_and_open(const char *base, int offset, unsigned int chipset)return -1 ; } +static unsigned int driver_any_chipset =DRIVER_ANY ;// give me a better name +static int __open_driver (const char *base,int offset,unsigned int chipset) {static pthread_mutex_t mutex =PTHREAD_MUTEX_INITIALIZER ;int fd; +if (chipset ==DRIVER_ANY ) + chipset = driver_any_chipset; + fd =__search_and_open (base, offset, chipset);if (fd !=-1 )return fd;
@@ -428,3 +433,21 @@ void igt_require_intel(int fd) {igt_require (is_i915_device (fd) &&has_known_intel_chipset (fd)); } + +bool set_driver_any (const char *name) +{ +for (int start =0 , end =ARRAY_SIZE (modules) -1 ; start < end; ) {// repetitive much? +int mid = start + (end - start) /2 ; +int ret =strcmp (modules[mid].module, name); +if (ret <0 ) { + start = mid +1 ; + }else if (ret >0 ) { + end = mid; + }else { + driver_any_chipset = modules[mid].bit; +return true; + } + } + +return false; +}
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ Fi.CI.BAT: failure for Add support for forcing specific module (rev2)
In reply to Rodrigo Siqueira== Series Details ==
== Series Details ==
Series: Add support for forcing specific module (rev2)
URL : https://patchwork.freedesktop.org/series/49233/
State : failure
== Summary ==
Applying: Add support for forcing specific module
Using index info to reconstruct a base tree...
Patch failed at 0001 Add support for forcing specific module Use 'git am --show-current-patch' to see the failed patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 10 lines · Rodrigo Siqueira
This commit adds a new option for forcing the use of a specific driver indicated via an environment variable.
Changes since V1:
Petri:
- Use an environment variable instead of command line
- Refactor the loop in__search_and_opento accept forced module
- Don't try to load kernel modulesSigned-off-by Rodrigo Siqueira <[email protected]>
Note: You can't drop the s-o-b line if your patch contains work by other people, like from Petri here. Proper way to resend a patch by someone else is to just add a subject prefix of "PATCH RESEND" and otherwise keep everything unchanged (including author and everything).
https://patchwork.freedesktop.org/patch/245532/
Cheers, Daniel
Quoted 111 lines
--- lib/drmtest.c | 44 ++++++++++++++++++++++++++++++++++++++++++-- lib/drmtest.h | 2 ++ lib/igt_core.c | 5 +++++ 3 files changed, 49 insertions(+), 2 deletions(-)lib/drmtest.c +42
-2@@ -123,6 +123,36 @@ static bool has_known_intel_chipset(int fd)return true; } +static char _forced_driver[5 ] ="" ; + +/** +* __set_forced_driver: +* @name: name of driver to forcibly use +* +* Set the name of a driver to use when calling #drm_open_driver with +* the #DRIVER_ANY flag. +*/ +void __set_forced_driver (const char *name) +{ +if (!strcmp (name,"" )) { +igt_warn ("IGT_FORCE_DRIVER flag specified without a value," +"ignoring force option\n" ); +return ; + } + +igt_info ("Attempt to force module %s\n" , name); + +strncpy (_forced_driver, name,4 ); +} + +static const char *forced_driver (void ) +{ +if (_forced_driver[0 ]) +return _forced_driver; + +return NULL ; +} +#define LOCAL_I915_EXEC_VEBOX (4 << 0)/** * gem_quiescent_gpu: @@ -250,8 +280,18 @@ static int __search_and_open(const char *base, int offset, unsigned int chipset)sprintf (name,"%s%u" , base, i + offset); fd =open_device (name, chipset); -if (fd !=-1 ) -return fd; +if (fd ==-1 ) +continue ; + +// Force module +if (chipset ==DRIVER_ANY &&forced_driver ()) { +if (__is_device (fd,forced_driver ())) +return fd; +close (fd); +continue ; + } + +return fd; }return -1 ;lib/drmtest.h +2
-0@@ -51,6 +51,8 @@*/ #define DRIVER_ANY ~(DRIVER_VGEM) +void __set_forced_driver (const char *name); +/** * ARRAY_SIZE: * @arr: static array lib/igt_core.c +5
-0@@ -647,6 +647,11 @@ static void common_init_env(void) igt_frame_dump_path =getenv ("IGT_FRAME_DUMP_PATH" ); stderr_needs_sentinel =getenv ("IGT_SENTINEL_ON_STDERR" ) !=NULL ; + + env =getenv ("IGT_FORCE_DRIVER" ); +if (env) { +__set_forced_driver (env); + } } static int common_init(int *argc, char **argv,Signature · 13 lines
2.18.0 -- Rodrigo Siqueira http://siqueira.tech Graduate Student Department of Computer Science University of São Paulo _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 10 lines · Daniel Vetter
Quoted 9 lines · Rodrigo Siqueira
This commit adds a new option for forcing the use of a specific driver indicated via an environment variable.
Changes since V1:
Petri:
- Use an environment variable instead of command line
- Refactor the loop in__search_and_opento accept forced module
- Don't try to load kernel modules
Quoted 8 lines
Quoted 1 line
Signed-off-by Rodrigo Siqueira <[email protected]>Note: You can't drop the s-o-b line if your patch contains work by other people, like from Petri here. Proper way to resend a patch by someone else is to just add a subject prefix of "PATCH RESEND" and otherwise keep everything unchanged (including author and everything).
Hi,
Thanks for your feedback.
Next time I will take care for not make this mistake again.
Best Regards
Rodrigo Siqueira
Quoted 103 lines
Cheers, Daniel
Quoted 101 lines
--- lib/drmtest.c | 44 ++++++++++++++++++++++++++++++++++++++++++-- lib/drmtest.h | 2 ++ lib/igt_core.c | 5 +++++ 3 files changed, 49 insertions(+), 2 deletions(-)lib/drmtest.c +42
-2@@ -123,6 +123,36 @@ static bool has_known_intel_chipset(int fd)return true; } +static char _forced_driver[5 ] ="" ; + +/** +* __set_forced_driver: +* @name: name of driver to forcibly use +* +* Set the name of a driver to use when calling #drm_open_driver with +* the #DRIVER_ANY flag. +*/ +void __set_forced_driver (const char *name) +{ +if (!strcmp (name,"" )) { +igt_warn ("IGT_FORCE_DRIVER flag specified without a value," +"ignoring force option\n" ); +return ; + } + +igt_info ("Attempt to force module %s\n" , name); + +strncpy (_forced_driver, name,4 ); +} + +static const char *forced_driver (void ) +{ +if (_forced_driver[0 ]) +return _forced_driver; + +return NULL ; +} +#define LOCAL_I915_EXEC_VEBOX (4 << 0)/** * gem_quiescent_gpu: @@ -250,8 +280,18 @@ static int __search_and_open(const char *base, int offset, unsigned int chipset)sprintf (name,"%s%u" , base, i + offset); fd =open_device (name, chipset); -if (fd !=-1 ) -return fd; +if (fd ==-1 ) +continue ; + +// Force module +if (chipset ==DRIVER_ANY &&forced_driver ()) { +if (__is_device (fd,forced_driver ())) +return fd; +close (fd); +continue ; + } + +return fd; }return -1 ;lib/drmtest.h +2
-0@@ -51,6 +51,8 @@*/ #define DRIVER_ANY ~(DRIVER_VGEM) +void __set_forced_driver (const char *name); +/** * ARRAY_SIZE: * @arr: static array lib/igt_core.c +5
-0@@ -647,6 +647,11 @@ static void common_init_env(void) igt_frame_dump_path =getenv ("IGT_FRAME_DUMP_PATH" ); stderr_needs_sentinel =getenv ("IGT_SENTINEL_ON_STDERR" ) !=NULL ; + + env =getenv ("IGT_FORCE_DRIVER" ); +if (env) { +__set_forced_driver (env); + } } static int common_init(int *argc, char **argv,Signature · 1 line
2.18.0
Quoted 15 lines
Quoted 10 lines
Signature · 9 lines
Rodrigo Siqueira http://siqueira.tech Graduate Student Department of Computer Science University of São Paulo _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-devSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 11 lines · Daniel Vetter
Quoted 9 lines · Rodrigo Siqueira
This commit adds a new option for forcing the use of a specific driver indicated via an environment variable.
Changes since V1:
Petri:
- Use an environment variable instead of command line
- Refactor the loop in__search_and_opento accept forced module
- Don't try to load kernel modules
Quoted 8 lines
Quoted 1 line
Signed-off-by Rodrigo Siqueira <[email protected]>Note: You can't drop the s-o-b line if your patch contains work by other people, like from Petri here. Proper way to resend a patch by someone else is to just add a subject prefix of "PATCH RESEND" and otherwise keep everything unchanged (including author and everything).
Last time I was told I have to _add_ my s-o-b nonetheless, even if just re-sending the patch.
I don't think I should, but in the end I had to change the series, add and change patches,
so it didn't matter.
Maybe we need some clarification on this?
https://lists.freedesktop.org/archives/intel-gfx/2018-November/183291.html
Lucas De Marchi
Quoted 115 lines
Cheers, Daniel
Quoted 101 lines
--- lib/drmtest.c | 44 ++++++++++++++++++++++++++++++++++++++++++-- lib/drmtest.h | 2 ++ lib/igt_core.c | 5 +++++ 3 files changed, 49 insertions(+), 2 deletions(-)lib/drmtest.c +42
-2@@ -123,6 +123,36 @@ static bool has_known_intel_chipset(int fd)return true; } +static char _forced_driver[5 ] ="" ; + +/** +* __set_forced_driver: +* @name: name of driver to forcibly use +* +* Set the name of a driver to use when calling #drm_open_driver with +* the #DRIVER_ANY flag. +*/ +void __set_forced_driver (const char *name) +{ +if (!strcmp (name,"" )) { +igt_warn ("IGT_FORCE_DRIVER flag specified without a value," +"ignoring force option\n" ); +return ; + } + +igt_info ("Attempt to force module %s\n" , name); + +strncpy (_forced_driver, name,4 ); +} + +static const char *forced_driver (void ) +{ +if (_forced_driver[0 ]) +return _forced_driver; + +return NULL ; +} +#define LOCAL_I915_EXEC_VEBOX (4 << 0)/** * gem_quiescent_gpu: @@ -250,8 +280,18 @@ static int __search_and_open(const char *base, int offset, unsigned int chipset)sprintf (name,"%s%u" , base, i + offset); fd =open_device (name, chipset); -if (fd !=-1 ) -return fd; +if (fd ==-1 ) +continue ; + +// Force module +if (chipset ==DRIVER_ANY &&forced_driver ()) { +if (__is_device (fd,forced_driver ())) +return fd; +close (fd); +continue ; + } + +return fd; }return -1 ;lib/drmtest.h +2
-0@@ -51,6 +51,8 @@*/ #define DRIVER_ANY ~(DRIVER_VGEM) +void __set_forced_driver (const char *name); +/** * ARRAY_SIZE: * @arr: static array lib/igt_core.c +5
-1@@ -647,6 +647,11 @@ static void common_init_env(void) igt_frame_dump_path =getenv ("IGT_FRAME_DUMP_PATH" ); stderr_needs_sentinel =getenv ("IGT_SENTINEL_ON_STDERR" ) !=NULL ; + + env =getenv ("IGT_FORCE_DRIVER" ); +if (env) { +__set_forced_driver (env); + } } static int common_init(int *argc, char **argv, --2.18.0
Quoted 10 lines
--
Rodrigo Siqueira
http://siqueira.tech
Graduate Student
Department of Computer Science
University of São Paulo
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 8 lines
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
--
Lucas De Marchi
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 19 lines · Lucas De Marchi
Quoted 18 lines · Daniel Vetter
Quoted 10 lines · Rodrigo Siqueira
This commit adds a new option for forcing the use of a specific driver indicated via an environment variable.
Changes since V1:
Petri:
- Use an environment variable instead of command line
- Refactor the loop in__search_and_opento accept forced module
- Don't try to load kernel modulesSigned-off-by Rodrigo Siqueira <[email protected]>Note: You can't drop the s-o-b line if your patch contains work by other people, like from Petri here. Proper way to resend a patch by someone else is to just add a subject prefix of "PATCH RESEND" and otherwise keep everything unchanged (including author and everything).
Quoted 7 lines
Quoted 1 line
Last time I was told I have to _add_ my s-o-b nonetheless, even if just re-sending the patch.
I don't think I should, but in the end I had to change the series, add and change patches,
so it didn't matter.
Communication error here? Rodrigo's resend didn't have my S-o-b, that's what Daniel was pointing at. Removing S-o-b is never ok. Whether it's correct and/or required to add your own S-o-b to resends is another matter.
Quoted 3 lines
Maybe we need some clarification on this?
https://lists.freedesktop.org/archives/intel-gfx/2018-November/183291.html
That was about a kernel patch, and kernel patches are _very_ strict about having to add your S-o-b.
Signature · 5 lines
Petri Latvala _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 29 lines · Petri Latvala
Quoted 19 lines · Lucas De Marchi
Quoted 18 lines · Daniel Vetter
Quoted 10 lines · Rodrigo Siqueira
This commit adds a new option for forcing the use of a specific driver indicated via an environment variable.
Changes since V1:
Petri:
- Use an environment variable instead of command line
- Refactor the loop in__search_and_opento accept forced module
- Don't try to load kernel modulesSigned-off-by Rodrigo Siqueira <[email protected]>Note: You can't drop the s-o-b line if your patch contains work by other people, like from Petri here. Proper way to resend a patch by someone else is to just add a subject prefix of "PATCH RESEND" and otherwise keep everything unchanged (including author and everything).
Quoted 7 lines
Quoted 1 line
Last time I was told I have to _add_ my s-o-b nonetheless, even if just re-sending the patch.
I don't think I should, but in the end I had to change the series, add and change patches,
so it didn't matter.
Quoted 4 lines
Communication error here? Rodrigo's resend didn't have my S-o-b, that's what Daniel was pointing at. Removing S-o-b is never ok. Whether it's correct and/or required to add your own S-o-b to resends is another matter.
Correct.
Quoted 6 lines
Quoted 3 lines
Maybe we need some clarification on this?
https://lists.freedesktop.org/archives/intel-gfx/2018-November/183291.html
That was about a kernel patch, and kernel patches are _very_ strict about having to add your S-o-b.
Yes, for the kernel even just sending a patch around by someone, even if you change nothing, needs your sob.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev