From owner-freebsd-current@FreeBSD.ORG Thu Feb 27 11:32:31 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 74712967 for ; Thu, 27 Feb 2014 11:32:31 +0000 (UTC) Received: from smtp.mei.co.jp (smtp.mei.co.jp [133.183.100.20]) by mx1.freebsd.org (Postfix) with ESMTP id 149BB1BE5 for ; Thu, 27 Feb 2014 11:32:30 +0000 (UTC) Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile14) with ESMTP id s1RBWQ3i019822; Thu, 27 Feb 2014 20:32:26 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili13) with ESMTP id s1RBWRJ26270; Thu, 27 Feb 2014 20:32:27 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi17) id s1RBWR9L008236; Thu, 27 Feb 2014 20:32:27 +0900 Received: from localhost by lomi17.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id s1RBWQVe008202; Thu, 27 Feb 2014 20:32:26 +0900 Date: Thu, 27 Feb 2014 20:32:26 +0900 (JST) Message-Id: <20140227.203226.2191673573133476018.okuno.kohji@jp.panasonic.com> To: hps@bitfrost.no Subject: Re: kqueue for usb_dev From: Kohji Okuno In-Reply-To: <530F197D.6040004@bitfrost.no> References: <20140227.190128.1827840697797583715.okuno.kohji@jp.panasonic.com> <20140227.193914.1745107579233813450.okuno.kohji@jp.panasonic.com> <530F197D.6040004@bitfrost.no> Organization: Panasonic Corporation X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: jmg@funkthat.com, freebsd-current@freebsd.org, okuno.kohji@jp.panasonic.com X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Feb 2014 11:32:31 -0000 Hi HPS, Your patch did not resolve the kernel panic. I think, we should check knlist_clear() before knlist_destroy(). When a device is lost suddenly, usb_dev notify to a process in usb_fifo_close() and then calls knlist_destroy(). knlist_destroy() clears knlist->kn_lock and knlist->kn_unlock. But, the process that is notified will start over kqueue_scan() after knlist_destroy(). And, in KN_LIST_LOCK(kn), the context will call NULL function (kn->knlist->kn_lock). Regards, Kohji Okuno > On 02/27/14 11:39, Kohji Okuno wrote: >> Hi HPS and John-Mark, >> >> After I changed as the following, the kernel panic does not happen. >> What do you think about this change? >> >> + knlist_clear(&f->selinfo.si_note, 0); >> knlist_destroy(&f->selinfo.si_note); >> >> Regards, >> Kohji Okuno >> > > Can you try the attached patch instead? > > --HPS >