All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/6] drm/i915: Generate i915_params {} using a macro
@ 2017-02-06  9:51 Chris Wilson
  2017-02-06  9:51 ` [PATCH v3 2/6] drm/i915: Use bool i915_param.alpha_support Chris Wilson
                   ` (5 more replies)
  0 siblings, 6 replies; 23+ messages in thread
From: Chris Wilson @ 2017-02-06  9:51 UTC (permalink / raw)
  To: intel-gfx

I want to print the struct from the error state and so would like to use
the existing struct definition as the template ala DEV_INFO*

v2: Use MEMBER() rather than p().

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/i915_params.h | 81 ++++++++++++++++++++------------------
 1 file changed, 43 insertions(+), 38 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h
index 8e433de04679..9a8c60342a82 100644
--- a/drivers/gpu/drm/i915/i915_params.h
+++ b/drivers/gpu/drm/i915/i915_params.h
@@ -27,46 +27,51 @@
 
 #include <linux/cache.h> /* for __read_mostly */
 
+#define I915_PARAMS_FOR_EACH(func) \
+	func(int, modeset); \
+	func(int, panel_ignore_lid); \
+	func(int, semaphores); \
+	func(int, lvds_channel_mode); \
+	func(int, panel_use_ssc); \
+	func(int, vbt_sdvo_panel_type); \
+	func(int, enable_rc6); \
+	func(int, enable_dc); \
+	func(int, enable_fbc); \
+	func(int, enable_ppgtt); \
+	func(int, enable_execlists); \
+	func(int, enable_psr); \
+	func(unsigned int, alpha_support); \
+	func(int, disable_power_well); \
+	func(int, enable_ips); \
+	func(int, invert_brightness); \
+	func(int, enable_guc_loading); \
+	func(int, enable_guc_submission); \
+	func(int, guc_log_level); \
+	func(int, use_mmio_flip); \
+	func(int, mmio_debug); \
+	func(int, edp_vswing); \
+	func(unsigned int, inject_load_failure); \
+	/* leave bools at the end to not create holes */ \
+	func(bool, enable_cmd_parser); \
+	func(bool, enable_hangcheck); \
+	func(bool, fastboot); \
+	func(bool, prefault_disable); \
+	func(bool, load_detect_test); \
+	func(bool, force_reset_modeset_test); \
+	func(bool, reset); \
+	func(bool, error_capture); \
+	func(bool, disable_display); \
+	func(bool, verbose_state_checks); \
+	func(bool, nuclear_pageflip); \
+	func(bool, enable_dp_mst); \
+	func(bool, enable_dpcd_backlight); \
+	func(bool, enable_gvt)
+
+#define MEMBER(T, member) T member
 struct i915_params {
-	int modeset;
-	int panel_ignore_lid;
-	int semaphores;
-	int lvds_channel_mode;
-	int panel_use_ssc;
-	int vbt_sdvo_panel_type;
-	int enable_rc6;
-	int enable_dc;
-	int enable_fbc;
-	int enable_ppgtt;
-	int enable_execlists;
-	int enable_psr;
-	unsigned int alpha_support;
-	int disable_power_well;
-	int enable_ips;
-	int invert_brightness;
-	int enable_guc_loading;
-	int enable_guc_submission;
-	int guc_log_level;
-	int use_mmio_flip;
-	int mmio_debug;
-	int edp_vswing;
-	unsigned int inject_load_failure;
-	/* leave bools at the end to not create holes */
-	bool enable_cmd_parser;
-	bool enable_hangcheck;
-	bool fastboot;
-	bool prefault_disable;
-	bool load_detect_test;
-	bool force_reset_modeset_test;
-	bool reset;
-	bool error_capture;
-	bool disable_display;
-	bool verbose_state_checks;
-	bool nuclear_pageflip;
-	bool enable_dp_mst;
-	bool enable_dpcd_backlight;
-	bool enable_gvt;
+	I915_PARAMS_FOR_EACH(MEMBER);
 };
+#undef MEMBER
 
 extern struct i915_params i915 __read_mostly;
 
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v3 2/6] drm/i915: Use bool i915_param.alpha_support
  2017-02-06  9:51 [PATCH v3 1/6] drm/i915: Generate i915_params {} using a macro Chris Wilson
@ 2017-02-06  9:51 ` Chris Wilson
  2017-02-06  9:51 ` [PATCH v3 3/6] drm/i915: Capture module parameters for the GPU error state Chris Wilson
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 23+ messages in thread
From: Chris Wilson @ 2017-02-06  9:51 UTC (permalink / raw)
  To: intel-gfx; +Cc: Jani Nikula, Daniel Vetter, Rodrigo Vivi

The alpha_support module option can only take one of two values, so
assign it to a boolean type. The only advantage is in pretty printing
via /sys/module/i915/parameters/alpha_support and elsewhere.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/i915_params.c | 2 +-
 drivers/gpu/drm/i915/i915_params.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
index 0e280fbd52f1..c2679fa7ed11 100644
--- a/drivers/gpu/drm/i915/i915_params.c
+++ b/drivers/gpu/drm/i915/i915_params.c
@@ -145,7 +145,7 @@ MODULE_PARM_DESC(enable_psr, "Enable PSR "
 		 "(0=disabled, 1=enabled - link mode chosen per-platform, 2=force link-standby mode, 3=force link-off mode) "
 		 "Default: -1 (use per-chip default)");
 
-module_param_named_unsafe(alpha_support, i915.alpha_support, int, 0400);
+module_param_named_unsafe(alpha_support, i915.alpha_support, bool, 0400);
 MODULE_PARM_DESC(alpha_support,
 	"Enable alpha quality driver support for latest hardware. "
 	"See also CONFIG_DRM_I915_ALPHA_SUPPORT.");
diff --git a/drivers/gpu/drm/i915/i915_params.h b/drivers/gpu/drm/i915/i915_params.h
index 9a8c60342a82..55d47eea172e 100644
--- a/drivers/gpu/drm/i915/i915_params.h
+++ b/drivers/gpu/drm/i915/i915_params.h
@@ -40,7 +40,6 @@
 	func(int, enable_ppgtt); \
 	func(int, enable_execlists); \
 	func(int, enable_psr); \
-	func(unsigned int, alpha_support); \
 	func(int, disable_power_well); \
 	func(int, enable_ips); \
 	func(int, invert_brightness); \
@@ -52,6 +51,7 @@
 	func(int, edp_vswing); \
 	func(unsigned int, inject_load_failure); \
 	/* leave bools at the end to not create holes */ \
+	func(bool, alpha_support); \
 	func(bool, enable_cmd_parser); \
 	func(bool, enable_hangcheck); \
 	func(bool, fastboot); \
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v3 3/6] drm/i915: Capture module parameters for the GPU error state
  2017-02-06  9:51 [PATCH v3 1/6] drm/i915: Generate i915_params {} using a macro Chris Wilson
  2017-02-06  9:51 ` [PATCH v3 2/6] drm/i915: Use bool i915_param.alpha_support Chris Wilson
@ 2017-02-06  9:51 ` Chris Wilson
  2017-02-06 11:13   ` Joonas Lahtinen
  2017-02-06 11:24   ` Chris Wilson
  2017-02-06  9:51 ` [PATCH v3 4/6] drm/i915: Show the current i915_params in debugfs/i915_capabilites Chris Wilson
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 23+ messages in thread
From: Chris Wilson @ 2017-02-06  9:51 UTC (permalink / raw)
  To: intel-gfx

They include useful material such as what mode the VM address space is
running in, what submission mode, extra quirks, etc.

v2: Undef the right macro, use type specific pretty printers
v3: Use strcmp(TYPENAME) rather than creating per-type pretty printers

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> #v1
Acked-by: Mika Kuoppala <mika.kuoppala@intel.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h       |  1 +
 drivers/gpu/drm/i915/i915_gpu_error.c | 42 +++++++++++++++++++++++++++++------
 2 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 5ef6a046b8ac..0cbd289da4ba 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -904,6 +904,7 @@ struct drm_i915_error_state {
 	u32 reset_count;
 	u32 suspend_count;
 	struct intel_device_info device_info;
+	struct i915_params params;
 
 	/* Generic register state */
 	u32 eir;
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 5283fe815a4d..5a70e16ee060 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -546,6 +546,29 @@ static void err_print_capabilities(struct drm_i915_error_state_buf *m,
 #undef PRINT_FLAG
 }
 
+static inline void err_print_param(struct drm_i915_error_state_buf *m,
+				   const char *name,
+				   const char *type,
+				   const void *x)
+{
+	if (!strcmp(type, "bool"))
+		err_printf(m, "i915.%s=%s\n", name, yesno(*(const bool *)x));
+	else if (!strcmp(type, "int"))
+		err_printf(m, "i915.%s=%d\n", name, *(const int *)x);
+	else if (!strcmp(type, "unsigned int"))
+		err_printf(m, "i915.%s=%u\n", name, *(const unsigned int *)x);
+	else
+		err_printf(m, "i915.%s=<unknown type '%s'>\n", name, type);
+}
+
+static void err_print_params(struct drm_i915_error_state_buf *m,
+			     const struct i915_params *p)
+{
+#define PRINT(T, x) err_print_param(m, #x, #T, &p->x);
+	I915_PARAMS_FOR_EACH(PRINT);
+#undef PRINT
+}
+
 int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 			    const struct i915_error_state_file_priv *error_priv)
 {
@@ -568,7 +591,6 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 		   error->boottime.tv_sec, error->boottime.tv_usec);
 	err_printf(m, "Uptime: %ld s %ld us\n",
 		   error->uptime.tv_sec, error->uptime.tv_usec);
-	err_print_capabilities(m, &error->device_info);
 
 	for (i = 0; i < ARRAY_SIZE(error->engine); i++) {
 		if (error->engine[i].hangcheck_stalled &&
@@ -588,6 +610,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 	err_printf(m, "PCI Subsystem: %04x:%04x\n",
 		   pdev->subsystem_vendor,
 		   pdev->subsystem_device);
+
 	err_printf(m, "IOMMU enabled?: %d\n", error->iommu);
 
 	if (HAS_CSR(dev_priv)) {
@@ -730,6 +753,9 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 	if (error->display)
 		intel_display_print_error_state(m, dev_priv, error->display);
 
+	err_print_capabilities(m, &error->device_info);
+	err_print_params(m, &error->params);
+
 out:
 	if (m->bytes == 0 && m->err)
 		return m->err;
@@ -1587,6 +1613,14 @@ static int capture(void *data)
 {
 	struct drm_i915_error_state *error = data;
 
+	do_gettimeofday(&error->time);
+	error->boottime = ktime_to_timeval(ktime_get_boottime());
+	error->uptime =
+		ktime_to_timeval(ktime_sub(ktime_get(),
+					   error->i915->gt.last_init_time));
+
+	error->params = i915;
+
 	i915_capture_gen_state(error->i915, error);
 	i915_capture_reg_state(error->i915, error);
 	i915_gem_record_fences(error->i915, error);
@@ -1595,12 +1629,6 @@ static int capture(void *data)
 	i915_capture_pinned_buffers(error->i915, error);
 	i915_gem_capture_guc_log_buffer(error->i915, error);
 
-	do_gettimeofday(&error->time);
-	error->boottime = ktime_to_timeval(ktime_get_boottime());
-	error->uptime =
-		ktime_to_timeval(ktime_sub(ktime_get(),
-					   error->i915->gt.last_init_time));
-
 	error->overlay = intel_overlay_capture_error_state(error->i915);
 	error->display = intel_display_capture_error_state(error->i915);
 
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v3 4/6] drm/i915: Show the current i915_params in debugfs/i915_capabilites
  2017-02-06  9:51 [PATCH v3 1/6] drm/i915: Generate i915_params {} using a macro Chris Wilson
  2017-02-06  9:51 ` [PATCH v3 2/6] drm/i915: Use bool i915_param.alpha_support Chris Wilson
  2017-02-06  9:51 ` [PATCH v3 3/6] drm/i915: Capture module parameters for the GPU error state Chris Wilson
@ 2017-02-06  9:51 ` Chris Wilson
  2017-02-06 11:21   ` Joonas Lahtinen
  2017-02-06  9:51 ` [PATCH v3 5/6] drm/i915: Add i915_param charp macro magic Chris Wilson
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 23+ messages in thread
From: Chris Wilson @ 2017-02-06  9:51 UTC (permalink / raw)
  To: intel-gfx

Alongside the hw capabilities, it is useful to know which of those have
been overridden by the user setting module parameters.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 3ae06568df7b..d7998c2f434f 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -61,6 +61,21 @@ drm_add_fake_info_node(struct drm_minor *minor,
 	return 0;
 }
 
+static inline void seq_print_param(struct seq_file *m,
+				   const char *name,
+				   const char *type,
+				   const void *x)
+{
+	if (!strcmp(type, "bool"))
+		seq_printf(m, "i915.%s=%s\n", name, yesno(*(const bool *)x));
+	else if (!strcmp(type, "int"))
+		seq_printf(m, "i915.%s=%d\n", name, *(const int *)x);
+	else if (!strcmp(type, "unsigned int"))
+		seq_printf(m, "i915.%s=%u\n", name, *(const unsigned int *)x);
+	else
+		seq_printf(m, "i915.%s=<unknown type '%s'>\n", name, type);
+}
+
 static int i915_capabilities(struct seq_file *m, void *data)
 {
 	struct drm_i915_private *dev_priv = node_to_i915(m->private);
@@ -69,10 +84,17 @@ static int i915_capabilities(struct seq_file *m, void *data)
 	seq_printf(m, "gen: %d\n", INTEL_GEN(dev_priv));
 	seq_printf(m, "platform: %s\n", intel_platform_name(info->platform));
 	seq_printf(m, "pch: %d\n", INTEL_PCH_TYPE(dev_priv));
+
 #define PRINT_FLAG(x)  seq_printf(m, #x ": %s\n", yesno(info->x))
 	DEV_INFO_FOR_EACH_FLAG(PRINT_FLAG);
 #undef PRINT_FLAG
 
+	kernel_param_lock(THIS_MODULE);
+#define PRINT_PARAM(T, x) seq_print_param(m, #x, #T, &i915.x);
+	I915_PARAMS_FOR_EACH(PRINT_PARAM);
+#undef PRINT_PARAM
+	kernel_param_unlock(THIS_MODULE);
+
 	return 0;
 }
 
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v3 5/6] drm/i915: Add i915_param charp macro magic
  2017-02-06  9:51 [PATCH v3 1/6] drm/i915: Generate i915_params {} using a macro Chris Wilson
                   ` (2 preceding siblings ...)
  2017-02-06  9:51 ` [PATCH v3 4/6] drm/i915: Show the current i915_params in debugfs/i915_capabilites Chris Wilson
@ 2017-02-06  9:51 ` Chris Wilson
  2017-02-06 12:32   ` Joonas Lahtinen
  2017-02-06  9:51 ` [PATCH v3 6/6] drm/i915: The return of i915_gpu_info to debugfs Chris Wilson
  2017-02-06 13:25 ` ✗ Fi.CI.BAT: failure for series starting with [v3,1/6] drm/i915: Generate i915_params {} using a macro Patchwork
  5 siblings, 1 reply; 23+ messages in thread
From: Chris Wilson @ 2017-02-06  9:51 UTC (permalink / raw)
  To: intel-gfx

Handling the dynamic charp module parameter requires us to copy it for
the error state, or remember to lock it when reading (in case it used
with 0600).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_debugfs.c   |  2 ++
 drivers/gpu/drm/i915/i915_gpu_error.c | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index d7998c2f434f..0e6d950bf7e9 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -72,6 +72,8 @@ static inline void seq_print_param(struct seq_file *m,
 		seq_printf(m, "i915.%s=%d\n", name, *(const int *)x);
 	else if (!strcmp(type, "unsigned int"))
 		seq_printf(m, "i915.%s=%u\n", name, *(const unsigned int *)x);
+	else if (!strcmp(type, "char *"))
+		seq_printf(m, "i915.%s=%s\n", name, *(const char **)x);
 	else
 		seq_printf(m, "i915.%s=<unknown type '%s'>\n", name, type);
 }
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 5a70e16ee060..824b6c0383c2 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -557,6 +557,8 @@ static inline void err_print_param(struct drm_i915_error_state_buf *m,
 		err_printf(m, "i915.%s=%d\n", name, *(const int *)x);
 	else if (!strcmp(type, "unsigned int"))
 		err_printf(m, "i915.%s=%u\n", name, *(const unsigned int *)x);
+	else if (!strcmp(type, "char *"))
+		err_printf(m, "i915.%s=%s\n", name, *(const char **)x);
 	else
 		err_printf(m, "i915.%s=<unknown type '%s'>\n", name, type);
 }
@@ -808,6 +810,12 @@ static void i915_error_object_free(struct drm_i915_error_object *obj)
 	kfree(obj);
 }
 
+static inline void free_param(const char *type, void *x)
+{
+	if (!strcmp(type, "char *"))
+		kfree(*(void **)x);
+}
+
 static void i915_error_state_free(struct kref *error_ref)
 {
 	struct drm_i915_error_state *error = container_of(error_ref,
@@ -838,6 +846,11 @@ static void i915_error_state_free(struct kref *error_ref)
 
 	kfree(error->overlay);
 	kfree(error->display);
+
+#define FREE(T, x) free_param(#T, &error->params.x);
+	I915_PARAMS_FOR_EACH(FREE);
+#undef FREE
+
 	kfree(error);
 }
 
@@ -1609,6 +1622,12 @@ static void i915_capture_gen_state(struct drm_i915_private *dev_priv,
 	       sizeof(error->device_info));
 }
 
+static inline void dup_param(const char *type, void *x)
+{
+	if (!strcmp(type, "char *"))
+		*(void **)x = kstrdup(*(void **)x, GFP_ATOMIC);
+}
+
 static int capture(void *data)
 {
 	struct drm_i915_error_state *error = data;
@@ -1620,6 +1639,9 @@ static int capture(void *data)
 					   error->i915->gt.last_init_time));
 
 	error->params = i915;
+#define DUP(T, x) dup_param(#T, &error->params.x);
+	I915_PARAMS_FOR_EACH(DUP);
+#undef DUP
 
 	i915_capture_gen_state(error->i915, error);
 	i915_capture_reg_state(error->i915, error);
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH v3 6/6] drm/i915: The return of i915_gpu_info to debugfs
  2017-02-06  9:51 [PATCH v3 1/6] drm/i915: Generate i915_params {} using a macro Chris Wilson
                   ` (3 preceding siblings ...)
  2017-02-06  9:51 ` [PATCH v3 5/6] drm/i915: Add i915_param charp macro magic Chris Wilson
@ 2017-02-06  9:51 ` Chris Wilson
  2017-02-07  9:09   ` Chris Wilson
  2017-02-06 13:25 ` ✗ Fi.CI.BAT: failure for series starting with [v3,1/6] drm/i915: Generate i915_params {} using a macro Patchwork
  5 siblings, 1 reply; 23+ messages in thread
From: Chris Wilson @ 2017-02-06  9:51 UTC (permalink / raw)
  To: intel-gfx; +Cc: Mika Kuoppala

Once upon a time before we had automated GPU state capture upon hangs,
we had intel_gpu_dump. Now we come almost full circle and reinstate that
view of the current GPU queues and registers by using the error capture
facility to snapshot the GPU state when debugfs/.../i915_gpu_info is
opened - which should provided useful debugging to both the error
capture routines (without having to cause a hang and avoid the error
state being eaten by igt) and generally.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c   | 123 +++++++++++++++++++---------------
 drivers/gpu/drm/i915/i915_drv.h       |  31 ++++++---
 drivers/gpu/drm/i915/i915_gpu_error.c | 117 ++++++++++++++++----------------
 drivers/gpu/drm/i915/i915_sysfs.c     |  27 ++++----
 drivers/gpu/drm/i915/intel_display.c  |   2 +-
 5 files changed, 160 insertions(+), 140 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 0e6d950bf7e9..76c453b98f6a 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -978,89 +978,103 @@ static int i915_gem_fence_regs_info(struct seq_file *m, void *data)
 }
 
 #if IS_ENABLED(CONFIG_DRM_I915_CAPTURE_ERROR)
-
-static ssize_t
-i915_error_state_write(struct file *filp,
-		       const char __user *ubuf,
-		       size_t cnt,
-		       loff_t *ppos)
+static ssize_t error_state_read(struct file *file, char __user *ubuf,
+				size_t count, loff_t *pos)
 {
-	struct i915_error_state_file_priv *error_priv = filp->private_data;
-
-	DRM_DEBUG_DRIVER("Resetting error state\n");
-	i915_destroy_error_state(error_priv->i915);
-
-	return cnt;
-}
+	struct drm_i915_error_state *error = file->private_data;
+	struct drm_i915_error_state_buf str;
+	ssize_t ret;
+	loff_t tmp;
 
-static int i915_error_state_open(struct inode *inode, struct file *file)
-{
-	struct drm_i915_private *dev_priv = inode->i_private;
-	struct i915_error_state_file_priv *error_priv;
+	if (!error)
+		return 0;
 
-	error_priv = kzalloc(sizeof(*error_priv), GFP_KERNEL);
-	if (!error_priv)
-		return -ENOMEM;
+	ret = i915_error_state_buf_init(&str, error->i915, count, *pos);
+	if (ret)
+		return ret;
 
-	error_priv->i915 = dev_priv;
+	ret = i915_error_state_to_str(&str, error);
+	if (ret)
+		goto out;
 
-	i915_error_state_get(&dev_priv->drm, error_priv);
+	tmp = 0;
+	ret = simple_read_from_buffer(ubuf, count, &tmp, str.buf, str.bytes);
+	if (ret < 0)
+		goto out;
 
-	file->private_data = error_priv;
+	*pos = str.start + ret;
+out:
+	i915_error_state_buf_release(&str);
+	return ret;
+}
 
+static int error_state_release(struct inode *inode, struct file *file)
+{
+	i915_error_state_put(file->private_data);
 	return 0;
 }
 
-static int i915_error_state_release(struct inode *inode, struct file *file)
+static int i915_gpu_info_open(struct inode *inode, struct file *file)
 {
-	struct i915_error_state_file_priv *error_priv = file->private_data;
+	struct drm_i915_error_state *error;
 
-	i915_error_state_put(error_priv);
-	kfree(error_priv);
+	error = i915_error_state(inode->i_private);
+	if (!error)
+		return -ENOMEM;
 
+	file->private_data = error;
 	return 0;
 }
 
-static ssize_t i915_error_state_read(struct file *file, char __user *userbuf,
-				     size_t count, loff_t *pos)
+static const struct file_operations i915_gpu_info_fops = {
+	.owner = THIS_MODULE,
+	.open = i915_gpu_info_open,
+	.read = error_state_read,
+	.llseek = default_llseek,
+	.release = error_state_release,
+};
+
+static ssize_t
+i915_error_state_write(struct file *filp,
+		       const char __user *ubuf,
+		       size_t cnt,
+		       loff_t *ppos)
 {
-	struct i915_error_state_file_priv *error_priv = file->private_data;
-	struct drm_i915_error_state_buf error_str;
-	loff_t tmp_pos = 0;
-	ssize_t ret_count = 0;
-	int ret;
+	struct drm_i915_error_state *error = filp->private_data;
 
-	ret = i915_error_state_buf_init(&error_str, error_priv->i915,
-					count, *pos);
-	if (ret)
-		return ret;
+	if (!error)
+		return 0;
 
-	ret = i915_error_state_to_str(&error_str, error_priv);
-	if (ret)
-		goto out;
+	DRM_DEBUG_DRIVER("Resetting error state\n");
+	i915_destroy_error_state(error->i915);
 
-	ret_count = simple_read_from_buffer(userbuf, count, &tmp_pos,
-					    error_str.buf,
-					    error_str.bytes);
+	return cnt;
+}
 
-	if (ret_count < 0)
-		ret = ret_count;
-	else
-		*pos = error_str.start + ret_count;
-out:
-	i915_error_state_buf_release(&error_str);
-	return ret ?: ret_count;
+static int i915_error_state_open(struct inode *inode, struct file *file)
+{
+	struct drm_i915_private *i915 = inode->i_private;
+	struct drm_i915_error_state *error;
+
+	spin_lock_irq(&i915->gpu_error.lock);
+	error = i915->gpu_error.first_error;
+	if (error)
+		i915_error_state_get(error);
+	spin_unlock_irq(&i915->gpu_error.lock);
+
+	file->private_data = error;
+
+	return 0;
 }
 
 static const struct file_operations i915_error_state_fops = {
 	.owner = THIS_MODULE,
 	.open = i915_error_state_open,
-	.read = i915_error_state_read,
+	.read = error_state_read,
 	.write = i915_error_state_write,
 	.llseek = default_llseek,
-	.release = i915_error_state_release,
+	.release = error_state_release,
 };
-
 #endif
 
 static int
@@ -4731,6 +4745,7 @@ static const struct i915_debugfs_files {
 	{"i915_gem_drop_caches", &i915_drop_caches_fops},
 #if IS_ENABLED(CONFIG_DRM_I915_CAPTURE_ERROR)
 	{"i915_error_state", &i915_error_state_fops},
+	{"i915_gpu_info", &i915_gpu_info_fops},
 #endif
 	{"i915_next_seqno", &i915_next_seqno_fops},
 	{"i915_display_crc_ctl", &i915_display_crc_ctl_fops},
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 0cbd289da4ba..263fabd1581c 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -910,7 +910,7 @@ struct drm_i915_error_state {
 	u32 eir;
 	u32 pgtbl_er;
 	u32 ier;
-	u32 gtier[4];
+	u32 gtier[4], ngtier;
 	u32 ccid;
 	u32 derrmr;
 	u32 forcewake;
@@ -924,6 +924,7 @@ struct drm_i915_error_state {
 	u32 gab_ctl;
 	u32 gfx_mode;
 
+	u32 nfence;
 	u64 fence[I915_MAX_NUM_FENCES];
 	struct intel_overlay_error_state *overlay;
 	struct intel_display_error_state *display;
@@ -1505,11 +1506,6 @@ struct drm_i915_error_state_buf {
 	loff_t pos;
 };
 
-struct i915_error_state_file_priv {
-	struct drm_i915_private *i915;
-	struct drm_i915_error_state *error;
-};
-
 #define I915_RESET_TIMEOUT (10 * HZ) /* 10s */
 #define I915_FENCE_TIMEOUT (10 * HZ) /* 10s */
 
@@ -3558,7 +3554,7 @@ static inline void intel_display_crc_init(struct drm_i915_private *dev_priv) {}
 __printf(2, 3)
 void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...);
 int i915_error_state_to_str(struct drm_i915_error_state_buf *estr,
-			    const struct i915_error_state_file_priv *error);
+			    const struct drm_i915_error_state *error);
 int i915_error_state_buf_init(struct drm_i915_error_state_buf *eb,
 			      struct drm_i915_private *i915,
 			      size_t count, loff_t pos);
@@ -3567,12 +3563,26 @@ static inline void i915_error_state_buf_release(
 {
 	kfree(eb->buf);
 }
+
+struct drm_i915_error_state *i915_error_state(struct drm_i915_private *i915);
 void i915_capture_error_state(struct drm_i915_private *dev_priv,
 			      u32 engine_mask,
 			      const char *error_msg);
-void i915_error_state_get(struct drm_device *dev,
-			  struct i915_error_state_file_priv *error_priv);
-void i915_error_state_put(struct i915_error_state_file_priv *error_priv);
+
+static inline struct drm_i915_error_state *
+i915_error_state_get(struct drm_i915_error_state *error)
+{
+	kref_get(&error->ref);
+	return error;
+}
+
+void __i915_error_state_free(struct kref *error_ref);
+static inline void i915_error_state_put(struct drm_i915_error_state *error)
+{
+	if (error)
+		kref_put(&error->ref, __i915_error_state_free);
+}
+
 void i915_destroy_error_state(struct drm_i915_private *dev_priv);
 
 #else
@@ -3739,7 +3749,6 @@ extern void intel_overlay_print_error_state(struct drm_i915_error_state_buf *e,
 extern struct intel_display_error_state *
 intel_display_capture_error_state(struct drm_i915_private *dev_priv);
 extern void intel_display_print_error_state(struct drm_i915_error_state_buf *e,
-					    struct drm_i915_private *dev_priv,
 					    struct intel_display_error_state *error);
 
 int sandybridge_pcode_read(struct drm_i915_private *dev_priv, u32 mbox, u32 *val);
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 824b6c0383c2..dac844270998 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -342,7 +342,7 @@ static void print_error_buffers(struct drm_i915_error_state_buf *m,
 }
 
 static void error_print_instdone(struct drm_i915_error_state_buf *m,
-				 struct drm_i915_error_engine *ee)
+				 const struct drm_i915_error_engine *ee)
 {
 	int slice;
 	int subslice;
@@ -372,7 +372,7 @@ static void error_print_instdone(struct drm_i915_error_state_buf *m,
 
 static void error_print_request(struct drm_i915_error_state_buf *m,
 				const char *prefix,
-				struct drm_i915_error_request *erq)
+				const struct drm_i915_error_request *erq)
 {
 	if (!erq->seqno)
 		return;
@@ -386,7 +386,7 @@ static void error_print_request(struct drm_i915_error_state_buf *m,
 
 static void error_print_context(struct drm_i915_error_state_buf *m,
 				const char *header,
-				struct drm_i915_error_context *ctx)
+				const struct drm_i915_error_context *ctx)
 {
 	err_printf(m, "%s%s[%d] user_handle %d hw_id %d, ban score %d guilty %d active %d\n",
 		   header, ctx->comm, ctx->pid, ctx->handle, ctx->hw_id,
@@ -394,7 +394,7 @@ static void error_print_context(struct drm_i915_error_state_buf *m,
 }
 
 static void error_print_engine(struct drm_i915_error_state_buf *m,
-			       struct drm_i915_error_engine *ee)
+			       const struct drm_i915_error_engine *ee)
 {
 	err_printf(m, "%s command stream:\n", engine_str(ee->engine_id));
 	err_printf(m, "  START: 0x%08x\n", ee->start);
@@ -571,21 +571,32 @@ static void err_print_params(struct drm_i915_error_state_buf *m,
 #undef PRINT
 }
 
+static void err_print_pciid(struct drm_i915_error_state_buf *m,
+			    struct drm_i915_private *i915)
+{
+	struct pci_dev *pdev = i915->drm.pdev;
+
+	err_printf(m, "PCI ID: 0x%04x\n", pdev->device);
+	err_printf(m, "PCI Revision: 0x%02x\n", pdev->revision);
+	err_printf(m, "PCI Subsystem: %04x:%04x\n",
+		   pdev->subsystem_vendor,
+		   pdev->subsystem_device);
+}
+
 int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
-			    const struct i915_error_state_file_priv *error_priv)
+			    const struct drm_i915_error_state *error)
 {
-	struct drm_i915_private *dev_priv = error_priv->i915;
-	struct pci_dev *pdev = dev_priv->drm.pdev;
-	struct drm_i915_error_state *error = error_priv->error;
+	struct drm_i915_private *dev_priv = m->i915;
 	struct drm_i915_error_object *obj;
 	int i, j;
 
 	if (!error) {
-		err_printf(m, "no error state collected\n");
-		goto out;
+		err_printf(m, "No error state collected\n");
+		return 0;
 	}
 
-	err_printf(m, "%s\n", error->error_msg);
+	if (*error->error_msg)
+		err_printf(m, "%s\n", error->error_msg);
 	err_printf(m, "Kernel: " UTS_RELEASE "\n");
 	err_printf(m, "Time: %ld s %ld us\n",
 		   error->time.tv_sec, error->time.tv_usec);
@@ -607,11 +618,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 	err_printf(m, "Reset count: %u\n", error->reset_count);
 	err_printf(m, "Suspend count: %u\n", error->suspend_count);
 	err_printf(m, "Platform: %s\n", intel_platform_name(error->device_info.platform));
-	err_printf(m, "PCI ID: 0x%04x\n", pdev->device);
-	err_printf(m, "PCI Revision: 0x%02x\n", pdev->revision);
-	err_printf(m, "PCI Subsystem: %04x:%04x\n",
-		   pdev->subsystem_vendor,
-		   pdev->subsystem_device);
+	err_print_pciid(m, error->i915);
 
 	err_printf(m, "IOMMU enabled?: %d\n", error->iommu);
 
@@ -627,19 +634,15 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 
 	err_printf(m, "EIR: 0x%08x\n", error->eir);
 	err_printf(m, "IER: 0x%08x\n", error->ier);
-	if (INTEL_GEN(dev_priv) >= 8) {
-		for (i = 0; i < 4; i++)
-			err_printf(m, "GTIER gt %d: 0x%08x\n", i,
-				   error->gtier[i]);
-	} else if (HAS_PCH_SPLIT(dev_priv) || IS_VALLEYVIEW(dev_priv))
-		err_printf(m, "GTIER: 0x%08x\n", error->gtier[0]);
+	for (i = 0; i < error->ngtier; i++)
+		err_printf(m, "GTIER[%d]: 0x%08x\n", i, error->gtier[i]);
 	err_printf(m, "PGTBL_ER: 0x%08x\n", error->pgtbl_er);
 	err_printf(m, "FORCEWAKE: 0x%08x\n", error->forcewake);
 	err_printf(m, "DERRMR: 0x%08x\n", error->derrmr);
 	err_printf(m, "CCID: 0x%08x\n", error->ccid);
 	err_printf(m, "Missed interrupts: 0x%08lx\n", dev_priv->gpu_error.missed_irq_rings);
 
-	for (i = 0; i < dev_priv->num_fence_regs; i++)
+	for (i = 0; i < error->nfence; i++)
 		err_printf(m, "  fence[%d] = %08llx\n", i, error->fence[i]);
 
 	if (INTEL_GEN(dev_priv) >= 6) {
@@ -688,7 +691,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 			    error->pinned_bo_count);
 
 	for (i = 0; i < ARRAY_SIZE(error->engine); i++) {
-		struct drm_i915_error_engine *ee = &error->engine[i];
+		const struct drm_i915_error_engine *ee = &error->engine[i];
 
 		obj = ee->batchbuffer;
 		if (obj) {
@@ -753,12 +756,11 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
 		intel_overlay_print_error_state(m, error->overlay);
 
 	if (error->display)
-		intel_display_print_error_state(m, dev_priv, error->display);
+		intel_display_print_error_state(m, error->display);
 
 	err_print_capabilities(m, &error->device_info);
 	err_print_params(m, &error->params);
 
-out:
 	if (m->bytes == 0 && m->err)
 		return m->err;
 
@@ -816,7 +818,7 @@ static inline void free_param(const char *type, void *x)
 		kfree(*(void **)x);
 }
 
-static void i915_error_state_free(struct kref *error_ref)
+void __i915_error_state_free(struct kref *error_ref)
 {
 	struct drm_i915_error_state *error = container_of(error_ref,
 							  typeof(*error), ref);
@@ -1018,16 +1020,17 @@ static void i915_gem_record_fences(struct drm_i915_private *dev_priv,
 {
 	int i;
 
-	if (IS_GEN3(dev_priv) || IS_GEN2(dev_priv)) {
+	if (INTEL_GEN(dev_priv) >= 6) {
 		for (i = 0; i < dev_priv->num_fence_regs; i++)
-			error->fence[i] = I915_READ(FENCE_REG(i));
-	} else if (IS_GEN5(dev_priv) || IS_GEN4(dev_priv)) {
+			error->fence[i] = I915_READ64(FENCE_REG_GEN6_LO(i));
+	} else if (INTEL_GEN(dev_priv) >= 4) {
 		for (i = 0; i < dev_priv->num_fence_regs; i++)
 			error->fence[i] = I915_READ64(FENCE_REG_965_LO(i));
-	} else if (INTEL_GEN(dev_priv) >= 6) {
+	} else {
 		for (i = 0; i < dev_priv->num_fence_regs; i++)
-			error->fence[i] = I915_READ64(FENCE_REG_GEN6_LO(i));
+			error->fence[i] = I915_READ(FENCE_REG(i));
 	}
+	error->nfence = i;
 }
 
 static inline u32
@@ -1568,9 +1571,11 @@ static void i915_capture_reg_state(struct drm_i915_private *dev_priv,
 		error->ier = I915_READ(GEN8_DE_MISC_IER);
 		for (i = 0; i < 4; i++)
 			error->gtier[i] = I915_READ(GEN8_GT_IER(i));
+		error->ngtier = 4;
 	} else if (HAS_PCH_SPLIT(dev_priv)) {
 		error->ier = I915_READ(DEIER);
 		error->gtier[0] = I915_READ(GTIER);
+		error->ngtier = 1;
 	} else if (IS_GEN2(dev_priv)) {
 		error->ier = I915_READ16(IER);
 	} else if (!IS_VALLEYVIEW(dev_priv)) {
@@ -1659,6 +1664,23 @@ static int capture(void *data)
 
 #define DAY_AS_SECONDS(x) (24 * 60 * 60 * (x))
 
+struct drm_i915_error_state *
+i915_error_state(struct drm_i915_private *i915)
+{
+	struct drm_i915_error_state *error;
+
+	error = kzalloc(sizeof(*error), GFP_ATOMIC);
+	if (!error)
+		return NULL;
+
+	kref_init(&error->ref);
+	error->i915 = i915;
+
+	stop_machine(capture, error, NULL);
+
+	return error;
+}
+
 /**
  * i915_capture_error_state - capture an error record for later analysis
  * @dev: drm device
@@ -1682,18 +1704,12 @@ void i915_capture_error_state(struct drm_i915_private *dev_priv,
 	if (READ_ONCE(dev_priv->gpu_error.first_error))
 		return;
 
-	/* Account for pipe specific data like PIPE*STAT */
-	error = kzalloc(sizeof(*error), GFP_ATOMIC);
+	error = i915_error_state(dev_priv);
 	if (!error) {
 		DRM_DEBUG_DRIVER("out of memory, not capturing error state\n");
 		return;
 	}
 
-	kref_init(&error->ref);
-	error->i915 = dev_priv;
-
-	stop_machine(capture, error, NULL);
-
 	i915_error_capture_msg(dev_priv, error, engine_mask, error_msg);
 	DRM_INFO("%s\n", error->error_msg);
 
@@ -1707,7 +1723,7 @@ void i915_capture_error_state(struct drm_i915_private *dev_priv,
 	}
 
 	if (error) {
-		i915_error_state_free(&error->ref);
+		__i915_error_state_free(&error->ref);
 		return;
 	}
 
@@ -1723,24 +1739,6 @@ void i915_capture_error_state(struct drm_i915_private *dev_priv,
 	}
 }
 
-void i915_error_state_get(struct drm_device *dev,
-			  struct i915_error_state_file_priv *error_priv)
-{
-	struct drm_i915_private *dev_priv = to_i915(dev);
-
-	spin_lock_irq(&dev_priv->gpu_error.lock);
-	error_priv->error = dev_priv->gpu_error.first_error;
-	if (error_priv->error)
-		kref_get(&error_priv->error->ref);
-	spin_unlock_irq(&dev_priv->gpu_error.lock);
-}
-
-void i915_error_state_put(struct i915_error_state_file_priv *error_priv)
-{
-	if (error_priv->error)
-		kref_put(&error_priv->error->ref, i915_error_state_free);
-}
-
 void i915_destroy_error_state(struct drm_i915_private *dev_priv)
 {
 	struct drm_i915_error_state *error;
@@ -1750,6 +1748,5 @@ void i915_destroy_error_state(struct drm_i915_private *dev_priv)
 	dev_priv->gpu_error.first_error = NULL;
 	spin_unlock_irq(&dev_priv->gpu_error.lock);
 
-	if (error)
-		kref_put(&error->ref, i915_error_state_free);
+	i915_error_state_put(error);
 }
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index a721ff116101..85f34191d29f 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -522,33 +522,32 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj,
 
 	struct device *kdev = kobj_to_dev(kobj);
 	struct drm_i915_private *dev_priv = kdev_minor_to_i915(kdev);
-	struct drm_device *dev = &dev_priv->drm;
-	struct i915_error_state_file_priv error_priv;
 	struct drm_i915_error_state_buf error_str;
-	ssize_t ret_count = 0;
-	int ret;
-
-	memset(&error_priv, 0, sizeof(error_priv));
+	struct drm_i915_error_state *error;
+	ssize_t ret;
 
-	ret = i915_error_state_buf_init(&error_str, to_i915(dev), count, off);
+	ret = i915_error_state_buf_init(&error_str, dev_priv, count, off);
 	if (ret)
 		return ret;
 
-	error_priv.i915 = dev_priv;
-	i915_error_state_get(dev, &error_priv);
+	spin_lock_irq(&dev_priv->gpu_error.lock);
+	error = dev_priv->gpu_error.first_error;
+	if (error)
+		i915_error_state_get(error);
+	spin_unlock_irq(&dev_priv->gpu_error.lock);
 
-	ret = i915_error_state_to_str(&error_str, &error_priv);
+	ret = i915_error_state_to_str(&error_str, error);
 	if (ret)
 		goto out;
 
-	ret_count = count < error_str.bytes ? count : error_str.bytes;
+	ret = count < error_str.bytes ? count : error_str.bytes;
+	memcpy(buf, error_str.buf, ret);
 
-	memcpy(buf, error_str.buf, ret_count);
 out:
-	i915_error_state_put(&error_priv);
+	i915_error_state_put(error);
 	i915_error_state_buf_release(&error_str);
 
-	return ret ?: ret_count;
+	return ret;
 }
 
 static ssize_t error_state_write(struct file *file, struct kobject *kobj,
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 45e587496886..a4f70e14177f 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -17515,9 +17515,9 @@ intel_display_capture_error_state(struct drm_i915_private *dev_priv)
 
 void
 intel_display_print_error_state(struct drm_i915_error_state_buf *m,
-				struct drm_i915_private *dev_priv,
 				struct intel_display_error_state *error)
 {
+	struct drm_i915_private *dev_priv = m->i915;
 	int i;
 
 	if (!error)
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH v3 3/6] drm/i915: Capture module parameters for the GPU error state
  2017-02-06  9:51 ` [PATCH v3 3/6] drm/i915: Capture module parameters for the GPU error state Chris Wilson
@ 2017-02-06 11:13   ` Joonas Lahtinen
  2017-02-06 11:24   ` Chris Wilson
  1 sibling, 0 replies; 23+ messages in thread
From: Joonas Lahtinen @ 2017-02-06 11:13 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On ma, 2017-02-06 at 09:51 +0000, Chris Wilson wrote:
> They include useful material such as what mode the VM address space is
> running in, what submission mode, extra quirks, etc.
> 
> v2: Undef the right macro, use type specific pretty printers
> v3: Use strcmp(TYPENAME) rather than creating per-type pretty printers
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> #v1

I'm fine with this too, it can be shown some __builtin love in the
future if necessary.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v3 4/6] drm/i915: Show the current i915_params in debugfs/i915_capabilites
  2017-02-06  9:51 ` [PATCH v3 4/6] drm/i915: Show the current i915_params in debugfs/i915_capabilites Chris Wilson
@ 2017-02-06 11:21   ` Joonas Lahtinen
  0 siblings, 0 replies; 23+ messages in thread
From: Joonas Lahtinen @ 2017-02-06 11:21 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On ma, 2017-02-06 at 09:51 +0000, Chris Wilson wrote:
> Alongside the hw capabilities, it is useful to know which of those have
> been overridden by the user setting module parameters.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Acked-by: Jani Nikula <jani.nikula@intel.com>

As discussed in IRC, with always_inline, this is (like the previous one
too);

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v3 3/6] drm/i915: Capture module parameters for the GPU error state
  2017-02-06  9:51 ` [PATCH v3 3/6] drm/i915: Capture module parameters for the GPU error state Chris Wilson
  2017-02-06 11:13   ` Joonas Lahtinen
@ 2017-02-06 11:24   ` Chris Wilson
  2017-02-06 11:29     ` Chris Wilson
  1 sibling, 1 reply; 23+ messages in thread
From: Chris Wilson @ 2017-02-06 11:24 UTC (permalink / raw)
  To: intel-gfx

On Mon, Feb 06, 2017 at 09:51:43AM +0000, Chris Wilson wrote:
> They include useful material such as what mode the VM address space is
> running in, what submission mode, extra quirks, etc.
> 
> v2: Undef the right macro, use type specific pretty printers
> v3: Use strcmp(TYPENAME) rather than creating per-type pretty printers
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> #v1
> Acked-by: Mika Kuoppala <mika.kuoppala@intel.com>
> Acked-by: Jani Nikula <jani.nikula@intel.com>

v4: Use always_inline to force GCC to eliminate the calls to strcmp and
generate the right call to seq_printf for each parameter.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> # :)

Equally imagine I've applied the same fix to next pair of patches
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v3 3/6] drm/i915: Capture module parameters for the GPU error state
  2017-02-06 11:24   ` Chris Wilson
@ 2017-02-06 11:29     ` Chris Wilson
  0 siblings, 0 replies; 23+ messages in thread
From: Chris Wilson @ 2017-02-06 11:29 UTC (permalink / raw)
  To: intel-gfx, joonas.lahtinen

On Mon, Feb 06, 2017 at 11:24:53AM +0000, Chris Wilson wrote:
> On Mon, Feb 06, 2017 at 09:51:43AM +0000, Chris Wilson wrote:
> > They include useful material such as what mode the VM address space is
> > running in, what submission mode, extra quirks, etc.
> > 
> > v2: Undef the right macro, use type specific pretty printers
> > v3: Use strcmp(TYPENAME) rather than creating per-type pretty printers
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> #v1
> > Acked-by: Mika Kuoppala <mika.kuoppala@intel.com>
> > Acked-by: Jani Nikula <jani.nikula@intel.com>
> 
> v4: Use always_inline to force GCC to eliminate the calls to strcmp and
> generate the right call to seq_printf for each parameter.

v5: With the strcmp elimination, we can now use BUILD_BUG to ensure
there are no unhandled types, also use __builtin_strcmp to make it look 
even more special.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v3 5/6] drm/i915: Add i915_param charp macro magic
  2017-02-06  9:51 ` [PATCH v3 5/6] drm/i915: Add i915_param charp macro magic Chris Wilson
@ 2017-02-06 12:32   ` Joonas Lahtinen
  2017-02-06 13:06     ` Chris Wilson
  2017-02-07  9:12     ` Chris Wilson
  0 siblings, 2 replies; 23+ messages in thread
From: Joonas Lahtinen @ 2017-02-06 12:32 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On ma, 2017-02-06 at 09:51 +0000, Chris Wilson wrote:
> Handling the dynamic charp module parameter requires us to copy it for
> the error state, or remember to lock it when reading (in case it used
> with 0600).
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

I'm bit hesitant that we merge known dead code here.

Maybe the guc firmware path override would be useful to excercise this?

Code itself;

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v3 5/6] drm/i915: Add i915_param charp macro magic
  2017-02-06 12:32   ` Joonas Lahtinen
@ 2017-02-06 13:06     ` Chris Wilson
  2017-02-07  9:12     ` Chris Wilson
  1 sibling, 0 replies; 23+ messages in thread
From: Chris Wilson @ 2017-02-06 13:06 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: intel-gfx

On Mon, Feb 06, 2017 at 02:32:17PM +0200, Joonas Lahtinen wrote:
> On ma, 2017-02-06 at 09:51 +0000, Chris Wilson wrote:
> > Handling the dynamic charp module parameter requires us to copy it for
> > the error state, or remember to lock it when reading (in case it used
> > with 0600).
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> I'm bit hesitant that we merge known dead code here.
> 
> Maybe the guc firmware path override would be useful to excercise this?

Sent a proof of principle patch, if those who need it could review it
and get Jani to bless it. Or just keep this patch to themselves.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* ✗ Fi.CI.BAT: failure for series starting with [v3,1/6] drm/i915: Generate i915_params {} using a macro
  2017-02-06  9:51 [PATCH v3 1/6] drm/i915: Generate i915_params {} using a macro Chris Wilson
                   ` (4 preceding siblings ...)
  2017-02-06  9:51 ` [PATCH v3 6/6] drm/i915: The return of i915_gpu_info to debugfs Chris Wilson
@ 2017-02-06 13:25 ` Patchwork
  5 siblings, 0 replies; 23+ messages in thread
From: Patchwork @ 2017-02-06 13:25 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: series starting with [v3,1/6] drm/i915: Generate i915_params {} using a macro
URL   : https://patchwork.freedesktop.org/series/19149/
State : failure

== Summary ==

Series 19149v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/19149/revisions/1/mbox/

Test drv_hangman:
        Subgroup error-state-basic:
                pass       -> INCOMPLETE (fi-hsw-4770)
Test kms_force_connector_basic:
        Subgroup force-connector-state:
                pass       -> DMESG-WARN (fi-snb-2520m)
        Subgroup force-load-detect:
                dmesg-warn -> PASS       (fi-snb-2520m)

fi-bdw-5557u     total:252  pass:214  dwarn:0   dfail:0   fail:0   skip:38 
fi-bsw-n3050     total:252  pass:192  dwarn:0   dfail:0   fail:0   skip:60 
fi-bxt-j4205     total:252  pass:208  dwarn:0   dfail:0   fail:0   skip:44 
fi-bxt-t5700     total:209  pass:167  dwarn:0   dfail:0   fail:0   skip:41 
fi-byt-j1900     total:252  pass:204  dwarn:0   dfail:0   fail:0   skip:48 
fi-byt-n2820     total:252  pass:200  dwarn:0   dfail:0   fail:0   skip:52 
fi-hsw-4770      total:5    pass:4    dwarn:0   dfail:0   fail:0   skip:0  
fi-hsw-4770r     total:252  pass:211  dwarn:0   dfail:0   fail:0   skip:41 
fi-ilk-650       total:14   pass:11   dwarn:0   dfail:0   fail:0   skip:2  
fi-ivb-3520m     total:252  pass:210  dwarn:0   dfail:0   fail:0   skip:42 
fi-ivb-3770      total:252  pass:210  dwarn:0   dfail:0   fail:0   skip:42 
fi-kbl-7500u     total:252  pass:207  dwarn:0   dfail:0   fail:2   skip:43 
fi-skl-6260u     total:252  pass:215  dwarn:0   dfail:0   fail:0   skip:37 
fi-skl-6700hq    total:252  pass:210  dwarn:0   dfail:0   fail:0   skip:42 
fi-skl-6700k     total:252  pass:205  dwarn:4   dfail:0   fail:0   skip:43 
fi-skl-6770hq    total:252  pass:215  dwarn:0   dfail:0   fail:0   skip:37 
fi-snb-2520m     total:252  pass:200  dwarn:1   dfail:0   fail:0   skip:51 
fi-snb-2600      total:252  pass:200  dwarn:0   dfail:0   fail:0   skip:52 

e7d4ec79b24f82431f34d070d16772538422fb13 drm-tip: 2017y-02m-06d-11h-49m-42s UTC integration manifest
48b227a drm/i915: The return of i915_gpu_info to debugfs
a0caf5d drm/i915: Add i915_param charp macro magic
6aef0eb drm/i915: Show the current i915_params in debugfs/i915_capabilites
7edf1c7 drm/i915: Capture module parameters for the GPU error state
66445eb drm/i915: Use bool i915_param.alpha_support
84d6a9c drm/i915: Generate i915_params {} using a macro

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3708/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v3 6/6] drm/i915: The return of i915_gpu_info to debugfs
  2017-02-06  9:51 ` [PATCH v3 6/6] drm/i915: The return of i915_gpu_info to debugfs Chris Wilson
@ 2017-02-07  9:09   ` Chris Wilson
  0 siblings, 0 replies; 23+ messages in thread
From: Chris Wilson @ 2017-02-07  9:09 UTC (permalink / raw)
  To: intel-gfx; +Cc: Mika Kuoppala

On Mon, Feb 06, 2017 at 09:51:46AM +0000, Chris Wilson wrote:
> Once upon a time before we had automated GPU state capture upon hangs,
> we had intel_gpu_dump. Now we come almost full circle and reinstate that
> view of the current GPU queues and registers by using the error capture
> facility to snapshot the GPU state when debugfs/.../i915_gpu_info is
> opened - which should provided useful debugging to both the error
> capture routines (without having to cause a hang and avoid the error
> state being eaten by igt) and generally.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@intel.com>

Mika, any chance you could take a look through this? You prompted me
that having i915_gpu_info was a good idea...
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v3 5/6] drm/i915: Add i915_param charp macro magic
  2017-02-06 12:32   ` Joonas Lahtinen
  2017-02-06 13:06     ` Chris Wilson
@ 2017-02-07  9:12     ` Chris Wilson
  2017-02-21 16:10       ` Jani Nikula
  1 sibling, 1 reply; 23+ messages in thread
From: Chris Wilson @ 2017-02-07  9:12 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: intel-gfx

On Mon, Feb 06, 2017 at 02:32:17PM +0200, Joonas Lahtinen wrote:
> On ma, 2017-02-06 at 09:51 +0000, Chris Wilson wrote:
> > Handling the dynamic charp module parameter requires us to copy it for
> > the error state, or remember to lock it when reading (in case it used
> > with 0600).
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> I'm bit hesitant that we merge known dead code here.
> 
> Maybe the guc firmware path override would be useful to excercise this?

Merged upto this point until we have a use for new parameter types.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH v3 5/6] drm/i915: Add i915_param charp macro magic
  2017-02-07  9:12     ` Chris Wilson
@ 2017-02-21 16:10       ` Jani Nikula
  2017-02-21 16:26         ` [PATCH] " Chris Wilson
  0 siblings, 1 reply; 23+ messages in thread
From: Jani Nikula @ 2017-02-21 16:10 UTC (permalink / raw)
  To: Chris Wilson, Joonas Lahtinen; +Cc: intel-gfx

On Tue, 07 Feb 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On Mon, Feb 06, 2017 at 02:32:17PM +0200, Joonas Lahtinen wrote:
>> On ma, 2017-02-06 at 09:51 +0000, Chris Wilson wrote:
>> > Handling the dynamic charp module parameter requires us to copy it for
>> > the error state, or remember to lock it when reading (in case it used
>> > with 0600).
>> > 
>> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>> 
>> I'm bit hesitant that we merge known dead code here.
>> 
>> Maybe the guc firmware path override would be useful to excercise this?
>
> Merged upto this point until we have a use for new parameter types.

I could use this now, care to send a rebased/refreshed version, please?

BR,
Jani.



-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH] drm/i915: Add i915_param charp macro magic
  2017-02-21 16:10       ` Jani Nikula
@ 2017-02-21 16:26         ` Chris Wilson
  2017-02-22 10:06           ` Jani Nikula
  0 siblings, 1 reply; 23+ messages in thread
From: Chris Wilson @ 2017-02-21 16:26 UTC (permalink / raw)
  To: intel-gfx

Handling the dynamic charp module parameter requires us to copy it for
the error state, or remember to lock it when reading (in case it used
with 0600).

v2: Use __always_inline and __builtin_strcmp

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c   |  2 ++
 drivers/gpu/drm/i915/i915_gpu_error.c | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 768461f7c7c6..655e60d609c2 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -72,6 +72,8 @@ static __always_inline void seq_print_param(struct seq_file *m,
 		seq_printf(m, "i915.%s=%d\n", name, *(const int *)x);
 	else if (!__builtin_strcmp(type, "unsigned int"))
 		seq_printf(m, "i915.%s=%u\n", name, *(const unsigned int *)x);
+	else if (!__builtin_strcmp(type, "char *"))
+		seq_printf(m, "i915.%s=%s\n", name, *(const char **)x);
 	else
 		BUILD_BUG();
 }
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 3a3c7c3c4931..2b1d15668192 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -557,6 +557,8 @@ static __always_inline void err_print_param(struct drm_i915_error_state_buf *m,
 		err_printf(m, "i915.%s=%d\n", name, *(const int *)x);
 	else if (!__builtin_strcmp(type, "unsigned int"))
 		err_printf(m, "i915.%s=%u\n", name, *(const unsigned int *)x);
+	else if (!__builtin_strcmp(type, "char *"))
+		err_printf(m, "i915.%s=%s\n", name, *(const char **)x);
 	else
 		BUILD_BUG();
 }
@@ -810,6 +812,12 @@ static void i915_error_object_free(struct drm_i915_error_object *obj)
 	kfree(obj);
 }
 
+static __always_inline void free_param(const char *type, void *x)
+{
+	if (!__builtin_strcmp(type, "char *"))
+		kfree(*(void **)x);
+}
+
 void __i915_gpu_state_free(struct kref *error_ref)
 {
 	struct i915_gpu_state *error =
@@ -840,6 +848,11 @@ void __i915_gpu_state_free(struct kref *error_ref)
 
 	kfree(error->overlay);
 	kfree(error->display);
+
+#define FREE(T, x) free_param(#T, &error->params.x);
+	I915_PARAMS_FOR_EACH(FREE);
+#undef FREE
+
 	kfree(error);
 }
 
@@ -1614,6 +1627,12 @@ static void i915_capture_gen_state(struct drm_i915_private *dev_priv,
 	       sizeof(error->device_info));
 }
 
+static __always_inline void dup_param(const char *type, void *x)
+{
+	if (!__builtin_strcmp(type, "char *"))
+		*(void **)x = kstrdup(*(void **)x, GFP_ATOMIC);
+}
+
 static int capture(void *data)
 {
 	struct i915_gpu_state *error = data;
@@ -1625,6 +1644,9 @@ static int capture(void *data)
 					   error->i915->gt.last_init_time));
 
 	error->params = i915;
+#define DUP(T, x) dup_param(#T, &error->params.x);
+	I915_PARAMS_FOR_EACH(DUP);
+#undef DUP
 
 	i915_capture_gen_state(error->i915, error);
 	i915_capture_reg_state(error->i915, error);
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/i915: Add i915_param charp macro magic
  2017-02-21 16:26         ` [PATCH] " Chris Wilson
@ 2017-02-22 10:06           ` Jani Nikula
  2017-02-22 10:11             ` Chris Wilson
  0 siblings, 1 reply; 23+ messages in thread
From: Jani Nikula @ 2017-02-22 10:06 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On Tue, 21 Feb 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Handling the dynamic charp module parameter requires us to copy it for
> the error state, or remember to lock it when reading (in case it used
> with 0600).
>
> v2: Use __always_inline and __builtin_strcmp
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c   |  2 ++
>  drivers/gpu/drm/i915/i915_gpu_error.c | 22 ++++++++++++++++++++++
>  2 files changed, 24 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 768461f7c7c6..655e60d609c2 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -72,6 +72,8 @@ static __always_inline void seq_print_param(struct seq_file *m,
>  		seq_printf(m, "i915.%s=%d\n", name, *(const int *)x);
>  	else if (!__builtin_strcmp(type, "unsigned int"))
>  		seq_printf(m, "i915.%s=%u\n", name, *(const unsigned int *)x);
> +	else if (!__builtin_strcmp(type, "char *"))
> +		seq_printf(m, "i915.%s=%s\n", name, *(const char **)x);
>  	else
>  		BUILD_BUG();
>  }
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index 3a3c7c3c4931..2b1d15668192 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -557,6 +557,8 @@ static __always_inline void err_print_param(struct drm_i915_error_state_buf *m,
>  		err_printf(m, "i915.%s=%d\n", name, *(const int *)x);
>  	else if (!__builtin_strcmp(type, "unsigned int"))
>  		err_printf(m, "i915.%s=%u\n", name, *(const unsigned int *)x);
> +	else if (!__builtin_strcmp(type, "char *"))
> +		err_printf(m, "i915.%s=%s\n", name, *(const char **)x);
>  	else
>  		BUILD_BUG();
>  }
> @@ -810,6 +812,12 @@ static void i915_error_object_free(struct drm_i915_error_object *obj)
>  	kfree(obj);
>  }
>  
> +static __always_inline void free_param(const char *type, void *x)
> +{
> +	if (!__builtin_strcmp(type, "char *"))
> +		kfree(*(void **)x);
> +}
> +
>  void __i915_gpu_state_free(struct kref *error_ref)
>  {
>  	struct i915_gpu_state *error =
> @@ -840,6 +848,11 @@ void __i915_gpu_state_free(struct kref *error_ref)
>  
>  	kfree(error->overlay);
>  	kfree(error->display);
> +
> +#define FREE(T, x) free_param(#T, &error->params.x);
> +	I915_PARAMS_FOR_EACH(FREE);
> +#undef FREE
> +
>  	kfree(error);
>  }
>  
> @@ -1614,6 +1627,12 @@ static void i915_capture_gen_state(struct drm_i915_private *dev_priv,
>  	       sizeof(error->device_info));
>  }
>  
> +static __always_inline void dup_param(const char *type, void *x)
> +{
> +	if (!__builtin_strcmp(type, "char *"))
> +		*(void **)x = kstrdup(*(void **)x, GFP_ATOMIC);
> +}
> +
>  static int capture(void *data)
>  {
>  	struct i915_gpu_state *error = data;
> @@ -1625,6 +1644,9 @@ static int capture(void *data)
>  					   error->i915->gt.last_init_time));
>  
>  	error->params = i915;
> +#define DUP(T, x) dup_param(#T, &error->params.x);
> +	I915_PARAMS_FOR_EACH(DUP);
> +#undef DUP
>  
>  	i915_capture_gen_state(error->i915, error);
>  	i915_capture_reg_state(error->i915, error);

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/i915: Add i915_param charp macro magic
  2017-02-22 10:06           ` Jani Nikula
@ 2017-02-22 10:11             ` Chris Wilson
  2017-02-22 10:29               ` Joonas Lahtinen
  2017-02-22 10:30               ` Jani Nikula
  0 siblings, 2 replies; 23+ messages in thread
From: Chris Wilson @ 2017-02-22 10:11 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen; +Cc: intel-gfx

On Wed, Feb 22, 2017 at 12:06:35PM +0200, Jani Nikula wrote:
> On Tue, 21 Feb 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > Handling the dynamic charp module parameter requires us to copy it for
> > the error state, or remember to lock it when reading (in case it used
> > with 0600).
> >
> > v2: Use __always_inline and __builtin_strcmp
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> 
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>

Joonas, do we feel justified in pushing now that Jani has a pending
usecase?
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/i915: Add i915_param charp macro magic
  2017-02-22 10:11             ` Chris Wilson
@ 2017-02-22 10:29               ` Joonas Lahtinen
  2017-02-22 10:33                 ` Chris Wilson
  2017-02-22 10:30               ` Jani Nikula
  1 sibling, 1 reply; 23+ messages in thread
From: Joonas Lahtinen @ 2017-02-22 10:29 UTC (permalink / raw)
  To: Chris Wilson, Jani Nikula; +Cc: intel-gfx

On ke, 2017-02-22 at 10:11 +0000, Chris Wilson wrote:
> On Wed, Feb 22, 2017 at 12:06:35PM +0200, Jani Nikula wrote:
> > 
> > > > On Tue, 21 Feb 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > > 
> > > Handling the dynamic charp module parameter requires us to copy it for
> > > the error state, or remember to lock it when reading (in case it used
> > > with 0600).
> > > 
> > > v2: Use __always_inline and __builtin_strcmp
> > > 
> > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > 
> > Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> 
> Joonas, do we feel justified in pushing now that Jani has a pending
> usecase?
> -Chris

Seems reasonable.

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/i915: Add i915_param charp macro magic
  2017-02-22 10:11             ` Chris Wilson
  2017-02-22 10:29               ` Joonas Lahtinen
@ 2017-02-22 10:30               ` Jani Nikula
  2017-02-22 10:37                 ` Chris Wilson
  1 sibling, 1 reply; 23+ messages in thread
From: Jani Nikula @ 2017-02-22 10:30 UTC (permalink / raw)
  To: Chris Wilson, Joonas Lahtinen; +Cc: intel-gfx

On Wed, 22 Feb 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> On Wed, Feb 22, 2017 at 12:06:35PM +0200, Jani Nikula wrote:
>> On Tue, 21 Feb 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>> > Handling the dynamic charp module parameter requires us to copy it for
>> > the error state, or remember to lock it when reading (in case it used
>> > with 0600).
>> >
>> > v2: Use __always_inline and __builtin_strcmp
>> >
>> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>> > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>> 
>> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>
> Joonas, do we feel justified in pushing now that Jani has a pending
> usecase?

And how about those firmware blob overrides, you had a patch for that
didn't you?

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/i915: Add i915_param charp macro magic
  2017-02-22 10:29               ` Joonas Lahtinen
@ 2017-02-22 10:33                 ` Chris Wilson
  0 siblings, 0 replies; 23+ messages in thread
From: Chris Wilson @ 2017-02-22 10:33 UTC (permalink / raw)
  To: Joonas Lahtinen; +Cc: intel-gfx

On Wed, Feb 22, 2017 at 12:29:11PM +0200, Joonas Lahtinen wrote:
> On ke, 2017-02-22 at 10:11 +0000, Chris Wilson wrote:
> > On Wed, Feb 22, 2017 at 12:06:35PM +0200, Jani Nikula wrote:
> > > 
> > > > > On Tue, 21 Feb 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > > > 
> > > > Handling the dynamic charp module parameter requires us to copy it for
> > > > the error state, or remember to lock it when reading (in case it used
> > > > with 0600).
> > > > 
> > > > v2: Use __always_inline and __builtin_strcmp
> > > > 
> > > > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > > > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > > 
> > > Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> > 
> > Joonas, do we feel justified in pushing now that Jani has a pending
> > usecase?
> > -Chris
> 
> Seems reasonable.

Then pushed. Have fun Jani!
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] drm/i915: Add i915_param charp macro magic
  2017-02-22 10:30               ` Jani Nikula
@ 2017-02-22 10:37                 ` Chris Wilson
  0 siblings, 0 replies; 23+ messages in thread
From: Chris Wilson @ 2017-02-22 10:37 UTC (permalink / raw)
  To: Jani Nikula; +Cc: intel-gfx

On Wed, Feb 22, 2017 at 12:30:38PM +0200, Jani Nikula wrote:
> On Wed, 22 Feb 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > On Wed, Feb 22, 2017 at 12:06:35PM +0200, Jani Nikula wrote:
> >> On Tue, 21 Feb 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> >> > Handling the dynamic charp module parameter requires us to copy it for
> >> > the error state, or remember to lock it when reading (in case it used
> >> > with 0600).
> >> >
> >> > v2: Use __always_inline and __builtin_strcmp
> >> >
> >> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> >> > Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> >> 
> >> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
> >
> > Joonas, do we feel justified in pushing now that Jani has a pending
> > usecase?
> 
> And how about those firmware blob overrides, you had a patch for that
> didn't you?

They need more polish to do what the commit log claims, i.e. make them
useful for bisection and atm everyone is digging through the [gh]uc init
and loaders. It's a bit busy there atm.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2017-02-22 10:37 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-06  9:51 [PATCH v3 1/6] drm/i915: Generate i915_params {} using a macro Chris Wilson
2017-02-06  9:51 ` [PATCH v3 2/6] drm/i915: Use bool i915_param.alpha_support Chris Wilson
2017-02-06  9:51 ` [PATCH v3 3/6] drm/i915: Capture module parameters for the GPU error state Chris Wilson
2017-02-06 11:13   ` Joonas Lahtinen
2017-02-06 11:24   ` Chris Wilson
2017-02-06 11:29     ` Chris Wilson
2017-02-06  9:51 ` [PATCH v3 4/6] drm/i915: Show the current i915_params in debugfs/i915_capabilites Chris Wilson
2017-02-06 11:21   ` Joonas Lahtinen
2017-02-06  9:51 ` [PATCH v3 5/6] drm/i915: Add i915_param charp macro magic Chris Wilson
2017-02-06 12:32   ` Joonas Lahtinen
2017-02-06 13:06     ` Chris Wilson
2017-02-07  9:12     ` Chris Wilson
2017-02-21 16:10       ` Jani Nikula
2017-02-21 16:26         ` [PATCH] " Chris Wilson
2017-02-22 10:06           ` Jani Nikula
2017-02-22 10:11             ` Chris Wilson
2017-02-22 10:29               ` Joonas Lahtinen
2017-02-22 10:33                 ` Chris Wilson
2017-02-22 10:30               ` Jani Nikula
2017-02-22 10:37                 ` Chris Wilson
2017-02-06  9:51 ` [PATCH v3 6/6] drm/i915: The return of i915_gpu_info to debugfs Chris Wilson
2017-02-07  9:09   ` Chris Wilson
2017-02-06 13:25 ` ✗ Fi.CI.BAT: failure for series starting with [v3,1/6] drm/i915: Generate i915_params {} using a macro Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.