Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757023Ab1D1Nbm (ORCPT ); Thu, 28 Apr 2011 09:31:42 -0400 Received: from relay.ptn-ipout02.plus.net ([212.159.7.36]:61117 "EHLO relay.ptn-ipout02.plus.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751802Ab1D1Nbk (ORCPT ); Thu, 28 Apr 2011 09:31:40 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq0oABlsuU1UXebr/2dsb2JhbACCNIJfkz6NL3eyYQKHTYkXDoVoBJJwglyHGQ Subject: mutex deadlock in w1/slaves/w1_ds2760 From: "Paul Parsons" To: Cc: Date: Thu, 28 Apr 2011 13:31:37 +0000 Content-Type: text/plain Mime-Version: 1.0 X-Mailer: email v2.5.0 (Linux 2.6.38 x86_64 [http://email.cleancode.org]) Message-Id: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2037 Lines: 46 I found a mutex deadlock in w1/slaves/w1_ds2760. The deadlock is intermittent in linux-2.6.39-rc4 (as though a race condition) but seems consistent in linux-2.6.39-rc5. The platform is an iPAQ hx4700 (XScale-PXA270). I can demonstrate the deadlock by adding some printk() calls, replacing the mutex_lock() call in w1_ds2760_io() with mutex_trylock(), and dumping the stack trace if mutex_trylock() fails. Here's the dmesg output: w1_process: mutex_lock(0xc3921e68) w1_ds2760_io: mutex_trylock(0xc3921e68) [] save_stack_trace_tsk+0x0/0xc4 [] save_stack_trace+0x24/0x28 [] w1_ds2760_io+0x12c/0x144 [] w1_ds2760_read+0x1c/0x24 [] ds2760_battery_read_status+0x3c/0x31c [] ds2760_battery_probe+0xb0/0x26c [] platform_drv_probe+0x1c/0x20 [] driver_probe_device+0x88/0x18c [] __device_attach+0x48/0x4c [] bus_for_each_drv+0x6c/0x94 [] device_attach+0x64/0x7c [] bus_probe_device+0x30/0x50 [] device_add+0x4ec/0x5cc [] platform_device_add+0x100/0x198 [] w1_ds2760_add_slave+0x90/0xfc [] w1_attach_slave_device+0x1a4/0x370 [] w1_slave_found+0x158/0x15c [] ds1wm_search+0xd8/0xdc [] w1_search_devices+0x44/0x50 [] w1_search_process+0x5c/0xf0 [] w1_process+0xf4/0x120 [] kthread+0x90/0x98 [] do_exit+0x0/0x6e8 [] 0xffffffff w1_process: mutex_unlock(0xc3921e68) Explanation: 1. w1_process() locks the mutex at 0xc3921e68. 2. w1_ds2760_io() locks the same mutex at 0xc3921e68 and thus mutex_trylock() fails. 3. stack trace showing the function path from w1_process() to w1_ds2760_io(). 4. w1_process() unlocks the mutex at 0xc3921e68. -- 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/