All of lore.kernel.org
 help / color / mirror / Atom feed
* Convert net_msg_warn, NETDEBUG, & LIMIT_NETDEBUG?
@ 2014-11-04 20:46 Joe Perches
  2014-11-05 22:16 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2014-11-04 20:46 UTC (permalink / raw)
  To: netdev

net_msg_warn is a sysctl used to control the printk
of a bundle of mostly ipv4/ipv6 logging messages.

Does anyone use it?

NETDEBUG is used 4 times, 2 of which seem senseless
as they are allocation failures messages after an
alloc_skb.  These already get stack dumps.

The other NETDEBUG uses are ESP crypto descriptions.

LIMIT_NETDEBUG is used a lot more.

include/net/sock.h:#define LIMIT_NETDEBUG(fmt, args...) \
include/net/sock.h-     do { if (net_msg_warn && net_ratelimit()) printk(fmt,##args); } while(0)

Most of the LIMIT_NETDEBUG uses are emitted at KERN_DEBUG.

Here is the count of each type of use:
     31 KERN_DEBUG
      2 KERN_ERR
      3 KERN_INFO
     11 KERN_WARNING

Should those KERN_DEBUG uses be converted to
net_dbg_ratelimited so that these uses could be
controlled via dynamic_debug instead of the
net_msg_warn sysctl?

net/dccp/ uses LIMIT_NETDEBUG via DCCP_WARN to
control another 38 KERN_WARNING messages.

The others LIMIT_NETDEBUG uses could be converted
to net_<level>_ratelimited if appropriate.

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

* Re: Convert net_msg_warn, NETDEBUG, & LIMIT_NETDEBUG?
  2014-11-04 20:46 Convert net_msg_warn, NETDEBUG, & LIMIT_NETDEBUG? Joe Perches
@ 2014-11-05 22:16 ` David Miller
  2014-11-05 22:39   ` [PATCH net-next] net; ipv[46] - Remove 2 unnecessary NETDEBUG OOM messages Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2014-11-05 22:16 UTC (permalink / raw)
  To: realty; +Cc: netdev

From: Joe Perches <realty@perches.com>
Date: Tue, 04 Nov 2014 12:46:40 -0800

> net_msg_warn is a sysctl used to control the printk
> of a bundle of mostly ipv4/ipv6 logging messages.
> 
> Does anyone use it?
  ...
> Should those KERN_DEBUG uses be converted to
> net_dbg_ratelimited so that these uses could be
> controlled via dynamic_debug instead of the
> net_msg_warn sysctl?
  ...

I will respond to this by saying that, generally speaking, I'd
rather we move away from local debugging facility and controls
and towards the generic ones.

Definitely kill the allocation failure debug stuff, that's obviously
superfluous and bogus.

It may be the case that we're stuck with the net_msg_warn sysctl
for the stuff that isn't obviously extraneous and removable like
the allocation failure cases.

Why don't we work on these one at a time and see what's left after
all the adjustments/deletions?

Thanks.

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

* [PATCH net-next] net; ipv[46] - Remove 2 unnecessary NETDEBUG OOM messages
  2014-11-05 22:16 ` David Miller
@ 2014-11-05 22:39   ` Joe Perches
  2014-11-06 20:11     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2014-11-05 22:39 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

These messages aren't useful as there's a generic dump_stack()
on OOM.

Neaten the comment and if test above the OOM by separating the
assign in if into an allocation then if test.

Signed-off-by: Joe Perches <joe@perches.com>
---
 net/ipv4/ip_output.c  |  8 +++-----
 net/ipv6/ip6_output.c | 10 ++++------
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index bc6471d..4a929ad 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -662,12 +662,10 @@ slow_path:
 		if (len < left)	{
 			len &= ~7;
 		}
-		/*
-		 *	Allocate buffer.
-		 */
 
-		if ((skb2 = alloc_skb(len+hlen+ll_rs, GFP_ATOMIC)) == NULL) {
-			NETDEBUG(KERN_INFO "IP: frag: no memory for new fragment!\n");
+		/* Allocate buffer */
+		skb2 = alloc_skb(len + hlen + ll_rs, GFP_ATOMIC);
+		if (!skb2) {
 			err = -ENOMEM;
 			goto fail;
 		}
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 8e950c2..916d2a1 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -747,13 +747,11 @@ slow_path:
 		if (len < left)	{
 			len &= ~7;
 		}
-		/*
-		 *	Allocate buffer.
-		 */
 
-		if ((frag = alloc_skb(len + hlen + sizeof(struct frag_hdr) +
-				      hroom + troom, GFP_ATOMIC)) == NULL) {
-			NETDEBUG(KERN_INFO "IPv6: frag: no memory for new fragment!\n");
+		/* Allocate buffer */
+		frag = alloc_skb(len + hlen + sizeof(struct frag_hdr) +
+				 hroom + troom, GFP_ATOMIC);
+		if (!frag) {
 			IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)),
 				      IPSTATS_MIB_FRAGFAILS);
 			err = -ENOMEM;

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

* Re: [PATCH net-next] net; ipv[46] - Remove 2 unnecessary NETDEBUG OOM messages
  2014-11-05 22:39   ` [PATCH net-next] net; ipv[46] - Remove 2 unnecessary NETDEBUG OOM messages Joe Perches
@ 2014-11-06 20:11     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-11-06 20:11 UTC (permalink / raw)
  To: joe; +Cc: netdev

From: Joe Perches <joe@perches.com>
Date: Wed, 05 Nov 2014 14:39:21 -0800

> These messages aren't useful as there's a generic dump_stack()
> on OOM.
> 
> Neaten the comment and if test above the OOM by separating the
> assign in if into an allocation then if test.
> 
> Signed-off-by: Joe Perches <joe@perches.com>

Applied.

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

end of thread, other threads:[~2014-11-06 20:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-04 20:46 Convert net_msg_warn, NETDEBUG, & LIMIT_NETDEBUG? Joe Perches
2014-11-05 22:16 ` David Miller
2014-11-05 22:39   ` [PATCH net-next] net; ipv[46] - Remove 2 unnecessary NETDEBUG OOM messages Joe Perches
2014-11-06 20:11     ` David Miller

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.