From: Joe Perches <joe@perches.com> Date: 2012-08-26 11:25:38
The recent commit to fix dynamic_debug was a bit unclean.
Neaten the style for dynamic_debug.
Reduce the stack use of message logging that uses netdev_printk
Add utility functions dev_printk_emit and dev_vprintk_emit for /dev/kmsg.
Joe Perches (5):
dev_dbg/dynamic_debug: Update to use printk_emit, optimize stack
netdev_printk/dynamic_netdev_dbg: Directly call printk_emit
netdev_printk/netif_printk: Remove a superfluous logging colon
dev: Add dev_vprintk_emit and dev_printk_emit
device and dynamic_debug: Use dev_vprintk_emit and dev_printk_emit
drivers/base/core.c | 87 +++++++++++++++++++++++++++++---------------
include/linux/device.h | 17 +++++++--
include/linux/netdevice.h | 3 --
lib/dynamic_debug.c | 56 ++++++++++++++++++++++-------
net/core/dev.c | 20 +++++++----
5 files changed, 126 insertions(+), 57 deletions(-)
--
1.7.8.111.gad25c.dirty
From: Joe Perches <joe@perches.com> Date: 2012-08-26 11:25:52
commit c4e00daaa9
("driver-core: extend dev_printk() to pass structured data")
changed __dev_printk and broke dynamic-debug's ability to control the
dynamic prefix of dev_dbg(dev,..).
commit af7f2158fd
("drivers-core: make structured logging play nice with dynamic-debug")
made a minimal correction.
The current dynamic debug code uses up to 3 recursion levels via %pV.
This can consume quite a bit of stack. Directly call printk_emit to
reduce the recursion depth.
These changes include:
dev_dbg:
o Create and use function create_syslog_header to format the syslog
header for printk_emit uses.
o Call create_syslog_header and neaten __dev_printk
o Make __dev_printk static not global
o Remove include header declaration of __dev_printk
o Remove now unused EXPORT_SYMBOL() of __dev_printk
o Whitespace neatening
dynamic_dev_dbg:
o Remove KERN_DEBUG from dynamic_emit_prefix
o Call create_syslog_header and printk_emit
o Whitespace neatening
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/base/core.c | 64 +++++++++++++++++++++++++----------------------
include/linux/device.h | 8 +++---
lib/dynamic_debug.c | 39 +++++++++++++++++++++-------
3 files changed, 67 insertions(+), 44 deletions(-)
From: Joe Perches <joe@perches.com> Date: 2012-08-26 11:25:59
A lot of stack is used in recursive printks with %pV.
Using multiple levels of %pV (a logging function with %pV
that calls another logging function with %pV) can consume
more stack than necessary.
Avoid excessive stack use by not calling dev_printk from
netdev_printk and dynamic_netdev_dbg. Duplicate the logic
and form of dev_printk instead.
Make __netdev_printk static.
Remove EXPORT_SYMBOL(__netdev_printk)
Whitespace and brace style neatening.
Signed-off-by: Joe Perches <joe@perches.com>
---
include/linux/netdevice.h | 3 ---
lib/dynamic_debug.c | 26 +++++++++++++++++++++++---
net/core/dev.c | 24 +++++++++++++++++-------
3 files changed, 40 insertions(+), 13 deletions(-)
From: Joe Perches <joe@perches.com> Date: 2012-08-26 11:26:12
netdev_printk originally called dev_printk with %pV.
This style emitted the complete dev_printk header with
a colon followed by the netdev_name prefix followed
by a colon.
Now that netdev_printk does not call dev_printk, the
extra colon is superfluous. Remove it.
Example:
old: sky2 0000:02:00.0: eth0: Link is up at 100 Mbps, full duplex, flow control both
new: sky2 0000:02:00.0 eth0: Link is up at 100 Mbps, full duplex, flow control both
Signed-off-by: Joe Perches <joe@perches.com>
---
lib/dynamic_debug.c | 2 +-
net/core/dev.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
From: Joe Perches <joe@perches.com> Date: 2012-08-26 11:26:23
Add utility functions to consolidate the use of
create_syslog_header and vprintk_emit.
This allows conversion of logging functions that
call create_syslog_header and then call vprintk_emit
or printk_emit to the dev_ equivalents.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/base/core.c | 27 +++++++++++++++++++++++++++
include/linux/device.h | 11 +++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)
From: David Miller <davem@davemloft.net> Date: 2012-08-30 17:17:05
From: Joe Perches <joe@perches.com>
Date: Sun, 26 Aug 2012 04:25:25 -0700
The recent commit to fix dynamic_debug was a bit unclean.
Neaten the style for dynamic_debug.
Reduce the stack use of message logging that uses netdev_printk
Add utility functions dev_printk_emit and dev_vprintk_emit for /dev/kmsg.
I think these should go through the generic device tree, feel free to
add my:
Acked-by: David S. Miller <davem@davemloft.net>
From: Jim Cromie <jim.cromie@gmail.com> Date: 2012-08-30 17:44:18
On Sun, Aug 26, 2012 at 5:25 AM, Joe Perches [off-list ref] wrote:
The recent commit to fix dynamic_debug was a bit unclean.
Neaten the style for dynamic_debug.
Reduce the stack use of message logging that uses netdev_printk
Add utility functions dev_printk_emit and dev_vprintk_emit for /dev/kmsg.
Joe Perches (5):
dev_dbg/dynamic_debug: Update to use printk_emit, optimize stack
netdev_printk/dynamic_netdev_dbg: Directly call printk_emit
netdev_printk/netif_printk: Remove a superfluous logging colon
dev: Add dev_vprintk_emit and dev_printk_emit
device and dynamic_debug: Use dev_vprintk_emit and dev_printk_emit
Ive tested this on 2 builds differing only by DYNAMIC_DEBUG
It works for me on x86-64
However, I just booted a non-dyndbg build on x86-32, and got this.
root@voyage:~# dmesg | grep Unknown
mac80211: Unknown symbol __dynamic_dev_dbg (err 0)
mac80211: Unknown symbol __dynamic_pr_debug (err 0)
scx200_acb: Unknown symbol __dynamic_dev_dbg (err 0)
scx200_acb: Unknown symbol __dynamic_pr_debug (err 0)
hwmon: Unknown symbol __dynamic_dev_dbg (err 0)
nsc_gpio: Unknown symbol __dynamic_dev_dbg (err 0)
nsc_gpio: Unknown symbol __dynamic_dev_dbg (err 0)
root@voyage:~#
It may be my error, will investigate asap,
but wanted to report now.
thanks
From: Joe Perches <joe@perches.com> Date: 2012-08-30 18:25:25
On Thu, 2012-08-30 at 11:43 -0600, Jim Cromie wrote:
On Sun, Aug 26, 2012 at 5:25 AM, Joe Perches [off-list ref] wrote:
quoted
The recent commit to fix dynamic_debug was a bit unclean.
Neaten the style for dynamic_debug.
Reduce the stack use of message logging that uses netdev_printk
Add utility functions dev_printk_emit and dev_vprintk_emit for /dev/kmsg.
Joe Perches (5):
dev_dbg/dynamic_debug: Update to use printk_emit, optimize stack
netdev_printk/dynamic_netdev_dbg: Directly call printk_emit
netdev_printk/netif_printk: Remove a superfluous logging colon
dev: Add dev_vprintk_emit and dev_printk_emit
device and dynamic_debug: Use dev_vprintk_emit and dev_printk_emit
Ive tested this on 2 builds differing only by DYNAMIC_DEBUG
It works for me on x86-64
However, I just booted a non-dyndbg build on x86-32, and got this.
root@voyage:~# dmesg | grep Unknown
mac80211: Unknown symbol __dynamic_dev_dbg (err 0)
mac80211: Unknown symbol __dynamic_pr_debug (err 0)
scx200_acb: Unknown symbol __dynamic_dev_dbg (err 0)
scx200_acb: Unknown symbol __dynamic_pr_debug (err 0)
hwmon: Unknown symbol __dynamic_dev_dbg (err 0)
nsc_gpio: Unknown symbol __dynamic_dev_dbg (err 0)
nsc_gpio: Unknown symbol __dynamic_dev_dbg (err 0)
root@voyage:~#
It may be my error, will investigate asap,
but wanted to report now.
Thanks, but I don't know how this is possible.
There are no 32/64 component tests in this code.
From: Jim Cromie <jim.cromie@gmail.com> Date: 2012-08-31 03:48:45
On Thu, Aug 30, 2012 at 11:43 AM, Jim Cromie [off-list ref] wrote:
On Sun, Aug 26, 2012 at 5:25 AM, Joe Perches [off-list ref] wrote:
quoted
The recent commit to fix dynamic_debug was a bit unclean.
Neaten the style for dynamic_debug.
Reduce the stack use of message logging that uses netdev_printk
Add utility functions dev_printk_emit and dev_vprintk_emit for /dev/kmsg.
Joe Perches (5):
dev_dbg/dynamic_debug: Update to use printk_emit, optimize stack
netdev_printk/dynamic_netdev_dbg: Directly call printk_emit
netdev_printk/netif_printk: Remove a superfluous logging colon
dev: Add dev_vprintk_emit and dev_printk_emit
device and dynamic_debug: Use dev_vprintk_emit and dev_printk_emit
Ive tested this on 2 builds differing only by DYNAMIC_DEBUG
It works for me on x86-64
However, I just booted a non-dyndbg build on x86-32, and got this.
Ok, transient error, went away with a clean build.
tested-by: Jim Cromie <jim.cromie@gmail.com>
thanks
On Thu, Aug 30, 2012 at 09:48:12PM -0600, Jim Cromie wrote:
On Thu, Aug 30, 2012 at 11:43 AM, Jim Cromie [off-list ref] wrote:
quoted
On Sun, Aug 26, 2012 at 5:25 AM, Joe Perches [off-list ref] wrote:
quoted
The recent commit to fix dynamic_debug was a bit unclean.
Neaten the style for dynamic_debug.
Reduce the stack use of message logging that uses netdev_printk
Add utility functions dev_printk_emit and dev_vprintk_emit for /dev/kmsg.
Joe Perches (5):
dev_dbg/dynamic_debug: Update to use printk_emit, optimize stack
netdev_printk/dynamic_netdev_dbg: Directly call printk_emit
netdev_printk/netif_printk: Remove a superfluous logging colon
dev: Add dev_vprintk_emit and dev_printk_emit
device and dynamic_debug: Use dev_vprintk_emit and dev_printk_emit
Ive tested this on 2 builds differing only by DYNAMIC_DEBUG
It works for me on x86-64
However, I just booted a non-dyndbg build on x86-32, and got this.
Ok, transient error, went away with a clean build.
tested-by: Jim Cromie <jim.cromie@gmail.com>
Jason, any ACK on these, or any of the other random dynamic debug
patches floating around? What am I supposed to be applying here?
thanks,
greg k-h
From: Jason Baron <hidden> Date: 2012-09-06 17:52:09
On Sun, Aug 26, 2012 at 04:25:25AM -0700, Joe Perches wrote:
The recent commit to fix dynamic_debug was a bit unclean.
Neaten the style for dynamic_debug.
Reduce the stack use of message logging that uses netdev_printk
Add utility functions dev_printk_emit and dev_vprintk_emit for /dev/kmsg.
Joe Perches (5):
dev_dbg/dynamic_debug: Update to use printk_emit, optimize stack
netdev_printk/dynamic_netdev_dbg: Directly call printk_emit
netdev_printk/netif_printk: Remove a superfluous logging colon
dev: Add dev_vprintk_emit and dev_printk_emit
device and dynamic_debug: Use dev_vprintk_emit and dev_printk_emit
Looks Good.
The one thing that is bothering me though, is that for
__dynamic_dev_dbg(), __dynamic_netdev_dbg(), we are copying much of the core
logic of __dev_printk(), __netdev_printk(), respectively. I would prefer
have this in one place. Can we add a 'prefix' argument to __dev_printk(),
and __netdev_printk() that dynamic debug can use, but is simply empty
for dev_printk() and netdev_printk().
Thanks,
-Jason
From: Jason Baron <hidden> Date: 2012-09-06 17:53:21
On Thu, Sep 06, 2012 at 09:13:59AM -0700, Greg Kroah-Hartman wrote:
On Thu, Aug 30, 2012 at 09:48:12PM -0600, Jim Cromie wrote:
quoted
On Thu, Aug 30, 2012 at 11:43 AM, Jim Cromie [off-list ref] wrote:
quoted
On Sun, Aug 26, 2012 at 5:25 AM, Joe Perches [off-list ref] wrote:
quoted
The recent commit to fix dynamic_debug was a bit unclean.
Neaten the style for dynamic_debug.
Reduce the stack use of message logging that uses netdev_printk
Add utility functions dev_printk_emit and dev_vprintk_emit for /dev/kmsg.
Joe Perches (5):
dev_dbg/dynamic_debug: Update to use printk_emit, optimize stack
netdev_printk/dynamic_netdev_dbg: Directly call printk_emit
netdev_printk/netif_printk: Remove a superfluous logging colon
dev: Add dev_vprintk_emit and dev_printk_emit
device and dynamic_debug: Use dev_vprintk_emit and dev_printk_emit
Ive tested this on 2 builds differing only by DYNAMIC_DEBUG
It works for me on x86-64
However, I just booted a non-dyndbg build on x86-32, and got this.
Ok, transient error, went away with a clean build.
tested-by: Jim Cromie <jim.cromie@gmail.com>
Jason, any ACK on these, or any of the other random dynamic debug
patches floating around? What am I supposed to be applying here?
Hi Greg,
I just posted some follow up comments to Joe, so let's see where that
discussion goes.
Thanks,
-Jason
From: Joe Perches <joe@perches.com> Date: 2012-09-06 18:43:54
On Thu, 2012-09-06 at 13:51 -0400, Jason Baron wrote:
On Sun, Aug 26, 2012 at 04:25:25AM -0700, Joe Perches wrote:
quoted
The recent commit to fix dynamic_debug was a bit unclean.
Neaten the style for dynamic_debug.
Reduce the stack use of message logging that uses netdev_printk
Add utility functions dev_printk_emit and dev_vprintk_emit for /dev/kmsg.
Joe Perches (5):
dev_dbg/dynamic_debug: Update to use printk_emit, optimize stack
netdev_printk/dynamic_netdev_dbg: Directly call printk_emit
netdev_printk/netif_printk: Remove a superfluous logging colon
dev: Add dev_vprintk_emit and dev_printk_emit
device and dynamic_debug: Use dev_vprintk_emit and dev_printk_emit
Looks Good.
The one thing that is bothering me though, is that for
__dynamic_dev_dbg(), __dynamic_netdev_dbg(), we are copying much of the core
logic of __dev_printk(), __netdev_printk(), respectively. I would prefer
have this in one place. Can we add a 'prefix' argument to __dev_printk(),
and __netdev_printk() that dynamic debug can use, but is simply empty
for dev_printk() and netdev_printk().
I don't think that's an improvement actually.
Why don't you try it.
From: Jason Baron <hidden> Date: 2012-09-07 14:52:46
On Thu, Sep 06, 2012 at 11:43:46AM -0700, Joe Perches wrote:
On Thu, 2012-09-06 at 13:51 -0400, Jason Baron wrote:
quoted
On Sun, Aug 26, 2012 at 04:25:25AM -0700, Joe Perches wrote:
quoted
The recent commit to fix dynamic_debug was a bit unclean.
Neaten the style for dynamic_debug.
Reduce the stack use of message logging that uses netdev_printk
Add utility functions dev_printk_emit and dev_vprintk_emit for /dev/kmsg.
Joe Perches (5):
dev_dbg/dynamic_debug: Update to use printk_emit, optimize stack
netdev_printk/dynamic_netdev_dbg: Directly call printk_emit
netdev_printk/netif_printk: Remove a superfluous logging colon
dev: Add dev_vprintk_emit and dev_printk_emit
device and dynamic_debug: Use dev_vprintk_emit and dev_printk_emit
Looks Good.
The one thing that is bothering me though, is that for
__dynamic_dev_dbg(), __dynamic_netdev_dbg(), we are copying much of the core
logic of __dev_printk(), __netdev_printk(), respectively. I would prefer
have this in one place. Can we add a 'prefix' argument to __dev_printk(),
and __netdev_printk() that dynamic debug can use, but is simply empty
for dev_printk() and netdev_printk().
I don't think that's an improvement actually.
Why don't you try it.
Ok, below is what I was thinking. It winds up being more deletions than
insertions.
Thanks,
-Jason
dynamic debug: remove duplicate __netdev_printk() and __dev_printk() logic
Add an option prefix string argument to __netdev_printk() and __dev_printk().
In this way dynamic debug does not have to contain duplicate logic.
Signed-off-by: Jason Baron <redacted>
---
drivers/base/core.c | 13 +++++++------
include/linux/device.h | 3 +++
include/linux/netdevice.h | 3 +++
lib/dynamic_debug.c | 32 ++++++++------------------------
net/core/dev.c | 11 ++++++-----
5 files changed, 27 insertions(+), 35 deletions(-)
From: Joe Perches <joe@perches.com> Date: 2012-09-07 14:58:45
On Thu, 2012-09-06 at 11:43 -0700, Joe Perches wrote:
On Thu, 2012-09-06 at 13:51 -0400, Jason Baron wrote:
quoted
On Sun, Aug 26, 2012 at 04:25:25AM -0700, Joe Perches wrote:
quoted
The recent commit to fix dynamic_debug was a bit unclean.
Neaten the style for dynamic_debug.
Reduce the stack use of message logging that uses netdev_printk
Add utility functions dev_printk_emit and dev_vprintk_emit for /dev/kmsg.
[]
quoted
The one thing that is bothering me though, is that for
__dynamic_dev_dbg(), __dynamic_netdev_dbg(), we are copying much of the core
logic of __dev_printk(), __netdev_printk(), respectively. I would prefer
have this in one place. Can we add a 'prefix' argument to __dev_printk(),
and __netdev_printk() that dynamic debug can use, but is simply empty
for dev_printk() and netdev_printk().
I don't think that's an improvement actually.
Because it would add an always effectively unused "" argument
to dev_printk and netdev_printk calls in non dynamic_debug
builds.
dynamic_debug is still mostly a developer feature and I
believe most distros do not enable it.
From: Joe Perches <joe@perches.com> Date: 2012-09-07 15:12:06
On Fri, 2012-09-07 at 10:52 -0400, Jason Baron wrote:
quoted hunk
On Thu, Sep 06, 2012 at 11:43:46AM -0700, Joe Perches wrote:
quoted
On Thu, 2012-09-06 at 13:51 -0400, Jason Baron wrote:
quoted
On Sun, Aug 26, 2012 at 04:25:25AM -0700, Joe Perches wrote:
quoted
The recent commit to fix dynamic_debug was a bit unclean.
Neaten the style for dynamic_debug.
Reduce the stack use of message logging that uses netdev_printk
Add utility functions dev_printk_emit and dev_vprintk_emit for /dev/kmsg.
Joe Perches (5):
dev_dbg/dynamic_debug: Update to use printk_emit, optimize stack
netdev_printk/dynamic_netdev_dbg: Directly call printk_emit
netdev_printk/netif_printk: Remove a superfluous logging colon
dev: Add dev_vprintk_emit and dev_printk_emit
device and dynamic_debug: Use dev_vprintk_emit and dev_printk_emit
Looks Good.
The one thing that is bothering me though, is that for
__dynamic_dev_dbg(), __dynamic_netdev_dbg(), we are copying much of the core
logic of __dev_printk(), __netdev_printk(), respectively. I would prefer
have this in one place. Can we add a 'prefix' argument to __dev_printk(),
and __netdev_printk() that dynamic debug can use, but is simply empty
for dev_printk() and netdev_printk().
I don't think that's an improvement actually.
Why don't you try it.
Ok, below is what I was thinking. It winds up being more deletions than
insertions.
Thanks,
-Jason
dynamic debug: remove duplicate __netdev_printk() and __dev_printk() logic
Add an option prefix string argument to __netdev_printk() and __dev_printk().
In this way dynamic debug does not have to contain duplicate logic.
Signed-off-by: Jason Baron <redacted>
---
drivers/base/core.c | 13 +++++++------
include/linux/device.h | 3 +++
include/linux/netdevice.h | 3 +++
lib/dynamic_debug.c | 32 ++++++++------------------------
net/core/dev.c | 11 ++++++-----
5 files changed, 27 insertions(+), 35 deletions(-)
'Morning Jason.
Funny. Crossed emails.
I still don't think this is better.
This does add an effectively unused "" to non-dynamic debug builds.
ie: the more common paths are encumbered as dynamic_debug isn't
a normally enabled distribution CONFIG_ option.
About the patch:
Wouldn't dev_printk_emit now would have a single caller and
could be made static?
Don't __dev_printk and __netdev_printk need EXPORT_SYMBOLs?
cheers, Joe
From: Jason Baron <hidden> Date: 2012-09-07 15:35:51
On Fri, Sep 07, 2012 at 08:12:01AM -0700, Joe Perches wrote:
On Fri, 2012-09-07 at 10:52 -0400, Jason Baron wrote:
quoted
On Thu, Sep 06, 2012 at 11:43:46AM -0700, Joe Perches wrote:
quoted
On Thu, 2012-09-06 at 13:51 -0400, Jason Baron wrote:
quoted
On Sun, Aug 26, 2012 at 04:25:25AM -0700, Joe Perches wrote:
quoted
The recent commit to fix dynamic_debug was a bit unclean.
Neaten the style for dynamic_debug.
Reduce the stack use of message logging that uses netdev_printk
Add utility functions dev_printk_emit and dev_vprintk_emit for /dev/kmsg.
Joe Perches (5):
dev_dbg/dynamic_debug: Update to use printk_emit, optimize stack
netdev_printk/dynamic_netdev_dbg: Directly call printk_emit
netdev_printk/netif_printk: Remove a superfluous logging colon
dev: Add dev_vprintk_emit and dev_printk_emit
device and dynamic_debug: Use dev_vprintk_emit and dev_printk_emit
Looks Good.
The one thing that is bothering me though, is that for
__dynamic_dev_dbg(), __dynamic_netdev_dbg(), we are copying much of the core
logic of __dev_printk(), __netdev_printk(), respectively. I would prefer
have this in one place. Can we add a 'prefix' argument to __dev_printk(),
and __netdev_printk() that dynamic debug can use, but is simply empty
for dev_printk() and netdev_printk().
I don't think that's an improvement actually.
Why don't you try it.
Ok, below is what I was thinking. It winds up being more deletions than
insertions.
Thanks,
-Jason
dynamic debug: remove duplicate __netdev_printk() and __dev_printk() logic
Add an option prefix string argument to __netdev_printk() and __dev_printk().
In this way dynamic debug does not have to contain duplicate logic.
Signed-off-by: Jason Baron <redacted>
---
drivers/base/core.c | 13 +++++++------
include/linux/device.h | 3 +++
include/linux/netdevice.h | 3 +++
lib/dynamic_debug.c | 32 ++++++++------------------------
net/core/dev.c | 11 ++++++-----
5 files changed, 27 insertions(+), 35 deletions(-)
'Morning Jason.
Funny. Crossed emails.
I still don't think this is better.
This does add an effectively unused "" to non-dynamic debug builds.
ie: the more common paths are encumbered as dynamic_debug isn't
a normally enabled distribution CONFIG_ option.
Yeah, not sure - I know Fedora enables it.
About the patch:
Wouldn't dev_printk_emit now would have a single caller and
could be made static?
Yes, I believe so.
Don't __dev_printk and __netdev_printk need EXPORT_SYMBOLs?
The usage in lib/dynamic_debug.c can't be built as a module. So not required.
If nobody else thinks this patch is better, let's at least add a comment in
__dev_printk() and __netdev_printk() to fix dynamic debug, if these are changed.
Thanks,
-Jason
From: Joe Perches <joe@perches.com> Date: 2012-09-08 01:55:54
On Fri, 2012-09-07 at 11:35 -0400, Jason Baron wrote:
If nobody else thinks this patch is better, let's at least add a comment in
__dev_printk() and __netdev_printk() to fix dynamic debug, if these are changed.
Or maybe make dynamic_emit_prefix a public function
and move the __dynamic_<foo>_printk functions to
nearby the __<foo>_printk functions so it's easier to
see that changing one requires the other to change.
Something like:
drivers/base/core.c | 34 +++++++++++++++++++
include/linux/dynamic_debug.h | 2 +
lib/dynamic_debug.c | 74 +----------------------------------------
net/core/dev.c | 40 ++++++++++++++++++++++
4 files changed, 77 insertions(+), 73 deletions(-)
From: Jason Baron <hidden> Date: 2012-09-10 20:56:16
On Fri, Sep 07, 2012 at 06:55:50PM -0700, Joe Perches wrote:
On Fri, 2012-09-07 at 11:35 -0400, Jason Baron wrote:
quoted
If nobody else thinks this patch is better, let's at least add a comment in
__dev_printk() and __netdev_printk() to fix dynamic debug, if these are changed.
Or maybe make dynamic_emit_prefix a public function
and move the __dynamic_<foo>_printk functions to
nearby the __<foo>_printk functions so it's easier to
see that changing one requires the other to change.
From: Joe Perches <joe@perches.com> Date: 2012-09-13 03:11:32
commit c4e00daaa9
("driver-core: extend dev_printk() to pass structured data")
changed __dev_printk and broke dynamic-debug's ability to control the
dynamic prefix of dev_dbg(dev,..).
commit af7f2158fd
("drivers-core: make structured logging play nice with dynamic-debug")
made a minimal correction.
The current dynamic debug code uses up to 3 recursion levels via %pV.
This can consume quite a bit of stack. Directly call printk_emit to
reduce the recursion depth.
These changes include:
dev_dbg:
o Create and use function create_syslog_header to format the syslog
header for printk_emit uses.
o Call create_syslog_header and neaten __dev_printk
o Make __dev_printk static not global
o Remove include header declaration of __dev_printk
o Remove now unused EXPORT_SYMBOL() of __dev_printk
o Whitespace neatening
dynamic_dev_dbg:
o Remove KERN_DEBUG from dynamic_emit_prefix
o Call create_syslog_header and printk_emit
o Whitespace neatening
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: David S. Miller <davem@davemloft.net>
Tested-by: Jim Cromie <jim.cromie@gmail.com>
Acked-by: Jason Baron <redacted>
---
drivers/base/core.c | 64 +++++++++++++++++++++++++----------------------
include/linux/device.h | 8 +++---
lib/dynamic_debug.c | 39 +++++++++++++++++++++-------
3 files changed, 67 insertions(+), 44 deletions(-)
From: Joe Perches <joe@perches.com> Date: 2012-09-13 03:12:41
A lot of stack is used in recursive printks with %pV.
Using multiple levels of %pV (a logging function with %pV
that calls another logging function with %pV) can consume
more stack than necessary.
Avoid excessive stack use by not calling dev_printk from
netdev_printk and dynamic_netdev_dbg. Duplicate the logic
and form of dev_printk instead.
Make __netdev_printk static.
Remove EXPORT_SYMBOL(__netdev_printk)
Whitespace and brace style neatening.
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: David S. Miller <davem@davemloft.net>
Tested-by: Jim Cromie <jim.cromie@gmail.com>
Acked-by: Jason Baron <redacted>
---
include/linux/netdevice.h | 3 ---
lib/dynamic_debug.c | 26 +++++++++++++++++++++++---
net/core/dev.c | 24 +++++++++++++++++-------
3 files changed, 40 insertions(+), 13 deletions(-)
From: Joe Perches <joe@perches.com> Date: 2012-09-13 03:13:09
netdev_printk originally called dev_printk with %pV.
This style emitted the complete dev_printk header with
a colon followed by the netdev_name prefix followed
by a colon.
Now that netdev_printk does not call dev_printk, the
extra colon is superfluous. Remove it.
Example:
old: sky2 0000:02:00.0: eth0: Link is up at 100 Mbps, full duplex, flow control both
new: sky2 0000:02:00.0 eth0: Link is up at 100 Mbps, full duplex, flow control both
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: David S. Miller <davem@davemloft.net>
Tested-by: Jim Cromie <jim.cromie@gmail.com>
Acked-by: Jason Baron <redacted>
---
lib/dynamic_debug.c | 2 +-
net/core/dev.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
From: Joe Perches <joe@perches.com> Date: 2012-09-13 03:13:39
Add utility functions to consolidate the use of
create_syslog_header and vprintk_emit.
This allows conversion of logging functions that
call create_syslog_header and then call vprintk_emit
or printk_emit to the dev_ equivalents.
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: David S. Miller <davem@davemloft.net>
Tested-by: Jim Cromie <jim.cromie@gmail.com>
Acked-by: Jason Baron <redacted>
---
drivers/base/core.c | 27 +++++++++++++++++++++++++++
include/linux/device.h | 11 +++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)
From: Joe Perches <joe@perches.com> Date: 2012-09-13 03:14:13
Convert direct calls of vprintk_emit and printk_emit to the
dev_ equivalents.
Make create_syslog_header static.
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: David S. Miller <davem@davemloft.net>
Tested-by: Jim Cromie <jim.cromie@gmail.com>
Acked-by: Jason Baron <redacted>
---
drivers/base/core.c | 14 +++++---------
include/linux/device.h | 2 --
lib/dynamic_debug.c | 31 +++++++++++--------------------
net/core/dev.c | 16 ++++++----------
4 files changed, 22 insertions(+), 41 deletions(-)
Missing "inline", cfr. http://kisskb.ellerman.id.au/kisskb/buildresult/7271354/
include/linux/device.h:930:12: error: 'dev_vprintk_emit' defined but
not used [-Werror=unused-function]
cc1: all warnings being treated as errors
make[2]: *** [arch/sh/kernel/dma-nommu.o] Error 1
+ const char *fmt, va_list args)
+{ return 0; }
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds