Skip to contentSkip to conversation

Freeing alive fib_info caused by ebc0ffae5

DISCUSSION Applied Michael Ellerman 3 participants 7 messages Nov 4, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi all,

I'm running Linus' latest or thereabouts (ff8b16d), and I'm seeing "Freeing alive fib_info" messages, from free_fib_info().

Actually I only get one per boot, when network interfaces come up. Seemingly related I am getting refcount problems when I shutdown, ie. unregister_netdevice() sees a usage count of 1, which never decrements.

Bisect says it's ebc0ffae5 which causes the problem, or makes it appear.

fib: RCU conversion of fib_lookup()

fib_lookup() converted to be called in RCU protected context, no reference taken and released on a contended cache line (fib_clntref)

Is this a bug in that commit, or a driver bug exposed?

cheers

#1 lore raw
Quoted 11 lines · Michael Ellerman

Hi all,

I'm running Linus' latest or thereabouts (ff8b16d), and I'm seeing "Freeing alive fib_info" messages, from free_fib_info().

Actually I only get one per boot, when network interfaces come up. Seemingly related I am getting refcount problems when I shutdown, ie. unregister_netdevice() sees a usage count of 1, which never decrements.

Bisect says it's ebc0ffae5 which causes the problem, or makes it appear.

Quoted 7 lines

fib: RCU conversion of fib_lookup()

fib_lookup() converted to be called in RCU protected context, no reference taken and released on a contended cache line (fib_clntref)

Is this a bug in that commit, or a driver bug exposed?

Hi Michael, thanks for the report (and painful bisection I guess)

Thats hard to say... Is it reproductable on my machine ?

Thanks

#2 lore raw
Quoted 18 lines · Eric Dumazet
Quoted 17 lines · Michael Ellerman

Hi all,

I'm running Linus' latest or thereabouts (ff8b16d), and I'm seeing "Freeing alive fib_info" messages, from free_fib_info().

Actually I only get one per boot, when network interfaces come up. Seemingly related I am getting refcount problems when I shutdown, ie. unregister_netdevice() sees a usage count of 1, which never decrements.

Bisect says it's ebc0ffae5 which causes the problem, or makes it appear.

fib: RCU conversion of fib_lookup()

fib_lookup() converted to be called in RCU protected context, no reference taken and released on a contended cache line (fib_clntref)

Quoted 5 lines
Quoted 1 line

Is this a bug in that commit, or a driver bug exposed?

Hi Michael, thanks for the report (and painful bisection I guess)

Thats hard to say... Is it reproductable on my machine ?

You could ask a stack trace eventually, this might help to spot the bug.

Thanks

net/ipv4/fib_semantics.c +1 -0
index 3e0da3e..8039db0 100644
@@ -159,6 +159,7 @@ void free_fib_info(struct fib_info *fi)
 {
 	if (fi->fib_dead == 0) {
 		pr_warning("Freeing alive fib_info %p\n", fi);
+		WARN_ON_ONCE(1);
 		return;
 	}
 	change_nexthops(fi) {
#3 lore raw
In reply to Eric Dumazet
Quoted 18 lines · Eric Dumazet
Quoted 17 lines · Michael Ellerman

Hi all,

I'm running Linus' latest or thereabouts (ff8b16d), and I'm seeing "Freeing alive fib_info" messages, from free_fib_info().

Actually I only get one per boot, when network interfaces come up. Seemingly related I am getting refcount problems when I shutdown, ie. unregister_netdevice() sees a usage count of 1, which never decrements.

Bisect says it's ebc0ffae5 which causes the problem, or makes it appear.

fib: RCU conversion of fib_lookup()

fib_lookup() converted to be called in RCU protected context, no reference taken and released on a contended cache line (fib_clntref)

Quoted 6 lines
Quoted 1 line

Is this a bug in that commit, or a driver bug exposed?

Hi Michael, thanks for the report (and painful bisection I guess)

Thats hard to say... Is it reproductable on my machine ?

Hmm, a review of the code spotted a bug in fib_result_assign()

Please try following patch :

Thanks again !

[PATCH] fib: fib_result_assign() should not change fib refcounts

After commit ebc0ffae5 (RCU conversion of fib_lookup()), fib_result_assign() should not change fib refcounts anymore.

Thanks to Michael who did the bisection and bug report.

---
 net/ipv4/fib_lookup.h |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
net/ipv4/fib_lookup.h +1 -4
index a29edf2..c079cc0 100644
@@ -47,11 +47,8 @@ extern int fib_detect_death(struct fib_info *fi, int order,
 static inline void fib_result_assign(struct fib_result *res,
 				     struct fib_info *fi)
 {
-	if (res->fi != NULL)
-		fib_info_put(res->fi);
+	/* we used to play games with refcounts, but we now use RCU */
 	res->fi = fi;
-	if (fi != NULL)
-		atomic_inc(&fi->fib_clntref);
 }
 
 #endif /* _FIB_LOOKUP_H */
#4 lore raw
Quoted 19 lines · Eric Dumazet
Quoted 18 lines · Eric Dumazet
Quoted 17 lines · Michael Ellerman

Hi all,

I'm running Linus' latest or thereabouts (ff8b16d), and I'm seeing "Freeing alive fib_info" messages, from free_fib_info().

Actually I only get one per boot, when network interfaces come up. Seemingly related I am getting refcount problems when I shutdown, ie. unregister_netdevice() sees a usage count of 1, which never decrements.

Bisect says it's ebc0ffae5 which causes the problem, or makes it appear.

fib: RCU conversion of fib_lookup()

fib_lookup() converted to be called in RCU protected context, no reference taken and released on a contended cache line (fib_clntref)

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Is this a bug in that commit, or a driver bug exposed?

Hi Michael, thanks for the report (and painful bisection I guess)

Thats hard to say... Is it reproductable on my machine ?

Hmm, a review of the code spotted a bug in fib_result_assign()

Aha, I was just adding some debug in there. Let me test the patch.

cheers

#5 lore raw
In reply to Eric Dumazet
Quoted 27 lines · Eric Dumazet

Hmm, a review of the code spotted a bug in fib_result_assign()

Please try following patch :

Thanks again !

[PATCH] fib: fib_result_assign() should not change fib refcounts

After commit ebc0ffae5 (RCU conversion of fib_lookup()), fib_result_assign() should not change fib refcounts anymore.

Thanks to Michael who did the bisection and bug report.

---
 net/ipv4/fib_lookup.h |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
net/ipv4/fib_lookup.h +0 -0
index a29edf2..c079cc0 100644
@@ -47,11 +47,8 @@ extern int fib_detect_death(struct fib_info *fi, int order,
 static inline void fib_result_assign(struct fib_result *res,
 				     struct fib_info *fi)

net/ipv4/fib_lookup.h extern int fib_detect_death(struct fib_info *fi, int order, · line 54

Quoted 10 lines
net/ipv4/fib_lookup.h +1 -4
 {
-	if (res->fi != NULL)
-		fib_info_put(res->fi);
+	/* we used to play games with refcounts, but we now use RCU */
 	res->fi = fi;
-	if (fi != NULL)
-		atomic_inc(&fi->fib_clntref);
 }
 
 #endif /* _FIB_LOOKUP_H */

Perfect, that fixes it, thanks!

cheers

maintainer Applied
#6 lore raw

From: Michael Ellerman <[email protected]>
Date: Thu, 04 Nov 2010 22:35:26 +1100

Quoted 7 lines · Eric Dumazet
Quoted 6 lines

[PATCH] fib: fib_result_assign() should not change fib refcounts

After commit ebc0ffae5 (RCU conversion of fib_lookup()), fib_result_assign() should not change fib refcounts anymore.

Thanks to Michael who did the bisection and bug report.

...

Quoted 1 line

Perfect, that fixes it, thanks!

Applied, thanks everyone!