* [PATCH 00/11] various fixes v2
@ 2011-07-14 16:09 Jason Baron
2011-07-14 16:09 ` [PATCH 01/11] dynamic_debug: Add __dynamic_dev_dbg Jason Baron
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jason Baron @ 2011-07-14 16:09 UTC (permalink / raw)
To: gregkh
Cc: joe, jim.cromie, bvanassche, linux-kernel, davem,
aloisio.almeida, netdev
Hi,
A bunch of dynamic debug fixes and cleanups. Since the last post I've
incorporated review feedback, and added an additional patch, so that
we no longer need to use KERN_CONT.
Thanks,
-Jason
Joe Perches (4):
dynamic_debug: Add __dynamic_dev_dbg
dynamic_debug: Consolidate prefix output to single routine
dynamic_debug: Remove uses of KERN_CONT in dynamic_emit_prefix
dynamic_debug: Convert printks to pr_<level>
Jason Baron (7):
dynamic_debug: remove unused control variables
dynamic_debug: add Jason Baron as maintainer
dynamic_debug: make netdev_dbg() call __netdev_printk()
dynamic_debug: make netif_dbg() call __netdev_printk()
dynamic_debug: consolidate repetitive struct _ddebug descriptor definitions
dynamic_debug: remove num_enabled accounting
dynamic_debug: use a single printk() to emit msgs
MAINTAINERS | 6 ++
drivers/base/core.c | 5 +-
include/linux/device.h | 5 +
include/linux/dynamic_debug.h | 51 +++++++-----
include/linux/netdevice.h | 10 +-
lib/dynamic_debug.c | 173 ++++++++++++++++++++++++++++-------------
net/core/dev.c | 3 +-
7 files changed, 171 insertions(+), 82 deletions(-)
--
1.7.5.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 01/11] dynamic_debug: Add __dynamic_dev_dbg
2011-07-14 16:09 [PATCH 00/11] various fixes v2 Jason Baron
@ 2011-07-14 16:09 ` Jason Baron
2011-07-14 16:09 ` [PATCH 07/11] dynamic_debug: make netdev_dbg() call __netdev_printk() Jason Baron
2011-07-14 16:09 ` [PATCH 08/11] dynamic_debug: make netif_dbg() " Jason Baron
2 siblings, 0 replies; 4+ messages in thread
From: Jason Baron @ 2011-07-14 16:09 UTC (permalink / raw)
To: gregkh
Cc: joe, jim.cromie, bvanassche, linux-kernel, davem,
aloisio.almeida, netdev
From: Joe Perches <joe@perches.com>
Unlike dynamic_pr_debug, dynamic uses of dev_dbg can not
currently add task_pid/KBUILD_MODNAME/__func__/__LINE__
to selected debug output.
Add a new function similar to dynamic_pr_debug to
optionally emit these prefixes.
Cc: Aloisio Almeida <aloisio.almeida@openbossa.org>
Noticed-by: Aloisio Almeida <aloisio.almeida@openbossa.org>
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Jason Baron <jbaron@redhat.com>
---
drivers/base/core.c | 5 +++--
include/linux/device.h | 5 +++++
include/linux/dynamic_debug.h | 10 ++++++++--
lib/dynamic_debug.c | 38 ++++++++++++++++++++++++++++++++++++++
4 files changed, 54 insertions(+), 4 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index bc8729d..82c8654 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1764,8 +1764,8 @@ void device_shutdown(void)
#ifdef CONFIG_PRINTK
-static int __dev_printk(const char *level, const struct device *dev,
- struct va_format *vaf)
+int __dev_printk(const char *level, const struct device *dev,
+ struct va_format *vaf)
{
if (!dev)
return printk("%s(NULL device *): %pV", level, vaf);
@@ -1773,6 +1773,7 @@ static int __dev_printk(const char *level, const struct device *dev,
return printk("%s%s %s: %pV",
level, dev_driver_string(dev), dev_name(dev), vaf);
}
+EXPORT_SYMBOL(__dev_printk);
int dev_printk(const char *level, const struct device *dev,
const char *fmt, ...)
diff --git a/include/linux/device.h b/include/linux/device.h
index e4f62d8..53711f2 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -785,6 +785,8 @@ extern const char *dev_driver_string(const struct device *dev);
#ifdef CONFIG_PRINTK
+extern int __dev_printk(const char *level, const struct device *dev,
+ struct va_format *vaf);
extern int dev_printk(const char *level, const struct device *dev,
const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)));
@@ -805,6 +807,9 @@ extern int _dev_info(const struct device *dev, const char *fmt, ...)
#else
+static inline int __dev_printk(const char *level, const struct device *dev,
+ struct va_format *vaf)
+ { return 0; }
static inline int dev_printk(const char *level, const struct device *dev,
const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)));
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index e747ecd..bdf1531 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -47,6 +47,13 @@ extern int ddebug_remove_module(const char *mod_name);
extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
+struct device;
+
+extern int __dynamic_dev_dbg(struct _ddebug *descriptor,
+ const struct device *dev,
+ const char *fmt, ...)
+ __attribute__ ((format (printf, 3, 4)));
+
#define dynamic_pr_debug(fmt, ...) do { \
static struct _ddebug descriptor \
__used \
@@ -57,7 +64,6 @@ extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
__dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \
} while (0)
-
#define dynamic_dev_dbg(dev, fmt, ...) do { \
static struct _ddebug descriptor \
__used \
@@ -65,7 +71,7 @@ extern int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
{ KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
_DPRINTK_FLAGS_DEFAULT }; \
if (unlikely(descriptor.enabled)) \
- dev_printk(KERN_DEBUG, dev, fmt, ##__VA_ARGS__); \
+ __dynamic_dev_dbg(&descriptor, dev, fmt, ##__VA_ARGS__); \
} while (0)
#else
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 75ca78f..63b6f95 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -30,6 +30,7 @@
#include <linux/jump_label.h>
#include <linux/hardirq.h>
#include <linux/sched.h>
+#include <linux/device.h>
extern struct _ddebug __start___verbose[];
extern struct _ddebug __stop___verbose[];
@@ -456,6 +457,43 @@ int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...)
}
EXPORT_SYMBOL(__dynamic_pr_debug);
+int __dynamic_dev_dbg(struct _ddebug *descriptor,
+ const struct device *dev, const char *fmt, ...)
+{
+ struct va_format vaf;
+ va_list args;
+ int res;
+
+ BUG_ON(!descriptor);
+ BUG_ON(!fmt);
+
+ va_start(args, fmt);
+
+ vaf.fmt = fmt;
+ vaf.va = &args;
+
+ res = printk(KERN_DEBUG);
+ if (descriptor->flags & _DPRINTK_FLAGS_INCL_TID) {
+ if (in_interrupt())
+ res += printk(KERN_CONT "<intr> ");
+ else
+ res += printk(KERN_CONT "[%d] ", task_pid_vnr(current));
+ }
+ if (descriptor->flags & _DPRINTK_FLAGS_INCL_MODNAME)
+ res += printk(KERN_CONT "%s:", descriptor->modname);
+ if (descriptor->flags & _DPRINTK_FLAGS_INCL_FUNCNAME)
+ res += printk(KERN_CONT "%s:", descriptor->function);
+ if (descriptor->flags & _DPRINTK_FLAGS_INCL_LINENO)
+ res += printk(KERN_CONT "%d ", descriptor->lineno);
+
+ res += __dev_printk(KERN_CONT, dev, &vaf);
+
+ va_end(args);
+
+ return res;
+}
+EXPORT_SYMBOL(__dynamic_dev_dbg);
+
static __initdata char ddebug_setup_string[1024];
static __init int ddebug_setup_query(char *str)
{
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 07/11] dynamic_debug: make netdev_dbg() call __netdev_printk()
2011-07-14 16:09 [PATCH 00/11] various fixes v2 Jason Baron
2011-07-14 16:09 ` [PATCH 01/11] dynamic_debug: Add __dynamic_dev_dbg Jason Baron
@ 2011-07-14 16:09 ` Jason Baron
2011-07-14 16:09 ` [PATCH 08/11] dynamic_debug: make netif_dbg() " Jason Baron
2 siblings, 0 replies; 4+ messages in thread
From: Jason Baron @ 2011-07-14 16:09 UTC (permalink / raw)
To: gregkh
Cc: joe, jim.cromie, bvanassche, linux-kernel, davem,
aloisio.almeida, netdev
From: Jason Baron <jbaron@redhat.com>
Previously, if dynamic debug was enabled netdev_dbg() was using
dynamic_dev_dbg() to print out the underlying msg. Fix this by making
sure netdev_dbg() uses __netdev_printk().
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Jason Baron <jbaron@redhat.com>
---
include/linux/dynamic_debug.h | 17 +++++++++++++++++
include/linux/netdevice.h | 6 ++++--
lib/dynamic_debug.c | 25 +++++++++++++++++++++++++
net/core/dev.c | 3 ++-
4 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h
index 843cb9e..feaac1e 100644
--- a/include/linux/dynamic_debug.h
+++ b/include/linux/dynamic_debug.h
@@ -47,6 +47,13 @@ extern int __dynamic_dev_dbg(struct _ddebug *descriptor,
const char *fmt, ...)
__attribute__ ((format (printf, 3, 4)));
+struct net_device;
+
+extern int __dynamic_netdev_dbg(struct _ddebug *descriptor,
+ const struct net_device *dev,
+ const char *fmt, ...)
+ __attribute__ ((format (printf, 3, 4)));
+
#define dynamic_pr_debug(fmt, ...) do { \
static struct _ddebug descriptor \
__used \
@@ -67,6 +74,16 @@ extern int __dynamic_dev_dbg(struct _ddebug *descriptor,
__dynamic_dev_dbg(&descriptor, dev, fmt, ##__VA_ARGS__); \
} while (0)
+#define dynamic_netdev_dbg(dev, fmt, ...) do { \
+ static struct _ddebug descriptor \
+ __used \
+ __attribute__((section("__verbose"), aligned(8))) = \
+ { KBUILD_MODNAME, __func__, __FILE__, fmt, __LINE__, \
+ _DPRINTK_FLAGS_DEFAULT }; \
+ if (unlikely(descriptor.enabled)) \
+ __dynamic_netdev_dbg(&descriptor, dev, fmt, ##__VA_ARGS__);\
+ } while (0)
+
#else
static inline int ddebug_remove_module(const char *mod)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 54b8b4d..9b132ef 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2635,6 +2635,9 @@ static inline const char *netdev_name(const struct net_device *dev)
return dev->name;
}
+extern int __netdev_printk(const char *level, const struct net_device *dev,
+ struct va_format *vaf);
+
extern int netdev_printk(const char *level, const struct net_device *dev,
const char *format, ...)
__attribute__ ((format (printf, 3, 4)));
@@ -2662,8 +2665,7 @@ extern int netdev_info(const struct net_device *dev, const char *format, ...)
#elif defined(CONFIG_DYNAMIC_DEBUG)
#define netdev_dbg(__dev, format, args...) \
do { \
- dynamic_dev_dbg((__dev)->dev.parent, "%s: " format, \
- netdev_name(__dev), ##args); \
+ dynamic_netdev_dbg(__dev, format, ##args); \
} while (0)
#else
#define netdev_dbg(__dev, format, args...) \
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 4fc03dd..ee3b9ba 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -33,6 +33,7 @@
#include <linux/hardirq.h>
#include <linux/sched.h>
#include <linux/device.h>
+#include <linux/netdevice.h>
extern struct _ddebug __start___verbose[];
extern struct _ddebug __stop___verbose[];
@@ -503,6 +504,30 @@ int __dynamic_dev_dbg(struct _ddebug *descriptor,
}
EXPORT_SYMBOL(__dynamic_dev_dbg);
+int __dynamic_netdev_dbg(struct _ddebug *descriptor,
+ const struct net_device *dev, const char *fmt, ...)
+{
+ struct va_format vaf;
+ va_list args;
+ int res;
+
+ BUG_ON(!descriptor);
+ BUG_ON(!fmt);
+
+ va_start(args, fmt);
+
+ vaf.fmt = fmt;
+ vaf.va = &args;
+
+ res = dynamic_emit_prefix(descriptor);
+ res += __netdev_printk(KERN_CONT, dev, &vaf);
+
+ va_end(args);
+
+ return res;
+}
+EXPORT_SYMBOL(__dynamic_netdev_dbg);
+
static __initdata char ddebug_setup_string[1024];
static __init int ddebug_setup_query(char *str)
{
diff --git a/net/core/dev.c b/net/core/dev.c
index 9c58c1e..d6d48b2 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6288,7 +6288,7 @@ const char *netdev_drivername(const struct net_device *dev)
return empty;
}
-static int __netdev_printk(const char *level, const struct net_device *dev,
+int __netdev_printk(const char *level, const struct net_device *dev,
struct va_format *vaf)
{
int r;
@@ -6303,6 +6303,7 @@ static int __netdev_printk(const char *level, const struct net_device *dev,
return r;
}
+EXPORT_SYMBOL(__netdev_printk);
int netdev_printk(const char *level, const struct net_device *dev,
const char *format, ...)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 08/11] dynamic_debug: make netif_dbg() call __netdev_printk()
2011-07-14 16:09 [PATCH 00/11] various fixes v2 Jason Baron
2011-07-14 16:09 ` [PATCH 01/11] dynamic_debug: Add __dynamic_dev_dbg Jason Baron
2011-07-14 16:09 ` [PATCH 07/11] dynamic_debug: make netdev_dbg() call __netdev_printk() Jason Baron
@ 2011-07-14 16:09 ` Jason Baron
2 siblings, 0 replies; 4+ messages in thread
From: Jason Baron @ 2011-07-14 16:09 UTC (permalink / raw)
To: gregkh
Cc: joe, jim.cromie, bvanassche, linux-kernel, davem,
aloisio.almeida, netdev
From: Jason Baron <jbaron@redhat.com>
Previously, netif_dbg() was using dynamic_dev_dbg() to perform
the underlying printk. Fix it to use __netdev_printk(), instead.
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Jason Baron <jbaron@redhat.com>
---
include/linux/netdevice.h | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9b132ef..cb73e77 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2732,9 +2732,7 @@ do { \
#define netif_dbg(priv, type, netdev, format, args...) \
do { \
if (netif_msg_##type(priv)) \
- dynamic_dev_dbg((netdev)->dev.parent, \
- "%s: " format, \
- netdev_name(netdev), ##args); \
+ dynamic_netdev_dbg(netdev, format, ##args); \
} while (0)
#else
#define netif_dbg(priv, type, dev, format, args...) \
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-07-14 16:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-14 16:09 [PATCH 00/11] various fixes v2 Jason Baron
2011-07-14 16:09 ` [PATCH 01/11] dynamic_debug: Add __dynamic_dev_dbg Jason Baron
2011-07-14 16:09 ` [PATCH 07/11] dynamic_debug: make netdev_dbg() call __netdev_printk() Jason Baron
2011-07-14 16:09 ` [PATCH 08/11] dynamic_debug: make netif_dbg() " Jason Baron
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).