netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: stop endless flood about dst entry refcount underflow or overflow
@ 2015-07-14 11:43 Konstantin Khlebnikov
  2015-07-14 12:04 ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Konstantin Khlebnikov @ 2015-07-14 11:43 UTC (permalink / raw)
  To: netdev, David S. Miller; +Cc: Eric Dumazet

Kernel generates a lot of warnings when dst entry reference counter
overflows and becomes negative. This patch prints address of dst entry,
its refcount and then resets reference counter to INT_MAX/2.

That bug was seen several times at machines with outdated 3.10.y kernels.
Most like it's already fixed in upstream. Anyway flood of that warnings
completely kills machine and makes further debugging impossible.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
 net/core/dst.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/dst.c b/net/core/dst.c
index e956ce6d1378..2ed91082b3cf 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -284,7 +284,8 @@ void dst_release(struct dst_entry *dst)
 		int newrefcnt;
 
 		newrefcnt = atomic_dec_return(&dst->__refcnt);
-		WARN_ON(newrefcnt < 0);
+		if (WARN(newrefcnt < 0, "dst: %p refcnt: %d\n", dst, newrefcnt))
+			atomic_set(&dst->__refcnt, INT_MAX / 2);
 		if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt)
 			call_rcu(&dst->rcu_head, dst_destroy_rcu);
 	}

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

* Re: [PATCH] net: stop endless flood about dst entry refcount underflow or overflow
  2015-07-14 11:43 [PATCH] net: stop endless flood about dst entry refcount underflow or overflow Konstantin Khlebnikov
@ 2015-07-14 12:04 ` Eric Dumazet
  2015-07-14 12:15   ` Konstantin Khlebnikov
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2015-07-14 12:04 UTC (permalink / raw)
  To: Konstantin Khlebnikov; +Cc: netdev, David S. Miller, Eric Dumazet

On Tue, 2015-07-14 at 14:43 +0300, Konstantin Khlebnikov wrote:
> Kernel generates a lot of warnings when dst entry reference counter
> overflows and becomes negative. This patch prints address of dst entry,
> its refcount and then resets reference counter to INT_MAX/2.
> 
> That bug was seen several times at machines with outdated 3.10.y kernels.
> Most like it's already fixed in upstream. Anyway flood of that warnings
> completely kills machine and makes further debugging impossible.
> 
> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
> ---
>  net/core/dst.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/net/core/dst.c b/net/core/dst.c
> index e956ce6d1378..2ed91082b3cf 100644
> --- a/net/core/dst.c
> +++ b/net/core/dst.c
> @@ -284,7 +284,8 @@ void dst_release(struct dst_entry *dst)
>  		int newrefcnt;
>  
>  		newrefcnt = atomic_dec_return(&dst->__refcnt);
> -		WARN_ON(newrefcnt < 0);
> +		if (WARN(newrefcnt < 0, "dst: %p refcnt: %d\n", dst, newrefcnt))
> +			atomic_set(&dst->__refcnt, INT_MAX / 2);
>  		if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt)
>  			call_rcu(&dst->rcu_head, dst_destroy_rcu);
>  	}


WARN_ON_ONCE() if you want, but setting __refcnt like this is absolutely
a dirty hack.

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

* Re: [PATCH] net: stop endless flood about dst entry refcount underflow or overflow
  2015-07-14 12:04 ` Eric Dumazet
@ 2015-07-14 12:15   ` Konstantin Khlebnikov
  2015-07-14 12:26     ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Konstantin Khlebnikov @ 2015-07-14 12:15 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: netdev, David S. Miller, Eric Dumazet

On 14.07.2015 15:04, Eric Dumazet wrote:
> On Tue, 2015-07-14 at 14:43 +0300, Konstantin Khlebnikov wrote:
>> Kernel generates a lot of warnings when dst entry reference counter
>> overflows and becomes negative. This patch prints address of dst entry,
>> its refcount and then resets reference counter to INT_MAX/2.
>>
>> That bug was seen several times at machines with outdated 3.10.y kernels.
>> Most like it's already fixed in upstream. Anyway flood of that warnings
>> completely kills machine and makes further debugging impossible.
>>
>> Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
>> ---
>>   net/core/dst.c |    3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/core/dst.c b/net/core/dst.c
>> index e956ce6d1378..2ed91082b3cf 100644
>> --- a/net/core/dst.c
>> +++ b/net/core/dst.c
>> @@ -284,7 +284,8 @@ void dst_release(struct dst_entry *dst)
>>   		int newrefcnt;
>>
>>   		newrefcnt = atomic_dec_return(&dst->__refcnt);
>> -		WARN_ON(newrefcnt < 0);
>> +		if (WARN(newrefcnt < 0, "dst: %p refcnt: %d\n", dst, newrefcnt))
>> +			atomic_set(&dst->__refcnt, INT_MAX / 2);
>>   		if (unlikely(dst->flags & DST_NOCACHE) && !newrefcnt)
>>   			call_rcu(&dst->rcu_head, dst_destroy_rcu);
>>   	}
>
>
> WARN_ON_ONCE() if you want, but setting __refcnt like this is absolutely
> a dirty hack.

Simple warn-once will hide a lot of information which could be useful.
Also dst entry leak is better than freeing actually active entry.

>
>
>


-- 
Konstantin

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

* Re: [PATCH] net: stop endless flood about dst entry refcount underflow or overflow
  2015-07-14 12:15   ` Konstantin Khlebnikov
@ 2015-07-14 12:26     ` Eric Dumazet
  2015-07-14 22:30       ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2015-07-14 12:26 UTC (permalink / raw)
  To: Konstantin Khlebnikov; +Cc: netdev, David S. Miller, Eric Dumazet

On Tue, 2015-07-14 at 15:15 +0300, Konstantin Khlebnikov wrote:

> Simple warn-once will hide a lot of information which could be useful.
> Also dst entry leak is better than freeing actually active entry.

Then BUG_ON() .

Really, we need to fix leaks, not brown paper them.

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

* Re: [PATCH] net: stop endless flood about dst entry refcount underflow or overflow
  2015-07-14 12:26     ` Eric Dumazet
@ 2015-07-14 22:30       ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2015-07-14 22:30 UTC (permalink / raw)
  To: eric.dumazet; +Cc: khlebnikov, netdev, edumazet

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 14 Jul 2015 14:26:07 +0200

> On Tue, 2015-07-14 at 15:15 +0300, Konstantin Khlebnikov wrote:
> 
>> Simple warn-once will hide a lot of information which could be useful.
>> Also dst entry leak is better than freeing actually active entry.
> 
> Then BUG_ON() .
> 
> Really, we need to fix leaks, not brown paper them.

No, killing the machine is not the answer.

If you want to rate limit this message, do it on a per-device basis,
but without corrupting the netdev state in the process.

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

end of thread, other threads:[~2015-07-14 22:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-14 11:43 [PATCH] net: stop endless flood about dst entry refcount underflow or overflow Konstantin Khlebnikov
2015-07-14 12:04 ` Eric Dumazet
2015-07-14 12:15   ` Konstantin Khlebnikov
2015-07-14 12:26     ` Eric Dumazet
2015-07-14 22:30       ` David Miller

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).