dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] treewide: convert vprintk uses to %pV
@ 2010-11-10  0:35 Joe Perches
  2010-11-10  0:35 ` [PATCH 1/9] drivers/gpu/drm/drm_stub.c: Use printf extension %pV Joe Perches
       [not found] ` <cover.1289348757.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Joe Perches @ 2010-11-10  0:35 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	cluster-devel-H+wXaHxf7aLQT0dZR+AlfA,
	linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA

Multiple secessive calls to printk can be interleaved.
Avoid this possible interleaving by using %pV

Joe Perches (9):
  drivers/gpu/drm/drm_stub.c: Use printf extension %pV
  drivers/isdn/mISDN: Use printf extension %pV
  drivers/net/wireless/ath/debug.c: Use printf extension %pV
  drivers/net/wireless/b43/main.c: Use printf extension %pV
  drivers/net/wireless/b43legacy/main.c: Use printf extension %pV
  fs/gfs2/glock.c: Use printf extension %pV
  fs/nilfs2/super.c: Use printf extension %pV
  fs/quota/dquot.c: Use printf extension %pV
  net/sunrpc/svc.c: Use printf extension %pV

 drivers/gpu/drm/drm_stub.c            |   14 +++++++--
 drivers/isdn/mISDN/layer1.c           |   10 +++++--
 drivers/isdn/mISDN/layer2.c           |   12 ++++++--
 drivers/isdn/mISDN/tei.c              |   23 +++++++++++----
 drivers/net/wireless/ath/debug.c      |    9 +++++-
 drivers/net/wireless/b43/main.c       |   48 ++++++++++++++++++++++++--------
 drivers/net/wireless/b43legacy/main.c |   47 ++++++++++++++++++++++++--------
 fs/gfs2/glock.c                       |    9 +++++-
 fs/nilfs2/super.c                     |   23 +++++++++++-----
 fs/quota/dquot.c                      |   12 +++++---
 net/sunrpc/svc.c                      |   12 +++++---
 11 files changed, 161 insertions(+), 58 deletions(-)

-- 
1.7.3.1.g432b3.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/9] drivers/gpu/drm/drm_stub.c: Use printf extension %pV
  2010-11-10  0:35 [PATCH 0/9] treewide: convert vprintk uses to %pV Joe Perches
@ 2010-11-10  0:35 ` Joe Perches
  2010-11-10  2:16   ` Kristian Høgsberg
       [not found] ` <cover.1289348757.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Joe Perches @ 2010-11-10  0:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: dri-devel

Using %pV reduces the number of printk calls and
eliminates any possible message interleaving from
other printk calls.

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/gpu/drm/drm_stub.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index cdc89ee..e632527 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -57,13 +57,21 @@ 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);
 	}
 }
-- 
1.7.3.1.g432b3.dirty

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

* Re: [PATCH 1/9] drivers/gpu/drm/drm_stub.c: Use printf extension %pV
  2010-11-10  0:35 ` [PATCH 1/9] drivers/gpu/drm/drm_stub.c: Use printf extension %pV Joe Perches
@ 2010-11-10  2:16   ` Kristian Høgsberg
  2010-11-10  2:31     ` Joe Perches
  0 siblings, 1 reply; 6+ messages in thread
From: Kristian Høgsberg @ 2010-11-10  2:16 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel, dri-devel

On Tue, Nov 9, 2010 at 7:35 PM, Joe Perches <joe@perches.com> wrote:
> Using %pV reduces the number of printk calls and
> eliminates any possible message interleaving from
> other printk calls.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  drivers/gpu/drm/drm_stub.c |   14 +++++++++++---
>  1 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
> index cdc89ee..e632527 100644
> --- a/drivers/gpu/drm/drm_stub.c
> +++ b/drivers/gpu/drm/drm_stub.c
> @@ -57,13 +57,21 @@ 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);

Wouldn't it be easier and more convenient to just make the %pV format
specifier just expect a format string and the va_arg list?  Like this

  printk(KERN_DEBUG "%pV", format, &args);

I mean, the %pV is kernel specific and we can just change how it works.

Kristian

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

* Re: [PATCH 1/9] drivers/gpu/drm/drm_stub.c: Use printf extension %pV
  2010-11-10  2:16   ` Kristian Høgsberg
@ 2010-11-10  2:31     ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2010-11-10  2:31 UTC (permalink / raw)
  To: Kristian Høgsberg; +Cc: linux-kernel, dri-devel

On Tue, 2010-11-09 at 21:16 -0500, Kristian Høgsberg wrote:
> On Tue, Nov 9, 2010 at 7:35 PM, Joe Perches <joe@perches.com> wrote:
> > Using %pV reduces the number of printk calls and
> > eliminates any possible message interleaving from
> > other printk calls.

> Wouldn't it be easier and more convenient to just make the %pV format
> specifier just expect a format string and the va_arg list?  Like this
>   printk(KERN_DEBUG "%pV", format, &args);
> I mean, the %pV is kernel specific and we can just change how it works.

No it wouldn't.

gcc would now warn about a mismatch between format and arguments.



_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH 0/9] treewide: convert vprintk uses to %pV
       [not found] ` <cover.1289348757.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
@ 2010-11-10 22:48   ` Luis R. Rodriguez
       [not found]     ` <AANLkTinhcbdm8YQOrFVdONODo6K6PcxHYtx5vqnap_3T-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Luis R. Rodriguez @ 2010-11-10 22:48 UTC (permalink / raw)
  To: Joe Perches
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	cluster-devel-H+wXaHxf7aLQT0dZR+AlfA,
	linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA

On Tue, Nov 9, 2010 at 4:35 PM, Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org> wrote:
> Multiple secessive calls to printk can be interleaved.
> Avoid this possible interleaving by using %pV
>
> Joe Perches (9):
>  drivers/gpu/drm/drm_stub.c: Use printf extension %pV
>  drivers/isdn/mISDN: Use printf extension %pV
>  drivers/net/wireless/ath/debug.c: Use printf extension %pV
>  drivers/net/wireless/b43/main.c: Use printf extension %pV
>  drivers/net/wireless/b43legacy/main.c: Use printf extension %pV
>  fs/gfs2/glock.c: Use printf extension %pV
>  fs/nilfs2/super.c: Use printf extension %pV
>  fs/quota/dquot.c: Use printf extension %pV
>  net/sunrpc/svc.c: Use printf extension %pV
>
>  drivers/gpu/drm/drm_stub.c            |   14 +++++++--
>  drivers/isdn/mISDN/layer1.c           |   10 +++++--
>  drivers/isdn/mISDN/layer2.c           |   12 ++++++--
>  drivers/isdn/mISDN/tei.c              |   23 +++++++++++----
>  drivers/net/wireless/ath/debug.c      |    9 +++++-
>  drivers/net/wireless/b43/main.c       |   48 ++++++++++++++++++++++++--------
>  drivers/net/wireless/b43legacy/main.c |   47 ++++++++++++++++++++++++--------
>  fs/gfs2/glock.c                       |    9 +++++-
>  fs/nilfs2/super.c                     |   23 +++++++++++-----
>  fs/quota/dquot.c                      |   12 +++++---
>  net/sunrpc/svc.c                      |   12 +++++---
>  11 files changed, 161 insertions(+), 58 deletions(-)

When was this added upstream BTW? I ask for backport considerations.

  Luis
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 0/9] treewide: convert vprintk uses to %pV
       [not found]     ` <AANLkTinhcbdm8YQOrFVdONODo6K6PcxHYtx5vqnap_3T-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-11-10 23:01       ` Joe Perches
  0 siblings, 0 replies; 6+ messages in thread
From: Joe Perches @ 2010-11-10 23:01 UTC (permalink / raw)
  To: Luis R. Rodriguez
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	cluster-devel-H+wXaHxf7aLQT0dZR+AlfA,
	linux-nilfs-u79uwXL29TY76Z2rM5mHXA,
	linux-nfs-u79uwXL29TY76Z2rM5mHXA

On Wed, 2010-11-10 at 14:48 -0800, Luis R. Rodriguez wrote:
> When was this added upstream BTW? I ask for backport considerations.

commit 7db6f5fb65a82af03229eef104dc9899c5eecf33
Author: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
Date:   Sun Jun 27 01:02:33 2010 +0000

    vsprintf: Recursive vsnprintf: Add "%pV", struct va_format
    
    Add the ability to print a format and va_list from a structure pointer
    
    Allows __dev_printk to be implemented as a single printk while
    minimizing string space duplication.
    
    %pV should not be used without some mechanism to verify the
    format and argument use ala __attribute__(format (printf(...))).
    
    Signed-off-by: Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
    Acked-by: Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>
    Signed-off-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>


--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2010-11-10 23:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-10  0:35 [PATCH 0/9] treewide: convert vprintk uses to %pV Joe Perches
2010-11-10  0:35 ` [PATCH 1/9] drivers/gpu/drm/drm_stub.c: Use printf extension %pV Joe Perches
2010-11-10  2:16   ` Kristian Høgsberg
2010-11-10  2:31     ` Joe Perches
     [not found] ` <cover.1289348757.git.joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2010-11-10 22:48   ` [PATCH 0/9] treewide: convert vprintk uses to %pV Luis R. Rodriguez
     [not found]     ` <AANLkTinhcbdm8YQOrFVdONODo6K6PcxHYtx5vqnap_3T-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-11-10 23:01       ` Joe Perches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).