From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753586Ab1ATPwN (ORCPT ); Thu, 20 Jan 2011 10:52:13 -0500 Received: from eu1sys200aog112.obsmtp.com ([207.126.144.133]:49885 "EHLO eu1sys200aog112.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751614Ab1ATPwL (ORCPT ); Thu, 20 Jan 2011 10:52:11 -0500 Message-ID: <4D3859EF.1030706@stericsson.com> Date: Thu, 20 Jan 2011 16:51:11 +0100 From: Mian Yousaf Kaukab User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Lightning/1.0b1 Thunderbird/3.0.10 MIME-Version: 1.0 To: Yang Ruirui Cc: Greg Kroah-Hartman , Linus WALLEIJ , Felipe Balbi , Heikki Krogerus , Tejun Heo , Samuel Ortiz , Hema HK , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] usb otg: use atomic notifier instead of blocking notifier References: <20110119092011.GA23624@darkstar> In-Reply-To: <20110119092011.GA23624@darkstar> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/19/2011 10:20 AM, Yang Ruirui wrote: > following bug happens with meego 2.6.35 kernel on nokia n900: > > [ 28.693756] BUG: sleeping function called from invalid context at kernel/rwsem.c:21 > [ 28.693786] in_atomic(): 1, irqs_disabled(): 128, pid: 706, name: udisks-part-id > [ 28.693817] 1 lock held by udisks-part-id/706: > [ 28.693817] #0: (&(&musb->lock)->rlock){-.-...}, at: [] musb_g_disconnect+0x90/0x148 > [ 28.693908] irq event stamp: 1169 > [ 28.693908] hardirqs last enabled at (1168): [] kmem_cache_alloc+0xd0/0x128 > [ 28.693969] hardirqs last disabled at (1169): [] __irq_svc+0x34/0xb4 > [ 28.694000] softirqs last enabled at (0): [] copy_process+0x304/0xe18 > [ 28.694030] softirqs last disabled at (0): [<(null)>] (null) > [ 28.694091] [] (unwind_backtrace+0x0/0xec) from [] (down_read+0x20/0x5c) > [ 28.694152] [] (down_read+0x20/0x5c) from [] (__blocking_notifier_call_chain+0x2c/0x5c) > [ 28.694183] [] (__blocking_notifier_call_chain+0x2c/0x5c) from [] (blocking_notifier_call_chain+0x14/0x18) > [ 28.694213] [] (blocking_notifier_call_chain+0x14/0x18) from [] (musb_gadget_vbus_draw+0x38/0x60) > [ 28.694274] [] (musb_gadget_vbus_draw+0x38/0x60) from [] (musb_interrupt+0xb08/0xcb0) > [ 28.694305] [] (musb_interrupt+0xb08/0xcb0) from [] (generic_interrupt+0x50/0x68) > [ 28.694335] [] (generic_interrupt+0x50/0x68) from [] (handle_IRQ_event+0x24/0xe8) > [ 28.694396] [] (handle_IRQ_event+0x24/0xe8) from [] (handle_level_irq+0xac/0x128) > [ 28.694427] [] (handle_level_irq+0xac/0x128) from [] (asm_do_IRQ+0x70/0x90) > [ 28.694458] [] (asm_do_IRQ+0x70/0x90) from [] (__irq_svc+0x4c/0xb4) > [ 28.694488] Exception stack(0xcd835ed0 to 0xcd835f18) > [ 28.694519] 5ec0: cfc0a240 c8282000 0000006b 0000006b > [ 28.694549] 5ee0: cfc0a240 0000041a 00001000 00000000 c8282000 cd834000 c8282000 be80c464 > [ 28.694580] 5f00: 00000c1e cd835f18 c00c333c c00c297c 80000013 ffffffff > [ 28.694610] [] (__irq_svc+0x4c/0xb4) from [] (check_poison_obj+0x24/0x194) > [ 28.694641] [] (check_poison_obj+0x24/0x194) from [] (cache_alloc_debugcheck_after+0x28/0x188) > [ 28.694671] [] (cache_alloc_debugcheck_after+0x28/0x188) from [] (kmem_cache_alloc+0xe8/0x128) > [ 28.694732] [] (kmem_cache_alloc+0xe8/0x128) from [] (getname+0x18/0xcc) > [ 28.694763] [] (getname+0x18/0xcc) from [] (do_sys_open+0x18/0x10c) > [ 28.694793] [] (do_sys_open+0x18/0x10c) from [] (ret_fast_syscall+0x0/0x3c) > [ 28.694854] > [ 28.694854] ================================= > [ 28.709014] [ INFO: inconsistent lock state ] > [ 28.717254] 2.6.35.96.5-adaptation-n900 #1 > [ 28.725128] --------------------------------- > [ 28.733123] inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-R} usage. > [ 28.742980] udisks-part-id/706 [HC1[1]:SC0[0]:HE0:SE1] takes: > [ 28.752441] (&(&twl->otg.notifier)->rwsem){+-+...}, at: [] __blocking_notifier_call_chain+0x2c/0x5c > [ 28.769836] {HARDIRQ-ON-W} state was registered at: > [ 28.778320] [] __lock_acquire+0x618/0x1730 > [ 28.787109] [] lock_acquire+0x60/0x74 > [ 28.795227] [] down_write+0x48/0x5c > [ 28.803131] [] blocking_notifier_chain_register+0x30/0x54 > [ 28.812896] [] isp1704_charger_probe+0x268/0x39c [isp1704_charger] > [ 28.823394] [] platform_drv_probe+0x18/0x1c > [ 28.831787] [] driver_probe_device+0xa8/0x158 > [ 28.840332] [] __driver_attach+0x68/0x8c > [ 28.848510] [] bus_for_each_dev+0x44/0x74 > [ 28.856689] [] bus_add_driver+0x9c/0x20c > [ 28.864746] [] driver_register+0xa8/0x138 > [ 28.872955] [] do_one_initcall+0x58/0x1ac > [ 28.881134] [] sys_init_module+0x90/0x1b0 > [ 28.889343] [] ret_fast_syscall+0x0/0x3c > [ 28.897491] irq event stamp: 1169 > [ 28.904083] hardirqs last enabled at (1168): [] kmem_cache_alloc+0xd0/0x128 > [ 28.915557] hardirqs last disabled at (1169): [] __irq_svc+0x34/0xb4 > [ 28.926239] softirqs last enabled at (0): [] copy_process+0x304/0xe18 > [ 28.937194] softirqs last disabled at (0): [<(null)>] (null) > [ 28.946258] > [ 28.946258] other info that might help us debug this: > [ 28.959381] 1 lock held by udisks-part-id/706: > [ 28.967163] #0: (&(&musb->lock)->rlock){-.-...}, at: [] musb_g_disconnect+0x90/0x148 > [ 28.979705] > [ 28.979705] stack backtrace: > [ 28.990997] [] (unwind_backtrace+0x0/0xec) from [] (print_usage_bug+0x170/0x1b4) > [ 29.007293] [] (print_usage_bug+0x170/0x1b4) from [] (mark_lock+0x358/0x628) > [ 29.019836] [] (mark_lock+0x358/0x628) from [] (__lock_acquire+0x554/0x1730) > [ 29.032409] [] (__lock_acquire+0x554/0x1730) from [] (lock_acquire+0x60/0x74) > [ 29.045166] [] (lock_acquire+0x60/0x74) from [] (down_read+0x48/0x5c) > [ 29.057250] [] (down_read+0x48/0x5c) from [] (__blocking_notifier_call_chain+0x2c/0x5c) > [ 29.074920] [] (__blocking_notifier_call_chain+0x2c/0x5c) from [] (blocking_notifier_call_chain+0x14/0x18) > [ 29.094573] [] (blocking_notifier_call_chain+0x14/0x18) from [] (musb_gadget_vbus_draw+0x38/0x60) > [ 29.113891] [] (musb_gadget_vbus_draw+0x38/0x60) from [] (musb_interrupt+0xb08/0xcb0) > [ 29.132629] [] (musb_interrupt+0xb08/0xcb0) from [] (generic_interrupt+0x50/0x68) > [ 29.151580] [] (generic_interrupt+0x50/0x68) from [] (handle_IRQ_event+0x24/0xe8) > [ 29.171081] [] (handle_IRQ_event+0x24/0xe8) from [] (handle_level_irq+0xac/0x128) > [ 29.190948] [] (handle_level_irq+0xac/0x128) from [] (asm_do_IRQ+0x70/0x90) > [ 29.205291] [] (asm_do_IRQ+0x70/0x90) from [] (__irq_svc+0x4c/0xb4) > [ 29.218963] Exception stack(0xcd835ed0 to 0xcd835f18) > [ 29.229644] 5ec0: cfc0a240 c8282000 0000006b 0000006b > [ 29.243591] 5ee0: cfc0a240 0000041a 00001000 00000000 c8282000 cd834000 c8282000 be80c464 > [ 29.257629] 5f00: 00000c1e cd835f18 c00c333c c00c297c 80000013 ffffffff > [ 29.270111] [] (__irq_svc+0x4c/0xb4) from [] (check_poison_obj+0x24/0x194) > [ 29.284637] [] (check_poison_obj+0x24/0x194) from [] (cache_alloc_debugcheck_after+0x28/0x188) > [ 29.306732] [] (cache_alloc_debugcheck_after+0x28/0x188) from [] (kmem_cache_alloc+0xe8/0x128) > [ 29.329071] [] (kmem_cache_alloc+0xe8/0x128) from [] (getname+0x18/0xcc) > [ 29.343597] [] (getname+0x18/0xcc) from [] (do_sys_open+0x18/0x10c) > [ 29.357696] [] (do_sys_open+0x18/0x10c) from [] (ret_fast_syscall+0x0/0x3c) > > Actually the blocking notifier chain runs in process context, so not fit for use here. > > For mainline kernel there's such issue as well. > Here fix this problem by changing to use atomic_notifier. > > Signed-off-by: Yang Ruirui > for ab8500-usb.c parts: Acked-by: Mian Yousaf Kaukab -- Mian Yousaf Kaukab