public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oliver@neukum.org>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Valdis.Kletnieks@vt.edu, jkosina@suse.cz, gregkh@suse.de,
	linux-kernel@vger.kernel.org, Oleg Nesterov <oleg@tv-sign.ru>
Subject: Re: 29-rc-mmotm - HID/USB wedge w/ WARNING: at kernel/workqueue.c:371
Date: Wed, 18 Mar 2009 08:48:50 +0100	[thread overview]
Message-ID: <200903180848.51755.oliver@neukum.org> (raw)
In-Reply-To: <49C069F2.5040003@cn.fujitsu.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2014 bytes --]

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 <laijs@cn.fujitsu.com>> > 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;\0ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

  reply	other threads:[~2009-03-18  7:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-17  6:33 29-rc-mmotm - HID/USB wedge w/ WARNING: at kernel/workqueue.c:371 Valdis.Kletnieks
2009-03-17 14:58 ` Alan Cox
2009-03-17 15:07 ` Oliver Neukum
2009-03-17 16:55   ` Valdis.Kletnieks
2009-03-17 20:53 ` Greg KH
2009-03-17 23:48   ` Valdis.Kletnieks
2009-03-17 20:54 ` Andrew Morton
2009-03-17 22:01   ` Valdis.Kletnieks
2009-03-18  2:29     ` Lai Jiangshan
2009-03-18  2:50       ` Andrew Morton
2009-03-18  3:26         ` Lai Jiangshan
2009-03-18  7:48           ` Oliver Neukum [this message]
2009-03-20 13:42             ` Valdis.Kletnieks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200903180848.51755.oliver@neukum.org \
    --to=oliver@neukum.org \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@suse.de \
    --cc=jkosina@suse.cz \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@tv-sign.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox