xe/xe_module_load: add a test to load/unload Xe driver
Subsystems (2)
v4 cover xe/xe_module_load: add a test to load/unload Xe driver
From: Mauro Carvalho Chehab <[email protected]>
It is interesting to let IGT to unload/reload the Xe driver, as it can help CI to track track troubles.
Add support for it.
Test documentation:
==================
igt@xe_module_load
==================
:Category: Sofware building block
:File: tests/xe/xe_module_load.c
:Sub-category: driver
:Summary: Tests the xe module loading
:Test category: functionality test
igt@xe_module_load@force-load
=============================
:Description: Load the Xe driver passing ``force_probe=*`` parameter :Run type: BAT
igt@xe_module_load@load
=======================
:Description: Load the Xe driver
:Run type: FULL
igt@xe_module_load@unload
=========================
:Description: Unload the Xe driver
:Run type: FULL
igt@xe_module_load@reload
=========================
:Description: Reload the Xe driver
:Run type: FULL
igt@xe_module_load@reload-no-display
====================================
:Description: Reload the Xe driver passing ``enable_display=0`` parameter :Run type: FULL
igt@xe_module_load@many-reload
==============================
:Description: Reload the Xe driver many times :Run type: FULL
---
v4:
- patch 1 broke on two patches, to reduce git diff, making easier to review;
- addressed some nitpicks on patch 4.
v3:
- no changes. Just rebased due to a merge conflict.
v2:
- added a patch (already submitted) to shut-up i915 trybot to try to run those tests when i915 driver is loaded;
- removed duplication of the unwanted drivers array and declare it as const with const strings;
- reordered includes and removed a duplication;
- did some cosmetic changes.
Mauro Carvalho Chehab (4):
intel-ci: update blacklists to work with the Xe driver
intel-ci: create a symlink for i915-blacklist.txt lib/igt_kmod: add support for Xe driver xe/xe_module_load: add a test to load/unload Xe driver
lib/igt_kmod.c | 34 ++--- lib/igt_kmod.h | 32 ++++- tests/intel-ci/blacklist.txt | 130 +---------------- tests/intel-ci/i915-blacklist.txt | 133 ++++++++++++++++++ tests/intel-ci/xe-blacklist.txt | 21 +++ tests/intel-ci/xe-fast-feedback.testlist | 3 + tests/meson.build | 1 + tests/xe/xe_module_load.c | 172 +++++++++++++++++++++++ 8 files changed, 377 insertions(+), 149 deletions(-) mode change 100644 => 120000 tests/intel-ci/blacklist.txt create mode 100644 tests/intel-ci/i915-blacklist.txt create mode 100644 tests/intel-ci/xe-blacklist.txt create mode 100644 tests/xe/xe_module_load.c
Signature · 1 line
2.39.2
PATCH v4 1/4 intel-ci: update blacklists to work with the Xe driver
From: Mauro Carvalho Chehab <[email protected]>
It doesn't make sense to run i915 tests with Xe driver and vice-versa. Update testlists to make it clear.
---
.../{blacklist.txt => i915-blacklist.txt} | 4 ++++
tests/intel-ci/xe-blacklist.txt | 21 +++++++++++++++++++
2 files changed, 25 insertions(+)
rename tests/intel-ci/{blacklist.txt => i915-blacklist.txt} (97%)
create mode 100644 tests/intel-ci/xe-blacklist.txttests/intel-ci/i915-blacklist.txt renamed from tests/intel-ci/blacklist.txt +4 -0
@@ -84,6 +84,10 @@ igt@kms_chamelium_frames@hdmi-.*-planes-random igt@vc4_.* igt@v3d_.* ############################################### +# Intel Xe +############################################### +igt@xe/.* +############################################### # AMD ############################################### igt@amdgpu/.*
tests/intel-ci/xe-blacklist.txt new file +21 -0
@@ -0,0 +1,21 @@ +############################################### +# Broadcom +############################################### +igt@vc4_.* +igt@v3d_.* +############################################### +# Intel i915 +############################################### +igt@i915/.* +############################################### +# AMD +############################################### +igt@amdgpu/.* +############################################### +# Panfrost +############################################### +igt@panfrost_.* +############################################### +# Qualcomm +############################################### +igt@msm_.*
Signature · 1 line
2.39.2
Re: [igt-dev] [PATCH i-g-t v4 1/4] intel-ci: update blacklists to work with the Xe driver
Hi Mauro,
Quoted 5 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
It doesn't make sense to run i915 tests with Xe driver and vice-versa. Update testlists to make it clear.
Quoted 7 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>--- .../{blacklist.txt => i915-blacklist.txt} | 4 ++++ tests/intel-ci/xe-blacklist.txt | 21 +++++++++++++++++++ 2 files changed, 25 insertions(+) rename tests/intel-ci/{blacklist.txt => i915-blacklist.txt} (97%) create mode 100644 tests/intel-ci/xe-blacklist.txt
imho we do not need symlink here but if you want to discuss it please split this move to i915-blacklist.txt and 2/4 into separate patchseries, so we will not block merging changes to xe-blacklist.txt and adding igt@xe_.* to blacklist.txt
Quoted 9 lines
tests/intel-ci/i915-blacklist.txt renamed from tests/intel-ci/blacklist.txt +0
-0
tests/intel-ci/i915-blacklist.txt igt@kms_chamelium_frames@hdmi-.*-planes-random · line 89
Quoted 6 lines
tests/intel-ci/i915-blacklist.txt renamed from tests/intel-ci/blacklist.txt +3
-0@@ -84,6 +84,10 @@ igt@kms_chamelium_frames@hdmi-.*-planes-random igt@vc4_.* igt@v3d_.* ############################################### +# Intel Xe +############################################### +igt@xe/.*
-------- ^
There is no xe subdirectory with xe tests, all binaries are named xe_* and are placed in build/tests/
This should be:
igt@xe_.*
tests/intel-ci/i915-blacklist.txt igt@kms_chamelium_frames@hdmi-.*-planes-random · line 93
Quoted 4 lines
tests/intel-ci/i915-blacklist.txt renamed from tests/intel-ci/blacklist.txt +1
-0+############################################### # AMD ############################################### igt@amdgpu/.*
See here, all amdgpu binaries are in this subfolder, so '/' is used.
Quoted 6 lines
tests/intel-ci/xe-blacklist.txt new file +0
-0
tests/intel-ci/xe-blacklist.txt line 9
Quoted 9 lines
tests/intel-ci/xe-blacklist.txt new file +9
-0@@ -0,0 +1,21 @@ +############################################### +# Broadcom +############################################### +igt@vc4_.* +igt@v3d_.* +############################################### +# Intel i915 +############################################### +igt@i915/.*
---------- ^
Same here,
igt@i915_.*
Add also:
igt@gem.*
igt@gen.*
imho look at tests/i915, we should really put all that here in alphabetical order and with regexp where possible to make it as short as possible.
Regards,
Kamil
Quoted 15 lines
tests/intel-ci/xe-blacklist.txt new file +12
-0+############################################### +# AMD +############################################### +igt@amdgpu/.* +############################################### +# Panfrost +############################################### +igt@panfrost_.* +############################################### +# Qualcomm +############################################### +igt@msm_.*Signature · 1 line
2.39.2
PATCH v4 2/4 intel-ci: create a symlink for i915-blacklist.txt
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
In order to avoid disrupts at exiting intel-ci tests, keep a symlink to the i915 blacklist:
i915-blacklist.txt -> blacklist.txt
--- tests/intel-ci/blacklist.txt | 1 + 1 file changed, 1 insertion(+) create mode 120000 tests/intel-ci/blacklist.txt
tests/intel-ci/blacklist.txt new file +1 -0
@@ -0,0 +1 @@ +i915-blacklist.txt
Signature · 1 line
2.39.2
PATCH v4 3/4 lib/igt_kmod: add support for Xe driver
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
Change the kmod logic to also work with the Xe driver.
--- lib/igt_kmod.c | 34 +++++++++++++++++----------------- lib/igt_kmod.h | 32 +++++++++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 20 deletions(-)
lib/igt_kmod.c +17 -17
@@ -404,23 +404,23 @@ static void *strdup_realloc(char *origptr, const char *strdata) }/** -* igt_i915_driver_load: -* @opts: options to pass to i915 driver +* igt_intel_driver_load: +* @opts: options to pass to Intel driver * -* Loads the i915 driver and its dependencies. +* Loads an Intel driver and its dependencies. * */ int -igt_i915_driver_load (const char *opts) +igt_intel_driver_load (const char *opts,const char *driver) {int ret;if (opts) -igt_info ("Reloading i915 with %s\n\n" , opts); +igt_info ("Reloading %s with %s\n\n" , driver, opts); - ret =igt_kmod_load ("i915" , opts); + ret =igt_kmod_load (driver, opts);if (ret) { -igt_debug ("Could not load i915\n" ); +igt_debug ("Could not load %s\n" , driver);return ret; }
@@ -496,7 +496,7 @@ int igt_audio_driver_unload(char **who)return igt_always_unload_audio_driver (who); } -int __igt_i915_driver_unload (char **who) +int __igt_intel_driver_unload (char **who,const char *driver) {int ret;
@@ -530,11 +530,11 @@ int __igt_i915_driver_unload(char **who) } } -if (igt_kmod_is_loaded ("i915" )) { - ret =igt_kmod_unload ("i915" ,0 ); +if (igt_kmod_is_loaded (driver)) { + ret =igt_kmod_unload (driver,0 );if (ret) {if (who) - *who =strdup_realloc (*who,"i915" ); + *who =strdup_realloc (*who, driver);return ret; }
@@ -544,18 +544,18 @@ int __igt_i915_driver_unload(char **who) }/** -* igt_i915_driver_unload: +* igt_intel_driver_unload: * -* Unloads the i915 driver and its dependencies. +* Unloads an Intel driver and its dependencies. * */ int -igt_i915_driver_unload (void ) +igt_intel_driver_unload (const char *driver) {char *who =NULL ;int ret; - ret =__igt_i915_driver_unload (&who); + ret =__igt_intel_driver_unload (&who, driver);if (ret) {igt_warn ("Could not unload %s\n" , who);igt_kmod_list_loaded ();
@@ -572,8 +572,8 @@ igt_i915_driver_unload(void)igt_kmod_unload ("drm_kms_helper" ,0 );igt_kmod_unload ("drm" ,0 ); -if (igt_kmod_is_loaded ("i915" )) { -igt_warn ("i915.ko still loaded!\n" ); +if (igt_kmod_is_loaded ("driver" )) { +igt_warn ("%s.ko still loaded!\n" , driver);return -EBUSY ; }
lib/igt_kmod.h +29 -3
@@ -38,9 +38,35 @@ int igt_kmod_unload(const char *mod_name, unsigned int flags);int igt_audio_driver_unload (char **whom); -int igt_i915_driver_load (const char *opts); -int igt_i915_driver_unload (void ); -int __igt_i915_driver_unload (char **whom); +int igt_intel_driver_load (const char *opts,const char *driver); +int igt_intel_driver_unload (const char *driver); +int __igt_intel_driver_unload (char **who,const char *driver); + +static inline int igt_i915_driver_load (const char *opts) +{ +return igt_intel_driver_load (opts,"i915" ); +} + +static inline int igt_i915_driver_unload (void ) +{ +return igt_intel_driver_unload ("i915" ); +} + +static inline int __igt_i915_driver_unload (char **whom) +{ +return __igt_intel_driver_unload (whom,"i915" ); +}; + +static inline int igt_xe_driver_load (const char *opts) +{ +return igt_intel_driver_load (opts,"xe" ); +} + + +static inline int igt_xe_driver_unload (void ) +{ +return igt_intel_driver_unload ("xe" ); +}int igt_amdgpu_driver_load (const char *opts);int igt_amdgpu_driver_unload (void );
Signature · 1 line
2.39.2
PATCH v4 4/4 xe/xe_module_load: add a test to load/unload Xe driver
In reply to Mauro Carvalho ChehabFrom: Mauro Carvalho Chehab <[email protected]>
This is helpful to allow IGT to check if there are issues during module load/unload.
--- tests/intel-ci/xe-fast-feedback.testlist | 3 + tests/meson.build | 1 + tests/xe/xe_module_load.c | 172 +++++++++++++++++++++++ 3 files changed, 176 insertions(+) create mode 100644 tests/xe/xe_module_load.c
tests/intel-ci/xe-fast-feedback.testlist +3 -0
@@ -1,3 +1,6 @@ +# Should be the first test +igt@xe_module_load@force-load + igt@xe_compute@compute-square igt@xe_debugfs@base igt@xe_debugfs@gt
tests/meson.build +1 -0
@@ -256,6 +256,7 @@ xe_progs = [ 'xe_huc_copy', 'xe_mmap', 'xe_mmio', + 'xe_module_load', 'xe_noexec_ping_pong', 'xe_pm', 'xe_prime_self_import',
tests/xe/xe_module_load.c new file +172 -0
172 lines not on this page · raw message
Signature · 1 line
2.39.2
Quoted 6 lines · Mauro Carvalho Chehab
From: Mauro Carvalho Chehab <[email protected]>
This is helpful to allow IGT to check if there are issues during module load/unload.
Signed-off-by Mauro Carvalho Chehab <[email protected]>
Quoted 211 lines
--- tests/intel-ci/xe-fast-feedback.testlist | 3 + tests/meson.build | 1 + tests/xe/xe_module_load.c | 172 +++++++++++++++++++++++ 3 files changed, 176 insertions(+) create mode 100644 tests/xe/xe_module_load.ctests/intel-ci/xe-fast-feedback.testlist +3
-0@@ -1,3 +1,6 @@ +# Should be the first test +igt@xe_module_load@force-load + igt@xe_compute@compute-square igt@xe_debugfs@base igt@xe_debugfs@gttests/meson.build +1
-0@@ -256,6 +256,7 @@ xe_progs = [ 'xe_huc_copy', 'xe_mmap', 'xe_mmio', + 'xe_module_load', 'xe_noexec_ping_pong', 'xe_pm', 'xe_prime_self_import',tests/xe/xe_module_load.c new file +172
-0@@ -0,0 +1,172 @@ +// SPDX-License-Identifier: MIT +/* +* Copyright © 2023 Intel Corporation +*/ + +/** +* TEST: Tests the xe module loading +* Category: Sofware building block +* Sub-category: driver +* Test category: functionality test +*/ + +#include <dirent.h> +#include <fcntl.h> +#include <libgen.h> + +#ifdef __linux__ +#include <linux/limits.h> +#endif + +#include <signal.h> + +#include <sys/ioctl.h> +#include <sys/utsname.h> + +#include "igt.h" + +#include "igt_aux.h" +#include "igt_core.h" +#include "igt_debugfs.h" +#include "igt_kmod.h" +#include "igt_sysfs.h" + +#define BAR_SIZE_SHIFT 20 +#define MIN_BAR_SIZE 256 + +static void file_write (const char *ptr,size_t size,size_t nmemb, +FILE *fp) +{ +int count; + + count =fwrite (ptr, size, nmemb, fp); +if (count == size * nmemb) +return ; + +igt_debug ("Can't update hda dynamic debug with : %s\n" , ptr); +} + +static void hda_dynamic_debug (bool enable) +{ +FILE *fp; +static const char snd_hda_intel_on[] ="module snd_hda_intel +pf" ; +static const char snd_hda_core_on[] ="module snd_hda_core +pf" ; + +static const char snd_hda_intel_off[] ="module snd_hda_intel =_" ; +static const char snd_hda_core_off[] ="module snd_hda_core =_" ; + + fp =fopen ("/sys/kernel/debug/dynamic_debug/control" ,"w" ); +if (!fp) { +igt_debug ("hda dynamic debug not available\n" ); +return ; + } + +if (enable) { +file_write (snd_hda_intel_on,1 ,sizeof (snd_hda_intel_on), fp); +file_write (snd_hda_core_on,1 ,sizeof (snd_hda_core_on), fp); + }else { +file_write (snd_hda_intel_off,1 ,sizeof (snd_hda_intel_off), fp); +file_write (snd_hda_core_off,1 ,sizeof (snd_hda_core_off), fp); + } + +fclose (fp); +} + +static void load_and_check_xe (const char *opts) +{ +int error; +int drm_fd; + +hda_dynamic_debug (true); + error =igt_xe_driver_load (opts); +hda_dynamic_debug (false); + +igt_assert_eq (error,0 ); + +/* driver is ready, check if it's bound */ + drm_fd =__drm_open_driver (DRIVER_XE ); +igt_fail_on_f (drm_fd <0 ,"Cannot open the xe DRM driver after modprobing xe.\n" ); +close (drm_fd); +} + +static const char *const unwanted_drivers[] = { +"xe" , +"i915" , +NULL +}; + +/** +* SUBTEST: force-load +* Description: Load the Xe driver passing ``force_probe=*`` parameter +* Run type: BAT +* +* SUBTEST: load +* Description: Load the Xe driver +* Run type: FULL +* +* SUBTEST: unload +* Description: Unload the Xe driver +* Run type: FULL +* +* SUBTEST: reload +* Description: Reload the Xe driver +* Run type: FULL +* +* SUBTEST: reload-no-display +* Description: Reload the Xe driver passing ``enable_display=0`` parameter +* Run type: FULL +* +* SUBTEST: many-reload +* Description: Reload the Xe driver many times +* Run type: FULL +*/ +igt_main +{ +igt_describe ("Check if xe and friends are not yet loaded, then load them." ); + igt_subtest("load") { +for (int i =0 ; unwanted_drivers[i] !=NULL ; i++) { +igt_skip_on_f (igt_kmod_is_loaded (unwanted_drivers[i]), +"%s is already loaded\n" , unwanted_drivers[i]); + } + +load_and_check_xe (NULL ); + } + + igt_subtest("unload") { +igt_xe_driver_unload (); + } + + igt_subtest("force-load") { +for (int i =0 ; unwanted_drivers[i] !=NULL ; i++) { +igt_skip_on_f (igt_kmod_is_loaded (unwanted_drivers[i]), +"%s is already loaded\n" , unwanted_drivers[i]); + } + +load_and_check_xe ("force_probe=*" ); + } + + igt_subtest("reload-no-display") { +igt_xe_driver_unload (); +load_and_check_xe ("enable_display=0" ); + } + + igt_subtest("many-reload") { +int i; + +for (i =0 ; i <10 ; i++) { +igt_debug ("reload cycle: %d\n" , i); +igt_xe_driver_unload (); +load_and_check_xe (NULL ); +sleep (1 ); + } + } + + igt_subtest("reload") { +igt_xe_driver_unload (); +load_and_check_xe (NULL ); + +/* only default modparams, can leave module loaded */ + } + +/* Subtests should unload the module themselves if they use modparams */ +}Signature · 1 line
2.39.2
Patchwork
CI[igt-dev] ✗ Fi.CI.BAT: failure for xe/xe_module_load: add a test to load/unload Xe driver (rev4)
In reply to Mauro Carvalho Chehab== Series Details ==
== Series Details ==
Series: xe/xe_module_load: add a test to load/unload Xe driver (rev4)
URL : https://patchwork.freedesktop.org/series/115511/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_12903 -> IGTPW_8667
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with IGTPW_8667 absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in IGTPW_8667, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8667/index.html
Participating hosts (36 -> 36)
------------------------------
Additional (1): fi-pnv-d510
Missing (1): fi-snb-2520m
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in IGTPW_8667:
### IGT changes ###
#### Possible regressions ####
* igt@kms_pipe_crc_basic@nonblocking-crc-frame-sequence@pipe-d-dp-1:
- bat-dg2-8: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12903/bat-dg2-8/igt@kms_pipe_crc_basic@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8667/bat-dg2-8/igt@kms_pipe_crc_basic@[email protected]
Known issues
------------
Here are the changes found in IGTPW_8667 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_selftest@live@gt_lrc:
- bat-rpls-2: [PASS][3] -> [INCOMPLETE][4] ([i915#4983] / [i915#7913])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12903/bat-rpls-2/igt@i915_selftest@live@gt_lrc.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8667/bat-rpls-2/igt@i915_selftest@live@gt_lrc.html
* igt@i915_selftest@live@reset:
- bat-rpls-1: [PASS][5] -> [ABORT][6] ([i915#4983])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12903/bat-rpls-1/igt@i915_selftest@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8667/bat-rpls-1/igt@i915_selftest@[email protected]
* igt@kms_pipe_crc_basic@read-crc:
- bat-dg2-11: NOTRUN -> [SKIP][7] ([i915#5354])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8667/bat-dg2-11/igt@[email protected]
* igt@kms_psr@primary_page_flip:
- fi-pnv-d510: NOTRUN -> [SKIP][8] ([fdo#109271]) +38 similar issues
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8667/fi-pnv-d510/igt@kms_psr@primary_page_flip.html
#### Possible fixes ####
* igt@kms_pipe_crc_basic@nonblocking-crc@pipe-d-dp-1:
- bat-dg2-8: [FAIL][9] -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_12903/bat-dg2-8/igt@kms_pipe_crc_basic@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8667/bat-dg2-8/igt@kms_pipe_crc_basic@[email protected]
[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[i915#4983]: https://gitlab.freedesktop.org/drm/intel/issues/4983
[i915#5354]: https://gitlab.freedesktop.org/drm/intel/issues/5354
[i915#7913]: https://gitlab.freedesktop.org/drm/intel/issues/7913
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_7211 -> IGTPW_8667
CI-20190529: 20190529
CI_DRM_12903: 08c3a5cb8ecc67b7251e5c2b127e8778cc4deab0 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_8667: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8667/index.html
IGT_7211: c0cc1de7b2f4041ca68960362aa55f881d416bac @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Testlist changes
----------------
+igt@xe_module_load@force-load
+igt@xe_module_load@load
+igt@xe_module_load@many-reload
+igt@xe_module_load@reload
+igt@xe_module_load@reload-no-display
+igt@xe_module_load@unload
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_8667/index.html