public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm: Don't split up debug output
Date: Mon, 18 Nov 2013 11:55:39 +0100	[thread overview]
Message-ID: <20131118105538.GA8646@ulmo.nvidia.com> (raw)
In-Reply-To: <1384723502-13398-1-git-send-email-daniel.vetter@ffwll.ch>


[-- Attachment #1.1: Type: text/plain, Size: 1742 bytes --]

On Sun, Nov 17, 2013 at 10:25:02PM +0100, Daniel Vetter wrote:
> Otherwise we risk that the 2nd part of the line ends up on a line of
> it's own, which means a kernel dmesg line without a log level. This
> then upsets the dmesg checker in piglit.
> 
> Only really happens in some of the truly nasty igt testcases which
> race cache dropping (through debugfs) with other gem operations.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> ---
>  drivers/gpu/drm/drm_stub.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
> index f53d5246979c..74e0357c1c38 100644
> --- a/drivers/gpu/drm/drm_stub.c
> +++ b/drivers/gpu/drm/drm_stub.c
> @@ -99,13 +99,19 @@ void drm_ut_debug_printk(unsigned int request_level,
>  			 const char *function_name,
>  			 const char *format, ...)
>  {
> +	struct va_format vaf;
>  	va_list args;
>  
>  	if (drm_debug & request_level) {
> -		if (function_name)
> -			printk(KERN_DEBUG "[%s:%s], ", prefix, function_name);
>  		va_start(args, format);
> -		vprintk(format, args);
> +		vaf.fmt = format;
> +		vaf.va = &args;
> +
> +		if (function_name)
> +			printk(KERN_DEBUG "[%s:%s], %pV", prefix,
> +			       function_name, &vaf);
> +		else
> +			printk(KERN_DEBUG "%pV", &vaf);
>  		va_end(args);
>  	}
>  }

According to Documentation/printk-formats.txt, usage of %pV is not
recommended unless the format string and va_list can be properly
verified for correctness.

I guess we leave it up to the compiler to do that verification using the
__printf() annotation, so I think it should be fine to use it here:

Reviewed-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #1.2: Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 159 bytes --]

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

      reply	other threads:[~2013-11-18 10:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-17 21:25 [PATCH] drm: Don't split up debug output Daniel Vetter
2013-11-18 10:55 ` Thierry Reding [this message]

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=20131118105538.GA8646@ulmo.nvidia.com \
    --to=thierry.reding@gmail.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox