[Intel-gfx] [PATCH 2/2] drm/i915: Capture module params on hang
Mika Kuoppala
mika.kuoppala at linux.intel.com
Thu Nov 6 12:23:48 CET 2014
as it helps with bug triaging.
v2: Use PAGE_SIZE on alloc, don't spam to dmesg (Chris Wilson)
Suggested-by: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 1 +
drivers/gpu/drm/i915/i915_gpu_error.c | 31 +++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 0f00e58..c0ae57c 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -339,6 +339,7 @@ struct drm_i915_error_state {
struct timeval time;
char error_msg[128];
+ char module_params_msg[1024];
u32 reset_count;
u32 suspend_count;
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 89a2f3d..5f5735b 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -342,6 +342,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
err_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec,
error->time.tv_usec);
err_printf(m, "Kernel: " UTS_RELEASE "\n");
+ err_printf(m, "Module params: %s\n", error->module_params_msg);
max_hangcheck_score = 0;
for (i = 0; i < ARRAY_SIZE(error->ring); i++) {
if (error->ring[i].hangcheck_score > max_hangcheck_score)
@@ -1258,6 +1259,34 @@ static void i915_error_capture_msg(struct drm_device *dev,
wedged ? "reset" : "continue");
}
+static void i915_error_capture_module_params(struct drm_i915_error_state *error)
+{
+ const struct module *m = THIS_MODULE;
+ int i, len;
+ char *buf;
+
+ if (!m)
+ return;
+
+ buf = kmalloc(PAGE_SIZE, GFP_ATOMIC);
+ if (buf == NULL)
+ return;
+
+ for (i = 0, len = 0; i < m->num_kp; i++) {
+ if (!m->kp[i].ops || !m->kp[i].ops->get ||
+ m->kp[i].ops->get(buf, &m->kp[i]) <= 0)
+ continue;
+
+ len += scnprintf(error->module_params_msg + len,
+ sizeof(error->module_params_msg) - len,
+ "%s=%s ",
+ m->kp[i].name,
+ buf);
+ }
+
+ kfree(buf);
+}
+
static void i915_capture_gen_state(struct drm_i915_private *dev_priv,
struct drm_i915_error_state *error)
{
@@ -1303,6 +1332,8 @@ void i915_capture_error_state(struct drm_device *dev, bool wedged,
error->display = intel_display_capture_error_state(dev);
i915_error_capture_msg(dev, error, wedged, error_msg);
+ i915_error_capture_module_params(error);
+
DRM_INFO("%s\n", error->error_msg);
spin_lock_irqsave(&dev_priv->gpu_error.lock, flags);
--
1.9.1
More information about the Intel-gfx
mailing list