diff mbox series

[08/39] drm/i915/gt: Show engine properties in the pretty printer

Message ID 20200826132811.17577-8-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [01/39] drm/i915/gem: Avoid implicit vmap for highmem on x86-32 | expand

Commit Message

Chris Wilson Aug. 26, 2020, 1:27 p.m. UTC
When debugging the engine state, include the user properties that may,
or may not, have been adjusted by the user/test.

For example,
vecs0
	...
	Properties:
		heartbeat_interval_ms: 2500 [default 2500]
		max_busywait_duration_ns: 8000 [default 8000]
		preempt_timeout_ms: 640 [default 640]
		stop_timeout_ms: 100 [default 100]
		timeslice_duration_ms: 1 [default 1]

Suggested-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/gt/intel_engine_cs.c | 36 +++++++++++++++++++++++
 1 file changed, 36 insertions(+)

Comments

Mika Kuoppala Aug. 27, 2020, 12:25 p.m. UTC | #1
Chris Wilson <chris@chris-wilson.co.uk> writes:

> When debugging the engine state, include the user properties that may,
> or may not, have been adjusted by the user/test.
>
> For example,
> vecs0
> 	...
> 	Properties:
> 		heartbeat_interval_ms: 2500 [default 2500]
> 		max_busywait_duration_ns: 8000 [default 8000]
> 		preempt_timeout_ms: 640 [default 640]
> 		stop_timeout_ms: 100 [default 100]
> 		timeslice_duration_ms: 1 [default 1]
>
> Suggested-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>

Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/gt/intel_engine_cs.c | 36 +++++++++++++++++++++++
>  1 file changed, 36 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> index f231edd3fa3a..1579a80bc8cb 100644
> --- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
> @@ -1599,6 +1599,41 @@ static unsigned long list_count(struct list_head *list)
>  	return count;
>  }
>  
> +static unsigned long read_ul(void *p, size_t x)
> +{
> +	return *(unsigned long *)(p + x);
> +}
> +
> +static void print_properties(struct intel_engine_cs *engine,
> +			     struct drm_printer *m)
> +{
> +	static const struct pmap {
> +		size_t offset;
> +		const char *name;
> +	} props[] = {
> +#define P(x) { \
> +	.offset = offsetof(typeof(engine->props), x), \
> +	.name = #x \
> +}
> +		P(heartbeat_interval_ms),
> +		P(max_busywait_duration_ns),
> +		P(preempt_timeout_ms),
> +		P(stop_timeout_ms),
> +		P(timeslice_duration_ms),
> +
> +		{},
> +#undef P
> +	};
> +	const struct pmap *p;
> +
> +	drm_printf(m, "\tProperties:\n");
> +	for (p = props; p->name; p++)
> +		drm_printf(m, "\t\t%s: %lu [default %lu]\n",
> +			   p->name,
> +			   read_ul(&engine->props, p->offset),
> +			   read_ul(&engine->defaults, p->offset));
> +}
> +
>  void intel_engine_dump(struct intel_engine_cs *engine,
>  		       struct drm_printer *m,
>  		       const char *header, ...)
> @@ -1641,6 +1676,7 @@ void intel_engine_dump(struct intel_engine_cs *engine,
>  	drm_printf(m, "\tReset count: %d (global %d)\n",
>  		   i915_reset_engine_count(error, engine),
>  		   i915_reset_count(error));
> +	print_properties(engine, m);
>  
>  	drm_printf(m, "\tRequests:\n");
>  
> -- 
> 2.20.1
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
index f231edd3fa3a..1579a80bc8cb 100644
--- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
@@ -1599,6 +1599,41 @@  static unsigned long list_count(struct list_head *list)
 	return count;
 }
 
+static unsigned long read_ul(void *p, size_t x)
+{
+	return *(unsigned long *)(p + x);
+}
+
+static void print_properties(struct intel_engine_cs *engine,
+			     struct drm_printer *m)
+{
+	static const struct pmap {
+		size_t offset;
+		const char *name;
+	} props[] = {
+#define P(x) { \
+	.offset = offsetof(typeof(engine->props), x), \
+	.name = #x \
+}
+		P(heartbeat_interval_ms),
+		P(max_busywait_duration_ns),
+		P(preempt_timeout_ms),
+		P(stop_timeout_ms),
+		P(timeslice_duration_ms),
+
+		{},
+#undef P
+	};
+	const struct pmap *p;
+
+	drm_printf(m, "\tProperties:\n");
+	for (p = props; p->name; p++)
+		drm_printf(m, "\t\t%s: %lu [default %lu]\n",
+			   p->name,
+			   read_ul(&engine->props, p->offset),
+			   read_ul(&engine->defaults, p->offset));
+}
+
 void intel_engine_dump(struct intel_engine_cs *engine,
 		       struct drm_printer *m,
 		       const char *header, ...)
@@ -1641,6 +1676,7 @@  void intel_engine_dump(struct intel_engine_cs *engine,
 	drm_printf(m, "\tReset count: %d (global %d)\n",
 		   i915_reset_engine_count(error, engine),
 		   i915_reset_count(error));
+	print_properties(engine, m);
 
 	drm_printf(m, "\tRequests:\n");