From owner-freebsd-arch@FreeBSD.ORG Sun Sep 13 15:20:43 2009 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3036A106566B for ; Sun, 13 Sep 2009 15:20:43 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-fx0-f210.google.com (mail-fx0-f210.google.com [209.85.220.210]) by mx1.freebsd.org (Postfix) with ESMTP id B92ED8FC0A for ; Sun, 13 Sep 2009 15:20:42 +0000 (UTC) Received: by fxm6 with SMTP id 6so1541846fxm.43 for ; Sun, 13 Sep 2009 08:20:41 -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=EmSY9MpxrYFKRrOO5VjAm4dNwER/BFa2mGIHygbM0jo=; b=eHlc40rRVo3k3ZNhxJd6iFpVbmkDswyDopb0r2Ntt8pWemVaeRmUqx/W6pd3SI5Mz+ h74wLhyU/V4opI1LUk7Oz5prNKBHZNy2e/OxRx3yYIDKh+nRO5Ca6ezRu2sOsxHHVhKt OL43GEvj5cL47ULGSCUjvkonks3MkfGCTAs0Q= 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=U6Jr1eFHOskCQWb0rNc5dX3TlU4oWLNC6T91r9OByAQfr0mbFfS/A6fVgUrneCVoCY kzpqUZvm7vnu9ibiz3mM7i/m6ok2foQi/7DJNgsQhpMpXqKONvQHVpW5tIyXhOAZWhKf b4H6M+o6Mpc28/ILSnjDZ5DEJCFEUlyiHKsFI= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.223.161.205 with SMTP id s13mr1922399fax.27.1252855241657; Sun, 13 Sep 2009 08:20:41 -0700 (PDT) In-Reply-To: <20090905.111446.500055027.imp@bsdimp.com> References: <3bbf2fe10909041546y2b5633e1ue063955568df1a06@mail.gmail.com> <20090904.172310.-1939841993.imp@bsdimp.com> <3bbf2fe10909050812l4340f679h6a4d7dae1daa3bf8@mail.gmail.com> <20090905.111446.500055027.imp@bsdimp.com> Date: Sun, 13 Sep 2009 17:20:41 +0200 X-Google-Sender-Auth: fc99d7fe187f3ee7 Message-ID: <3bbf2fe10909130820t62f03cfflcdf45a651db15f14@mail.gmail.com> From: Attilio Rao To: "M. Warner Losh" Content-Type: text/plain; charset=UTF-8 Cc: arch@freebsd.org Subject: Re: NEWBUS states 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:20:43 -0000 2009/9/5 M. Warner Losh : > Attilio, > > [[ trimmed ]] > > Sounds like we're getting closer to closure... > So I reverted r196779 and now I would like to commit and MFC just this patch: http://www.freebsd.org/~attilio/newbus9-8.diff I still think the good way to go is to use the device flags, but this patch will allow us to be highly flexible in terms of adding new states, if we need it in the future. Let me know if you have objections against that. Attilio -- Peace can only be achieved by understanding - A. Einstein From owner-freebsd-arch@FreeBSD.ORG Sun Sep 13 15:27:24 2009 Return-Path: Delivered-To: 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 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 From owner-freebsd-arch@FreeBSD.ORG Mon Sep 14 11:06:55 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 56C551065694 for ; Mon, 14 Sep 2009 11:06:55 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 2BDD78FC22 for ; Mon, 14 Sep 2009 11:06:55 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n8EB6tkd072246 for ; Mon, 14 Sep 2009 11:06:55 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n8EB6skK072242 for freebsd-arch@FreeBSD.org; Mon, 14 Sep 2009 11:06:54 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 14 Sep 2009 11:06:54 GMT Message-Id: <200909141106.n8EB6skK072242@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-arch@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-arch@FreeBSD.org 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: Mon, 14 Sep 2009 11:06:55 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/120749 arch [request] Suggest upping the default kern.ps_arg_cache 1 problem total. From owner-freebsd-arch@FreeBSD.ORG Mon Sep 14 13:13:37 2009 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08995106566C; Mon, 14 Sep 2009 13:13:37 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id CA96F8FC18; Mon, 14 Sep 2009 13:13:36 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 7D4DA46B2D; Mon, 14 Sep 2009 09:13:36 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id CA01D8A01B; Mon, 14 Sep 2009 09:13:35 -0400 (EDT) From: John Baldwin To: Hans Petter Selasky Date: Mon, 14 Sep 2009 08:52:48 -0400 User-Agent: KMail/1.9.7 References: <200909031340.n83Defkv034013@svn.freebsd.org> <200909080936.37603.jhb@freebsd.org> <200909121009.22931.hselasky@c2i.net> In-Reply-To: <200909121009.22931.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200909140852.49192.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 14 Sep 2009 09:13:35 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Attilio Rao , 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: Mon, 14 Sep 2009 13:13:37 -0000 On Saturday 12 September 2009 4:09:21 am Hans Petter Selasky wrote: > 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 I think bus_generic_detach() needs to work when called from a foo_detach() routine, so I think you don't need the USB changes. Even if the new states get reintroduced bus_generic_detach() will still have to work correctly the way you had used it. -- John Baldwin From owner-freebsd-arch@FreeBSD.ORG Mon Sep 14 13:13:37 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 08995106566C; Mon, 14 Sep 2009 13:13:37 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id CA96F8FC18; Mon, 14 Sep 2009 13:13:36 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 7D4DA46B2D; Mon, 14 Sep 2009 09:13:36 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id CA01D8A01B; Mon, 14 Sep 2009 09:13:35 -0400 (EDT) From: John Baldwin To: Hans Petter Selasky Date: Mon, 14 Sep 2009 08:52:48 -0400 User-Agent: KMail/1.9.7 References: <200909031340.n83Defkv034013@svn.freebsd.org> <200909080936.37603.jhb@freebsd.org> <200909121009.22931.hselasky@c2i.net> In-Reply-To: <200909121009.22931.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200909140852.49192.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Mon, 14 Sep 2009 09:13:35 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Attilio Rao , 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: Mon, 14 Sep 2009 13:13:37 -0000 On Saturday 12 September 2009 4:09:21 am Hans Petter Selasky wrote: > 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 I think bus_generic_detach() needs to work when called from a foo_detach() routine, so I think you don't need the USB changes. Even if the new states get reintroduced bus_generic_detach() will still have to work correctly the way you had used it. -- John Baldwin From owner-freebsd-arch@FreeBSD.ORG Mon Sep 14 14:21:59 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 C4D02106566B for ; Mon, 14 Sep 2009 14:21:59 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe07.swip.net [212.247.154.193]) by mx1.freebsd.org (Postfix) with ESMTP id 55D628FC23 for ; Mon, 14 Sep 2009 14:21:58 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=GdtqiKf97NUA:10 a=MnI1ikcADjEx7bvsp0jZvQ==:17 a=FUEoquDKuWGG4oh1sLcA:9 a=PDpIfzlt6djI12S4lwF1_9Uixj4A:4 Received: from [188.126.201.140] (account mc467741@c2i.net HELO laptop.adsl.tele2.no) by mailfe07.swip.net (CommuniGate Pro SMTP 5.2.13) with ESMTPA id 1298523545; Mon, 14 Sep 2009 15:21:55 +0200 From: Hans Petter Selasky To: freebsd-arch@freebsd.org Date: Mon, 14 Sep 2009 15:22:24 +0200 User-Agent: KMail/1.11.4 (FreeBSD/9.0-CURRENT; KDE/4.2.4; i386; ; ) References: <200909031340.n83Defkv034013@svn.freebsd.org> <200909121009.22931.hselasky@c2i.net> <200909140852.49192.jhb@freebsd.org> In-Reply-To: <200909140852.49192.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: <200909141522.25635.hselasky@c2i.net> Cc: Attilio Rao 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: Mon, 14 Sep 2009 14:21:59 -0000 On Monday 14 September 2009 14:52:48 John Baldwin wrote: > > I think bus_generic_detach() needs to work when called from a foo_detach() > routine, so I think you don't need the USB changes. Even if the new states > get reintroduced bus_generic_detach() will still have to work correctly the > way you had used it. Ok. --HPS