[PATCH 10/10] drm/xe: Taint kernel when debug configfs parameters are set

Stuart Summers <[email protected]> Wed, 5 Aug 2026 23:20:31 +0000
Newsgroups org.freedesktop.lists.intel-xe
Message-ID <[email protected]>
Writing any debug configfs attribute indicates the system is running
in a non-standard configuration that may mask bugs or produce misleading
behaviour. Taint the kernel with TAINT_TEST on each successful write so
bug reports clearly reflect when debug settings were active.

Signed-off-by: Stuart Summers <[email protected]>
Assisted-by: Copilot:claude-sonnet-4.6,claude-sonnet-5
---
 drivers/gpu/drm/xe/xe_configfs_debug.c        | 12 ++++++++++++
 drivers/gpu/drm/xe/xe_configfs_debug_params.c |  6 ++++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/xe/xe_configfs_debug.c b/drivers/gpu/drm/xe/xe_configfs_debug.c
index 6060abe66e73..13ab9422b9c1 100644
--- a/drivers/gpu/drm/xe/xe_configfs_debug.c
+++ b/drivers/gpu/drm/xe/xe_configfs_debug.c
@@ -8,6 +8,7 @@
 #include <linux/module.h>
 #include <linux/cleanup.h>
 #include <linux/find.h>
+#include <linux/panic.h>
 #include <linux/pci.h>
 #include <linux/string.h>
 
@@ -33,6 +34,10 @@
  * and driver debugging and are not stable ABI. Using them is "at your own
  * risk".
  *
+ * Writing any debug attribute taints the kernel with ``TAINT_TEST``. This
+ * makes it visible in bug reports when a non-standard or unsafe configuration
+ * was active.
+ *
  * See the top-level ``Xe Configfs`` documentation in ``xe_configfs.c``
  * for how to create, probe and remove configfs devices. Once a device
  * directory exists, the driver populates it with a ``debug/`` subdirectory
@@ -528,6 +533,7 @@ static ssize_t wa_bb_store(struct wa_bb wa_bb[static XE_ENGINE_CLASS_MAX],
 
 	if (!count) {
 		memset(wa_bb, 0, sizeof(tmp_wa_bb));
+		add_taint(TAINT_TEST, LOCKDEP_STILL_OK);
 		return len;
 	}
 
@@ -547,6 +553,8 @@ static ssize_t wa_bb_store(struct wa_bb wa_bb[static XE_ENGINE_CLASS_MAX],
 
 	memcpy(wa_bb, tmp_wa_bb, sizeof(tmp_wa_bb));
 
+	add_taint(TAINT_TEST, LOCKDEP_STILL_OK);
+
 	return len;
 }
 
@@ -699,6 +707,8 @@ static ssize_t engines_allowed_store(struct config_item *item, const char *page,
 
 	dev->config.debug.engines_allowed = val;
 
+	add_taint(TAINT_TEST, LOCKDEP_STILL_OK);
+
 	return len;
 }
 
@@ -789,6 +799,8 @@ static ssize_t gt_types_allowed_store(struct config_item *item, const char *page
 
 	dev->config.debug.gt_types_allowed = typemask;
 
+	add_taint(TAINT_TEST, LOCKDEP_STILL_OK);
+
 	return len;
 }
 
diff --git a/drivers/gpu/drm/xe/xe_configfs_debug_params.c b/drivers/gpu/drm/xe/xe_configfs_debug_params.c
index c868e3f49ea4..482363833e13 100644
--- a/drivers/gpu/drm/xe/xe_configfs_debug_params.c
+++ b/drivers/gpu/drm/xe/xe_configfs_debug_params.c
@@ -29,11 +29,15 @@
  * This file also generates the xe_configfs_get_<name>() accessors used
  * by the rest of the driver to read a parameter's effective value; see
  * the DOC section below.
+ *
+ * Setting these parameters taints the kernel since these are intended
+ * for debug and testing purposes only.
  */
 
 #include <linux/cleanup.h>
 #include <linux/configfs.h>
 #include <linux/kernel.h>
+#include <linux/panic.h>
 #include <linux/pci.h>
 #include <linux/string.h>
 #include <linux/sysfs.h>
@@ -65,6 +69,7 @@ static ssize_t _name##_store(struct config_item *item, const char *page, size_t
 	if (xe_configfs_is_bound(dev)) \
 		return -EBUSY; \
 	dev->config.debug.params._name = val; \
+	add_taint(TAINT_TEST, LOCKDEP_STILL_OK); \
 	return len; \
 }
 
@@ -101,6 +106,7 @@ static ssize_t _name##_store(struct config_item *item, const char *page, size_t
 	if (xe_configfs_is_bound(dev)) \
 		return -EBUSY; \
 	dev->config.debug.params._name = val; \
+	add_taint(TAINT_TEST, LOCKDEP_STILL_OK); \
 	return len; \
 }
 
-- 
2.43.0