From owner-freebsd-usb@FreeBSD.ORG Tue Dec 20 16:44:53 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB4D3106567D; Tue, 20 Dec 2011 16:44:53 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe03.c2i.net [212.247.154.66]) by mx1.freebsd.org (Postfix) with ESMTP id 0263A8FC1B; Tue, 20 Dec 2011 16:44:52 +0000 (UTC) X-T2-Spam-Status: No, hits=-0.2 required=5.0 tests=ALL_TRUSTED, BAYES_50 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe03.swip.net (CommuniGate Pro SMTP 5.4.2) with ESMTPA id 52872170; Tue, 20 Dec 2011 17:44:50 +0100 From: Hans Petter Selasky To: Andriy Gapon Date: Tue, 20 Dec 2011 17:42:23 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-STABLE; KDE/4.4.5; amd64; ; ) References: <4EF088C8.8090906@FreeBSD.org> In-Reply-To: <4EF088C8.8090906@FreeBSD.org> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201112201742.23998.hselasky@c2i.net> Cc: freebsd-usb@freebsd.org Subject: Re: ukbd locking update X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Dec 2011 16:44:53 -0000 On Tuesday 20 December 2011 14:08:24 Andriy Gapon wrote: > I completing a patch that changes some locking in ukbd to account for > SCHEDULER_STOPPED and for other realities of the code. > > As a preview I would like to share couple of observations that had their > effect on the patch. > > 1. Acquiring Giant in device_attach, _detach in similar newbus method > implementations should be redundant because those are already executed with > Giant held. That's done either by the general newbus code or via > usbd_enum_lock() when the operations are executed in the USB explore > thread. > > 2. As discussed before: > if (!mutex_owned(&Giant)) > mutex_lock(&Giant) > this pattern does not make sense, because the Giant is recursive and can be > simply acquired without any check. > > Do you agree? Yes! --HPS