* [PATCH] 2.6.19-rc4 - netlink messages created with bad flags in soft_irq context
@ 2006-10-31 22:06 Andy Gospodarek
2006-11-01 3:50 ` Herbert Xu
2006-11-01 6:00 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Andy Gospodarek @ 2006-10-31 22:06 UTC (permalink / raw)
To: linux-kernel, netdev
I've got a kernel built where
CONFIG_DEBUG_SPINLOCK_SLEEP=y
is in the config and I've noticed some interesting behavior when
bringing up bonds in balance-alb mode. When I start to enslave devices
to a bond I get the following in the ring buffer:
BUG: sleeping function called from invalid context at mm/slab.c:3007
in_atomic():1, irqs_disabled():0
along with a nice backtrace of the error that pointed to the cause of
this message. The bonding code was calling for the device to set its
MAC address and the netlink message that would be send as a result of
this notification was being created with the flag GFP_KERNEL instead of
GFP_ATOMIC.
After I did this, I noticed I didn't completely clear the error (since
this call eventually tries to talk the rtnl_lock), but it gets us
closer. I'm still trying to decide how best to approach the remaining
problem and will hopefully post a solution soon, but I wanted to get
this in and/or get some feedback on this patch/direction first.
Signed-off-by: Andy Gospodarek <andy@greyhouse.net>
---
rtnetlink.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 221e403..93d6fb3 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -159,7 +159,7 @@ int rtnetlink_send(struct sk_buff *skb,
NETLINK_CB(skb).dst_group = group;
if (echo)
atomic_inc(&skb->users);
- netlink_broadcast(rtnl, skb, pid, group, GFP_KERNEL);
+ netlink_broadcast(rtnl, skb, pid, group, GFP_ATOMIC);
if (echo)
err = netlink_unicast(rtnl, skb, pid, MSG_DONTWAIT);
return err;
@@ -589,7 +589,7 @@ #endif /* CONFIG_NET_WIRELESS_RTNETLINK
payload = NLMSG_ALIGN(sizeof(struct ifinfomsg) +
nla_total_size(iw_buf_len));
- nskb = nlmsg_new(nlmsg_total_size(payload), GFP_KERNEL);
+ nskb = nlmsg_new(nlmsg_total_size(payload), GFP_ATOMIC);
if (nskb == NULL) {
err = -ENOBUFS;
goto errout;
@@ -639,7 +639,7 @@ void rtmsg_ifinfo(int type, struct net_d
struct sk_buff *skb;
int err = -ENOBUFS;
- skb = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
+ skb = nlmsg_new(NLMSG_GOODSIZE, GFP_ATOMIC);
if (skb == NULL)
goto errout;
@@ -649,7 +649,7 @@ void rtmsg_ifinfo(int type, struct net_d
goto errout;
}
- err = rtnl_notify(skb, 0, RTNLGRP_LINK, NULL, GFP_KERNEL);
+ err = rtnl_notify(skb, 0, RTNLGRP_LINK, NULL, GFP_ATOMIC);
errout:
if (err < 0)
rtnl_set_sk_err(RTNLGRP_LINK, err);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] 2.6.19-rc4 - netlink messages created with bad flags in soft_irq context
2006-10-31 22:06 [PATCH] 2.6.19-rc4 - netlink messages created with bad flags in soft_irq context Andy Gospodarek
@ 2006-11-01 3:50 ` Herbert Xu
2006-11-01 6:00 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2006-11-01 3:50 UTC (permalink / raw)
To: Andy Gospodarek; +Cc: linux-kernel, netdev, davem
Andy Gospodarek <andy@greyhouse.net> wrote:
> I've got a kernel built where
>
> CONFIG_DEBUG_SPINLOCK_SLEEP=y
>
> is in the config and I've noticed some interesting behavior when
> bringing up bonds in balance-alb mode. When I start to enslave devices
> to a bond I get the following in the ring buffer:
>
> BUG: sleeping function called from invalid context at mm/slab.c:3007
> in_atomic():1, irqs_disabled():0
>
> along with a nice backtrace of the error that pointed to the cause of
> this message. The bonding code was calling for the device to set its
> MAC address and the netlink message that would be send as a result of
> this notification was being created with the flag GFP_KERNEL instead of
> GFP_ATOMIC.
The bonding driver is known to be broken in places where it tries to
call into the network stack in atomic contexts where it shouldn't.
So please verify whether this is the case here before changing netlink.
Thanks,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] 2.6.19-rc4 - netlink messages created with bad flags in soft_irq context
2006-10-31 22:06 [PATCH] 2.6.19-rc4 - netlink messages created with bad flags in soft_irq context Andy Gospodarek
2006-11-01 3:50 ` Herbert Xu
@ 2006-11-01 6:00 ` David Miller
2006-11-01 13:10 ` Andy Gospodarek
1 sibling, 1 reply; 4+ messages in thread
From: David Miller @ 2006-11-01 6:00 UTC (permalink / raw)
To: andy; +Cc: linux-kernel, netdev
From: Andy Gospodarek <andy@greyhouse.net>
Date: Tue, 31 Oct 2006 17:06:00 -0500
> I've got a kernel built where
>
> CONFIG_DEBUG_SPINLOCK_SLEEP=y
>
> is in the config and I've noticed some interesting behavior when
> bringing up bonds in balance-alb mode. When I start to enslave devices
> to a bond I get the following in the ring buffer:
>
> BUG: sleeping function called from invalid context at mm/slab.c:3007
> in_atomic():1, irqs_disabled():0
As Herbert mentioned, the bonding layer calls into the networking
in atomic contexts when that is illegal.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] 2.6.19-rc4 - netlink messages created with bad flags in soft_irq context
2006-11-01 6:00 ` David Miller
@ 2006-11-01 13:10 ` Andy Gospodarek
0 siblings, 0 replies; 4+ messages in thread
From: Andy Gospodarek @ 2006-11-01 13:10 UTC (permalink / raw)
To: David Miller; +Cc: andy, linux-kernel, netdev
On Tue, Oct 31, 2006 at 10:00:47PM -0800, David Miller wrote:
> From: Andy Gospodarek <andy@greyhouse.net>
> Date: Tue, 31 Oct 2006 17:06:00 -0500
>
> > I've got a kernel built where
> >
> > CONFIG_DEBUG_SPINLOCK_SLEEP=y
> >
> > is in the config and I've noticed some interesting behavior when
> > bringing up bonds in balance-alb mode. When I start to enslave devices
> > to a bond I get the following in the ring buffer:
> >
> > BUG: sleeping function called from invalid context at mm/slab.c:3007
> > in_atomic():1, irqs_disabled():0
>
> As Herbert mentioned, the bonding layer calls into the networking
> in atomic contexts when that is illegal.
> -
Thanks for the feedback. If it seems the bonding driver is one of the
only culprits, I'll investigate a solution that is specific to bonding
(maybe a workqueue for such calls...) rather that one that effects the
entire stack.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-11-01 13:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-31 22:06 [PATCH] 2.6.19-rc4 - netlink messages created with bad flags in soft_irq context Andy Gospodarek
2006-11-01 3:50 ` Herbert Xu
2006-11-01 6:00 ` David Miller
2006-11-01 13:10 ` Andy Gospodarek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®