@@ -2279,6 +2279,17 @@ static int i915_rps_boost_info(struct seq_file *m, void *data)
return 0;
}
+#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
+static int i915_fail_injection_info(struct seq_file *m, void *data)
+{
+ struct drm_i915_private *i915 = node_to_i915(m->private);
+
+ seq_printf(m, "Available checkpoints: %u\n", i915->load_fail_count);
+
+ return 0;
+}
+#endif
+
static int i915_llc(struct seq_file *m, void *data)
{
struct drm_i915_private *dev_priv = node_to_i915(m->private);
@@ -4797,6 +4808,9 @@ static const struct drm_info_list i915_debugfs_list[] = {
{"i915_sseu_status", i915_sseu_status, 0},
{"i915_drrs_status", i915_drrs_status, 0},
{"i915_rps_boost_info", i915_rps_boost_info, 0},
+#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
+ {"i915_fail_injection_info", i915_fail_injection_info, 0},
+#endif
};
#define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
@@ -57,14 +57,11 @@
static struct drm_driver driver;
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
-static unsigned int i915_load_fail_count;
-bool __i915_inject_load_failure(const char *func, int line)
+bool __i915_inject_load_failure(struct drm_i915_private *i915,
+ const char *func, int line)
{
- if (i915_load_fail_count >= i915_modparams.inject_load_failure)
- return false;
-
- if (++i915_load_fail_count == i915_modparams.inject_load_failure) {
+ if (++i915->load_fail_count == i915_modparams.inject_load_failure) {
DRM_INFO("Injecting failure at checkpoint %u [%s:%d]\n",
i915_modparams.inject_load_failure, func, line);
return true;
@@ -114,11 +111,11 @@ __i915_printk(struct drm_i915_private *dev_priv, const char *level,
va_end(args);
}
-static bool i915_error_injected(struct drm_i915_private *dev_priv)
+static bool i915_error_injected(struct drm_i915_private *i915)
{
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
return i915_modparams.inject_load_failure &&
- i915_load_fail_count == i915_modparams.inject_load_failure;
+ i915->load_fail_count == i915_modparams.inject_load_failure;
#else
return false;
#endif
@@ -107,9 +107,10 @@
I915_STATE_WARN((x), "%s", "WARN_ON(" __stringify(x) ")")
#if IS_ENABLED(CONFIG_DRM_I915_DEBUG)
-bool __i915_inject_load_failure(const char *func, int line);
+bool __i915_inject_load_failure(struct drm_i915_private *i915,
+ const char *func, int line);
#define i915_inject_load_failure() \
- __i915_inject_load_failure(__func__, __LINE__)
+ __i915_inject_load_failure(dev_priv, __func__, __LINE__)
#else
#define i915_inject_load_failure() false
#endif
@@ -2120,6 +2121,8 @@ struct drm_i915_private {
struct i915_pmu pmu;
+ unsigned int load_fail_count;
+
/*
* NOTE: This is the dri1/ums dungeon, don't add stuff here. Your patch
* will be rejected. Instead look for a better place.
We'd like to start testing module load with fault injection. To avoid making any asumptions on number of available fault injection checkpoints (either in IGT or in i915), we can compute it at runtime and export it in debugfs. Signed-off-by: Michał Winiarski <michal.winiarski@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Imre Deak <imre.deak@intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> --- drivers/gpu/drm/i915/i915_debugfs.c | 14 ++++++++++++++ drivers/gpu/drm/i915/i915_drv.c | 13 +++++-------- drivers/gpu/drm/i915/i915_drv.h | 7 +++++-- 3 files changed, 24 insertions(+), 10 deletions(-)