Convert sh scripts to C variants.
v4 cover Convert sh scripts to C variants.
TL;DR changes since last version: Use lib/igt_kmod so other users can make use of it (specifically found that lib/igt_gvt, and covert it).
This series adds some library support to help converting sh scripts to C version. Based on that I've converted drv_module_reload_basic and kms_sysfs_edid_timing. Other tests should follow. drv_module_reload requires the most boilerplate code.
The reason for so many changes is the fact that some code got moved so other users can use it. Secondly wrappers around libkmod in lib/igt_kmod and procps in lib/igt_aux. Thirdly drv_module_reload has embedded tools/gem_info and tests/gem_exec_store in it, with minor modifications to allow running them as subtests. Finally, C is more verbose than sh.
Changes since v3:
- lib/igt_kmod: added libkmod helpers into their own file. There seems to be another user for it: lib/igt_gvt. Fixed a issue with lib/igt_gvt while at it and converted to make use of lib/igt_kmod.
- lib/{igt_kmod, igt_aux}: Fixed gtk-doc documentation formatting (Daniel Vetter)
- tests/drv_module_reload: Re-worked reload() method by splitting into load() and unload() and asserting more.
- replaced SW_FINISH with SET_CACHEING in tests/drv_module_reload (Chris Wilson)
Changes since v2:
- lib/igt_aux: Addressed comments from Chris Wilson
- tests/drv_module_reload: Passed incorrectly boolean instead of uint as flags to igt_kmod_unload().
Changes since v1:
- lib/igt_aux: Addressed comments from Chris Wilson
- tests/drv_module_reload: Addressed comments from Chris Wilson and Petri Latvala
- tests/kms_sysfs_edid_timing: Addressed comments from Chris Wilson
- (Hopefully): Addressed comments from Jani Nikula.
Marius Vlad (4):
lib/{igt_sysfs,igt_aux}: Make available to other users kick_fbcon()
(unbind_fbcon()), and added helpers to lib/igt_aux, lib/igt_kmod.
lib/igt_gvt: Make use of libkmod helpers and fix reading gvt
parameter.
tests/drv_module_reload: Convert sh script to C version. tests/kms_sysfs_edid_timing: Convert sh to C version.
configure.ac | 2 + lib/Makefile.am | 2 + lib/Makefile.sources | 2 + lib/igt_aux.c | 40 ++++ lib/igt_aux.h | 2 + lib/igt_gvt.c | 79 +++---- lib/igt_kmod.c | 164 ++++++++++++++ lib/igt_kmod.h | 35 +++ lib/igt_sysfs.c | 54 +++++ lib/igt_sysfs.h | 2 + tests/Makefile.am | 1 - tests/Makefile.sources | 4 +- tests/drv_module_reload.c | 415 ++++++++++++++++++++++++++++++++++ tests/drv_module_reload_basic | 105 --------- tests/gem_alive.c | 35 --- tests/gvt_basic.c | 2 +- tests/intel-ci/fast-feedback.testlist | 13 +- tests/kms_sysfs_edid_timing | 25 -- tests/kms_sysfs_edid_timing.c | 107 +++++++++ tools/Makefile.sources | 1 + tools/intel_gem_info.c | 35 +++ 21 files changed, 910 insertions(+), 215 deletions(-) create mode 100644 lib/igt_kmod.c create mode 100644 lib/igt_kmod.h create mode 100644 tests/drv_module_reload.c delete mode 100755 tests/drv_module_reload_basic delete mode 100644 tests/gem_alive.c delete mode 100755 tests/kms_sysfs_edid_timing create mode 100644 tests/kms_sysfs_edid_timing.c create mode 100644 tools/intel_gem_info.c
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 1/4 lib/{igt_sysfs, igt_aux}: Make available to other users kick_fbcon() (unbind_fbcon()), and added helpers to lib/igt_aux, lib/igt_kmod.
lib/igt_aux: Added igt_pkill helper. lib/igt_kmod: Added load/unload kmod helpers.
v4:
- decided to split libkmod helpers into their own file as there's another user lib/igt_gvt or tests/gvt_basic.
- fixed some gtk-doc documentation.
v3:
- return -errno (igt_pkill()) in case of failure (Cris Wilson)
- return bool for igt_kmod_is_loaded(), replaced strncasecmp with strncmp (Chris Wilson)
- use igt_debug() instead of igt_info() for igt_kmod_load()/ igt_kmod_unload() and return -err directly from libkmod (Chris Wilson)
v2:
- Renamed libkmod helpers (Chris Wilson)
- Removed SIGTERM/SIGKILL case where we repeatedly tried to terminate the
process: just call kill(2) once (Chris Wilson)
- Removed redundant check in igt_kmod_unload(), igt_module_in_use() (Chris Wilson)
- Pass flags to igt_kmod_unload() from the caller (Chris Wilson)
- Removed useless function igt_kill() which acts just as kill(2) (Chris Wilson)
--- configure.ac | 2 + lib/Makefile.am | 2 + lib/Makefile.sources | 2 + lib/igt_aux.c | 40 +++++++++++++ lib/igt_aux.h | 2 + lib/igt_gvt.c | 43 +------------- lib/igt_kmod.c | 164 +++++++++++++++++++++++++++++++++++++++++++++++++++ lib/igt_kmod.h | 35 +++++++++++ lib/igt_sysfs.c | 54 +++++++++++++++++ lib/igt_sysfs.h | 2 + 10 files changed, 305 insertions(+), 41 deletions(-) create mode 100644 lib/igt_kmod.c create mode 100644 lib/igt_kmod.h
configure.ac +2 -0
@@ -121,6 +121,8 @@ AC_SUBST(ASSEMBLER_WARN_CFLAGS) PKG_CHECK_MODULES(DRM, [libdrm]) PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10]) +PKG_CHECK_MODULES(KMOD, [libkmod]) +PKG_CHECK_MODULES(PROCPS, [libprocps]) case "$target_cpu" in x86*|i?86)
lib/Makefile.am +2 -0
@@ -34,6 +34,8 @@ AM_CFLAGS += $(CAIRO_CFLAGS) libintel_tools_la_LIBADD = \ $(DRM_LIBS) \ $(PCIACCESS_LIBS) \ + $(PROCPS_LIBS) \ + $(KMOD_LIBS) \ $(CAIRO_LIBS) \ $(LIBUDEV_LIBS) \ $(LIBUNWIND_LIBS) \
lib/Makefile.sources +2 -0
@@ -77,6 +77,8 @@ lib_source_list = \ igt_pm.h \ uwildmat/uwildmat.h \ uwildmat/uwildmat.c \ + igt_kmod.c \ + igt_kmod.h \ $(NULL) .PHONY: version.h.tmp
lib/igt_aux.c +40 -0
@@ -51,6 +51,8 @@#include <termios.h> #include <assert.h> +#include <proc/readproc.h> +#include "drmtest.h" #include "i915_drm.h" #include "intel_chipset.h"
@@ -1193,6 +1195,44 @@ void igt_set_module_param_int(const char *name, int val)igt_set_module_param (name, str); } +/** +* igt_pkill: +* @sig: Signal to send +* @comm: Name of process in the form found in /proc/pid/comm (limited to 15 +* chars) +* +* Returns: 0 in case the process is not found running or the signal has been +* sent successfully or -errno otherwise. +* +* This function sends the signal @sig for a process found in process table +* with name @comm. +*/ +int +igt_pkill (int sig,const char *comm) +{ +PROCTAB *proc; +proc_t *proc_info; +int err =0 ; + + proc =openproc (PROC_FILLCOM |PROC_FILLSTAT |PROC_FILLARG ); +igt_assert (proc !=NULL ); + +while ((proc_info =readproc (proc,NULL ))) { +if (!strncasecmp (proc_info->cmd, comm,sizeof (proc_info->cmd))) { + +if (kill (proc_info->tid, sig) <0 ) + err = -errno; + +freeproc (proc_info); +break ; + } +freeproc (proc_info); + } + +closeproc (proc); +return err; +} + static struct igt_siglatency { timer_t timer; struct timespec target;
lib/igt_aux.h +2 -0
@@ -264,4 +264,6 @@ double igt_stop_siglatency(struct igt_mean *result);void igt_set_module_param (const char *name,const char *val);void igt_set_module_param_int (const char *name,int val); +int igt_pkill (int sig,const char *comm); +#endif /* IGT_AUX_H */
lib/igt_gvt.c +2 -41
57 lines not on this page · raw message
lib/igt_kmod.c new file +164 -0
164 lines not on this page · raw message
lib/igt_kmod.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* Copyright © 2016 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +*/ + +#ifndef IGT_KMOD_H +#define IGT_KMOD_H + +#include <libkmod.h> + +bool igt_kmod_is_loaded (const char *mod_name); + +int igt_kmod_load (const char *mod_name,const char *opts); +int igt_kmod_unload (const char *mod_name,unsigned int flags); + + +#endif /* IGT_KMOD_H */
lib/igt_sysfs.c +54 -0
64 lines not on this page · raw message
lib/igt_sysfs.h +2 -0
@@ -43,4 +43,6 @@ bool igt_sysfs_set_u32(int dir, const char *attr, uint32_t value);bool igt_sysfs_get_boolean (int dir,const char *attr);bool igt_sysfs_set_boolean (int dir,const char *attr,bool value); +void kick_fbcon (bool enable); +#endif /* __IGT_SYSFS_H__ */
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 1/4 v4] lib/{igt_sysfs, igt_aux}: Make available to other users kick_fbcon() (unbind_fbcon()), and added helpers to lib/igt_aux, lib/igt_kmod.
lib/Makefile.am AM_CFLAGS += $(CAIRO_CFLAGS)
Quoted 5 lines · Marius Vlad
lib/Makefile.am +0
-0@@ -34,6 +34,8 @@ AM_CFLAGS += $(CAIRO_CFLAGS)
Missed adding the CFLAGS for KMOD and PROCPS.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 2/4 lib/igt_gvt: Make use of libkmod helpers and fix reading gvt parameter.
In reply to Marius Vlad--- lib/igt_gvt.c | 42 +++++++++++++++++++++++++++++++++++------- tests/gvt_basic.c | 2 +- 2 files changed, 36 insertions(+), 8 deletions(-)
lib/igt_gvt.c +35 -7
@@ -24,23 +24,26 @@#include "igt.h" #include "igt_gvt.h" #include "igt_sysfs.h" +#include "igt_kmod.h" +#include <signal.h> #include <dirent.h> #include <unistd.h> #include <fcntl.h> +#include <time.h> static bool is_gvt_enabled (void ) {FILE *file; -int value; +char value;bool enabled = false; file =fopen ("/sys/module/i915/parameters/enable_gvt" ,"r" );if (!file)return false; -if (fscanf (file,"%d" , &value) ==1 ) - enabled = value; +if (fscanf (file,"%c" , &value) ==1 ) + enabled = (value =='Y' ? true : false);fclose (file); errno =0 ;
@@ -50,9 +53,20 @@ static bool is_gvt_enabled(void)static void unload_i915 (void ) {kick_fbcon (false); -/* pkill alsact */ -igt_ignore_warn (system ("/sbin/modprobe -s -r i915" )); + +if (igt_kmod_is_loaded ("i915" )) { + +if (igt_kmod_is_loaded ("snd_hda_intel" )) { +igt_assert (!igt_pkill (SIGTERM ,"alsactl" )); +igt_assert (!igt_kmod_unload ("snd_hda_intel" ,0 )); + } + +igt_assert (!igt_kmod_unload ("i915" ,0 )); +igt_assert (!igt_kmod_unload ("drm_kms_helper" ,0 )); +igt_assert (!igt_kmod_unload ("drm" ,0 )); + } + }bool igt_gvt_load_module (void )
@@ -61,8 +75,15 @@ bool igt_gvt_load_module(void)return true;unload_i915 (); -igt_ignore_warn (system ("/sbin/modprobe -s i915 enable_gvt=1" )); +igt_assert (!igt_kmod_load ("drm" ,NULL )); +igt_assert (!igt_kmod_load ("drm_kms_helper" ,NULL )); + +igt_assert (!igt_kmod_load ("i915" ,"enable_gvt=1" )); + +kick_fbcon (true); + +igt_assert (!igt_kmod_load ("snd_hda_intel" ,NULL ));return is_gvt_enabled (); }
@@ -72,7 +93,14 @@ void igt_gvt_unload_module(void)return ;unload_i915 (); -igt_ignore_warn (system ("/sbin/modprobe -s i915 enable_gvt=0" )); + +igt_assert (!igt_kmod_load ("drm" ,NULL )); +igt_assert (!igt_kmod_load ("drm_kms_helper" ,NULL )); + +igt_assert (!igt_kmod_load ("i915" ,"enable_gvt=0" ));igt_assert (!is_gvt_enabled ()); + +kick_fbcon (true); +igt_assert (!igt_kmod_load ("snd_hda_intel" ,NULL )); }
tests/gvt_basic.c +1 -1
@@ -32,7 +32,7 @@ igt_main igt_fixture {igt_require (igt_gvt_load_module ()); - fd =drm_open_driver (DRIVER_INTEL ); + fd =__drm_open_driver (DRIVER_INTEL ); }igt_subtest_f ("invalid-placeholder-test" );
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 2/4 v4] lib/igt_gvt: Make use of libkmod helpers and fix reading gvt parameter.
Quoted 27 lines · Marius Vlad
Signed-off-by Marius Vlad <[email protected]>--- lib/igt_gvt.c | 42 +++++++++++++++++++++++++++++++++++------- tests/gvt_basic.c | 2 +- 2 files changed, 36 insertions(+), 8 deletions(-)lib/igt_gvt.c +4
-1@@ -24,23 +24,26 @@#include "igt.h" #include "igt_gvt.h" #include "igt_sysfs.h" +#include "igt_kmod.h" +#include <signal.h> #include <dirent.h> #include <unistd.h> #include <fcntl.h> +#include <time.h> static bool is_gvt_enabled (void ) {FILE *file; -int value; +char value;
lib/igt_gvt.c line 46
Quoted 10 lines
lib/igt_gvt.c +2
-2bool enabled = false; file =fopen ("/sys/module/i915/parameters/enable_gvt" ,"r" );if (!file)return false; -if (fscanf (file,"%d" , &value) ==1 ) - enabled = value; +if (fscanf (file,"%c" , &value) ==1 ) + enabled = (value =='Y' ? true : false);
enabled = value == 'Y'; else if (fscanf(file, "%d", &value) == 1) enabled = value;
Do I see a igt_kmod_parameter_get_boolean() in the future, I think I do!
Quoted 11 lines
lib/igt_gvt.c +1
-2fclose (file); errno =0 ;@@ -50,9 +53,20 @@ static bool is_gvt_enabled(void)static void unload_i915 (void ) {kick_fbcon (false); -/* pkill alsact */ -igt_ignore_warn (system ("/sbin/modprobe -s -r i915" )); +
lib/igt_gvt.c static bool is_gvt_enabled(void) · line 67
Quoted 10 lines
lib/igt_gvt.c +10
-0+if (igt_kmod_is_loaded ("i915" )) { + +if (igt_kmod_is_loaded ("snd_hda_intel" )) { +igt_assert (!igt_pkill (SIGTERM ,"alsactl" )); +igt_assert (!igt_kmod_unload ("snd_hda_intel" ,0 )); + } + +igt_assert (!igt_kmod_unload ("i915" ,0 )); +igt_assert (!igt_kmod_unload ("drm_kms_helper" ,0 )); +igt_assert (!igt_kmod_unload ("drm" ,0 ));
But don't we already have this routine...
For this test, we shouldn't fail if we can't setup the environment as we need, but skip the test.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 2/4 v4] lib/igt_gvt: Make use of libkmod helpers and fix reading gvt parameter.
Quoted 53 lines · Chris Wilson
Quoted 27 lines · Marius Vlad
Signed-off-by Marius Vlad <[email protected]>--- lib/igt_gvt.c | 42 +++++++++++++++++++++++++++++++++++------- tests/gvt_basic.c | 2 +- 2 files changed, 36 insertions(+), 8 deletions(-)lib/igt_gvt.c +4
-1@@ -24,23 +24,26 @@#include "igt.h" #include "igt_gvt.h" #include "igt_sysfs.h" +#include "igt_kmod.h" +#include <signal.h> #include <dirent.h> #include <unistd.h> #include <fcntl.h> +#include <time.h> static bool is_gvt_enabled (void ) {FILE *file; -int value; +char value;lib/igt_gvt.c line 46
Quoted 10 lines
lib/igt_gvt.c +2
-2bool enabled = false; file =fopen ("/sys/module/i915/parameters/enable_gvt" ,"r" );if (!file)return false; -if (fscanf (file,"%d" , &value) ==1 ) - enabled = value; +if (fscanf (file,"%c" , &value) ==1 ) + enabled = (value =='Y' ? true : false);enabled = value == 'Y'; else if (fscanf(file, "%d", &value) == 1) enabled = value;Do I see a
igt_kmod_parameter_get_boolean()in the future, I think I do!Quoted 9 lines
lib/igt_gvt.c +0
-1fclose (file); errno =0 ;@@ -50,9 +53,20 @@ static bool is_gvt_enabled(void)static void unload_i915 (void ) {kick_fbcon (false); -/* pkill alsact */
Quoted 14 lines
lib/igt_gvt.c static bool is_gvt_enabled(void) · line 67
Quoted 12 lines
lib/igt_gvt.c +11
-1-igt_ignore_warn (system ("/sbin/modprobe -s -r i915" )); + +if (igt_kmod_is_loaded ("i915" )) { + +if (igt_kmod_is_loaded ("snd_hda_intel" )) { +igt_assert (!igt_pkill (SIGTERM ,"alsactl" )); +igt_assert (!igt_kmod_unload ("snd_hda_intel" ,0 )); + } + +igt_assert (!igt_kmod_unload ("i915" ,0 )); +igt_assert (!igt_kmod_unload ("drm_kms_helper" ,0 )); +igt_assert (!igt_kmod_unload ("drm" ,0 ));But don't we already have this routine...
No. But I guess I can add a driver_load()/driver_unload() in lib/igt_kmod which does that, if that is what you meant.
Quoted 3 lines
For this test, we shouldn't fail if we can't setup the environment as we need, but skip the test.
Right, maybe I got it wrong, but you call igt_require(igt_gvt_load_module()) which in turn calls is_gvt_enabled(). igt_require will skip if igt_gvt_load_module() is false. That is why I kept like that. Besides that, I haven't checked what happens when the modules are built-in, so the assert might fail in that case.
Quoted 4 lines
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 2/4 v4] lib/igt_gvt: Make use of libkmod helpers and fix reading gvt parameter.
Quoted 69 lines · Marius Vlad
Quoted 53 lines · Chris Wilson
Quoted 27 lines · Marius Vlad
Signed-off-by Marius Vlad <[email protected]>--- lib/igt_gvt.c | 42 +++++++++++++++++++++++++++++++++++------- tests/gvt_basic.c | 2 +- 2 files changed, 36 insertions(+), 8 deletions(-)lib/igt_gvt.c +4
-1@@ -24,23 +24,26 @@#include "igt.h" #include "igt_gvt.h" #include "igt_sysfs.h" +#include "igt_kmod.h" +#include <signal.h> #include <dirent.h> #include <unistd.h> #include <fcntl.h> +#include <time.h> static bool is_gvt_enabled (void ) {FILE *file; -int value; +char value;lib/igt_gvt.c line 46
Quoted 10 lines
lib/igt_gvt.c +2
-2bool enabled = false; file =fopen ("/sys/module/i915/parameters/enable_gvt" ,"r" );if (!file)return false; -if (fscanf (file,"%d" , &value) ==1 ) - enabled = value; +if (fscanf (file,"%c" , &value) ==1 ) + enabled = (value =='Y' ? true : false);enabled = value == 'Y'; else if (fscanf(file, "%d", &value) == 1) enabled = value;Do I see a
igt_kmod_parameter_get_boolean()in the future, I think I do!Quoted 9 lines
lib/igt_gvt.c +0
-1fclose (file); errno =0 ;@@ -50,9 +53,20 @@ static bool is_gvt_enabled(void)static void unload_i915 (void ) {kick_fbcon (false); -/* pkill alsact */ Quoted 14 lines
lib/igt_gvt.c static bool is_gvt_enabled(void) · line 67
Quoted 12 lines
lib/igt_gvt.c +11
-1-igt_ignore_warn (system ("/sbin/modprobe -s -r i915" )); + +if (igt_kmod_is_loaded ("i915" )) { + +if (igt_kmod_is_loaded ("snd_hda_intel" )) { +igt_assert (!igt_pkill (SIGTERM ,"alsactl" )); +igt_assert (!igt_kmod_unload ("snd_hda_intel" ,0 )); + } + +igt_assert (!igt_kmod_unload ("i915" ,0 )); +igt_assert (!igt_kmod_unload ("drm_kms_helper" ,0 )); +igt_assert (!igt_kmod_unload ("drm" ,0 ));But don't we already have this routine...
Quoted 2 lines
No. But I guess I can add a driver_load()/driver_unload() in
lib/igt_kmodwhich does that, if that is what you meant.
This is the same sequence as required for reloading any kms driver. However, note here we only require i915 to be reloaded, we can avoid taking further risk in reloading the drm layer. So perhaps we don't want the same code here as drv_module_reload. (Or a more complete interface that gives finer control.)
Quoted 9 lines
Quoted 3 lines
For this test, we shouldn't fail if we can't setup the environment as we need, but skip the test.
Right, maybe I got it wrong, but you call igt_require(igt_gvt_load_module()) which in turn calls
is_gvt_enabled().igt_requirewill skip ifigt_gvt_load_module()is false. That is why I kept like that. Besides that, I haven't checked what happens when the modules are built-in, so the assert might fail in that case.
The asserts are indeed testing something unrelated to the test, only the setup of its environment. If we can't set up the environment for the test, we skip.
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 3/4 tests/drv_module_reload: Convert sh script to C version.
In reply to Marius Vladv4:
- adjust test to make use of lib/igt_kmod
- replaced SW_FINISH with SET_CACHEING (Chris Wilson)
v3:
- fix passing boolean value as flags to igt_kmod_unload().
v2:
- embedded gem_alive and gem_exec_store into test (Chris Wilson)
- int main() to igt_main (Chris Wilson)
- moved tests/gem_alive -> tools/gem_info (Chris Wilson)
- added to intel-ci/fast-feedback.testlist (Petri Latvala)
- added hda_dynamic_debug() (Petri Latvala)
- renamed from tests/drv_module_reload_basic to tests/drv_module_reload (all subtests are basic and have been added to fast-feedback.testlist)
--- tests/Makefile.am | 1 - tests/Makefile.sources | 2 +- tests/drv_module_reload.c | 415 ++++++++++++++++++++++++++++++++++ tests/drv_module_reload_basic | 105 --------- tests/gem_alive.c | 35 --- tests/intel-ci/fast-feedback.testlist | 13 +- tools/Makefile.sources | 1 + tools/intel_gem_info.c | 35 +++ 8 files changed, 464 insertions(+), 143 deletions(-) create mode 100644 tests/drv_module_reload.c delete mode 100755 tests/drv_module_reload_basic delete mode 100644 tests/gem_alive.c create mode 100644 tools/intel_gem_info.c
tests/Makefile.am +0 -1
@@ -26,7 +26,6 @@ noinst_PROGRAMS = \ $(NULL) pkglibexec_PROGRAMS = \ - gem_alive \ gem_stress \ $(TESTS_progs) \ $(TESTS_progs_M) \
tests/Makefile.sources +1 -1
@@ -211,6 +211,7 @@ TESTS_progs = \ kms_pwrite_crc \ kms_sink_crc_basic \ prime_udl \ + drv_module_reload \ $(NULL) # IMPORTANT: The ZZ_ tests need to be run last!
@@ -221,7 +222,6 @@ TESTS_scripts_M = \ TESTS_scripts = \ debugfs_emon_crash \ drv_debugfs_reader \ - drv_module_reload_basic \ kms_sysfs_edid_timing \ sysfs_l3_parity \ test_rte_check \
tests/drv_module_reload.c new file +415 -0
415 lines not on this page · raw message
tests/drv_module_reload_basic deleted +0 -105
105 lines not on this page · raw message
tests/gem_alive.c deleted +0 -35
@@ -1,35 +0,0 @@ -#include "igt.h" -#include <sys/ioctl.h> -#include <fcntl.h> -#include <errno.h> -#include <string.h> -#include <signal.h> -#include <i915_drm.h> - - -int main (void ) -{ -struct drm_i915_gem_sw_finish arg = {0 }; -int fd; - -signal (SIGALRM ,SIG_IGN ); - - fd =__drm_open_driver (DRIVER_INTEL ); -if (fd <0 ) -return IGT_EXIT_SKIP ; - -alarm (1 ); -if (ioctl (fd,DRM_IOCTL_I915_GEM_SW_FINISH , &arg) ==0 ) -return IGT_EXIT_SKIP ; - -switch (errno) { -case ENOENT : -return 0 ; -case EIO : -return 1 ; -case EINTR : -return 2 ; -default : -return 3 ; - } -}
tests/intel-ci/fast-feedback.testlist +12 -1
@@ -3,7 +3,18 @@ igt@core_prop_blob@basic igt@drv_getparams_basic@basic-eu-total igt@drv_getparams_basic@basic-subslice-total igt@drv_hangman@error-state-basic -igt@drv_module_reload_basic +igt@drv_module_reload@basic-reload +igt@drv_module_reload@basic-gem-info +igt@drv_module_reload@basic-exec-store-default +igt@drv_module_reload@basic-exec-store-render +igt@drv_module_reload@basic-exec-store-bsd +igt@drv_module_reload@basic-exec-store-bsd1 +igt@drv_module_reload@basic-exec-store-bsd2 +igt@drv_module_reload@basic-exec-store-blt +igt@drv_module_reload@basic-exec-store-vebox +igt@drv_module_reload@basic-exec-store-all +igt@drv_module_reload@basic-reload-inject +igt@drv_module_reload@basic-reload-final igt@gem_basic@bad-close igt@gem_basic@create-close igt@gem_basic@create-fd-close
tools/Makefile.sources +1 -0
@@ -29,6 +29,7 @@ tools_prog_lists = \ intel_residency \ intel_stepping \ intel_watermark \ + intel_gem_info \ $(NULL) dist_bin_SCRIPTS = intel_gpu_abrt
tools/intel_gem_info.c new file +35 -0
@@ -0,0 +1,35 @@ +#include "igt.h" +#include <sys/ioctl.h> +#include <fcntl.h> +#include <errno.h> +#include <string.h> +#include <signal.h> +#include <i915_drm.h> + + +int main (void ) +{ +struct drm_i915_gem_sw_finish arg = {0 }; +int fd; + +signal (SIGALRM ,SIG_IGN ); + + fd =__drm_open_driver (DRIVER_INTEL ); +if (fd <0 ) +return IGT_EXIT_SKIP ; + +alarm (1 ); +if (ioctl (fd,DRM_IOCTL_I915_GEM_SW_FINISH , &arg) ==0 ) +return IGT_EXIT_SKIP ; + +switch (errno) { +case ENOENT : +return 0 ; +case EIO : +return 1 ; +case EINTR : +return 2 ; +default : +return 3 ; + } +}
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 3/4 v4] tests/drv_module_reload: Convert sh script to C version.
tests/drv_module_reload.c line 394
Quoted 13 lines · Marius Vlad
tests/drv_module_reload.c new file +13
-0+ igt_subtest_group { +int fd; + +igt_fixture + fd =__drm_open_driver (DRIVER_INTEL ); + + igt_subtest_group { + igt_subtest("basic-gem-info") +if ((err =gem_info (fd))) +igt_fail (err); + igt_subtest_group + if ((err = gem_exec_store(fd))) + igt_fail(err);
This is a misinterpretation of the existing test. These are not subtests, but a sanity check that reload() works. A call to gem_exec_store() can just whither away, it doesn't reveal much about the general sanity of the driver, but a quick call to an ioctl such as gem_info() is enough to be sure the driver is there (i.e. the module load worked as adverticed) and not hung upon load.
One more thing about gem_info(), to be used in process it needs to be something like:
/* Check the driver load completed by seeing if it responds to an ioctl
* correctly. We pick an ioctl that calls i915_mutex_interruptible()
* first (before failing on the invalid arg) so that we can inspect its
* driver error detection (-EIO if already wedged, or -EINTR if stuck). */
void i915_gem_sanitycheck(void)
{
struct set_cacheing arg = {};
int fd, err;
fd = __drm_driver_open(DRIVER_INTEL);
igt_set_timeout(1, "module reload failed");
err = 0;
if (ioctl(fd, SET_CACHEING, &arg))
err = -errno;
igt_set_timeout(0, NULL);
close(fd);
igt_assert_eq(err, -ENOENT);}
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 3/4 v4] tests/drv_module_reload: Convert sh script to C version.
Quoted 13 lines · Chris Wilson
Quoted 12 lines · Marius Vlad
tests/drv_module_reload.c new file +12
-0+ igt_subtest_group { +int fd; + +igt_fixture + fd =__drm_open_driver (DRIVER_INTEL ); + + igt_subtest_group { + igt_subtest("basic-gem-info") +if ((err =gem_info (fd))) +igt_fail (err); +igt_subtest_group + if ((err = gem_exec_store(fd)))
Quoted 8 lines
Review
Quoted 1 line
(quoted diff) +1
-0+ igt_fail(err);This is a misinterpretation of the existing test. These are not subtests, but a sanity check that
reload()works. A call togem_exec_store()can just whither away, it doesn't reveal much about the general sanity of the driver, but a quick call to an ioctl such asgem_info()is enough to be sure the driver is there (i.e. the module load worked as adverticed) and not hung upon load.
Indeed, that's exactly what they are: sanity check that reloading of the driver works, just that grouping them as subtests/subgroups made embedding them easier and I thought that worked better given igt is centered around tests/subtests (gem_exec_store has a igt_skip_on_f() thus the subgroup)
I guess that I can call them directly in "basic-reload" subtest. If either gem_info and gem_exec_store failed than reloading failed. Is that a reasonable approach and it is OK with you?
Quoted 26 lines
One more thing about
gem_info(), to be used in process it needs to be something like:/* Check the driver load completed by seeing if it responds to an ioctl
* correctly. We pick an ioctl that callsi915_mutex_interruptible()
* first (before failing on the invalid arg) so that we can inspect its
* driver error detection (-EIOif already wedged, or-EINTRif stuck). */
voidi915_gem_sanitycheck(void){ struct set_cacheing arg = {}; int fd, err; fd = __drm_driver_open(DRIVER_INTEL); igt_set_timeout(1, "module reload failed"); err = 0; if (ioctl(fd, SET_CACHEING, &arg)) err = -errno; igt_set_timeout(0, NULL); close(fd); igt_assert_eq(err, -ENOENT);
Quoted 1 line
}
Alright will do.
Quoted 4 lines
-Chris
Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v4 4/4 tests/kms_sysfs_edid_timing: Convert sh to C version.
In reply to Marius Vladv2:
- don't read cached values (Chris Wilson)
- warn on per connector, and fail per mean (Chris Wilson)
These are synthetic: 5us per connector, and 600us for all (as threshold).
--- tests/Makefile.sources | 2 +- tests/kms_sysfs_edid_timing | 25 ---------- tests/kms_sysfs_edid_timing.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 26 deletions(-) delete mode 100755 tests/kms_sysfs_edid_timing create mode 100644 tests/kms_sysfs_edid_timing.c
tests/Makefile.sources +1 -1
@@ -212,6 +212,7 @@ TESTS_progs = \ kms_sink_crc_basic \ prime_udl \ drv_module_reload \ + kms_sysfs_edid_timing \ $(NULL) # IMPORTANT: The ZZ_ tests need to be run last!
@@ -222,7 +223,6 @@ TESTS_scripts_M = \ TESTS_scripts = \ debugfs_emon_crash \ drv_debugfs_reader \ - kms_sysfs_edid_timing \ sysfs_l3_parity \ test_rte_check \ tools_test \
tests/kms_sysfs_edid_timing deleted +0 -25
@@ -1,25 +0,0 @@ -#!/bin/bash -# -# This check the time we take to read the content of all the possible connectors. -# Without the edid -ENXIO patch (http://permalink.gmane.org/gmane.comp.video.dri.devel/62083), -# we sometimes take a *really* long time. So let's just check for some reasonable timing here -# - -DRM_LIB_ALLOW_NO_MASTER=1 - -SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )" -. $SOURCE_DIR/drm_lib.sh - -TIME1=$(date +%s%N) -cat $(find /sys/devices/|grep drm | grep /status) > /dev/null -TIME2=$(date +%s%N) - -# time in ms -RES=$(((TIME2 - TIME1) / 1000000)) - -if [ $RES -gt 600 ]; then - echo "Talking to outputs took ${RES}ms, something is wrong" - exit $IGT_EXIT_FAILURE -fi - -exit $IGT_EXIT_SUCCESS
tests/kms_sysfs_edid_timing.c new file +107 -0
107 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 4/4 v4] tests/kms_sysfs_edid_timing: Convert sh to C version.
Quoted 117 lines · Marius Vlad
v2:
- don't read cached values (Chris Wilson)
- warn on per connector, and fail per mean (Chris Wilson)These are synthetic: 5us per connector, and 600us for all (as threshold).
Signed-off-by Marius Vlad <[email protected]>--- tests/Makefile.sources | 2 +- tests/kms_sysfs_edid_timing | 25 ---------- tests/kms_sysfs_edid_timing.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 26 deletions(-) delete mode 100755 tests/kms_sysfs_edid_timing create mode 100644 tests/kms_sysfs_edid_timing.ctests/Makefile.sources +1
-1@@ -212,6 +212,7 @@ TESTS_progs = \ kms_sink_crc_basic \ prime_udl \ drv_module_reload \ + kms_sysfs_edid_timing \ $(NULL) # IMPORTANT: The ZZ_ tests need to be run last!@@ -222,7 +223,6 @@ TESTS_scripts_M = \ TESTS_scripts = \ debugfs_emon_crash \ drv_debugfs_reader \ - kms_sysfs_edid_timing \ sysfs_l3_parity \ test_rte_check \ tools_test \tests/kms_sysfs_edid_timing deleted +0
-25@@ -1,25 +0,0 @@ -#!/bin/bash -# -# This check the time we take to read the content of all the possible connectors. -# Without the edid -ENXIO patch (http://permalink.gmane.org/gmane.comp.video.dri.devel/62083), -# we sometimes take a *really* long time. So let's just check for some reasonable timing here -# - -DRM_LIB_ALLOW_NO_MASTER=1 - -SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )" -. $SOURCE_DIR/drm_lib.sh - -TIME1=$(date +%s%N) -cat $(find /sys/devices/|grep drm | grep /status) > /dev/null -TIME2=$(date +%s%N) - -# time in ms -RES=$(((TIME2 - TIME1) / 1000000)) - -if [ $RES -gt 600 ]; then - echo "Talking to outputs took ${RES}ms, something is wrong" - exit $IGT_EXIT_FAILURE -fi - -exit $IGT_EXIT_SUCCESStests/kms_sysfs_edid_timing.c new file +44
-0@@ -0,0 +1,107 @@ +/* +* Copyright © 2016 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +*/ +#include "igt.h" +#include "igt_debugfs.h" +#include "igt_sysfs.h" +#include "igt_core.h" + +#include <dirent.h> +#include <fcntl.h> +#include <sys/stat.h> +#include <time.h> + +#define USEC_PER_SEC (1000*1000) +#define THRESHOLD_PER_CONNECTOR 5 +#define THRESHOLD_TOTAL 600 + +IGT_TEST_DESCRIPTION ("This check the time we take to read the content of all " +"the possible connectors. Without the edid -ENXIO patch " +"(http://permalink.gmane.org/gmane.comp.video.dri.devel/62083), " +"we sometimes take a *really* long time. " +"So let's just check for some reasonable timing here" ); + +static uint64_t +mean (uint64_t *a,size_t a_len)
tests/kms_sysfs_edid_timing.c line 54
Quoted 10 lines
tests/kms_sysfs_edid_timing.c new file +10
-0+{ +int p; +uint64_t __sum; + +for (p =0 , __sum =0 ; p < a_len; p++) { + __sum += a[p]; + } + +return (__sum / a_len); +}
See igt_stats.h: igt_mean
tests/kms_sysfs_edid_timing.c line 58
Quoted 3 lines
tests/kms_sysfs_edid_timing.c new file +3
-0+igt_simple_main +{ +int dir =igt_sysfs_open (-1 ,NULL );
Hmm, that will try to find intel - I was hoping to be a little more generic and do every cardN-connectorM in /sys/class/drm (not /sys/class/drm/card0 as sysfs_open will return)
Quoted 14 lines
tests/kms_sysfs_edid_timing.c new file +14
-0+DIR *dirp =fdopendir (dir); +struct dirent *de; + +int i, fd =0 ; +int fds[32 ]; + +uint64_t elapsed, elapsed_mean; +uint64_t a[32 ]; + +struct stat st; +struct timespec start = {}; + +memset (fds,-1 ,sizeof (fds)); +memset (a,-1 ,sizeof (a));
tests/kms_sysfs_edid_timing.c line 82
Quoted 10 lines
tests/kms_sysfs_edid_timing.c new file +10
-0+ +while ((de =readdir (dirp))) { + +if (*de->d_name =='.' ) +continue ; + +if (fstatat (dir, de->d_name, &st,0 )) +continue ; + +if (S_ISDIR (st.st_mode) && !strncmp (de->d_name,"card0-" ,6 )) {
sysfs_open would have reported the index as assuming card0 fails if vgem was loaded first, for example.
Quoted 6 lines
tests/kms_sysfs_edid_timing.c new file +6
-0+int dfd =openat (dir, de->d_name,O_RDONLY ); +igt_assert (dfd >0 ); + fds[fd++] = dfd; + } + } +closedir (dirp);
tests/kms_sysfs_edid_timing.c line 98
Quoted 10 lines
tests/kms_sysfs_edid_timing.c new file +10
-0+ +for (i =0 ; i < fd; i++) { +igt_sysfs_set (fds[i],"status" ,"detect" ); + + elapsed =igt_nsec_elapsed (&start); +igt_sysfs_get (fds[i],"status" ); + elapsed =igt_nsec_elapsed (&start); + +igt_warn_on_f (elapsed > (THRESHOLD_PER_CONNECTOR *USEC_PER_SEC ), +"Threshold per connector exceeded (elapsed %lu ns)\n" , elapsed);
I was suggesting we repeat the probe of each connector several times.
DIR *dir = opendir("/sys/class/drm");
while ((de = readdir(dir)) {
struct igt_mean mean = {};
struct stat st;
char path[128];
if (*de->d_name == '.') continue;
snprintf(path, sizeof(path), "/sys/class/drm/%s/status", de->d_name);
if (stat(path, &st)
continue;
for (int i = 0; i < 15; i++) {
struct timespec tv;
int fd;
fd = open(path, O_WRONLY);
igt_nsec_elapsed(&tv);
write(fd, "detect\n", 7);
igt_mean_add(&mean, igt_nsec_elapsed(&tv));
close(fd);
}
if (mean.max > 10e6) /* 10 milisecond */
igt_warn("%s: probe time exceed 10ms, max=%.2fms, avg=%.2fms\n",
de->d_name, mean.max / 1e6, mean.mean / 1e6);
igt_assert_f(mean.mean < 50e6,
"%s: average probe time exceeded 50ms, max=%.2fms, avg=%.2fms\n",
de->d_name, mean.max / 1e6, mean.mean / 1e6);
}closedir(dir);
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 4/4 v4] tests/kms_sysfs_edid_timing: Convert sh to C version.
Quoted 122 lines · Chris Wilson
Quoted 121 lines · Marius Vlad
v2:
- don't read cached values (Chris Wilson)
- warn on per connector, and fail per mean (Chris Wilson)These are synthetic: 5us per connector, and 600us for all (as threshold).
Signed-off-by Marius Vlad <[email protected]>--- tests/Makefile.sources | 2 +- tests/kms_sysfs_edid_timing | 25 ---------- tests/kms_sysfs_edid_timing.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 26 deletions(-) delete mode 100755 tests/kms_sysfs_edid_timing create mode 100644 tests/kms_sysfs_edid_timing.ctests/Makefile.sources +1
-1@@ -212,6 +212,7 @@ TESTS_progs = \ kms_sink_crc_basic \ prime_udl \ drv_module_reload \ + kms_sysfs_edid_timing \ $(NULL) # IMPORTANT: The ZZ_ tests need to be run last!@@ -222,7 +223,6 @@ TESTS_scripts_M = \ TESTS_scripts = \ debugfs_emon_crash \ drv_debugfs_reader \ - kms_sysfs_edid_timing \ sysfs_l3_parity \ test_rte_check \ tools_test \tests/kms_sysfs_edid_timing deleted +0
-25@@ -1,25 +0,0 @@ -#!/bin/bash -# -# This check the time we take to read the content of all the possible connectors. -# Without the edid -ENXIO patch (http://permalink.gmane.org/gmane.comp.video.dri.devel/62083), -# we sometimes take a *really* long time. So let's just check for some reasonable timing here -# - -DRM_LIB_ALLOW_NO_MASTER=1 - -SOURCE_DIR="$( dirname "${BASH_SOURCE[0]}" )" -. $SOURCE_DIR/drm_lib.sh - -TIME1=$(date +%s%N) -cat $(find /sys/devices/|grep drm | grep /status) > /dev/null -TIME2=$(date +%s%N) - -# time in ms -RES=$(((TIME2 - TIME1) / 1000000)) - -if [ $RES -gt 600 ]; then - echo "Talking to outputs took ${RES}ms, something is wrong" - exit $IGT_EXIT_FAILURE -fi - -exit $IGT_EXIT_SUCCESStests/kms_sysfs_edid_timing.c new file +48
-0@@ -0,0 +1,107 @@ +/* +* Copyright © 2016 Intel Corporation +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice (including the next +* paragraph) shall be included in all copies or substantial portions of the +* Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +* IN THE SOFTWARE. +*/ +#include "igt.h" +#include "igt_debugfs.h" +#include "igt_sysfs.h" +#include "igt_core.h" + +#include <dirent.h> +#include <fcntl.h> +#include <sys/stat.h> +#include <time.h> + +#define USEC_PER_SEC (1000*1000) +#define THRESHOLD_PER_CONNECTOR 5 +#define THRESHOLD_TOTAL 600 + +IGT_TEST_DESCRIPTION ("This check the time we take to read the content of all " +"the possible connectors. Without the edid -ENXIO patch " +"(http://permalink.gmane.org/gmane.comp.video.dri.devel/62083), " +"we sometimes take a *really* long time. " +"So let's just check for some reasonable timing here" ); + +static uint64_t +mean (uint64_t *a,size_t a_len) +{ +int p; +uint64_t __sum; +
Quoted 8 lines
tests/kms_sysfs_edid_timing.c line 54
Quoted 6 lines
tests/kms_sysfs_edid_timing.c new file +6
-0+for (p =0 , __sum =0 ; p < a_len; p++) { + __sum += a[p]; + } + +return (__sum / a_len); +}See
igt_stats.h:igt_mean
Alright will use that.
Quoted 8 lines
tests/kms_sysfs_edid_timing.c line 58
Quoted 4 lines
tests/kms_sysfs_edid_timing.c new file +3
-0+igt_simple_main +{ +int dir =igt_sysfs_open (-1 ,NULL );Hmm, that will try to find intel - I was hoping to be a little more generic and do every cardN-connectorM in
/sys/class/drm(not/sys/class/drm/card0assysfs_openwill return)
Right, misunderstood you the first time.
Quoted 72 lines
Quoted 15 lines
tests/kms_sysfs_edid_timing.c new file +14
-0+DIR *dirp =fdopendir (dir); +struct dirent *de; + +int i, fd =0 ; +int fds[32 ]; + +uint64_t elapsed, elapsed_mean; +uint64_t a[32 ]; + +struct stat st; +struct timespec start = {}; + +memset (fds,-1 ,sizeof (fds)); +memset (a,-1 ,sizeof (a));tests/kms_sysfs_edid_timing.c line 82
Quoted 10 lines
tests/kms_sysfs_edid_timing.c new file +10
-0+ +while ((de =readdir (dirp))) { + +if (*de->d_name =='.' ) +continue ; + +if (fstatat (dir, de->d_name, &st,0 )) +continue ; + +if (S_ISDIR (st.st_mode) && !strncmp (de->d_name,"card0-" ,6 )) {
sysfs_openwould have reported the index as assuming card0 fails if vgem was loaded first, for example.Quoted 6 lines
tests/kms_sysfs_edid_timing.c new file +6
-0+int dfd =openat (dir, de->d_name,O_RDONLY ); +igt_assert (dfd >0 ); + fds[fd++] = dfd; + } + } +closedir (dirp);tests/kms_sysfs_edid_timing.c line 98
Quoted 10 lines
tests/kms_sysfs_edid_timing.c new file +10
-0+ +for (i =0 ; i < fd; i++) { +igt_sysfs_set (fds[i],"status" ,"detect" ); + + elapsed =igt_nsec_elapsed (&start); +igt_sysfs_get (fds[i],"status" ); + elapsed =igt_nsec_elapsed (&start); + +igt_warn_on_f (elapsed > (THRESHOLD_PER_CONNECTOR *USEC_PER_SEC ), +"Threshold per connector exceeded (elapsed %lu ns)\n" , elapsed);I was suggesting we repeat the probe of each connector several times.
DIR *dir =
opendir("/sys/class/drm");while ((de = readdir(dir)) { struct igt_mean mean = {}; struct stat st; char path[128]; if (*de->d_name == '.') continue; snprintf(path, sizeof(path), "/sys/class/drm/%s/status", de->d_name); if (stat(path, &st) continue; for (int i = 0; i < 15; i++) { struct timespec tv; int fd; fd = open(path, O_WRONLY); igt_nsec_elapsed(&tv); write(fd, "detect\n", 7); igt_mean_add(&mean, igt_nsec_elapsed(&tv)); close(fd); }
Quoted 7 lines
if (mean.max > 10e6) /* 10 milisecond */
igt_warn("%s: probe time exceed 10ms, max=%.2fms, avg=%.2fms\n",
de->d_name, mean.max / 1e6, mean.mean / 1e6);
igt_assert_f(mean.mean < 50e6,
"%s: average probe time exceeded 50ms, max=%.2fms, avg=%.2fms\n",
de->d_name, mean.max / 1e6, mean.mean / 1e6);
}Okay will do that.
Quoted 3 lines
Signature · 2 lines
-- Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx