[i-g-t] Update DRM debug level dynamically
Bhanuprakash Modem
bhanuprakash.modem at intel.com
Wed Jul 10 10:51:30 UTC 2024
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
---
lib/igt_sysfs.c | 104 +++++++++++++++
lib/igt_sysfs.h | 5 +
tests/intel-ci/fast-feedback.testlist | 184 +++-----------------------
tests/kms_atomic_transition.c | 2 +
4 files changed, 127 insertions(+), 168 deletions(-)
diff --git a/lib/igt_sysfs.c b/lib/igt_sysfs.c
index ffeec1ca2..ddf23f620 100644
--- a/lib/igt_sysfs.c
+++ b/lib/igt_sysfs.c
@@ -212,6 +212,25 @@ int igt_sysfs_open(int device)
return open(path, O_RDONLY);
}
+/**
+ * igt_sysfs_drm_module_params_open:
+ *
+ * This opens the sysfs directory corresponding to drm module
+ * parameters.
+ *
+ * Returns:
+ * The directory fd, or -1 on failure.
+ */
+int igt_sysfs_drm_module_params_open(void)
+{
+ char path[] = "/sys/module/drm/parameters";
+
+ if (access(path, F_OK))
+ return -1;
+
+ return open(path, O_RDONLY);
+}
+
/**
* xe_sysfs_gt_path:
* @xe_device: fd of the device
@@ -412,6 +431,91 @@ int igt_sysfs_get_num_gt(int device)
return num_gts;
}
+static int log_level = -1;
+
+/**
+ * igt_drm_debug_level_get:
+ *
+ * This reads the current debug log level of the machine on
+ * which the test is currently executing.
+ *
+ * Returns:
+ * The current log level, or -1 on error.
+ */
+
+int igt_drm_debug_level_get(int dir)
+{
+ char buf[20];
+
+ if (log_level >= 0)
+ return log_level;
+
+ if (igt_sysfs_read(dir, "debug", buf, sizeof(buf) - 1) < 0)
+ return -1;
+
+ return atoi(buf);
+}
+
+/**
+ * igt_drm_debug_level_reset:
+ *
+ * This modifies the current debug log level of the machine
+ * to the default value post-test.
+ *
+ */
+void igt_drm_debug_level_reset(void)
+{
+ char buf[20];
+ int dir;
+
+ if (log_level < 0)
+ return;
+
+ dir = igt_sysfs_drm_module_params_open();
+ if (dir < 0)
+ return;
+
+ igt_debug("Resetting DRM debug level to %d\n", log_level);
+ snprintf(buf, sizeof(buf), "%d", log_level);
+ igt_assert(igt_sysfs_set(dir, "debug", buf));
+
+ close(dir);
+}
+
+static void igt_drm_debug_level_reset_exit_handler(int sig)
+{
+ igt_drm_debug_level_reset();
+}
+
+/**
+ * igt_drm_debug_level_update:
+ * @debug_level: new debug level to set
+ *
+ * This modifies the current drm debug log level to the new value.
+ */
+void igt_drm_debug_level_update(unsigned int debug_level)
+{
+ char buf[220];
+ int dir;
+
+ dir = igt_sysfs_drm_module_params_open();
+ if (dir < 0)
+ return;
+
+ log_level = igt_drm_debug_level_get(dir);
+ if (log_level < 0) {
+ close(dir);
+ return;
+ }
+
+ igt_debug("Setting DRM bebug level to %d\n", debug_level);
+ snprintf(buf, sizeof(buf), "%d", debug_level);
+ igt_assert(igt_sysfs_set(dir, "debug", buf));
+
+ close(dir);
+ igt_install_exit_handler(igt_drm_debug_level_reset_exit_handler);
+}
+
/**
* igt_sysfs_write:
* @dir: sysfs directory
diff --git a/lib/igt_sysfs.h b/lib/igt_sysfs.h
index 6c604d939..a276c6ed1 100644
--- a/lib/igt_sysfs.h
+++ b/lib/igt_sysfs.h
@@ -138,6 +138,11 @@ void igt_sysfs_set_boolean(int dir, const char *attr, bool value);
void bind_fbcon(bool enable);
void fbcon_blink_enable(bool enable);
+void igt_drm_debug_level_update(unsigned int debug_level);
+void igt_drm_debug_level_reset(void);
+int igt_drm_debug_level_get(int dir);
+int igt_sysfs_drm_module_params_open(void);
+
/**
* igt_sysfs_rw_attr:
* @dir: file descriptor for parent directory
diff --git a/tests/intel-ci/fast-feedback.testlist b/tests/intel-ci/fast-feedback.testlist
index be0965110..3df4be5cc 100644
--- a/tests/intel-ci/fast-feedback.testlist
+++ b/tests/intel-ci/fast-feedback.testlist
@@ -1,171 +1,19 @@
# Try to load the driver if it's not available yet.
igt at i915_module_load@load
-# Keep alphabetically sorted by default
-igt at core_auth@basic-auth
-igt at debugfs_test@read_all_entries
-igt at debugfs_test@basic-hwmon
-igt at debugfs_test@sysfs
-igt at fbdev@eof
-igt at fbdev@info
-igt at fbdev@nullptr
-igt at fbdev@read
-igt at fbdev@write
-igt at gem_basic@bad-close
-igt at gem_basic@create-close
-igt at gem_basic@create-fd-close
-igt at gem_busy@busy at all-engines
-igt at gem_close_race@basic-process
-igt at gem_close_race@basic-threads
-igt at gem_ctx_create@basic
-igt at gem_ctx_create@basic-files
-igt at gem_ctx_exec@basic
-igt at gem_exec_basic@basic
-igt at gem_exec_create@basic
-igt at gem_exec_fence@basic-busy
-igt at gem_exec_fence@basic-wait
-igt at gem_exec_fence@basic-await
-igt at gem_exec_fence@nb-await
-igt at gem_exec_gttfill@basic
-igt at gem_exec_parallel@engines
-igt at gem_exec_store@basic
-igt at gem_flink_basic@bad-flink
-igt at gem_flink_basic@bad-open
-igt at gem_flink_basic@basic
-igt at gem_flink_basic@double-flink
-igt at gem_flink_basic@flink-lifetime
-igt at gem_huc_copy@huc-copy
-igt at gem_linear_blits@basic
-igt at gem_mmap@basic
-igt at gem_mmap_gtt@basic
-igt at gem_render_linear_blits@basic
-igt at gem_render_tiled_blits@basic
-igt at gem_ringfill@basic-all
-igt at gem_softpin@allocator-basic
-igt at gem_softpin@allocator-basic-reserve
-igt at gem_softpin@safe-alignment
-igt at gem_sync@basic-all
-igt at gem_sync@basic-each
-igt at gem_tiled_blits@basic
-igt at gem_tiled_fence_blits@basic
-igt at gem_tiled_pread_basic
-igt at gem_wait@busy at all-engines
-igt at gem_wait@wait at all-engines
-igt at i915_getparams_basic@basic-eu-total
-igt at i915_getparams_basic@basic-subslice-total
-igt at i915_hangman@error-state-basic
-igt at i915_pciid
-igt at kms_addfb_basic@addfb25-4-tiled
-igt at kms_addfb_basic@addfb25-bad-modifier
-igt at kms_addfb_basic@addfb25-framebuffer-vs-set-tiling
-igt at kms_addfb_basic@addfb25-modifier-no-flag
-igt at kms_addfb_basic@addfb25-x-tiled-legacy
-igt at kms_addfb_basic@addfb25-x-tiled-mismatch-legacy
-igt at kms_addfb_basic@addfb25-yf-tiled-legacy
-igt at kms_addfb_basic@addfb25-y-tiled-legacy
-igt at kms_addfb_basic@addfb25-y-tiled-small-legacy
-igt at kms_addfb_basic@bad-pitch-0
-igt at kms_addfb_basic@bad-pitch-1024
-igt at kms_addfb_basic@bad-pitch-128
-igt at kms_addfb_basic@bad-pitch-256
-igt at kms_addfb_basic@bad-pitch-32
-igt at kms_addfb_basic@bad-pitch-63
-igt at kms_addfb_basic@bad-pitch-65536
-igt at kms_addfb_basic@bad-pitch-999
-igt at kms_addfb_basic@basic
-igt at kms_addfb_basic@basic-x-tiled-legacy
-igt at kms_addfb_basic@basic-y-tiled-legacy
-igt at kms_addfb_basic@bo-too-small
-igt at kms_addfb_basic@bo-too-small-due-to-tiling
-igt at kms_addfb_basic@clobberred-modifier
-igt at kms_addfb_basic@framebuffer-vs-set-tiling
-igt at kms_addfb_basic@invalid-get-prop
-igt at kms_addfb_basic@invalid-get-prop-any
-igt at kms_addfb_basic@invalid-set-prop
-igt at kms_addfb_basic@invalid-set-prop-any
-igt at kms_addfb_basic@no-handle
-igt at kms_addfb_basic@size-max
-igt at kms_addfb_basic@small-bo
-igt at kms_addfb_basic@tile-pitch-mismatch
-igt at kms_addfb_basic@too-high
-igt at kms_addfb_basic@too-wide
-igt at kms_addfb_basic@unused-handle
-igt at kms_addfb_basic@unused-modifier
-igt at kms_addfb_basic@unused-offsets
-igt at kms_addfb_basic@unused-pitches
-igt at kms_busy@basic
-igt at kms_prop_blob@basic
-igt at kms_cursor_legacy@basic-busy-flip-before-cursor-atomic
-igt at kms_cursor_legacy@basic-busy-flip-before-cursor-legacy
-igt at kms_cursor_legacy@basic-flip-after-cursor-atomic
-igt at kms_cursor_legacy@basic-flip-after-cursor-legacy
-igt at kms_cursor_legacy@basic-flip-after-cursor-varying-size
-igt at kms_cursor_legacy@basic-flip-before-cursor-atomic
-igt at kms_cursor_legacy@basic-flip-before-cursor-legacy
-igt at kms_cursor_legacy@basic-flip-before-cursor-varying-size
-igt at kms_dsc@dsc-basic
-igt at kms_flip@basic-flip-vs-dpms
-igt at kms_flip@basic-flip-vs-modeset
-igt at kms_flip@basic-flip-vs-wf_vblank
-igt at kms_flip@basic-plain-flip
-igt at kms_force_connector_basic@force-connector-state
-igt at kms_force_connector_basic@force-edid
-igt at kms_force_connector_basic@force-load-detect
-igt at kms_force_connector_basic@prune-stale-modes
-igt at kms_frontbuffer_tracking@basic
-igt at kms_hdmi_inject@inject-audio
-igt at kms_pipe_crc_basic@compare-crc-sanitycheck-xr24
-igt at kms_pipe_crc_basic@compare-crc-sanitycheck-nv12
-igt at kms_pipe_crc_basic@hang-read-crc
-igt at kms_pipe_crc_basic@nonblocking-crc
-igt at kms_pipe_crc_basic@nonblocking-crc-frame-sequence
-igt at kms_pipe_crc_basic@read-crc
-igt at kms_pipe_crc_basic@read-crc-frame-sequence
-igt at kms_pm_backlight@basic-brightness
-igt at kms_pm_rpm@basic-pci-d3-state
-igt at kms_pm_rpm@basic-rte
-igt at kms_psr@psr-primary-page-flip
-igt at kms_psr@psr-cursor-plane-move
-igt at kms_psr@psr-sprite-plane-onoff
-igt at kms_psr@psr-primary-mmap-gtt
-igt at kms_setmode@basic-clone-single-crtc
-igt at i915_pm_rps@basic-api
-igt at prime_self_import@basic-llseek-bad
-igt at prime_self_import@basic-llseek-size
-igt at prime_self_import@basic-with_fd_dup
-igt at prime_self_import@basic-with_one_bo
-igt at prime_self_import@basic-with_one_bo_two_files
-igt at prime_self_import@basic-with_two_bos
-igt at prime_vgem@basic-fence-flip
-igt at prime_vgem@basic-fence-mmap
-igt at prime_vgem@basic-fence-read
-igt at prime_vgem@basic-gtt
-igt at prime_vgem@basic-read
-igt at prime_vgem@basic-write
-igt at vgem_basic@setversion
-igt at vgem_basic@create
-igt at vgem_basic@debugfs
-igt at vgem_basic@dmabuf-export
-igt at vgem_basic@dmabuf-fence
-igt at vgem_basic@dmabuf-fence-before
-igt at vgem_basic@dmabuf-mmap
-igt at vgem_basic@mmap
-igt at vgem_basic@second-client
-igt at vgem_basic@sysfs
-
-# All tests that do module unloading and reloading are executed last.
-# They will sometimes reveal issues of earlier tests leaving the
-# driver in a broken state that is not otherwise noticed in that test.
-
-igt at core_hotunplug@unbind-rebind
-igt at vgem_basic@unload
-igt at i915_module_load@reload
-igt at gem_lmem_swapping@basic
-igt at gem_lmem_swapping@parallel-random-engines
-igt at gem_lmem_swapping@random-engines
-igt at gem_lmem_swapping@verify-random
-igt at i915_pm_rpm@module-reload
-
-# Kernel selftests
-igt at i915_selftest@live
-igt at dmabuf@all-tests
+igt at kms_atomic_transition@plane-primary-toggle-with-vblank-wait
+igt at kms_atomic_transition@plane-all-transition
+igt at kms_atomic_transition@plane-all-transition-fencing
+igt at kms_atomic_transition@plane-all-transition-nonblocking
+igt at kms_atomic_transition@plane-all-transition-nonblocking-fencing
+igt at kms_atomic_transition@plane-use-after-nonblocking-unbind
+igt at kms_atomic_transition@plane-use-after-nonblocking-unbind-fencing
+igt at kms_atomic_transition@plane-all-modeset-transition
+igt at kms_atomic_transition@plane-all-modeset-transition-fencing
+igt at kms_atomic_transition@plane-all-modeset-transition-internal-panels
+igt at kms_atomic_transition@plane-all-modeset-transition-fencing-internal-panels
+igt at kms_atomic_transition@plane-toggle-modeset-transition
+igt at kms_atomic_transition@modeset-transition
+igt at kms_atomic_transition@modeset-transition-fencing
+igt at kms_atomic_transition@modeset-transition-nonblocking
+igt at kms_atomic_transition@modeset-transition-nonblocking-fencing
diff --git a/tests/kms_atomic_transition.c b/tests/kms_atomic_transition.c
index 29dd8ac4e..910e3203b 100644
--- a/tests/kms_atomic_transition.c
+++ b/tests/kms_atomic_transition.c
@@ -34,6 +34,7 @@
#include "igt_rand.h"
#include "drmtest.h"
#include "sw_sync.h"
+#include "igt_sysfs.h"
#include <errno.h>
#include <pthread.h>
#include <stdbool.h>
@@ -1182,6 +1183,7 @@ igt_main_args("", long_opts, help_str, opt_handler, &data)
igt_require(data.display.is_atomic);
igt_display_require_output(&data.display);
+ igt_drm_debug_level_update(2);
for_each_connected_output(&data.display, output)
count++;
--
2.43.2
More information about the Intel-gfx-trybot
mailing list