From: Alexander Aring Subject: Re: [PATCH] wpan: use GFP_ATOMIC instead of GFP_KERNEL Date: Tue, 5 Feb 2013 19:40:15 +0100 Message-ID: <20130205184013.GC1124@x61s.8.8.8.8> References: <1360078474-24362-1-git-send-email-alex.aring@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: dbaryshkov@gmail.com, linux-zigbee-devel@lists.sourceforge.net, davem@davemloft.net, netdev@vger.kernel.org To: alex.bluesman.smirnov@gmail.com Return-path: Received: from mail-bk0-f48.google.com ([209.85.214.48]:36065 "EHLO mail-bk0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754340Ab3BESj3 (ORCPT ); Tue, 5 Feb 2013 13:39:29 -0500 Received: by mail-bk0-f48.google.com with SMTP id jf20so247191bkc.21 for ; Tue, 05 Feb 2013 10:39:28 -0800 (PST) Content-Disposition: inline In-Reply-To: <1360078474-24362-1-git-send-email-alex.aring@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: 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] [] (unwind_backtrace+0x0/0x11c) from [] (__schedule_bug+0x48/0x5c) > [ 48.867342] [] (__schedule_bug+0x48/0x5c) from [] (__schedule+0x68/0x5bc) > [ 48.876357] [] (__schedule+0x68/0x5bc) from [] (__cond_resched+0x24/0x34) > [ 48.885368] [] (__cond_resched+0x24/0x34) from [] (_cond_resched+0x34/0x44) > [ 48.894559] [] (_cond_resched+0x34/0x44) from [] (kmem_cache_alloc_trace+0x2c/0x158) > [ 48.904578] [] (kmem_cache_alloc_trace+0x2c/0x158) from [] (mac802154_header_create+0x44/0x2) > [ 48.915594] [] (mac802154_header_create+0x44/0x24c) from [] (lowpan_header_create.part.3+0x7) > [ 48.927157] [] (lowpan_header_create.part.3+0x734/0x79c) from [] (neigh_connected_output+0x9) > [ 48.938542] [] (neigh_connected_output+0x98/0xd0) from [] (ip6_finish_output2+0x374/0x45c) > [ 48.949102] [] (ip6_finish_output2+0x374/0x45c) from [] (ndisc_send_skb+0x174/0x22c) > [ 48.959101] [] (ndisc_send_skb+0x174/0x22c) from [] (ndisc_send_rs+0x3c/0x44) > [ 48.968473] [] (ndisc_send_rs+0x3c/0x44) from [] (addrconf_rs_timer+0xbc/0x16c) > [ 48.978032] [] (addrconf_rs_timer+0xbc/0x16c) from [] (call_timer_fn+0x74/0x134) > [ 48.987675] [] (call_timer_fn+0x74/0x134) from [] (run_timer_softirq+0x258/0x2d4) > [ 48.997417] [] (run_timer_softirq+0x258/0x2d4) from [] (__do_softirq+0x118/0x248) > [ 49.007156] [] (__do_softirq+0x118/0x248) from [] (irq_exit+0x44/0x84) > [ 49.015890] [] (irq_exit+0x44/0x84) from [] (handle_IRQ+0x7c/0xb8) > [ 49.024249] [] (handle_IRQ+0x7c/0xb8) from [] (omap3_intc_handle_irq+0x54/0x68) > [ 49.033801] [] (omap3_intc_handle_irq+0x54/0x68) from [] (__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] [] (__irq_svc+0x40/0x50) from [] (default_idle+0x24/0x2c) > [ 49.079789] [] (default_idle+0x24/0x2c) from [] (cpu_idle+0x9c/0xf0) > [ 49.088328] [] (cpu_idle+0x9c/0xf0) from [] (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 > --- > 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.