From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754488AbZCRHoT (ORCPT ); Wed, 18 Mar 2009 03:44:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753702AbZCRHoJ (ORCPT ); Wed, 18 Mar 2009 03:44:09 -0400 Received: from smtp-out003.kontent.com ([81.88.40.217]:48721 "EHLO smtp-out003.kontent.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751716AbZCRHoI (ORCPT ); Wed, 18 Mar 2009 03:44:08 -0400 From: Oliver Neukum To: Lai Jiangshan Subject: Re: 29-rc-mmotm - HID/USB wedge w/ WARNING: at kernel/workqueue.c:371 Date: Wed, 18 Mar 2009 08:48:50 +0100 User-Agent: KMail/1.10.3 (Linux/2.6.27.7-9-default; KDE/4.1.3; x86_64; ; ) Cc: Andrew Morton , Valdis.Kletnieks@vt.edu, jkosina@suse.cz, gregkh@suse.de, linux-kernel@vger.kernel.org, Oleg Nesterov References: <6648.1237271589@turing-police.cc.vt.edu> <20090317195004.18fb6af6.akpm@linux-foundation.org> <49C069F2.5040003@cn.fujitsu.com> In-Reply-To: <49C069F2.5040003@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Message-Id: <200903180848.51755.oliver@neukum.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by alpha.home.local id n2I7iMqu005219 Am Mittwoch 18 März 2009 04:26:42 schrieb Lai Jiangshan:> Andrew Morton wrote:> > On Wed, 18 Mar 2009 10:29:40 +0800 Lai Jiangshan > > wrote:> >> >> > static void run_workqueue(struct cpu_workqueue_struct *cwq)> > {> > spin_lock_irq(&cwq->lock);> > cwq->run_depth++;> > if (cwq->run_depth > 3) {> > /* morton gets to eat his hat */> > printk("%s: recursion depth exceeded: %d\n",> > __func__, cwq->run_depth);> > dump_stack();> > }> >> > That was added five or six years ago, and I never ever got to eat my hat.>> If Valdis.Kletnieks let lockdep work, he will see the complain> from lockdep at first.>> >> If it's hard for you avoid flush_scheduled_work() in> >> keventd's work fuction by other fix, you can create> >> another workqueue to handle your works, IMO.> >> > Why do we need to change anything here? No known bugs were fixed, and> > some new ones were added.>> I prefer the code which has no known bugs and no known potential bugs.>> I defend myself:> I did not add a new bug as you said, it's the new code hid_cease_io()> adds a new unsafe usage of workqueue. Very well, here's a patch.Please test. Regards Oliverdiff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.cindex bc017cd..4306cb1 100644--- a/drivers/hid/usbhid/hid-core.c+++ b/drivers/hid/usbhid/hid-core.c@@ -1210,7 +1210,6 @@ static void hid_cease_io(struct usbhid_device *usbhid) usb_kill_urb(usbhid->urbin); usb_kill_urb(usbhid->urbctrl); usb_kill_urb(usbhid->urbout);- flush_scheduled_work(); } /* Treat USB reset pretty much the same as suspend/resume */@@ -1222,6 +1221,7 @@ static int hid_pre_reset(struct usb_interface *intf) spin_lock_irq(&usbhid->lock); set_bit(HID_RESET_PENDING, &usbhid->iofl); spin_unlock_irq(&usbhid->lock);+ cancel_work_sync(&usbhid->restart_work); hid_cease_io(usbhid); return 0;{.n++%ݶw{.n+{G{ayʇڙ,jfhz_(階ݢj"mG?&~iOzv^m ?I