From owner-p4-releng@FreeBSD.ORG Tue Sep 30 13:53:47 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7050B16A4C0; Tue, 30 Sep 2003 13:53:47 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4A11E16A4B3 for ; Tue, 30 Sep 2003 13:53:47 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8484543FF9 for ; Tue, 30 Sep 2003 13:53:46 -0700 (PDT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h8UKrkXJ022312 for ; Tue, 30 Sep 2003 13:53:46 -0700 (PDT) (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h8UKrjed022309 for perforce@freebsd.org; Tue, 30 Sep 2003 13:53:45 -0700 (PDT) (envelope-from imp@freebsd.org) Date: Tue, 30 Sep 2003 13:53:45 -0700 (PDT) Message-Id: <200309302053.h8UKrjed022309@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Subject: PERFORCE change 38911 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2003 20:53:47 -0000 http://perforce.freebsd.org/chv.cgi?CH=38911 Change 38911 by imp@imp_koguchi on 2003/09/30 13:52:55 Strawman driver Affected files ... .. //depot/doc/strawman-driver.c#1 add Differences ... From owner-p4-releng@FreeBSD.ORG Tue Sep 30 14:12:14 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 51F3416A4E0; Tue, 30 Sep 2003 14:12:14 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2929816A4C0 for ; Tue, 30 Sep 2003 14:12:14 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6884D43FB1 for ; Tue, 30 Sep 2003 14:12:13 -0700 (PDT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h8ULCDXJ024394 for ; Tue, 30 Sep 2003 14:12:13 -0700 (PDT) (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h8ULCCLZ024391 for perforce@freebsd.org; Tue, 30 Sep 2003 14:12:12 -0700 (PDT) (envelope-from imp@freebsd.org) Date: Tue, 30 Sep 2003 14:12:12 -0700 (PDT) Message-Id: <200309302112.h8ULCCLZ024391@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Subject: PERFORCE change 38917 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2003 21:12:14 -0000 http://perforce.freebsd.org/chv.cgi?CH=38917 Change 38917 by imp@imp_koguchi on 2003/09/30 14:11:19 phk's sc = dev->si_drv1; Start on attach() some whitespace for clarity. Affected files ... .. //depot/doc/strawman-driver.c#2 edit Differences ... ==== //depot/doc/strawman-driver.c#2 (text+ko) ==== @@ -16,6 +16,9 @@ static int foo_ctl_ioctl(dev_t dev, u_long cmd, caddr_t data, nit flag, struct thread *td) { + foo_softc *sc; + + sc = dev->si_drv1; ... case FOO_GERBIL: /* Wait for a weird GERBIL event in the device and return it */ @@ -37,25 +40,48 @@ } static int +foo_attach(device_t dev) +{ + int unit; + foo_softc *sc; + + sc = device_get_softc(dev); + unit = device_get_unit(dev); + + /* allocate resoureces, initailze thigns */ + /* xXX show how we allocate mtx, cv, irq, ih */ + + /* Allocate device */ + sc->d = make_dev(devsw, 1, 0, 0, 0755, "fooctl%d", unit); + sc->d->si_drv1 = sc; +} + +static int foo_detach(device_t dev) { sc = device_get_softc(dev); foo_disable_intr(sc); /* disable hardware intr ??? */ + /* Everybody active here */ callout_reset(&sc->stat_ch, hz, fxp_tick, sc); + /* Network, ISR and devsw active */ bus_teardown_intr(sc->dev, sc->irq, sc->ih); + /* Network and devsw active */ ether_ifdetach(&sc->arpcom.ac_if); sc->ih = NULL; foo_wakeup_my_sleepers(sc); + /* devsw active */ destroy_dev(sc->d); + /* only mutex alive */ mtx_destroy(&sc->mtx); cv_destroy(&sc->cv); - /* release the resources */ + + /* release the hardware resources */ bus_release_resource(sc->dev, SYS_RES_IRQ, 0, sc->irq); // etc } From owner-p4-releng@FreeBSD.ORG Tue Sep 30 14:14:17 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 479C516A4C0; Tue, 30 Sep 2003 14:14:17 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2262A16A4B3 for ; Tue, 30 Sep 2003 14:14:17 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8BE2643FFB for ; Tue, 30 Sep 2003 14:14:16 -0700 (PDT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h8ULEGXJ024493 for ; Tue, 30 Sep 2003 14:14:16 -0700 (PDT) (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h8ULEGV4024490 for perforce@freebsd.org; Tue, 30 Sep 2003 14:14:16 -0700 (PDT) (envelope-from imp@freebsd.org) Date: Tue, 30 Sep 2003 14:14:16 -0700 (PDT) Message-Id: <200309302114.h8ULEGV4024490@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Subject: PERFORCE change 38918 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2003 21:14:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=38918 Change 38918 by imp@imp_koguchi on 2003/09/30 14:14:04 unlock the mutex Affected files ... .. //depot/doc/strawman-driver.c#3 edit Differences ... ==== //depot/doc/strawman-driver.c#3 (text+ko) ==== @@ -21,10 +21,12 @@ sc = dev->si_drv1; ... case FOO_GERBIL: - /* Wait for a weird GERBIL event in the device and return it */ + /* + * Wait for a weird GERBIL event in the device and return it */ mtx_lock(&sc->mtx); cv_wait(&sc->cv, &sc->mtx); + mtx_unlock(&sc->mtx); if (sc->dead) return EGONE; ... From owner-p4-releng@FreeBSD.ORG Tue Sep 30 14:30:38 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 63FF116A4C1; Tue, 30 Sep 2003 14:30:38 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2309416A4BF for ; Tue, 30 Sep 2003 14:30:38 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7E5B343F3F for ; Tue, 30 Sep 2003 14:30:37 -0700 (PDT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h8ULUbXJ025258 for ; Tue, 30 Sep 2003 14:30:37 -0700 (PDT) (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h8ULUbgU025255 for perforce@freebsd.org; Tue, 30 Sep 2003 14:30:37 -0700 (PDT) (envelope-from imp@freebsd.org) Date: Tue, 30 Sep 2003 14:30:37 -0700 (PDT) Message-Id: <200309302130.h8ULUbgU025255@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Subject: PERFORCE change 38920 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2003 21:30:38 -0000 http://perforce.freebsd.org/chv.cgi?CH=38920 Change 38920 by imp@imp_koguchi on 2003/09/30 14:30:31 Document two races. One against setting/testing 'dead'. The other against si_drv1 being nulled out in destroy_dev(). Affected files ... .. //depot/doc/strawman-driver.c#4 edit Differences ... ==== //depot/doc/strawman-driver.c#4 (text+ko) ==== @@ -18,7 +18,11 @@ { foo_softc *sc; - sc = dev->si_drv1; + sc = dev->si_drv1; /* RACE #2, a */ + if (sc == NULL) + return EGONE; + if (sc->dead) /* RACE #1, a */ + return EGONE; ... case FOO_GERBIL: /* @@ -27,7 +31,7 @@ mtx_lock(&sc->mtx); cv_wait(&sc->cv, &sc->mtx); mtx_unlock(&sc->mtx); - if (sc->dead) + if (sc->dead) /* Race #1, b */ return EGONE; ... } @@ -35,7 +39,7 @@ static void foo_wakeup_my_sleepers(foo_softc *sc) { - sc->dead = 1; + sc->dead = 1; /* Race #1, c */ mtx_lock(&sc->mtx); cv_broadcast(&sc->cv); mtx_unlock(&sc->mtx); @@ -63,6 +67,8 @@ { sc = device_get_softc(dev); + sc->d->si_drv1 = NULL /* Race #2, b */ + foo_disable_intr(sc); /* disable hardware intr ??? */ /* Everybody active here */ @@ -96,3 +102,28 @@ * destroy_dev() makes sure that no devsw calls in flight. */ +/* Races */ + +/* #1 + * + * We have a race here. + * + * The test points 'a' and 'b' might lose the race with the set point 'c'. + * + * If 'c' wins the race with either 'a' or 'b', then we're OK. We properly + * bail out early. If we lose the race that's OK too. In 'b' case, we go + * ahead and maybe sleep in the cv_wait. However, since we're using a condvar + * in that case, we don't sleep and 'win' the race at 'c'. When we're + * racing against 'c', then we'll access state of the device after + * we've started destroying it. That's OK, so long as the driver knows + * what can/can't be active at this point. + */ + +/* #2 + * + * We need to lock the door in a race here with the destroy_dev() + * function setting to NULL before we can get in and do something + * at point 'a'. So at point 'b' we set it to NULL. If 'b' happens + * before 'a', that's OK, because sc is guaranteed to be valid for the + * life of the call to ioctl, or any of the devsw functions. + */ From owner-p4-releng@FreeBSD.ORG Tue Sep 30 15:02:19 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1D79016A4C0; Tue, 30 Sep 2003 15:02:19 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EDA7316A4B3 for ; Tue, 30 Sep 2003 15:02:18 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4CF0044017 for ; Tue, 30 Sep 2003 15:02:18 -0700 (PDT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h8UM2IXJ026603 for ; Tue, 30 Sep 2003 15:02:18 -0700 (PDT) (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h8UM2HsO026596 for perforce@freebsd.org; Tue, 30 Sep 2003 15:02:17 -0700 (PDT) (envelope-from imp@freebsd.org) Date: Tue, 30 Sep 2003 15:02:17 -0700 (PDT) Message-Id: <200309302202.h8UM2HsO026596@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Subject: PERFORCE change 38924 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2003 22:02:19 -0000 http://perforce.freebsd.org/chv.cgi?CH=38924 Change 38924 by imp@imp_koguchi on 2003/09/30 15:01:37 More tweaking with input from jhb. phk has indicated he'd like to see new/old examples, so I'll try to do that later. gotta get back to work. Affected files ... .. //depot/doc/strawman-driver.c#5 edit Differences ... ==== //depot/doc/strawman-driver.c#5 (text+ko) ==== @@ -40,6 +40,7 @@ foo_wakeup_my_sleepers(foo_softc *sc) { sc->dead = 1; /* Race #1, c */ + sc->d->si_drv1 = NULL; /* Race #2, b */ mtx_lock(&sc->mtx); cv_broadcast(&sc->cv); mtx_unlock(&sc->mtx); @@ -67,23 +68,23 @@ { sc = device_get_softc(dev); - sc->d->si_drv1 = NULL /* Race #2, b */ + foo_wakeup_my_sleepers(sc); foo_disable_intr(sc); /* disable hardware intr ??? */ /* Everybody active here */ - callout_reset(&sc->stat_ch, hz, fxp_tick, sc); + if (callout_stop(&sc->stat_ch, hz, fxp_tick, sc) == 0) + printf("Maybe we just lost a race\n"); /* Network, ISR and devsw active */ bus_teardown_intr(sc->dev, sc->irq, sc->ih); - /* Network and devsw active */ + /* network and devsw active */ + destroy_dev(sc->d); + + /* Network active */ ether_ifdetach(&sc->arpcom.ac_if); sc->ih = NULL; - foo_wakeup_my_sleepers(sc); - - /* devsw active */ - destroy_dev(sc->d); /* only mutex alive */ mtx_destroy(&sc->mtx); From owner-p4-releng@FreeBSD.ORG Tue Sep 30 18:13:34 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id B924716A4C0; Tue, 30 Sep 2003 18:13:33 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8E00B16A4B3; Tue, 30 Sep 2003 18:13:33 -0700 (PDT) Received: from sccrmhc11.comcast.net (sccrmhc11.comcast.net [204.127.202.55]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8C4DB43FE5; Tue, 30 Sep 2003 18:13:32 -0700 (PDT) (envelope-from julian@elischer.org) Received: from interjet.elischer.org ([12.233.125.100]) by comcast.net (sccrmhc11) with ESMTP id <2003100101133001100m0e03e>; Wed, 1 Oct 2003 01:13:31 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id OAA53443; Tue, 30 Sep 2003 14:49:33 -0700 (PDT) Date: Tue, 30 Sep 2003 14:49:32 -0700 (PDT) From: Julian Elischer To: Warner Losh In-Reply-To: <200309302112.h8ULCCLZ024391@repoman.freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Perforce Change Reviews Subject: Re: PERFORCE change 38917 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2003 01:13:34 -0000 Someone who understands all this stuff should update /usr/share/examples/drivers/make_device_driver.sh On Tue, 30 Sep 2003, Warner Losh wrote: > http://perforce.freebsd.org/chv.cgi?CH=38917 > > Change 38917 by imp@imp_koguchi on 2003/09/30 14:11:19 > > phk's sc = dev->si_drv1; > Start on attach() > some whitespace for clarity. > > Affected files ... > > .. //depot/doc/strawman-driver.c#2 edit > > Differences ... > > ==== //depot/doc/strawman-driver.c#2 (text+ko) ==== > > @@ -16,6 +16,9 @@ > static int > foo_ctl_ioctl(dev_t dev, u_long cmd, caddr_t data, nit flag, struct thread *td) > { > + foo_softc *sc; > + > + sc = dev->si_drv1; > ... > case FOO_GERBIL: > /* Wait for a weird GERBIL event in the device and return it */ > @@ -37,25 +40,48 @@ > } > > static int > +foo_attach(device_t dev) > +{ > + int unit; > + foo_softc *sc; > + > + sc = device_get_softc(dev); > + unit = device_get_unit(dev); > + > + /* allocate resoureces, initailze thigns */ > + /* xXX show how we allocate mtx, cv, irq, ih */ > + > + /* Allocate device */ > + sc->d = make_dev(devsw, 1, 0, 0, 0755, "fooctl%d", unit); > + sc->d->si_drv1 = sc; > +} > + > +static int > foo_detach(device_t dev) > { > sc = device_get_softc(dev); > > foo_disable_intr(sc); /* disable hardware intr ??? */ > + > /* Everybody active here */ > callout_reset(&sc->stat_ch, hz, fxp_tick, sc); > + > /* Network, ISR and devsw active */ > bus_teardown_intr(sc->dev, sc->irq, sc->ih); > + > /* Network and devsw active */ > ether_ifdetach(&sc->arpcom.ac_if); > sc->ih = NULL; > foo_wakeup_my_sleepers(sc); > + > /* devsw active */ > destroy_dev(sc->d); > + > /* only mutex alive */ > mtx_destroy(&sc->mtx); > cv_destroy(&sc->cv); > - /* release the resources */ > + > + /* release the hardware resources */ > bus_release_resource(sc->dev, SYS_RES_IRQ, 0, sc->irq); > // etc > } > From owner-p4-releng@FreeBSD.ORG Tue Sep 30 18:50:34 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6AF2416A4C0; Tue, 30 Sep 2003 18:50:34 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4280516A4B3 for ; Tue, 30 Sep 2003 18:50:34 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2532444003 for ; Tue, 30 Sep 2003 18:50:31 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.9p1/8.12.9) with ESMTP id h911oSAD098008; Tue, 30 Sep 2003 19:50:28 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 30 Sep 2003 19:50:29 -0600 (MDT) Message-Id: <20030930.195029.26965475.imp@bsdimp.com> To: julian@elischer.org From: "M. Warner Losh" In-Reply-To: References: <200309302112.h8ULCCLZ024391@repoman.freebsd.org> X-Mailer: Mew version 2.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: perforce@freebsd.org Subject: Re: PERFORCE change 38917 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2003 01:50:34 -0000 In message: Julian Elischer writes: : Someone who understands all this stuff should update : : /usr/share/examples/drivers/make_device_driver.sh That's premature at this time. We're trying to hash out the guarnatees that various subsystems need to make in order to ensure that we can successfully detach drivers. Warner From owner-p4-releng@FreeBSD.ORG Tue Sep 30 20:34:16 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id D345316A4C0; Tue, 30 Sep 2003 20:34:15 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ACF8316A4B3 for ; Tue, 30 Sep 2003 20:34:15 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 38CC743FF9 for ; Tue, 30 Sep 2003 20:34:15 -0700 (PDT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h913YFXJ051110 for ; Tue, 30 Sep 2003 20:34:15 -0700 (PDT) (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h913YEnh051107 for perforce@freebsd.org; Tue, 30 Sep 2003 20:34:14 -0700 (PDT) (envelope-from imp@freebsd.org) Date: Tue, 30 Sep 2003 20:34:14 -0700 (PDT) Message-Id: <200310010334.h913YEnh051107@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Subject: PERFORCE change 38944 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2003 03:34:16 -0000 http://perforce.freebsd.org/chv.cgi?CH=38944 Change 38944 by imp@imp_koguchi on 2003/09/30 20:34:04 cv_wait usually loops, per rwatson. Affected files ... .. //depot/doc/strawman-driver.c#6 edit Differences ... ==== //depot/doc/strawman-driver.c#6 (text+ko) ==== @@ -23,17 +23,24 @@ return EGONE; if (sc->dead) /* RACE #1, a */ return EGONE; -... + switch (cmd) + { case FOO_GERBIL: /* * Wait for a weird GERBIL event in the device and return it */ mtx_lock(&sc->mtx); - cv_wait(&sc->cv, &sc->mtx); + sc->sc_gerbil = 0; + while (!sc->sc_gerbil) { + if (sc->dead) /* Race #1, b */ + return EGONE; + cv_wait(&sc->cv, &sc->mtx); + } mtx_unlock(&sc->mtx); - if (sc->dead) /* Race #1, b */ - return EGONE; - ... + return (0); + default: + return (ENOTTY); + } } static void From owner-p4-releng@FreeBSD.ORG Tue Sep 30 21:26:19 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id AF2CE16A4C0; Tue, 30 Sep 2003 21:26:19 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8622316A4B3 for ; Tue, 30 Sep 2003 21:26:19 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5FF6D44011 for ; Tue, 30 Sep 2003 21:26:18 -0700 (PDT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h914QIXJ059499 for ; Tue, 30 Sep 2003 21:26:18 -0700 (PDT) (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h914QHpp059496 for perforce@freebsd.org; Tue, 30 Sep 2003 21:26:17 -0700 (PDT) (envelope-from imp@freebsd.org) Date: Tue, 30 Sep 2003 21:26:17 -0700 (PDT) Message-Id: <200310010426.h914QHpp059496@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Subject: PERFORCE change 38945 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2003 04:26:20 -0000 http://perforce.freebsd.org/chv.cgi?CH=38945 Change 38945 by imp@imp_koguchi on 2003/09/30 21:26:14 unlock -- per rwatson Affected files ... .. //depot/doc/strawman-driver.c#7 edit Differences ... ==== //depot/doc/strawman-driver.c#7 (text+ko) ==== @@ -32,9 +32,11 @@ mtx_lock(&sc->mtx); sc->sc_gerbil = 0; while (!sc->sc_gerbil) { - if (sc->dead) /* Race #1, b */ + cv_wait(&sc->cv, &sc->mtx); + if (sc->dead) { /* Race #1, b */ + mtx_unlock(&sc->mtx); return EGONE; - cv_wait(&sc->cv, &sc->mtx); + } } mtx_unlock(&sc->mtx); return (0); From owner-p4-releng@FreeBSD.ORG Tue Sep 30 21:37:34 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 77C5C16A4EA; Tue, 30 Sep 2003 21:37:34 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4B91E16A4E8 for ; Tue, 30 Sep 2003 21:37:34 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id C3F3343F93 for ; Tue, 30 Sep 2003 21:37:33 -0700 (PDT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h914bXXJ059945 for ; Tue, 30 Sep 2003 21:37:33 -0700 (PDT) (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h914bXI4059942 for perforce@freebsd.org; Tue, 30 Sep 2003 21:37:33 -0700 (PDT) (envelope-from imp@freebsd.org) Date: Tue, 30 Sep 2003 21:37:33 -0700 (PDT) Message-Id: <200310010437.h914bXI4059942@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Subject: PERFORCE change 38947 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2003 04:37:35 -0000 http://perforce.freebsd.org/chv.cgi?CH=38947 Change 38947 by imp@imp_koguchi on 2003/09/30 21:36:37 document the race in the callout api. this one sucks since if we lose this one we can have a crash. Affected files ... .. //depot/doc/strawman-driver.c#8 edit Differences ... ==== //depot/doc/strawman-driver.c#8 (text+ko) ==== @@ -83,7 +83,7 @@ /* Everybody active here */ if (callout_stop(&sc->stat_ch, hz, fxp_tick, sc) == 0) - printf("Maybe we just lost a race\n"); + printf("Maybe we just lost a race\n"); /* race 3 */ /* Network, ISR and devsw active */ bus_teardown_intr(sc->dev, sc->irq, sc->ih); @@ -116,8 +116,6 @@ /* #1 * - * We have a race here. - * * The test points 'a' and 'b' might lose the race with the set point 'c'. * * If 'c' wins the race with either 'a' or 'b', then we're OK. We properly @@ -137,3 +135,13 @@ * before 'a', that's OK, because sc is guaranteed to be valid for the * life of the call to ioctl, or any of the devsw functions. */ + +/* #3 + * + * Callout interface is inharently racy. We have no way of knowing + * when a callout might be in progress or complete. A return value of + * 0 means either the callout has happened, or is happening. However, + * we can't tell if the code has finished executing or not. This + * means that if the code is executing and we try to unload the page + * that is executing, then we've set ourselves up for a crash. + */ From owner-p4-releng@FreeBSD.ORG Tue Sep 30 22:53:09 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C3FBB16A4C1; Tue, 30 Sep 2003 22:53:08 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9B80B16A4B3 for ; Tue, 30 Sep 2003 22:53:08 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2687643FF5 for ; Tue, 30 Sep 2003 22:53:08 -0700 (PDT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h915r7XJ064076 for ; Tue, 30 Sep 2003 22:53:07 -0700 (PDT) (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h915r7VL064073 for perforce@freebsd.org; Tue, 30 Sep 2003 22:53:07 -0700 (PDT) (envelope-from imp@freebsd.org) Date: Tue, 30 Sep 2003 22:53:07 -0700 (PDT) Message-Id: <200310010553.h915r7VL064073@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Subject: PERFORCE change 38953 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2003 05:53:09 -0000 http://perforce.freebsd.org/chv.cgi?CH=38953 Change 38953 by imp@imp_koguchi on 2003/09/30 22:52:38 Document that in FreeBSD 5 the callout wheel locking precludes the race documented here as race #3. Affected files ... .. //depot/doc/strawman-driver.c#9 edit Differences ... ==== //depot/doc/strawman-driver.c#9 (text+ko) ==== @@ -144,4 +144,7 @@ * we can't tell if the code has finished executing or not. This * means that if the code is executing and we try to unload the page * that is executing, then we've set ourselves up for a crash. + * + * However, given how FreeBSD 5 locks the callout code, the race can + * never be lost. */ From owner-p4-releng@FreeBSD.ORG Wed Oct 1 12:23:49 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 53A0C16A4C0; Wed, 1 Oct 2003 12:23:49 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 931) id 1424816A4BF; Wed, 1 Oct 2003 12:23:49 -0700 (PDT) Date: Wed, 1 Oct 2003 14:23:49 -0500 From: Juli Mallett To: "M. Warner Losh" Message-ID: <20031001142349.A87379@FreeBSD.org> References: <200309302112.h8ULCCLZ024391@repoman.freebsd.org> <20030930.195029.26965475.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030930.195029.26965475.imp@bsdimp.com>; from imp@bsdimp.com on Tue, Sep 30, 2003 at 07:50:29PM -0600 X-Title: Code Maven X-Towel: Yes X-Negacore: Yes X-Authentication-Warning: localhost: juli pwned teh intarweb cc: perforce@freebsd.org cc: julian@elischer.org Subject: Re: PERFORCE change 38917 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2003 19:23:49 -0000 * "M. Warner Losh" [ Date: 2003-09-30 ] [ w.r.t. Re: PERFORCE change 38917 for review ] > In message: > Julian Elischer writes: > : Someone who understands all this stuff should update > : > : /usr/share/examples/drivers/make_device_driver.sh > > That's premature at this time. We're trying to hash out the > guarnatees that various subsystems need to make in order to ensure > that we can successfully detach drivers. In other words, the strawman is being used to find the fundamental flaws/races/... that we need to grow the APIs/etc. to accomodate? Groovy. Better APIs and primitives :D -- juli mallett. email: jmallett@freebsd.org; efnet: juli; aim: bsdflata; i have lost my way home early - i don't care cause i won't stay there. From owner-p4-releng@FreeBSD.ORG Wed Oct 1 12:28:49 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4F07716A4C1; Wed, 1 Oct 2003 12:28:49 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 25A0D16A4B3; Wed, 1 Oct 2003 12:28:49 -0700 (PDT) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7A69B43F3F; Wed, 1 Oct 2003 12:28:47 -0700 (PDT) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.9/8.12.9) with ESMTP id h91JSTbw004061; Wed, 1 Oct 2003 21:28:29 +0200 (CEST) (envelope-from phk@phk.freebsd.dk) To: Juli Mallett From: "Poul-Henning Kamp" In-Reply-To: Your message of "Wed, 01 Oct 2003 14:23:49 CDT." <20031001142349.A87379@FreeBSD.org> Date: Wed, 01 Oct 2003 21:28:29 +0200 Message-ID: <4060.1065036509@critter.freebsd.dk> cc: perforce@freebsd.org cc: julian@elischer.org cc: "M. Warner Losh" Subject: Re: PERFORCE change 38917 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2003 19:28:49 -0000 In message <20031001142349.A87379@FreeBSD.org>, Juli Mallett writes: >* "M. Warner Losh" [ Date: 2003-09-30 ] > [ w.r.t. Re: PERFORCE change 38917 for review ] >> In message: >> Julian Elischer writes: >> : Someone who understands all this stuff should update >> : >> : /usr/share/examples/drivers/make_device_driver.sh >> >> That's premature at this time. We're trying to hash out the >> guarnatees that various subsystems need to make in order to ensure >> that we can successfully detach drivers. > >In other words, the strawman is being used to find the fundamental >flaws/races/... that we need to grow the APIs/etc. to accomodate? Yes, that's the concept. It is rather trivial to solve the actual problems, throw enough mutexes at it and you're done. It is far more tricky to do it in a way where you get both readable source code (so people understand what it does and how it does it), simple conceptual models (so people can understand it) etc. And then of course, once we have that we need a transistion plan, and that in itself is a problem because we want to minimize code sweeps, and we have a lot of practically untestable drivers. >Groovy. Better APIs and primitives :D Yeah, well, eventually. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. From owner-p4-releng@FreeBSD.ORG Wed Oct 1 14:16:16 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 023D116A4B3; Wed, 1 Oct 2003 14:16:15 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CC9D516A4B3 for ; Wed, 1 Oct 2003 14:16:15 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 18F8443FE1 for ; Wed, 1 Oct 2003 14:16:15 -0700 (PDT) (envelope-from brooks@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h91LGEXJ041786 for ; Wed, 1 Oct 2003 14:16:14 -0700 (PDT) (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h91LGEnR041783 for perforce@freebsd.org; Wed, 1 Oct 2003 14:16:14 -0700 (PDT) (envelope-from brooks@freebsd.org) Date: Wed, 1 Oct 2003 14:16:14 -0700 (PDT) Message-Id: <200310012116.h91LGEnR041783@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis To: Perforce Change Reviews Subject: PERFORCE change 39003 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2003 21:16:16 -0000 http://perforce.freebsd.org/chv.cgi?CH=39003 Change 39003 by brooks@brooks_minya on 2003/10/01 14:15:19 Move arpcom to the top of the softc where the networking code currently requires it to live. Affected files ... .. //depot/doc/strawman-driver.c#10 edit Differences ... ==== //depot/doc/strawman-driver.c#10 (text+ko) ==== @@ -4,8 +4,8 @@ struct foo_softc { + struct arpcom arpcom; /* per-interface network data */ struct callout stat_ch; /* stat callout */ - struct arpcom arpcom; /* per-interface network data */ struct resource *irq; /* resource descriptor for interrupt */ void *ih; /* interrupt handler cookie */ dev_t d; From owner-p4-releng@FreeBSD.ORG Wed Oct 1 15:43:31 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2C2ED16A4C1; Wed, 1 Oct 2003 15:43:31 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EA86716A4C0; Wed, 1 Oct 2003 15:43:30 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3089F43FDD; Wed, 1 Oct 2003 15:43:29 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.9p1/8.12.9) with ESMTP id h91MhHAD011307; Wed, 1 Oct 2003 16:43:19 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 01 Oct 2003 16:43:15 -0600 (MDT) Message-Id: <20031001.164315.11988972.imp@bsdimp.com> To: jmallett@FreeBSD.ORG From: "M. Warner Losh" In-Reply-To: <20031001142349.A87379@FreeBSD.org> References: <20030930.195029.26965475.imp@bsdimp.com> <20031001142349.A87379@FreeBSD.org> X-Mailer: Mew version 2.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: perforce@FreeBSD.ORG cc: julian@elischer.org Subject: Re: PERFORCE change 38917 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Oct 2003 22:43:31 -0000 In message: <20031001142349.A87379@FreeBSD.org> Juli Mallett writes: : * "M. Warner Losh" [ Date: 2003-09-30 ] : [ w.r.t. Re: PERFORCE change 38917 for review ] : > In message: : > Julian Elischer writes: : > : Someone who understands all this stuff should update : > : : > : /usr/share/examples/drivers/make_device_driver.sh : > : > That's premature at this time. We're trying to hash out the : > guarnatees that various subsystems need to make in order to ensure : > that we can successfully detach drivers. : : In other words, the strawman is being used to find the fundamental : flaws/races/... that we need to grow the APIs/etc. to accomodate? : : Groovy. Better APIs and primitives :D Yes. This is an anal-rentive view at our APIs and how they are implement to make sure that we get all the driver issues dealt with properly to effectively support removable drivers. Warner From owner-p4-releng@FreeBSD.ORG Wed Oct 1 19:21:37 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 74D6516A4C0; Wed, 1 Oct 2003 19:21:37 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4AE2616A4B3; Wed, 1 Oct 2003 19:21:37 -0700 (PDT) Received: from perrin.nxad.com (internal.nxad.com [69.1.70.251]) by mx1.FreeBSD.org (Postfix) with ESMTP id BA55743FDD; Wed, 1 Oct 2003 19:21:36 -0700 (PDT) (envelope-from hmp@nxad.com) Received: by perrin.nxad.com (Postfix, from userid 1072) id D309F20F01; Wed, 1 Oct 2003 19:21:35 -0700 (PDT) Date: Wed, 1 Oct 2003 19:21:35 -0700 From: Hiten Pandya To: "M. Warner Losh" Message-ID: <20031002022135.GA26666@perrin.nxad.com> References: <20030930.195029.26965475.imp@bsdimp.com> <20031001142349.A87379@FreeBSD.org> <20031001.164315.11988972.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031001.164315.11988972.imp@bsdimp.com> X-Operating-System: FreeBSD FreeBSD 4.7-STABLE User-Agent: Mutt/1.5.4i cc: jmallett@FreeBSD.ORG cc: perforce@FreeBSD.ORG cc: julian@elischer.org Subject: Re: PERFORCE change 38917 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Oct 2003 02:21:38 -0000 On Wed, Oct 01, 2003 at 04:43:15PM -0600, M. Warner Losh wrote: : Yes. This is an anal-rentive view at our APIs and how they are : implement to make sure that we get all the driver issues dealt with : properly to effectively support removable drivers. : : Warner Does this also include PCI Hotplugging or is this going to be a separate effort? Regards, -- Hiten Pandya hmp@backplane.com From owner-p4-releng@FreeBSD.ORG Thu Oct 2 23:00:57 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 80FA916A4C0; Thu, 2 Oct 2003 23:00:57 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 54CFB16A4B3; Thu, 2 Oct 2003 23:00:57 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5916E43FB1; Thu, 2 Oct 2003 23:00:56 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.9p1/8.12.9) with ESMTP id h9360nAD026778; Fri, 3 Oct 2003 00:00:49 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 03 Oct 2003 00:00:52 -0600 (MDT) Message-Id: <20031003.000052.96921421.imp@bsdimp.com> To: hmp@nxad.com From: "M. Warner Losh" In-Reply-To: <20031002022135.GA26666@perrin.nxad.com> References: <20031001142349.A87379@FreeBSD.org> <20031001.164315.11988972.imp@bsdimp.com> <20031002022135.GA26666@perrin.nxad.com> X-Mailer: Mew version 2.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: jmallett@freebsd.org cc: perforce@freebsd.org cc: julian@elischer.org Subject: Re: PERFORCE change 38917 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Oct 2003 06:00:58 -0000 In message: <20031002022135.GA26666@perrin.nxad.com> Hiten Pandya writes: : Does this also include PCI Hotplugging or is this going to be : a separate effort? Yes and no. We already have removable devices in the tree. CardBus, PC Card, USB and Firewire. Right now the drivers take liberties and chances and there are a number of ugly races that rear their ugly heads. This is an effort to clean that up and make things totally safe in all the cases that we can think of, and to document those areas where we can't. There's no specific plans on my part to implement the hot plug state transition and deal with it. People have raised their hands in the past to work on it, but so far no one has made significant progress in public view. Warner From owner-p4-releng@FreeBSD.ORG Fri Oct 3 10:19:37 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E56B316A4C1; Fri, 3 Oct 2003 10:19:36 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BC76216A4B3 for ; Fri, 3 Oct 2003 10:19:36 -0700 (PDT) Received: from mail.speakeasy.net (mail16.speakeasy.net [216.254.0.216]) by mx1.FreeBSD.org (Postfix) with ESMTP id 35A3743FF2 for ; Fri, 3 Oct 2003 10:19:35 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 23533 invoked from network); 3 Oct 2003 17:19:33 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 3 Oct 2003 17:19:33 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.9/8.12.9) with ESMTP id h93HHr6Y074606; Fri, 3 Oct 2003 13:17:53 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20031003.000052.96921421.imp@bsdimp.com> Date: Fri, 03 Oct 2003 13:17:59 -0400 (EDT) From: John Baldwin To: "M. Warner Losh" X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: jmallett@freebsd.org cc: hmp@nxad.com cc: perforce@freebsd.org cc: julian@elischer.org Subject: Re: PERFORCE change 38917 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Oct 2003 17:19:37 -0000 On 03-Oct-2003 M. Warner Losh wrote: > In message: <20031002022135.GA26666@perrin.nxad.com> > Hiten Pandya writes: >: Does this also include PCI Hotplugging or is this going to be >: a separate effort? > > Yes and no. > > We already have removable devices in the tree. CardBus, PC Card, USB > and Firewire. Right now the drivers take liberties and chances and > there are a number of ugly races that rear their ugly heads. This is > an effort to clean that up and make things totally safe in all the > cases that we can think of, and to document those areas where we > can't. > > There's no specific plans on my part to implement the hot plug state > transition and deal with it. People have raised their hands in the > past to work on it, but so far no one has made significant progress in > public view. BTW, I thought of a locking concern in attach routines this morning. Basically, as soon as a driver does bus_setup_intr(), it needs to start using any locks shared with its interrupt handler and the hardware and driver state need to be able to handle having the handler invoked when that function is called. The reason is that the device may be attached to an interrupt line shared with another device and thus the other device may generate an interrupt and call the new devices handler before bus_setup_intr() even returns. Similarly, locking will be needed after calls to disk_create(), if_attach(), etc. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ From owner-p4-releng@FreeBSD.ORG Fri Oct 3 15:52:55 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 69D9516A4C0; Fri, 3 Oct 2003 15:52:55 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3613E16A4B3; Fri, 3 Oct 2003 15:52:55 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id B787E44020; Fri, 3 Oct 2003 15:51:29 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.9p1/8.12.9) with ESMTP id h93MpDAD038686; Fri, 3 Oct 2003 16:51:14 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 03 Oct 2003 16:51:14 -0600 (MDT) Message-Id: <20031003.165114.08027459.imp@bsdimp.com> To: jhb@freebsd.org From: "M. Warner Losh" In-Reply-To: References: <20031003.000052.96921421.imp@bsdimp.com> X-Mailer: Mew version 2.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: jmallett@freebsd.org cc: hmp@nxad.com cc: perforce@freebsd.org cc: julian@elischer.org Subject: Re: PERFORCE change 38917 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Oct 2003 22:52:55 -0000 In message: John Baldwin writes: : : On 03-Oct-2003 M. Warner Losh wrote: : > In message: <20031002022135.GA26666@perrin.nxad.com> : > Hiten Pandya writes: : >: Does this also include PCI Hotplugging or is this going to be : >: a separate effort? : > : > Yes and no. : > : > We already have removable devices in the tree. CardBus, PC Card, USB : > and Firewire. Right now the drivers take liberties and chances and : > there are a number of ugly races that rear their ugly heads. This is : > an effort to clean that up and make things totally safe in all the : > cases that we can think of, and to document those areas where we : > can't. : > : > There's no specific plans on my part to implement the hot plug state : > transition and deal with it. People have raised their hands in the : > past to work on it, but so far no one has made significant progress in : > public view. : : BTW, I thought of a locking concern in attach routines this morning. : Basically, as soon as a driver does bus_setup_intr(), it needs to start : using any locks shared with its interrupt handler and the hardware : and driver state need to be able to handle having the handler invoked : when that function is called. The reason is that the device may be : attached to an interrupt line shared with another device and thus the : other device may generate an interrupt and call the new devices handler : before bus_setup_intr() even returns. Similarly, locking will be : needed after calls to disk_create(), if_attach(), etc. Yes. That's true. I'll keep it in mind. Warner From owner-p4-releng@FreeBSD.ORG Sat Oct 4 12:16:43 2003 Return-Path: Delivered-To: p4-releng@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 6551B16A4C0; Sat, 4 Oct 2003 12:16:43 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3AFE416A4B3 for ; Sat, 4 Oct 2003 12:16:43 -0700 (PDT) Received: from perrin.nxad.com (internal.nxad.com [69.1.70.251]) by mx1.FreeBSD.org (Postfix) with ESMTP id B0B4043F85 for ; Sat, 4 Oct 2003 12:16:42 -0700 (PDT) (envelope-from hmp@nxad.com) Received: by perrin.nxad.com (Postfix, from userid 1072) id C62E421064; Sat, 4 Oct 2003 12:16:41 -0700 (PDT) Date: Sat, 4 Oct 2003 12:16:41 -0700 From: Hiten Pandya To: "M. Warner Losh" Message-ID: <20031004191641.GA27319@perrin.nxad.com> References: <20031001142349.A87379@FreeBSD.org> <20031001.164315.11988972.imp@bsdimp.com> <20031002022135.GA26666@perrin.nxad.com> <20031003.000052.96921421.imp@bsdimp.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20031003.000052.96921421.imp@bsdimp.com> X-Operating-System: FreeBSD FreeBSD 4.7-STABLE User-Agent: Mutt/1.5.4i cc: perforce@freebsd.org cc: julian@elischer.org Subject: Re: PERFORCE change 38917 for review X-BeenThere: p4-releng@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 releng tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Oct 2003 19:16:43 -0000 On Fri, Oct 03, 2003 at 12:00:52AM -0600, M. Warner Losh wrote: : In message: <20031002022135.GA26666@perrin.nxad.com> : Hiten Pandya writes: : : Does this also include PCI Hotplugging or is this going to be : : a separate effort? : : Yes and no. : : We already have removable devices in the tree. CardBus, PC Card, USB : and Firewire. Right now the drivers take liberties and chances and : there are a number of ugly races that rear their ugly heads. This is : an effort to clean that up and make things totally safe in all the : cases that we can think of, and to document those areas where we : can't. : : There's no specific plans on my part to implement the hot plug state : transition and deal with it. People have raised their hands in the : past to work on it, but so far no one has made significant progress in : public view. Hmm, I see your point of view. Also, another problem with PCI Hotplug controllers is that most of them are proprietary, like for example, the IBM controllers. Regards, -- Hiten Pandya hmp@backplane.com