* [PATCH] wpan: use GFP_ATOMIC instead of GFP_KERNEL @ 2013-02-05 15:34 Alexander Aring 2013-02-05 16:09 ` Eric Dumazet ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Alexander Aring @ 2013-02-05 15:34 UTC (permalink / raw) To: alex.bluesman.smirnov Cc: dbaryshkov, linux-zigbee-devel, davem, netdev, Alexander Aring I got this message at runtime: [ 48.847347] BUG: scheduling while atomic: swapper/0/0/0x40000100 [ 48.853870] Modules linked in: autofs4 [ 48.857891] [<c0013db8>] (unwind_backtrace+0x0/0x11c) from [<c04cfb84>] (__schedule_bug+0x48/0x5c) [ 48.867342] [<c04cfb84>] (__schedule_bug+0x48/0x5c) from [<c04e0f4c>] (__schedule+0x68/0x5bc) [ 48.876357] [<c04e0f4c>] (__schedule+0x68/0x5bc) from [<c0063f0c>] (__cond_resched+0x24/0x34) [ 48.885368] [<c0063f0c>] (__cond_resched+0x24/0x34) from [<c04e152c>] (_cond_resched+0x34/0x44) [ 48.894559] [<c04e152c>] (_cond_resched+0x34/0x44) from [<c00e9b28>] (kmem_cache_alloc_trace+0x2c/0x158) [ 48.904578] [<c00e9b28>] (kmem_cache_alloc_trace+0x2c/0x158) from [<c04baa3c>] (mac802154_header_create+0x44/0x2) [ 48.915594] [<c04baa3c>] (mac802154_header_create+0x44/0x24c) from [<c04b8e50>] (lowpan_header_create.part.3+0x7) [ 48.927157] [<c04b8e50>] (lowpan_header_create.part.3+0x734/0x79c) from [<c03ebc04>] (neigh_connected_output+0x9) [ 48.938542] [<c03ebc04>] (neigh_connected_output+0x98/0xd0) from [<c0467d5c>] (ip6_finish_output2+0x374/0x45c) [ 48.949102] [<c0467d5c>] (ip6_finish_output2+0x374/0x45c) from [<c0479bcc>] (ndisc_send_skb+0x174/0x22c) [ 48.959101] [<c0479bcc>] (ndisc_send_skb+0x174/0x22c) from [<c047b138>] (ndisc_send_rs+0x3c/0x44) [ 48.968473] [<c047b138>] (ndisc_send_rs+0x3c/0x44) from [<c046e3f0>] (addrconf_rs_timer+0xbc/0x16c) [ 48.978032] [<c046e3f0>] (addrconf_rs_timer+0xbc/0x16c) from [<c00451fc>] (call_timer_fn+0x74/0x134) [ 48.987675] [<c00451fc>] (call_timer_fn+0x74/0x134) from [<c0046984>] (run_timer_softirq+0x258/0x2d4) [ 48.997417] [<c0046984>] (run_timer_softirq+0x258/0x2d4) from [<c003fb84>] (__do_softirq+0x118/0x248) [ 49.007156] [<c003fb84>] (__do_softirq+0x118/0x248) from [<c003ff64>] (irq_exit+0x44/0x84) [ 49.015890] [<c003ff64>] (irq_exit+0x44/0x84) from [<c000e780>] (handle_IRQ+0x7c/0xb8) [ 49.024249] [<c000e780>] (handle_IRQ+0x7c/0xb8) from [<c000857c>] (omap3_intc_handle_irq+0x54/0x68) [ 49.033801] [<c000857c>] (omap3_intc_handle_irq+0x54/0x68) from [<c04e2900>] (__irq_svc+0x40/0x50) [ 49.043239] Exception stack(0xc074bf68 to 0xc074bfb0) [ 49.048576] bf60: ffffffed 00000000 002f8000 00000000 c074a000 c07b6608 [ 49.057199] bf80: c04ec10c c0757618 80004059 413fc082 00000000 00000000 00000000 c074bfb0 [ 49.065821] bfa0: c000e904 c000e908 60000013 ffffffff [ 49.071162] [<c04e2900>] (__irq_svc+0x40/0x50) from [<c000e908>] (default_idle+0x24/0x2c) [ 49.079789] [<c000e908>] (default_idle+0x24/0x2c) from [<c000ea7c>] (cpu_idle+0x9c/0xf0) [ 49.088328] [<c000ea7c>] (cpu_idle+0x9c/0xf0) from [<c06ff7dc>] (start_kernel+0x258/0x2a4) It seems that mac802154_header_create is calling from a irq context. So kzalloc need GFP_ATOMIC flag. This patch will fix it. Signed-off-by: Alexander Aring <alex.aring@gmail.com> --- net/mac802154/wpan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c index 98c867b..0d9e110 100644 --- a/net/mac802154/wpan.c +++ b/net/mac802154/wpan.c @@ -143,7 +143,7 @@ static int mac802154_header_create(struct sk_buff *skb, if (!daddr) return -EINVAL; - head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_KERNEL); + head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_ATOMIC); if (head == NULL) return -ENOMEM; -- 1.8.1.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] wpan: use GFP_ATOMIC instead of GFP_KERNEL 2013-02-05 15:34 [PATCH] wpan: use GFP_ATOMIC instead of GFP_KERNEL Alexander Aring @ 2013-02-05 16:09 ` Eric Dumazet 2013-02-05 18:00 ` Alexander Aring 2013-02-05 18:40 ` Alexander Aring 2013-02-19 23:31 ` [Linux-zigbee-devel] " Alan Ott 2 siblings, 1 reply; 8+ messages in thread From: Eric Dumazet @ 2013-02-05 16:09 UTC (permalink / raw) To: Alexander Aring Cc: alex.bluesman.smirnov, dbaryshkov, linux-zigbee-devel, davem, netdev On Tue, 2013-02-05 at 16:34 +0100, Alexander Aring wrote: > I got this message at runtime: > > [ 48.847347] BUG: scheduling while atomic: swapper/0/0/0x40000100 > [ 48.853870] Modules linked in: autofs4 > [ 48.857891] [<c0013db8>] (unwind_backtrace+0x0/0x11c) from [<c04cfb84>] (__schedule_bug+0x48/0x5c) > [ 48.867342] [<c04cfb84>] (__schedule_bug+0x48/0x5c) from [<c04e0f4c>] (__schedule+0x68/0x5bc) > [ 48.876357] [<c04e0f4c>] (__schedule+0x68/0x5bc) from [<c0063f0c>] (__cond_resched+0x24/0x34) > [ 48.885368] [<c0063f0c>] (__cond_resched+0x24/0x34) from [<c04e152c>] (_cond_resched+0x34/0x44) > [ 48.894559] [<c04e152c>] (_cond_resched+0x34/0x44) from [<c00e9b28>] (kmem_cache_alloc_trace+0x2c/0x158) > [ 48.904578] [<c00e9b28>] (kmem_cache_alloc_trace+0x2c/0x158) from [<c04baa3c>] (mac802154_header_create+0x44/0x2) > [ 48.915594] [<c04baa3c>] (mac802154_header_create+0x44/0x24c) from [<c04b8e50>] (lowpan_header_create.part.3+0x7) > [ 48.927157] [<c04b8e50>] (lowpan_header_create.part.3+0x734/0x79c) from [<c03ebc04>] (neigh_connected_output+0x9) > [ 48.938542] [<c03ebc04>] (neigh_connected_output+0x98/0xd0) from [<c0467d5c>] (ip6_finish_output2+0x374/0x45c) > [ 48.949102] [<c0467d5c>] (ip6_finish_output2+0x374/0x45c) from [<c0479bcc>] (ndisc_send_skb+0x174/0x22c) > [ 48.959101] [<c0479bcc>] (ndisc_send_skb+0x174/0x22c) from [<c047b138>] (ndisc_send_rs+0x3c/0x44) > [ 48.968473] [<c047b138>] (ndisc_send_rs+0x3c/0x44) from [<c046e3f0>] (addrconf_rs_timer+0xbc/0x16c) > [ 48.978032] [<c046e3f0>] (addrconf_rs_timer+0xbc/0x16c) from [<c00451fc>] (call_timer_fn+0x74/0x134) > [ 48.987675] [<c00451fc>] (call_timer_fn+0x74/0x134) from [<c0046984>] (run_timer_softirq+0x258/0x2d4) > [ 48.997417] [<c0046984>] (run_timer_softirq+0x258/0x2d4) from [<c003fb84>] (__do_softirq+0x118/0x248) > [ 49.007156] [<c003fb84>] (__do_softirq+0x118/0x248) from [<c003ff64>] (irq_exit+0x44/0x84) > [ 49.015890] [<c003ff64>] (irq_exit+0x44/0x84) from [<c000e780>] (handle_IRQ+0x7c/0xb8) > [ 49.024249] [<c000e780>] (handle_IRQ+0x7c/0xb8) from [<c000857c>] (omap3_intc_handle_irq+0x54/0x68) > [ 49.033801] [<c000857c>] (omap3_intc_handle_irq+0x54/0x68) from [<c04e2900>] (__irq_svc+0x40/0x50) > [ 49.043239] Exception stack(0xc074bf68 to 0xc074bfb0) > [ 49.048576] bf60: ffffffed 00000000 002f8000 00000000 c074a000 c07b6608 > [ 49.057199] bf80: c04ec10c c0757618 80004059 413fc082 00000000 00000000 00000000 c074bfb0 > [ 49.065821] bfa0: c000e904 c000e908 60000013 ffffffff > [ 49.071162] [<c04e2900>] (__irq_svc+0x40/0x50) from [<c000e908>] (default_idle+0x24/0x2c) > [ 49.079789] [<c000e908>] (default_idle+0x24/0x2c) from [<c000ea7c>] (cpu_idle+0x9c/0xf0) > [ 49.088328] [<c000ea7c>] (cpu_idle+0x9c/0xf0) from [<c06ff7dc>] (start_kernel+0x258/0x2a4) > > It seems that mac802154_header_create is calling from a irq context. > So kzalloc need GFP_ATOMIC flag. > > This patch will fix it. > > Signed-off-by: Alexander Aring <alex.aring@gmail.com> > --- > net/mac802154/wpan.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c > index 98c867b..0d9e110 100644 > --- a/net/mac802154/wpan.c > +++ b/net/mac802154/wpan.c > @@ -143,7 +143,7 @@ static int mac802154_header_create(struct sk_buff *skb, > if (!daddr) > return -EINVAL; > > - head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_KERNEL); > + head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_ATOMIC); > if (head == NULL) > return -ENOMEM; > Please remove this allocation, its absolutely not needed. 40 bytes on the stack are fine. Thanks ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] wpan: use GFP_ATOMIC instead of GFP_KERNEL 2013-02-05 16:09 ` Eric Dumazet @ 2013-02-05 18:00 ` Alexander Aring 2013-02-05 18:13 ` Alexander Aring [not found] ` <20130205180057.GA1124-P4zwP3w+81Pu/k754drY8A@public.gmane.org> 0 siblings, 2 replies; 8+ messages in thread From: Alexander Aring @ 2013-02-05 18:00 UTC (permalink / raw) To: Eric Dumazet Cc: alex.bluesman.smirnov, dbaryshkov, linux-zigbee-devel, davem, netdev Hi, thanks for your reply. On Tue, Feb 05, 2013 at 08:09:57AM -0800, Eric Dumazet wrote: > On Tue, 2013-02-05 at 16:34 +0100, Alexander Aring wrote: > > I got this message at runtime: > > > > [ 48.847347] BUG: scheduling while atomic: swapper/0/0/0x40000100 > > [ 48.853870] Modules linked in: autofs4 > > [ 48.857891] [<c0013db8>] (unwind_backtrace+0x0/0x11c) from [<c04cfb84>] (__schedule_bug+0x48/0x5c) > > [ 48.867342] [<c04cfb84>] (__schedule_bug+0x48/0x5c) from [<c04e0f4c>] (__schedule+0x68/0x5bc) > > [ 48.876357] [<c04e0f4c>] (__schedule+0x68/0x5bc) from [<c0063f0c>] (__cond_resched+0x24/0x34) > > [ 48.885368] [<c0063f0c>] (__cond_resched+0x24/0x34) from [<c04e152c>] (_cond_resched+0x34/0x44) > > [ 48.894559] [<c04e152c>] (_cond_resched+0x34/0x44) from [<c00e9b28>] (kmem_cache_alloc_trace+0x2c/0x158) > > [ 48.904578] [<c00e9b28>] (kmem_cache_alloc_trace+0x2c/0x158) from [<c04baa3c>] (mac802154_header_create+0x44/0x2) > > [ 48.915594] [<c04baa3c>] (mac802154_header_create+0x44/0x24c) from [<c04b8e50>] (lowpan_header_create.part.3+0x7) > > [ 48.927157] [<c04b8e50>] (lowpan_header_create.part.3+0x734/0x79c) from [<c03ebc04>] (neigh_connected_output+0x9) > > [ 48.938542] [<c03ebc04>] (neigh_connected_output+0x98/0xd0) from [<c0467d5c>] (ip6_finish_output2+0x374/0x45c) > > [ 48.949102] [<c0467d5c>] (ip6_finish_output2+0x374/0x45c) from [<c0479bcc>] (ndisc_send_skb+0x174/0x22c) > > [ 48.959101] [<c0479bcc>] (ndisc_send_skb+0x174/0x22c) from [<c047b138>] (ndisc_send_rs+0x3c/0x44) > > [ 48.968473] [<c047b138>] (ndisc_send_rs+0x3c/0x44) from [<c046e3f0>] (addrconf_rs_timer+0xbc/0x16c) > > [ 48.978032] [<c046e3f0>] (addrconf_rs_timer+0xbc/0x16c) from [<c00451fc>] (call_timer_fn+0x74/0x134) > > [ 48.987675] [<c00451fc>] (call_timer_fn+0x74/0x134) from [<c0046984>] (run_timer_softirq+0x258/0x2d4) > > [ 48.997417] [<c0046984>] (run_timer_softirq+0x258/0x2d4) from [<c003fb84>] (__do_softirq+0x118/0x248) > > [ 49.007156] [<c003fb84>] (__do_softirq+0x118/0x248) from [<c003ff64>] (irq_exit+0x44/0x84) > > [ 49.015890] [<c003ff64>] (irq_exit+0x44/0x84) from [<c000e780>] (handle_IRQ+0x7c/0xb8) > > [ 49.024249] [<c000e780>] (handle_IRQ+0x7c/0xb8) from [<c000857c>] (omap3_intc_handle_irq+0x54/0x68) > > [ 49.033801] [<c000857c>] (omap3_intc_handle_irq+0x54/0x68) from [<c04e2900>] (__irq_svc+0x40/0x50) > > [ 49.043239] Exception stack(0xc074bf68 to 0xc074bfb0) > > [ 49.048576] bf60: ffffffed 00000000 002f8000 00000000 c074a000 c07b6608 > > [ 49.057199] bf80: c04ec10c c0757618 80004059 413fc082 00000000 00000000 00000000 c074bfb0 > > [ 49.065821] bfa0: c000e904 c000e908 60000013 ffffffff > > [ 49.071162] [<c04e2900>] (__irq_svc+0x40/0x50) from [<c000e908>] (default_idle+0x24/0x2c) > > [ 49.079789] [<c000e908>] (default_idle+0x24/0x2c) from [<c000ea7c>] (cpu_idle+0x9c/0xf0) > > [ 49.088328] [<c000ea7c>] (cpu_idle+0x9c/0xf0) from [<c06ff7dc>] (start_kernel+0x258/0x2a4) > > > > It seems that mac802154_header_create is calling from a irq context. > > So kzalloc need GFP_ATOMIC flag. > > > > This patch will fix it. > > > > Signed-off-by: Alexander Aring <alex.aring@gmail.com> > > --- > > net/mac802154/wpan.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c > > index 98c867b..0d9e110 100644 > > --- a/net/mac802154/wpan.c > > +++ b/net/mac802154/wpan.c > > @@ -143,7 +143,7 @@ static int mac802154_header_create(struct sk_buff *skb, > > if (!daddr) > > return -EINVAL; > > > > - head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_KERNEL); > > + head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_ATOMIC); > > if (head == NULL) > > return -ENOMEM; > > > > Please remove this allocation, its absolutely not needed. I don't know how I can do that. head is a temp buffer. At the end of this function stands: memcpy(skb_push(skb, pos), head, pos) and 'pos' is determined at runtime. skb_push will add data to the start of buffer, so head buffer will be at the start of skb. I don't know where I should manipulate the skb buffer at beginning of this function. Regards Alex > > 40 bytes on the stack are fine. > > Thanks > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] wpan: use GFP_ATOMIC instead of GFP_KERNEL 2013-02-05 18:00 ` Alexander Aring @ 2013-02-05 18:13 ` Alexander Aring 2013-02-05 18:21 ` Eric Dumazet [not found] ` <20130205180057.GA1124-P4zwP3w+81Pu/k754drY8A@public.gmane.org> 1 sibling, 1 reply; 8+ messages in thread From: Alexander Aring @ 2013-02-05 18:13 UTC (permalink / raw) To: Eric Dumazet Cc: alex.bluesman.smirnov, dbaryshkov, linux-zigbee-devel, davem, netdev Hi, On Tue, Feb 05, 2013 at 07:00:57PM +0100, Alexander Aring wrote: > Hi, > > thanks for your reply. > > On Tue, Feb 05, 2013 at 08:09:57AM -0800, Eric Dumazet wrote: > > On Tue, 2013-02-05 at 16:34 +0100, Alexander Aring wrote: > > > I got this message at runtime: > > > > > > [ 48.847347] BUG: scheduling while atomic: swapper/0/0/0x40000100 > > > [ 48.853870] Modules linked in: autofs4 > > > [ 48.857891] [<c0013db8>] (unwind_backtrace+0x0/0x11c) from [<c04cfb84>] (__schedule_bug+0x48/0x5c) > > > [ 48.867342] [<c04cfb84>] (__schedule_bug+0x48/0x5c) from [<c04e0f4c>] (__schedule+0x68/0x5bc) > > > [ 48.876357] [<c04e0f4c>] (__schedule+0x68/0x5bc) from [<c0063f0c>] (__cond_resched+0x24/0x34) > > > [ 48.885368] [<c0063f0c>] (__cond_resched+0x24/0x34) from [<c04e152c>] (_cond_resched+0x34/0x44) > > > [ 48.894559] [<c04e152c>] (_cond_resched+0x34/0x44) from [<c00e9b28>] (kmem_cache_alloc_trace+0x2c/0x158) > > > [ 48.904578] [<c00e9b28>] (kmem_cache_alloc_trace+0x2c/0x158) from [<c04baa3c>] (mac802154_header_create+0x44/0x2) > > > [ 48.915594] [<c04baa3c>] (mac802154_header_create+0x44/0x24c) from [<c04b8e50>] (lowpan_header_create.part.3+0x7) > > > [ 48.927157] [<c04b8e50>] (lowpan_header_create.part.3+0x734/0x79c) from [<c03ebc04>] (neigh_connected_output+0x9) > > > [ 48.938542] [<c03ebc04>] (neigh_connected_output+0x98/0xd0) from [<c0467d5c>] (ip6_finish_output2+0x374/0x45c) > > > [ 48.949102] [<c0467d5c>] (ip6_finish_output2+0x374/0x45c) from [<c0479bcc>] (ndisc_send_skb+0x174/0x22c) > > > [ 48.959101] [<c0479bcc>] (ndisc_send_skb+0x174/0x22c) from [<c047b138>] (ndisc_send_rs+0x3c/0x44) > > > [ 48.968473] [<c047b138>] (ndisc_send_rs+0x3c/0x44) from [<c046e3f0>] (addrconf_rs_timer+0xbc/0x16c) > > > [ 48.978032] [<c046e3f0>] (addrconf_rs_timer+0xbc/0x16c) from [<c00451fc>] (call_timer_fn+0x74/0x134) > > > [ 48.987675] [<c00451fc>] (call_timer_fn+0x74/0x134) from [<c0046984>] (run_timer_softirq+0x258/0x2d4) > > > [ 48.997417] [<c0046984>] (run_timer_softirq+0x258/0x2d4) from [<c003fb84>] (__do_softirq+0x118/0x248) > > > [ 49.007156] [<c003fb84>] (__do_softirq+0x118/0x248) from [<c003ff64>] (irq_exit+0x44/0x84) > > > [ 49.015890] [<c003ff64>] (irq_exit+0x44/0x84) from [<c000e780>] (handle_IRQ+0x7c/0xb8) > > > [ 49.024249] [<c000e780>] (handle_IRQ+0x7c/0xb8) from [<c000857c>] (omap3_intc_handle_irq+0x54/0x68) > > > [ 49.033801] [<c000857c>] (omap3_intc_handle_irq+0x54/0x68) from [<c04e2900>] (__irq_svc+0x40/0x50) > > > [ 49.043239] Exception stack(0xc074bf68 to 0xc074bfb0) > > > [ 49.048576] bf60: ffffffed 00000000 002f8000 00000000 c074a000 c07b6608 > > > [ 49.057199] bf80: c04ec10c c0757618 80004059 413fc082 00000000 00000000 00000000 c074bfb0 > > > [ 49.065821] bfa0: c000e904 c000e908 60000013 ffffffff > > > [ 49.071162] [<c04e2900>] (__irq_svc+0x40/0x50) from [<c000e908>] (default_idle+0x24/0x2c) > > > [ 49.079789] [<c000e908>] (default_idle+0x24/0x2c) from [<c000ea7c>] (cpu_idle+0x9c/0xf0) > > > [ 49.088328] [<c000ea7c>] (cpu_idle+0x9c/0xf0) from [<c06ff7dc>] (start_kernel+0x258/0x2a4) > > > > > > It seems that mac802154_header_create is calling from a irq context. > > > So kzalloc need GFP_ATOMIC flag. > > > > > > This patch will fix it. > > > > > > Signed-off-by: Alexander Aring <alex.aring@gmail.com> > > > --- > > > net/mac802154/wpan.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c > > > index 98c867b..0d9e110 100644 > > > --- a/net/mac802154/wpan.c > > > +++ b/net/mac802154/wpan.c > > > @@ -143,7 +143,7 @@ static int mac802154_header_create(struct sk_buff *skb, > > > if (!daddr) > > > return -EINVAL; > > > > > > - head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_KERNEL); > > > + head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_ATOMIC); > > > if (head == NULL) > > > return -ENOMEM; > > > > > > > Please remove this allocation, its absolutely not needed. > > I don't know how I can do that. head is a temp buffer. > At the end of this function stands: > > memcpy(skb_push(skb, pos), head, pos) > > and 'pos' is determined at runtime. skb_push will add data to the > start of buffer, so head buffer will be at the start of skb. I don't > know where I should manipulate the skb buffer at beginning of this function. > > Regards > Alex Ahh, you mean to put it on the stack. :-) Sorry about that. > > > > > 40 bytes on the stack are fine. > > > > Thanks > > > > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] wpan: use GFP_ATOMIC instead of GFP_KERNEL 2013-02-05 18:13 ` Alexander Aring @ 2013-02-05 18:21 ` Eric Dumazet 0 siblings, 0 replies; 8+ messages in thread From: Eric Dumazet @ 2013-02-05 18:21 UTC (permalink / raw) To: Alexander Aring Cc: alex.bluesman.smirnov, dbaryshkov, linux-zigbee-devel, davem, netdev On Tue, 2013-02-05 at 19:13 +0100, Alexander Aring wrote: > Ahh, you mean to put it on the stack. :-) > > Sorry about that. No problem ;) ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <20130205180057.GA1124-P4zwP3w+81Pu/k754drY8A@public.gmane.org>]
* Re: [PATCH] wpan: use GFP_ATOMIC instead of GFP_KERNEL [not found] ` <20130205180057.GA1124-P4zwP3w+81Pu/k754drY8A@public.gmane.org> @ 2013-02-05 18:20 ` Eric Dumazet 0 siblings, 0 replies; 8+ messages in thread From: Eric Dumazet @ 2013-02-05 18:20 UTC (permalink / raw) To: Alexander Aring Cc: netdev-u79uwXL29TY76Z2rM5mHXA, davem-fT/PcQaiUtIeIZ0/mPfg9Q, linux-zigbee-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f On Tue, 2013-02-05 at 19:00 +0100, Alexander Aring wrote: > I don't know how I can do that. head is a temp buffer. > At the end of this function stands: > > memcpy(skb_push(skb, pos), head, pos) > > and 'pos' is determined at runtime. skb_push will add data to the > start of buffer, so head buffer will be at the start of skb. I don't > know where I should manipulate the skb buffer at beginning of this function. Please try : diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c index 199b922..d18f2ac 100644 --- a/net/mac802154/wpan.c +++ b/net/mac802154/wpan.c @@ -137,16 +137,12 @@ static int mac802154_header_create(struct sk_buff *skb, struct ieee802154_addr dev_addr; struct mac802154_sub_if_data *priv = netdev_priv(dev); int pos = 2; - u8 *head; + u8 head[MAC802154_FRAME_HARD_HEADER_LEN]; u16 fc; if (!daddr) return -EINVAL; - head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_KERNEL); - if (head == NULL) - return -ENOMEM; - head[pos++] = mac_cb(skb)->seq; /* DSN/BSN */ fc = mac_cb_type(skb); @@ -210,7 +206,6 @@ static int mac802154_header_create(struct sk_buff *skb, head[1] = fc >> 8; memcpy(skb_push(skb, pos), head, pos); - kfree(head); return pos; } ------------------------------------------------------------------------------ Free Next-Gen Firewall Hardware Offer Buy your Sophos next-gen firewall before the end March 2013 and get the hardware for free! Learn more. http://p.sf.net/sfu/sophos-d2d-feb ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] wpan: use GFP_ATOMIC instead of GFP_KERNEL 2013-02-05 15:34 [PATCH] wpan: use GFP_ATOMIC instead of GFP_KERNEL Alexander Aring 2013-02-05 16:09 ` Eric Dumazet @ 2013-02-05 18:40 ` Alexander Aring 2013-02-19 23:31 ` [Linux-zigbee-devel] " Alan Ott 2 siblings, 0 replies; 8+ messages in thread From: Alexander Aring @ 2013-02-05 18:40 UTC (permalink / raw) To: alex.bluesman.smirnov; +Cc: dbaryshkov, linux-zigbee-devel, davem, netdev Hi, On Tue, Feb 05, 2013 at 04:34:34PM +0100, Alexander Aring wrote: > I got this message at runtime: > > [ 48.847347] BUG: scheduling while atomic: swapper/0/0/0x40000100 > [ 48.853870] Modules linked in: autofs4 > [ 48.857891] [<c0013db8>] (unwind_backtrace+0x0/0x11c) from [<c04cfb84>] (__schedule_bug+0x48/0x5c) > [ 48.867342] [<c04cfb84>] (__schedule_bug+0x48/0x5c) from [<c04e0f4c>] (__schedule+0x68/0x5bc) > [ 48.876357] [<c04e0f4c>] (__schedule+0x68/0x5bc) from [<c0063f0c>] (__cond_resched+0x24/0x34) > [ 48.885368] [<c0063f0c>] (__cond_resched+0x24/0x34) from [<c04e152c>] (_cond_resched+0x34/0x44) > [ 48.894559] [<c04e152c>] (_cond_resched+0x34/0x44) from [<c00e9b28>] (kmem_cache_alloc_trace+0x2c/0x158) > [ 48.904578] [<c00e9b28>] (kmem_cache_alloc_trace+0x2c/0x158) from [<c04baa3c>] (mac802154_header_create+0x44/0x2) > [ 48.915594] [<c04baa3c>] (mac802154_header_create+0x44/0x24c) from [<c04b8e50>] (lowpan_header_create.part.3+0x7) > [ 48.927157] [<c04b8e50>] (lowpan_header_create.part.3+0x734/0x79c) from [<c03ebc04>] (neigh_connected_output+0x9) > [ 48.938542] [<c03ebc04>] (neigh_connected_output+0x98/0xd0) from [<c0467d5c>] (ip6_finish_output2+0x374/0x45c) > [ 48.949102] [<c0467d5c>] (ip6_finish_output2+0x374/0x45c) from [<c0479bcc>] (ndisc_send_skb+0x174/0x22c) > [ 48.959101] [<c0479bcc>] (ndisc_send_skb+0x174/0x22c) from [<c047b138>] (ndisc_send_rs+0x3c/0x44) > [ 48.968473] [<c047b138>] (ndisc_send_rs+0x3c/0x44) from [<c046e3f0>] (addrconf_rs_timer+0xbc/0x16c) > [ 48.978032] [<c046e3f0>] (addrconf_rs_timer+0xbc/0x16c) from [<c00451fc>] (call_timer_fn+0x74/0x134) > [ 48.987675] [<c00451fc>] (call_timer_fn+0x74/0x134) from [<c0046984>] (run_timer_softirq+0x258/0x2d4) > [ 48.997417] [<c0046984>] (run_timer_softirq+0x258/0x2d4) from [<c003fb84>] (__do_softirq+0x118/0x248) > [ 49.007156] [<c003fb84>] (__do_softirq+0x118/0x248) from [<c003ff64>] (irq_exit+0x44/0x84) > [ 49.015890] [<c003ff64>] (irq_exit+0x44/0x84) from [<c000e780>] (handle_IRQ+0x7c/0xb8) > [ 49.024249] [<c000e780>] (handle_IRQ+0x7c/0xb8) from [<c000857c>] (omap3_intc_handle_irq+0x54/0x68) > [ 49.033801] [<c000857c>] (omap3_intc_handle_irq+0x54/0x68) from [<c04e2900>] (__irq_svc+0x40/0x50) > [ 49.043239] Exception stack(0xc074bf68 to 0xc074bfb0) > [ 49.048576] bf60: ffffffed 00000000 002f8000 00000000 c074a000 c07b6608 > [ 49.057199] bf80: c04ec10c c0757618 80004059 413fc082 00000000 00000000 00000000 c074bfb0 > [ 49.065821] bfa0: c000e904 c000e908 60000013 ffffffff > [ 49.071162] [<c04e2900>] (__irq_svc+0x40/0x50) from [<c000e908>] (default_idle+0x24/0x2c) > [ 49.079789] [<c000e908>] (default_idle+0x24/0x2c) from [<c000ea7c>] (cpu_idle+0x9c/0xf0) > [ 49.088328] [<c000ea7c>] (cpu_idle+0x9c/0xf0) from [<c06ff7dc>] (start_kernel+0x258/0x2a4) > > It seems that mac802154_header_create is calling from a irq context. > So kzalloc need GFP_ATOMIC flag. > > This patch will fix it. > > Signed-off-by: Alexander Aring <alex.aring@gmail.com> > --- > net/mac802154/wpan.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/mac802154/wpan.c b/net/mac802154/wpan.c > index 98c867b..0d9e110 100644 > --- a/net/mac802154/wpan.c > +++ b/net/mac802154/wpan.c > @@ -143,7 +143,7 @@ static int mac802154_header_create(struct sk_buff *skb, > if (!daddr) > return -EINVAL; > > - head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_KERNEL); > + head = kzalloc(MAC802154_FRAME_HARD_HEADER_LEN, GFP_ATOMIC); > if (head == NULL) > return -ENOMEM; > > -- > 1.8.1.2 > Please drop this patch. I resend a better solution. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Linux-zigbee-devel] [PATCH] wpan: use GFP_ATOMIC instead of GFP_KERNEL 2013-02-05 15:34 [PATCH] wpan: use GFP_ATOMIC instead of GFP_KERNEL Alexander Aring 2013-02-05 16:09 ` Eric Dumazet 2013-02-05 18:40 ` Alexander Aring @ 2013-02-19 23:31 ` Alan Ott 2 siblings, 0 replies; 8+ messages in thread From: Alan Ott @ 2013-02-19 23:31 UTC (permalink / raw) To: Alexander Aring; +Cc: alex.bluesman.smirnov, netdev, davem, linux-zigbee-devel On 02/05/2013 07:34 AM, Alexander Aring wrote: > I got this message at runtime: > > [ 48.847347] BUG: scheduling while atomic: swapper/0/0/0x40000100 Hi Alexander, Please check out the patch set here: https://github.com/beagleboard/kernel/tree/3.8/patches/6lowpan This is Tony's patch set which is not merged yet and might save you some time. Tony is hoping to get much of it merged this cycle. Alan. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-02-19 23:32 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-02-05 15:34 [PATCH] wpan: use GFP_ATOMIC instead of GFP_KERNEL Alexander Aring 2013-02-05 16:09 ` Eric Dumazet 2013-02-05 18:00 ` Alexander Aring 2013-02-05 18:13 ` Alexander Aring 2013-02-05 18:21 ` Eric Dumazet [not found] ` <20130205180057.GA1124-P4zwP3w+81Pu/k754drY8A@public.gmane.org> 2013-02-05 18:20 ` Eric Dumazet 2013-02-05 18:40 ` Alexander Aring 2013-02-19 23:31 ` [Linux-zigbee-devel] " Alan Ott
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).