Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Sep 2003 21:37:33 -0700 (PDT)
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 38947 for review
Message-ID:  <200310010437.h914bXI4059942@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.
+ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200310010437.h914bXI4059942>