All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Build request info on stack before printk
@ 2018-04-24  1:01 Chris Wilson
  2018-04-24  1:08 ` Chris Wilson
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Chris Wilson @ 2018-04-24  1:01 UTC (permalink / raw)
  To: intel-gfx

printk unhelpfully inserts a '\n' between consecutive calls, and since
our drm_printf wrapper may be emitting info a seq_file instead,
KERN_CONT is not an option. To work with any drm_printf destination, we
need to build up the output into a temporary buf on the stack and then
feed the complete line in a single call to printk.

Fixes: b7268c5eed0a ("drm/i915: Pack params to engine->schedule() into a struct")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_engine_cs.c | 23 ++++++++++++++---------
 1 file changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
index be608f7111f5..6a5e0a05b1ee 100644
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -1113,14 +1113,16 @@ unsigned int intel_engines_has_context_isolation(struct drm_i915_private *i915)
 	return which;
 }
 
-static void print_sched_attr(struct drm_printer *m,
-			     const struct drm_i915_private *i915,
-			     const struct i915_sched_attr *attr)
+static int print_sched_attr(const struct i915_sched_attr *attr,
+			    char *buf, int offset, int len)
 {
 	if (attr->priority == I915_PRIORITY_INVALID)
-		return;
+		return offset;
+
+	offset += snprintf(buf + offset, len - offset,
+			   " prio=%d", attr->priority);
 
-	drm_printf(m, "prio=%d", attr->priority);
+	return offset;
 }
 
 static void print_request(struct drm_printer *m,
@@ -1128,14 +1130,17 @@ static void print_request(struct drm_printer *m,
 			  const char *prefix)
 {
 	const char *name = rq->fence.ops->get_timeline_name(&rq->fence);
+	char buf[80];
+	int x = 0;
+
+	x = print_sched_attr(&rq->sched.attr, buf, x, sizeof(buf));
 
-	drm_printf(m, "%s%x%s [%llx:%x] ",
+	drm_printf(m, "%s%x%s [%llx:%x]%s @ %dms: %s\n",
 		   prefix,
 		   rq->global_seqno,
 		   i915_request_completed(rq) ? "!" : "",
-		   rq->fence.context, rq->fence.seqno);
-	print_sched_attr(m, rq->i915, &rq->sched.attr);
-	drm_printf(m, " @ %dms: %s\n",
+		   rq->fence.context, rq->fence.seqno,
+		   buf,
 		   jiffies_to_msecs(jiffies - rq->emitted_jiffies),
 		   name);
 }
-- 
2.17.0

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

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

* [PATCH] drm/i915: Build request info on stack before printk
  2018-04-24  1:01 [PATCH] drm/i915: Build request info on stack before printk Chris Wilson
@ 2018-04-24  1:08 ` Chris Wilson
  2018-04-24  1:25   ` Chris Wilson
                     ` (2 more replies)
  2018-04-24  1:44 ` ✓ Fi.CI.BAT: success for drm/i915: Build request info on stack before printk (rev2) Patchwork
  2018-04-24  2:32 ` ✓ Fi.CI.IGT: " Patchwork
  2 siblings, 3 replies; 8+ messages in thread
From: Chris Wilson @ 2018-04-24  1:08 UTC (permalink / raw)
  To: intel-gfx

printk unhelpfully inserts a '\n' between consecutive calls, and since
our drm_printf wrapper may be emitting info a seq_file instead,
KERN_CONT is not an option. To work with any drm_printf destination, we
need to build up the output into a temporary buf on the stack and then
feed the complete line in a single call to printk.

Fixes: b7268c5eed0a ("drm/i915: Pack params to engine->schedule() into a struct")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_engine_cs.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
index be608f7111f5..66cddd059666 100644
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -1113,14 +1113,17 @@ unsigned int intel_engines_has_context_isolation(struct drm_i915_private *i915)
 	return which;
 }
 
-static void print_sched_attr(struct drm_printer *m,
-			     const struct drm_i915_private *i915,
-			     const struct i915_sched_attr *attr)
+static int print_sched_attr(struct drm_i915_private *i915,
+			    const struct i915_sched_attr *attr,
+			    char *buf, int x, int len)
 {
 	if (attr->priority == I915_PRIORITY_INVALID)
-		return;
+		return x;
+
+	x += snprintf(buf + x, len - x,
+		      " prio=%d", attr->priority);
 
-	drm_printf(m, "prio=%d", attr->priority);
+	return x;
 }
 
 static void print_request(struct drm_printer *m,
@@ -1128,14 +1131,17 @@ static void print_request(struct drm_printer *m,
 			  const char *prefix)
 {
 	const char *name = rq->fence.ops->get_timeline_name(&rq->fence);
+	char buf[80];
+	int x = 0;
+
+	x = print_sched_attr(rq->i915, &rq->sched.attr, buf, x, sizeof(buf));
 
-	drm_printf(m, "%s%x%s [%llx:%x] ",
+	drm_printf(m, "%s%x%s [%llx:%x]%s @ %dms: %s\n",
 		   prefix,
 		   rq->global_seqno,
 		   i915_request_completed(rq) ? "!" : "",
-		   rq->fence.context, rq->fence.seqno);
-	print_sched_attr(m, rq->i915, &rq->sched.attr);
-	drm_printf(m, " @ %dms: %s\n",
+		   rq->fence.context, rq->fence.seqno,
+		   buf,
 		   jiffies_to_msecs(jiffies - rq->emitted_jiffies),
 		   name);
 }
-- 
2.17.0

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

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

* Re: [PATCH] drm/i915: Build request info on stack before printk
  2018-04-24  1:08 ` Chris Wilson
@ 2018-04-24  1:25   ` Chris Wilson
  2018-04-24 11:57   ` Tvrtko Ursulin
  2018-04-24 12:24   ` Chris Wilson
  2 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2018-04-24  1:25 UTC (permalink / raw)
  To: intel-gfx

Quoting Chris Wilson (2018-04-24 02:08:39)
> printk unhelpfully inserts a '\n' between consecutive calls, and since
> our drm_printf wrapper may be emitting info a seq_file instead,
> KERN_CONT is not an option. To work with any drm_printf destination, we
> need to build up the output into a temporary buf on the stack and then
> feed the complete line in a single call to printk.
> 
> Fixes: b7268c5eed0a ("drm/i915: Pack params to engine->schedule() into a struct")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---

I put back the i915 parameter as it makes later patches easier. The
conflict in rebasing was a reminder why it was there in the first place.
-Chris

>  drivers/gpu/drm/i915/intel_engine_cs.c | 24 +++++++++++++++---------
>  1 file changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index be608f7111f5..66cddd059666 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -1113,14 +1113,17 @@ unsigned int intel_engines_has_context_isolation(struct drm_i915_private *i915)
>         return which;
>  }
>  
> -static void print_sched_attr(struct drm_printer *m,
> -                            const struct drm_i915_private *i915,
> -                            const struct i915_sched_attr *attr)
> +static int print_sched_attr(struct drm_i915_private *i915,
> +                           const struct i915_sched_attr *attr,
> +                           char *buf, int x, int len)
>  {
>         if (attr->priority == I915_PRIORITY_INVALID)
> -               return;
> +               return x;
> +
> +       x += snprintf(buf + x, len - x,
> +                     " prio=%d", attr->priority);
>  
> -       drm_printf(m, "prio=%d", attr->priority);
> +       return x;
>  }
>  
>  static void print_request(struct drm_printer *m,
> @@ -1128,14 +1131,17 @@ static void print_request(struct drm_printer *m,
>                           const char *prefix)
>  {
>         const char *name = rq->fence.ops->get_timeline_name(&rq->fence);
> +       char buf[80];
> +       int x = 0;
> +
> +       x = print_sched_attr(rq->i915, &rq->sched.attr, buf, x, sizeof(buf));
>  
> -       drm_printf(m, "%s%x%s [%llx:%x] ",
> +       drm_printf(m, "%s%x%s [%llx:%x]%s @ %dms: %s\n",
>                    prefix,
>                    rq->global_seqno,
>                    i915_request_completed(rq) ? "!" : "",
> -                  rq->fence.context, rq->fence.seqno);
> -       print_sched_attr(m, rq->i915, &rq->sched.attr);
> -       drm_printf(m, " @ %dms: %s\n",
> +                  rq->fence.context, rq->fence.seqno,
> +                  buf,
>                    jiffies_to_msecs(jiffies - rq->emitted_jiffies),
>                    name);
>  }
> -- 
> 2.17.0
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.BAT: success for drm/i915: Build request info on stack before printk (rev2)
  2018-04-24  1:01 [PATCH] drm/i915: Build request info on stack before printk Chris Wilson
  2018-04-24  1:08 ` Chris Wilson
@ 2018-04-24  1:44 ` Patchwork
  2018-04-24  2:32 ` ✓ Fi.CI.IGT: " Patchwork
  2 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-04-24  1:44 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Build request info on stack before printk (rev2)
URL   : https://patchwork.freedesktop.org/series/42150/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4082 -> Patchwork_8781 =

== Summary - SUCCESS ==

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/42150/revisions/2/mbox/

== Known issues ==

  Here are the changes found in Patchwork_8781 that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@gem_mmap_gtt@basic-small-bo-tiledx:
      fi-gdg-551:         PASS -> FAIL (fdo#102575)

    
    ==== Possible fixes ====

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      fi-snb-2520m:       INCOMPLETE (fdo#103713) -> PASS

    igt@prime_vgem@basic-fence-flip:
      fi-ilk-650:         FAIL (fdo#104008) -> PASS

    
  fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
  fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713
  fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008


== Participating hosts (36 -> 33) ==

  Missing    (3): fi-ctg-p8600 fi-ilk-m540 fi-skl-6700hq 


== Build changes ==

    * Linux: CI_DRM_4082 -> Patchwork_8781

  CI_DRM_4082: 0600266ef9b8407e0dc281acb6b754eba8178c91 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4444: dcc44347494231feabc588c2a76998cbc9afdf8c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_8781: 82f3d491ddbe50ab7d41593587b28fbffb0c1c3b @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4444: a2f486679f467cd6e82578384f56d4aabaa8cf2e @ git://anongit.freedesktop.org/piglit


== Linux commits ==

82f3d491ddbe drm/i915: Build request info on stack before printk

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8781/issues.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.IGT: success for drm/i915: Build request info on stack before printk (rev2)
  2018-04-24  1:01 [PATCH] drm/i915: Build request info on stack before printk Chris Wilson
  2018-04-24  1:08 ` Chris Wilson
  2018-04-24  1:44 ` ✓ Fi.CI.BAT: success for drm/i915: Build request info on stack before printk (rev2) Patchwork
@ 2018-04-24  2:32 ` Patchwork
  2 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-04-24  2:32 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Build request info on stack before printk (rev2)
URL   : https://patchwork.freedesktop.org/series/42150/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4082_full -> Patchwork_8781_full =

== Summary - WARNING ==

  Minor unknown changes coming with Patchwork_8781_full need to be verified
  manually.
  
  If you think the reported changes have nothing to do with the changes
  introduced in Patchwork_8781_full, please notify your bug team to allow them
  to document this new failure mode, which will reduce false positives in CI.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/42150/revisions/2/mbox/

== Possible new issues ==

  Here are the unknown changes that may have been introduced in Patchwork_8781_full:

  === IGT changes ===

    ==== Warnings ====

    igt@gem_mocs_settings@mocs-rc6-vebox:
      shard-kbl:          SKIP -> PASS +4

    igt@kms_flip@flip-vs-wf_vblank-interruptible:
      shard-kbl:          PASS -> SKIP +20

    igt@kms_flip@plain-flip-fb-recreate-interruptible:
      shard-glk:          PASS -> SKIP +42

    igt@kms_frontbuffer_tracking@fbc-1p-shrfb-fliptrack:
      shard-glk:          SKIP -> PASS +45

    
== Known issues ==

  Here are the changes found in Patchwork_8781_full that come from known issues:

  === IGT changes ===

    ==== Issues hit ====

    igt@kms_flip@2x-plain-flip-fb-recreate-interruptible:
      shard-hsw:          PASS -> FAIL (fdo#100368)

    igt@kms_flip@absolute-wf_vblank-interruptible:
      shard-glk:          PASS -> FAIL (fdo#106087)

    igt@kms_flip@dpms-vs-vblank-race:
      shard-hsw:          PASS -> FAIL (fdo#103060)

    igt@kms_flip@wf_vblank-ts-check-interruptible:
      shard-glk:          PASS -> FAIL (fdo#100368)

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-mmap-cpu:
      shard-kbl:          PASS -> DMESG-WARN (fdo#105602, fdo#103558)

    igt@kms_hdmi_inject@inject-audio:
      shard-glk:          PASS -> FAIL (fdo#102370)

    igt@kms_mmio_vs_cs_flip@setcrtc_vs_cs_flip:
      shard-kbl:          PASS -> DMESG-WARN (fdo#105602, fdo#103313, fdo#103558)

    igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
      shard-kbl:          PASS -> DMESG-WARN (fdo#103558)

    igt@kms_sysfs_edid_timing:
      shard-apl:          PASS -> WARN (fdo#100047)

    igt@pm_rpm@pm-caching:
      shard-kbl:          PASS -> DMESG-WARN (fdo#103313, fdo#103558)

    
    ==== Possible fixes ====

    igt@gem_exec_parallel@default-contexts:
      shard-snb:          INCOMPLETE (fdo#105411) -> PASS

    igt@kms_atomic_transition@1x-modeset-transitions:
      shard-apl:          FAIL (fdo#103207) -> PASS

    igt@kms_flip@dpms-vs-vblank-race:
      shard-glk:          FAIL (fdo#103060) -> PASS

    igt@kms_flip@modeset-vs-vblank-race-interruptible:
      shard-hsw:          FAIL (fdo#103060) -> PASS +1

    
  fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
  fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
  fdo#102370 https://bugs.freedesktop.org/show_bug.cgi?id=102370
  fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
  fdo#103207 https://bugs.freedesktop.org/show_bug.cgi?id=103207
  fdo#103313 https://bugs.freedesktop.org/show_bug.cgi?id=103313
  fdo#103558 https://bugs.freedesktop.org/show_bug.cgi?id=103558
  fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
  fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
  fdo#106087 https://bugs.freedesktop.org/show_bug.cgi?id=106087


== Participating hosts (6 -> 5) ==

  Missing    (1): shard-glkb 


== Build changes ==

    * Linux: CI_DRM_4082 -> Patchwork_8781

  CI_DRM_4082: 0600266ef9b8407e0dc281acb6b754eba8178c91 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4444: dcc44347494231feabc588c2a76998cbc9afdf8c @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_8781: 82f3d491ddbe50ab7d41593587b28fbffb0c1c3b @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4444: a2f486679f467cd6e82578384f56d4aabaa8cf2e @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8781/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/i915: Build request info on stack before printk
  2018-04-24  1:08 ` Chris Wilson
  2018-04-24  1:25   ` Chris Wilson
@ 2018-04-24 11:57   ` Tvrtko Ursulin
  2018-04-24 12:04     ` Chris Wilson
  2018-04-24 12:24   ` Chris Wilson
  2 siblings, 1 reply; 8+ messages in thread
From: Tvrtko Ursulin @ 2018-04-24 11:57 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx


On 24/04/2018 02:08, Chris Wilson wrote:
> printk unhelpfully inserts a '\n' between consecutive calls, and since
> our drm_printf wrapper may be emitting info a seq_file instead,
> KERN_CONT is not an option. To work with any drm_printf destination, we
> need to build up the output into a temporary buf on the stack and then
> feed the complete line in a single call to printk.
> 
> Fixes: b7268c5eed0a ("drm/i915: Pack params to engine->schedule() into a struct")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/intel_engine_cs.c | 24 +++++++++++++++---------
>   1 file changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index be608f7111f5..66cddd059666 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -1113,14 +1113,17 @@ unsigned int intel_engines_has_context_isolation(struct drm_i915_private *i915)
>   	return which;
>   }
>   
> -static void print_sched_attr(struct drm_printer *m,
> -			     const struct drm_i915_private *i915,
> -			     const struct i915_sched_attr *attr)
> +static int print_sched_attr(struct drm_i915_private *i915,
> +			    const struct i915_sched_attr *attr,
> +			    char *buf, int x, int len)
>   {
>   	if (attr->priority == I915_PRIORITY_INVALID)
> -		return;
> +		return x;
> +
> +	x += snprintf(buf + x, len - x,
> +		      " prio=%d", attr->priority);
>   
> -	drm_printf(m, "prio=%d", attr->priority);
> +	return x;
>   }
>   
>   static void print_request(struct drm_printer *m,
> @@ -1128,14 +1131,17 @@ static void print_request(struct drm_printer *m,
>   			  const char *prefix)
>   {
>   	const char *name = rq->fence.ops->get_timeline_name(&rq->fence);
> +	char buf[80];

Worth using less stack space? 6 chars plus max negative int (12) - 18 
should be enough?

> +	int x = 0;
> +
> +	x = print_sched_attr(rq->i915, &rq->sched.attr, buf, x, sizeof(buf));

x is effectively unused. Drop it and simplify the helper and all?

>   
> -	drm_printf(m, "%s%x%s [%llx:%x] ",
> +	drm_printf(m, "%s%x%s [%llx:%x]%s @ %dms: %s\n",
>   		   prefix,
>   		   rq->global_seqno,
>   		   i915_request_completed(rq) ? "!" : "",
> -		   rq->fence.context, rq->fence.seqno);
> -	print_sched_attr(m, rq->i915, &rq->sched.attr);
> -	drm_printf(m, " @ %dms: %s\n",
> +		   rq->fence.context, rq->fence.seqno,
> +		   buf,
>   		   jiffies_to_msecs(jiffies - rq->emitted_jiffies),
>   		   name);
>   }
> 

Regards,

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

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

* Re: [PATCH] drm/i915: Build request info on stack before printk
  2018-04-24 11:57   ` Tvrtko Ursulin
@ 2018-04-24 12:04     ` Chris Wilson
  0 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2018-04-24 12:04 UTC (permalink / raw)
  To: Tvrtko Ursulin, intel-gfx

Quoting Tvrtko Ursulin (2018-04-24 12:57:41)
> 
> On 24/04/2018 02:08, Chris Wilson wrote:
> > printk unhelpfully inserts a '\n' between consecutive calls, and since
> > our drm_printf wrapper may be emitting info a seq_file instead,
> > KERN_CONT is not an option. To work with any drm_printf destination, we
> > need to build up the output into a temporary buf on the stack and then
> > feed the complete line in a single call to printk.
> > 
> > Fixes: b7268c5eed0a ("drm/i915: Pack params to engine->schedule() into a struct")
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > ---
> >   drivers/gpu/drm/i915/intel_engine_cs.c | 24 +++++++++++++++---------
> >   1 file changed, 15 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> > index be608f7111f5..66cddd059666 100644
> > --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> > +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> > @@ -1113,14 +1113,17 @@ unsigned int intel_engines_has_context_isolation(struct drm_i915_private *i915)
> >       return which;
> >   }
> >   
> > -static void print_sched_attr(struct drm_printer *m,
> > -                          const struct drm_i915_private *i915,
> > -                          const struct i915_sched_attr *attr)
> > +static int print_sched_attr(struct drm_i915_private *i915,
> > +                         const struct i915_sched_attr *attr,
> > +                         char *buf, int x, int len)
> >   {
> >       if (attr->priority == I915_PRIORITY_INVALID)
> > -             return;
> > +             return x;
> > +
> > +     x += snprintf(buf + x, len - x,
> > +                   " prio=%d", attr->priority);
> >   
> > -     drm_printf(m, "prio=%d", attr->priority);
> > +     return x;
> >   }
> >   
> >   static void print_request(struct drm_printer *m,
> > @@ -1128,14 +1131,17 @@ static void print_request(struct drm_printer *m,
> >                         const char *prefix)
> >   {
> >       const char *name = rq->fence.ops->get_timeline_name(&rq->fence);
> > +     char buf[80];
> 
> Worth using less stack space? 6 chars plus max negative int (12) - 18 
> should be enough?
> 
> > +     int x = 0;
> > +
> > +     x = print_sched_attr(rq->i915, &rq->sched.attr, buf, x, sizeof(buf));
> 
> x is effectively unused. Drop it and simplify the helper and all?

It felt like a common enough idiom to allow for future expansion. It's
going to be required at some point in the near future, I'm sure.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH] drm/i915: Build request info on stack before printk
  2018-04-24  1:08 ` Chris Wilson
  2018-04-24  1:25   ` Chris Wilson
  2018-04-24 11:57   ` Tvrtko Ursulin
@ 2018-04-24 12:24   ` Chris Wilson
  2 siblings, 0 replies; 8+ messages in thread
From: Chris Wilson @ 2018-04-24 12:24 UTC (permalink / raw)
  To: intel-gfx

Quoting Chris Wilson (2018-04-24 02:08:39)
> printk unhelpfully inserts a '\n' between consecutive calls, and since
> our drm_printf wrapper may be emitting info a seq_file instead,
> KERN_CONT is not an option. To work with any drm_printf destination, we
> need to build up the output into a temporary buf on the stack and then
> feed the complete line in a single call to printk.
> 
> Fixes: b7268c5eed0a ("drm/i915: Pack params to engine->schedule() into a struct")
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

From IRC,
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2018-04-24 12:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-24  1:01 [PATCH] drm/i915: Build request info on stack before printk Chris Wilson
2018-04-24  1:08 ` Chris Wilson
2018-04-24  1:25   ` Chris Wilson
2018-04-24 11:57   ` Tvrtko Ursulin
2018-04-24 12:04     ` Chris Wilson
2018-04-24 12:24   ` Chris Wilson
2018-04-24  1:44 ` ✓ Fi.CI.BAT: success for drm/i915: Build request info on stack before printk (rev2) Patchwork
2018-04-24  2:32 ` ✓ Fi.CI.IGT: " 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.