All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Build request info on stack before printk
Date: Tue, 24 Apr 2018 02:25:26 +0100	[thread overview]
Message-ID: <152453312679.13524.4917966520788516189@mail.alporthouse.com> (raw)
In-Reply-To: <20180424010839.22860-1-chris@chris-wilson.co.uk>

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

  reply	other threads:[~2018-04-24  1:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=152453312679.13524.4917966520788516189@mail.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.