From owner-freebsd-arch@FreeBSD.ORG Sun Sep 13 15:27:24 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 DC0A7106566B; Sun, 13 Sep 2009 15:27:24 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mx1.freebsd.org (Postfix) with ESMTP id 1093C8FC08; Sun, 13 Sep 2009 15:27:23 +0000 (UTC) Received: by bwz2 with SMTP id 2so1521649bwz.43 for ; Sun, 13 Sep 2009 08:27:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type; bh=39aPpSMe6dgdVe4Lg+XqBZDv0zhDP/mp5Xq+Bx4e2PY=; b=mVAz5/+DVgjGjPAJvgm1YI2OYI5Q1TFhuvG5NnuWqAJdGPBgfPyw4r0F3XJq28dSD3 CiTk5rAEPhLTbbXX8IibntEiXxX504H4h8Wjpi1FMnaGTSwiT6ewFm5AHPsFJhJCjvhF zVm9LigfhczLkJ0eWy/0XKCBtkj88uVj8Eh0Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=iKBEulCPoNLQfuJv//bDkae1P0SwWpfXzvaDyB2RHrwic5rzvBQoDrqFMvla75hfLb P437J4Az2tlz9Xkc4vsQUyfD1p+1E2U6GBPkKBiA2GHpug0ke4gCD6jpdxYMm3JOy3zW Za773jF7+cULXUdiFKc9oDndrKkiLSvwEgncw= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.223.5.87 with SMTP id 23mr1875697fau.87.1252855642879; Sun, 13 Sep 2009 08:27:22 -0700 (PDT) In-Reply-To: <200909121009.22931.hselasky@c2i.net> References: <200909031340.n83Defkv034013@svn.freebsd.org> <3bbf2fe10909041546y2b5633e1ue063955568df1a06@mail.gmail.com> <200909080936.37603.jhb@freebsd.org> <200909121009.22931.hselasky@c2i.net> Date: Sun, 13 Sep 2009 17:27:21 +0200 X-Google-Sender-Auth: b918787303fbe116 Message-ID: <3bbf2fe10909130827m5d8381ebv3e7167986f1f104d@mail.gmail.com> From: Attilio Rao To: Hans Petter Selasky Content-Type: text/plain; charset=UTF-8 Cc: arch@freebsd.org, freebsd-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: Sun, 13 Sep 2009 15:27:25 -0000 2009/9/12 Hans Petter Selasky : > 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(). Yes, I think there was an error in the logic. However I reverted them because we decided to go with another approach. I'm not sure if your patch (I still didn't review them) are though necessary even in the case of a saner logic, so for the moment, try to not loose them. Attilio -- Peace can only be achieved by understanding - A. Einstein