From owner-p4-projects@FreeBSD.ORG Tue Sep 30 21:37:34 2003 Return-Path: Delivered-To: p4-projects@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-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects 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. + */