Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752688Ab2KRRGm (ORCPT ); Sun, 18 Nov 2012 12:06:42 -0500 Received: from mail-ia0-f174.google.com ([209.85.210.174]:65096 "EHLO mail-ia0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752618Ab2KRRGk (ORCPT ); Sun, 18 Nov 2012 12:06:40 -0500 MIME-Version: 1.0 Date: Sun, 18 Nov 2012 12:06:40 -0500 Message-ID: Subject: [Patch v1 1/1] RTL8712 alignment bug in 3.6.5 on ARM From: Josh Coombs To: linux ARM , wlanfae@realtek.com, Larry.Finger@lwfinger.net, florian.c.schilhabel@googlemail.com, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Andrew Lunn Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 9596 Lines: 191 Starting with 3.6.5 on a Marvell Kirkwood based GoFlex Net I began observing scheduler bugs when using a USB based RTL8712 WiFi NIC. These would eventually overwhelm systemd's logger under moderate network activity and crash the box. [ 64.312377] BUG: scheduling while atomic: crond/151/0x40000300 [ 79.771862] BUG: scheduling while atomic: swapper/0/0x40000500 [ 81.826267] BUG: scheduling while atomic: swapper/0/0x40000500 [ 90.330911] BUG: scheduling while atomic: swapper/0/0x40000500 Working with Andrew Lunn we dug in further with full stack traces: [ 53.173973] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready [ 54.191655] BUG: scheduling while atomic: crond/144/0x40000300 [ 54.197537] Modules linked in: rmd160 sha1_generic hmac blowfish_generic blowfish_common sr_mod cdrom fbcon bitblit softcursor font udlfb syscopyarea sysfillrect sysimgblt fb_sys_fops fb hid_generic snd_usb_audio snd_usbmidi_lib snd_hwdep mct_u232 snd_rawmidi snd_seq_device snd_pcm snd_page_alloc usbhid usbserial snd_timer snd hid soundcore mv_cesa cryptodev(O) ipv6 autofs4 [ 54.231214] [] (unwind_backtrace+0x0/0xe0) from [] (__schedule_bug+0x48/0x60) [ 54.240171] [] (__schedule_bug+0x48/0x60) from [] (__schedule+0x4c/0x4bc) [ 54.248773] [] (__schedule+0x4c/0x4bc) from [] (__cond_resched+0x24/0x34) [ 54.257365] [] (__cond_resched+0x24/0x34) from [] (_cond_resched+0x3c/0x44) [ 54.266134] [] (_cond_resched+0x3c/0x44) from [] (do_alignment+0x29c/0x784) [ 54.274895] [] (do_alignment+0x29c/0x784) from [] (do_DataAbort+0x34/0x98) [ 54.283571] [] (do_DataAbort+0x34/0x98) from [] (__dabt_svc+0x38/0x60) [ 54.291891] Exception stack(0xc4575ac8 to 0xc4575b10) [ 54.296976] 5ac0: 00000138 00000000 00000000 00000000 c781c200 00000000 [ 54.305209] 5ae0: c7020338 c7000440 c70806e4 0000090e c781c238 c781c220 00000002 c4575b10 [ 54.313438] 5b00: c035f994 c035f4bc 60000013 ffffffff [ 54.318536] [] (__dabt_svc+0x38/0x60) from [] (r8712_xmitframe_coalesce+0x388/0x8a0) [ 54.328092] [] (r8712_xmitframe_coalesce+0x388/0x8a0) from [] (r8712_xmit_direct+0x18/0x40) [ 54.338256] [] (r8712_xmit_direct+0x18/0x40) from [] (r8712_pre_xmit+0xac/0xb4) [ 54.347373] [] (r8712_pre_xmit+0xac/0xb4) from [] (r8712_xmit_entry+0x70/0xf0) [ 54.356410] [] (r8712_xmit_entry+0x70/0xf0) from [] (dev_hard_start_xmit+0x440/0x67c) [ 54.366056] [] (dev_hard_start_xmit+0x440/0x67c) from [] (sch_direct_xmit+0x50/0x1a4) [ 54.375694] [] (sch_direct_xmit+0x50/0x1a4) from [] (dev_queue_xmit+0x2ec/0x4d8) [ 54.384993] [] (dev_queue_xmit+0x2ec/0x4d8) from [] (ip6_finish_output2+0x294/0x344 [ipv6]) [ 54.395288] [] (ip6_finish_output2+0x294/0x344 [ipv6]) from [] (ndisc_send_skb+0x110/0x1f4 [ipv6]) [ 54.406202] [] (ndisc_send_skb+0x110/0x1f4 [ipv6]) from [] (ndisc_send_rs+0x3c/0x44 [ipv6]) [ 54.416493] [] (ndisc_send_rs+0x3c/0x44 [ipv6]) from [] (addrconf_dad_completed+0x80/0xc0 [ipv6]) [ 54.427289] [] (addrconf_dad_completed+0x80/0xc0 [ipv6]) from [] (addrconf_dad_timer+0x70/0x10c [ipv6]) [ 54.438563] [] (addrconf_dad_timer+0x70/0x10c [ipv6]) from [] (run_timer_softirq+0x1b0/0x2fc) [ 54.448904] [] (run_timer_softirq+0x1b0/0x2fc) from [] (__do_softirq+0xa0/0x1f8) [ 54.458103] [] (__do_softirq+0xa0/0x1f8) from [] (irq_exit+0x40/0x8c) [ 54.466345] [] (irq_exit+0x40/0x8c) from [] (handle_IRQ+0x64/0x84) [ 54.474322] [] (handle_IRQ+0x64/0x84) from [] (__irq_svc+0x34/0x78) [ 54.482389] [] (__irq_svc+0x34/0x78) from [] (lookup_fast+0x74/0x258) [ 54.490615] [] (lookup_fast+0x74/0x258) from [] (path_lookupat+0xfc/0x71c) [ 54.499286] [] (path_lookupat+0xfc/0x71c) from [] (do_path_lookup+0x1c/0x5c) [ 54.508138] [] (do_path_lookup+0x1c/0x5c) from [] (user_path_at_empty+0x54/0x8c) [ 54.517338] [] (user_path_at_empty+0x54/0x8c) from [] (user_path_at+0x10/0x14) [ 54.526368] [] (user_path_at+0x10/0x14) from [] (vfs_fstatat+0x2c/0x5c) [ 54.534789] [] (vfs_fstatat+0x2c/0x5c) from [] (sys_stat64+0x14/0x30) [ 54.543027] [] (sys_stat64+0x14/0x30) from [] (ret_fast_syscall+0x0/0x2c) [ 54.831585] BUG: scheduling while atomic: crond/144/0x40000300 [ 54.837464] Modules linked in: rmd160 sha1_generic hmac blowfish_generic blowfish_common sr_mod cdrom fbcon bitblit softcursor font udlfb syscopyarea sysfillrect sysimgblt fb_sys_fops fb hid_generic snd_usb_audio snd_usbmidi_lib snd_hwdep mct_u232 snd_rawmidi snd_seq_device snd_pcm snd_page_alloc usbhid usbserial snd_timer snd hid soundcore mv_cesa cryptodev(O) ipv6 autofs4 [ 54.871168] [] (unwind_backtrace+0x0/0xe0) from [] (__schedule_bug+0x48/0x60) [ 54.880117] [] (__schedule_bug+0x48/0x60) from [] (__schedule+0x4c/0x4bc) [ 54.888714] [] (__schedule+0x4c/0x4bc) from [] (__cond_resched+0x24/0x34) [ 54.897309] [] (__cond_resched+0x24/0x34) from [] (_cond_resched+0x3c/0x44) [ 54.906079] [] (_cond_resched+0x3c/0x44) from [] (do_alignment+0x29c/0x784) [ 54.914839] [] (do_alignment+0x29c/0x784) from [] (do_DataAbort+0x34/0x98) [ 54.923515] [] (do_DataAbort+0x34/0x98) from [] (__dabt_svc+0x38/0x60) [ 54.931832] Exception stack(0xc4575b28 to 0xc4575b70) [ 54.936917] 5b20: 00000138 00000000 00000000 00000000 c781a200 00000000 [ 54.945153] 5b40: c70203dc c7000440 c70806e4 0000090e c781a238 c781a220 00000016 c4575b70 [ 54.953381] 5b60: c035f994 c035f4bc 60000013 ffffffff [ 54.958490] [] (__dabt_svc+0x38/0x60) from [] (r8712_xmitframe_coalesce+0x388/0x8a0) [ 54.968045] [] (r8712_xmitframe_coalesce+0x388/0x8a0) from [] (r8712_xmit_direct+0x18/0x40) [ 54.978209] [] (r8712_xmit_direct+0x18/0x40) from [] (r8712_pre_xmit+0xac/0xb4) [ 54.987320] [] (r8712_pre_xmit+0xac/0xb4) from [] (r8712_xmit_entry+0x70/0xf0) [ 54.996354] [] (r8712_xmit_entry+0x70/0xf0) from [] (dev_hard_start_xmit+0x440/0x67c) [ 55.005998] [] (dev_hard_start_xmit+0x440/0x67c) from [] (sch_direct_xmit+0x50/0x1a4) [ 55.015636] [] (sch_direct_xmit+0x50/0x1a4) from [] (dev_queue_xmit+0x2ec/0x4d8) [ 55.024971] [] (dev_queue_xmit+0x2ec/0x4d8) from [] (mld_sendpack+0x184/0x300 [ipv6]) [ 55.034774] [] (mld_sendpack+0x184/0x300 [ipv6]) from [] (mld_ifc_timer_expire+0x1e8/0x234 [ipv6]) [ 55.045636] [] (mld_ifc_timer_expire+0x1e8/0x234 [ipv6]) from [] (run_timer_softirq+0x1b0/0x2fc) [ 55.056238] [] (run_timer_softirq+0x1b0/0x2fc) from [] (__do_softirq+0xa0/0x1f8) [ 55.065448] [] (__do_softirq+0xa0/0x1f8) from [] (irq_exit+0x40/0x8c) [ 55.073691] [] (irq_exit+0x40/0x8c) from [] (handle_IRQ+0x64/0x84) [ 55.081668] [] (handle_IRQ+0x64/0x84) from [] (__irq_svc+0x34/0x78) [ 55.089725] [] (__irq_svc+0x34/0x78) from [] (path_init+0x4/0x310) [ 55.097707] [] (path_init+0x4/0x310) from [] (path_lookupat+0x2c/0x71c) [ 55.106120] [] (path_lookupat+0x2c/0x71c) from [] (do_path_lookup+0x1c/0x5c) [ 55.114970] [] (do_path_lookup+0x1c/0x5c) from [] (user_path_at_empty+0x54/0x8c) [ 55.124170] [] (user_path_at_empty+0x54/0x8c) from [] (user_path_at+0x10/0x14) [ 55.133202] [] (user_path_at+0x10/0x14) from [] (vfs_fstatat+0x2c/0x5c) [ 55.141622] [] (vfs_fstatat+0x2c/0x5c) from [] (sys_stat64+0x14/0x30) [ 55.149846] [] (sys_stat64+0x14/0x30) from [] (ret_fast_syscall+0x0/0x2c) This pointed to a non-aligned access, which my patch below corrects. I've verified 3.6.4 does not show these symptoms, 3.6.5 and 3.6.6 do, with the patch below the bug goes away on my system. Tested-by: Joshua Coombs -- diff -ruN a/drivers/staging/rtl8712/rtl871x_sta_mgt.c b/drivers/staging/rtl8712/rtl871x_sta_mgt.c --- a/drivers/staging/rtl8712/rtl871x_sta_mgt.c 2012-11-05 03:57:06.000000000 -0500 +++ b/drivers/staging/rtl8712/rtl871x_sta_mgt.c 2012-11-13 12:54:28.000000000 -0500 @@ -55,8 +55,8 @@ NUM_STA + 4); if (pstapriv->pallocated_stainfo_buf == NULL) return _FAIL; - pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 4 - - ((addr_t)(pstapriv->pallocated_stainfo_buf) & 3); + pstapriv->pstainfo_buf = pstapriv->pallocated_stainfo_buf + 8 - + ((addr_t)(pstapriv->pallocated_stainfo_buf) & 7); _init_queue(&pstapriv->free_sta_queue); spin_lock_init(&pstapriv->sta_hash_lock); pstapriv->asoc_sta_count = 0; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/