From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ville Tervo Subject: tty: n_gsm: System lockup when closing n_gsm ldisc Date: Tue, 24 Jan 2012 13:52:59 +0200 Message-ID: <4F1E9B9B.1090008@nokia.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from smtp.nokia.com ([147.243.1.48]:58461 "EHLO mgw-sa02.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756261Ab2AXLxs (ORCPT ); Tue, 24 Jan 2012 06:53:48 -0500 Received: from [172.21.22.171] (helruo-dhcp022171.ntc.nokia.com [172.21.22.171]) by mgw-sa02.nokia.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id q0OBrkQK030278 for ; Tue, 24 Jan 2012 13:53:46 +0200 Sender: linux-serial-owner@vger.kernel.org List-Id: linux-serial@vger.kernel.org To: linux-serial@vger.kernel.org Hi, n_gsm seems to lockup when I do following actions. 1) open n_gsm on tty 2) open /dev/ttygsm1 and keep it open 4) close n_gsm Now I get following warning from lockdep. tty_vhangup() in n_gsm.c is trying to acquire BTM while tty_set_ldisc is already holding it. Inserting tty_unlock()/tty_lock() pair around tty_vhangup "solves" the lockup problem, but still leaves lockdep warning for lock(&tty->ldisc_mutex) and lock(big_tty_mutex) in SMP case. Any ideas how to fix this for real? ============================================= [ INFO: possible recursive locking detected ] 3.3.0-rc1-2-generic+ #51 Not tainted --------------------------------------------- n_gsm_test/891 is trying to acquire lock: (big_tty_mutex){+.+.+.}, at: [] tty_lock+0x14/0x20 but task is already holding lock: (big_tty_mutex){+.+.+.}, at: [] tty_lock+0x14/0x20 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(big_tty_mutex); lock(big_tty_mutex); *** DEADLOCK *** May be due to missing lock nesting notation 2 locks held by n_gsm_test/891: #0: (big_tty_mutex){+.+.+.}, at: [] tty_lock+0x14/0x20 #1: (&tty->ldisc_mutex){+.+.+.}, at: [] tty_set_ldisc+0x173/0x2b0 stack backtrace: Pid: 891, comm: n_gsm_test Not tainted 3.3.0-rc1-2-generic+ #51 Call Trace: [] ? printk+0x1d/0x1f [] print_deadlock_bug+0xda/0xe0 [] validate_chain.isra.35+0x5d2/0x6b0 [] __lock_acquire+0x34b/0x810 [] lock_acquire+0x90/0x1c0 [] ? tty_lock+0x14/0x20 [] ? local_clock+0x65/0x70 [] mutex_lock_nested+0x6d/0x340 [] ? tty_lock+0x14/0x20 [] ? __tty_hangup+0x4d/0x3d0 [] ? tty_lock+0x14/0x20 [] tty_lock+0x14/0x20 [] __tty_hangup+0x52/0x3d0 [] ? trace_hardirqs_on+0xb/0x10 [] tty_vhangup+0xd/0x10 [] gsm_cleanup_mux+0xd4/0x1d0 [] ? abort_exclusive_wait+0x80/0x80 [] gsmld_close+0x42/0x80 [] tty_ldisc_close.isra.5+0x35/0x50 [] tty_set_ldisc+0x196/0x2b0 [] ? might_fault+0x95/0xa0 [] tty_ioctl+0x65a/0x7c0 [] ? fsnotify+0x252/0x680 [] ? fsnotify+0x76/0x680 [] ? tty_ldisc_deref+0xd/0x10 [] ? tty_write+0x17f/0x230 [] ? check_flags+0x12/0x20 [] ? no_tty+0x30/0x30 [] do_vfs_ioctl+0x79/0x300 [] ? sysenter_exit+0xf/0x1a [] sys_ioctl+0x32/0x60 [] sysenter_do_call+0x12/0x3c -- Ville