From owner-freebsd-arch@FreeBSD.ORG Sat Sep 12 09:09:05 2009 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FEDD106568F; Sat, 12 Sep 2009 09:09:05 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe12.swip.net [212.247.155.97]) by mx1.freebsd.org (Postfix) with ESMTP id C33EA8FC15; Sat, 12 Sep 2009 09:09:04 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=GdtqiKf97NUA:10 a=MnI1ikcADjEx7bvsp0jZvQ==:17 a=6I5d2MoRAAAA:8 a=viAooO_9UH8L9rE-ugsA:9 a=2M0tjdNYXvltNyAZNdAA:7 a=-UOZAa_BRpAuh4d3qNN0x9cqlFUA:4 Received: from [188.126.201.140] (account mc467741@c2i.net HELO laptop.adsl.tele2.no) by mailfe12.swip.net (CommuniGate Pro SMTP 5.2.13) with ESMTPA id 1133208111; Sat, 12 Sep 2009 10:08:59 +0200 From: Hans Petter Selasky To: freebsd-arch@freebsd.org Date: Sat, 12 Sep 2009 10:09:21 +0200 User-Agent: KMail/1.11.4 (FreeBSD/9.0-CURRENT; KDE/4.2.4; i386; ; ) References: <200909031340.n83Defkv034013@svn.freebsd.org> <3bbf2fe10909041546y2b5633e1ue063955568df1a06@mail.gmail.com> <200909080936.37603.jhb@freebsd.org> In-Reply-To: <200909080936.37603.jhb@freebsd.org> X-Face: (%:6u[ldzJ`0qjD7sCkfdMmD*RxpOwEEQ+KWt[{J#x6ow~JO:,zwp.(t; @Aq :4:&nFCgDb8[3oIeTb^'",;u{5{}C9>"PuY\)!=#\u9SSM-nz8+SR~B\!qBv MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200909121009.22931.hselasky@c2i.net> Cc: Attilio Rao , arch@freebsd.org Subject: Re: NEWBUS states (was Re: svn commit: r196779 - in head/sys: kern sys) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Sep 2009 09:09:05 -0000 On Tuesday 08 September 2009 15:36:37 John Baldwin wrote: > On Friday 04 September 2009 6:46:03 pm Attilio Rao wrote: > > We all agreed the one-state was the better option but it can't be done > > in this way because of the device_is_attached() used in the detach > > virtual functions. Using just one transition state will break > > device_is_attached() in those parts. > > The right fix, as pointed out in other e-mails, is to not use > > device_is_attached() in detach virtual functions. The better fix, in > > my idea would involve: > > - replace the device_is_attached() usage in detach virtual functions, > > with a more functional support > > - use one-state transition > > > > But that is just too much job to push in before then 8.0-REL and if > > that would mean to not commit a patch and make impossible a future > > MFC, I prefer to go with a lesser-perfect-but-still-working-approach. > > Wait, all you need to MFC is the change to the enum. Fixing the various > detach routines does _not_ have to be in 8.0. That could be merged after > the release. Hi, http://svn.freebsd.org/viewvc/base/head/sys/kern/subr_bus.c?r1=196529&r2=196779 I'm sorry to say that the latest patches to subr_bus.c have broken USB. I've got several reports on memory used after free, due to bus_generic_detach() returning EBUSY when called from uhub_detach(). ... bus_generic_detach(device_t dev) { device_t child; int error; if (dev->state != DS_ATTACHED) return (EBUSY); TAILQ_FOREACH(child, &dev->children, link) { if ((error = device_detach(child)) != 0) return (error); } return (0); } A fix for USB is available here: http://perforce.freebsd.org/chv.cgi?CH=168387 --HPS