From owner-freebsd-arch@FreeBSD.ORG Fri Jul 9 21:18:55 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6E3B216A4CE for ; Fri, 9 Jul 2004 21:18:55 +0000 (GMT) Received: from srv1.cosmo-project.de (srv1.cosmo-project.de [213.83.6.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id DA36843D48 for ; Fri, 9 Jul 2004 21:18:54 +0000 (GMT) (envelope-from ticso@cicely12.cicely.de) Received: from cicely5.cicely.de (cicely5.cicely.de [IPv6:3ffe:400:8d0:301:200:92ff:fe9b:20e7]) (authenticated bits=0) i69LIoaI070613 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Fri, 9 Jul 2004 23:18:52 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (cicely12.cicely.de [IPv6:3ffe:400:8d0:301::12]) by cicely5.cicely.de (8.12.10/8.12.10) with ESMTP id i69LILUi029544 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 9 Jul 2004 23:18:22 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: from cicely12.cicely.de (localhost [127.0.0.1]) by cicely12.cicely.de (8.12.11/8.12.11) with ESMTP id i69LILxC038097; Fri, 9 Jul 2004 23:18:21 +0200 (CEST) (envelope-from ticso@cicely12.cicely.de) Received: (from ticso@localhost) by cicely12.cicely.de (8.12.11/8.12.11/Submit) id i69LIKWR038096; Fri, 9 Jul 2004 23:18:20 +0200 (CEST) (envelope-from ticso) Date: Fri, 9 Jul 2004 23:18:20 +0200 From: Bernd Walter To: Lukas Ertl Message-ID: <20040709211819.GC35892@cicely12.cicely.de> References: <20040709170834.U581@korben.in.tern> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040709170834.U581@korben.in.tern> X-Operating-System: FreeBSD cicely12.cicely.de 5.2-CURRENT alpha User-Agent: Mutt/1.5.6i X-Spam-Status: No, hits=-4.9 required=3.0 tests=BAYES_00 autolearn=ham version=2.61 X-Spam-Report: * -4.9 BAYES_00 BODY: Bayesian spam probability is 0 to 1% * [score: 0.0000] X-Spam-Checker-Version: SpamAssassin 2.61 (1.212.2.1-2003-12-09-exp) on cicely5.cicely.de cc: arch@freebsd.org Subject: Re: USB locking X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: ticso@cicely.de List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2004 21:18:55 -0000 On Fri, Jul 09, 2004 at 05:10:55PM +0200, Lukas Ertl wrote: > Hello, > > I've prepared a patch that adds some basic locking primitives to parts of > the USB stack (usb.c, uhci.c, ehci.c). Mainly, I've added some mutexes > and applied them instead of calls to spl*, wrapped into #ifdef's to stay > somewhat compatible with NetBSD. I'd be happy if I could get some review. > > Just replacing spl* with locks is not enough to protect code. spls were only required to protect from interrupts, but whithout GIANT we need to protect from multiple userland calls as well. One point that I noticed was that you call usb_transfer_complete with a lock held - this function will run the upcall function of the xfer issuer, which is code you don't know anything about. -- B.Walter BWCT http://www.bwct.de bernd@bwct.de info@bwct.de