Remove spurious read-side infinite loops.
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Fri, 20 Feb 2009 16:55:38 +0000 (11:55 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Fri, 20 Feb 2009 16:55:38 +0000 (11:55 -0500)
Remove spurious read-side infinite loops from urcu_reader() model.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
formal-model/urcu.spin

index 611464b3eb660b61d6269b5c64210afe6754d950..eea18e8a27323f50dea0fa23fd668086b5ea46be 100644 (file)
@@ -27,6 +27,10 @@ bit free = 0;     /* Has RCU reclamation happened, e.g., kfree()? */
 bit need_mb = 0;  /* =1 says need reader mb, =0 for reader response. */
 byte reader_progress[4];
                  /* Count of read-side statement executions. */
+bit reader_done = 0;
+                 /* =0 says reader still running, =1 says done. */
+bit updater_done = 0;
+                 /* =0 says updater still running, =1 says done. */
 
 /* urcu definitions and variables, taken straight from the algorithm. */
 
@@ -50,7 +54,7 @@ proctype urcu_reader()
        do
        :: need_mb == 1 ->
                need_mb = 0;
-       :: 1 -> skip;
+       :: !updater_done -> skip;
        :: 1 -> break;
        od;
 
@@ -92,7 +96,7 @@ proctype urcu_reader()
                                    reader_progress[2] +
                                    reader_progress[3] == 0) && need_mb == 1 ->
                                        need_mb = 0;
-                               :: 1 -> skip;
+                               :: !updater_done -> skip;
                                :: 1 -> break;
                                od;
                                urcu_active_readers = tmp;
@@ -150,7 +154,7 @@ proctype urcu_reader()
                        do
                        :: need_mb == 1 ->
                                need_mb = 0;
-                       :: 1 -> skip;
+                       :: !updater_done -> skip;
                        :: 1 -> break;
                        od;
                :: else -> skip;
@@ -167,11 +171,14 @@ proctype urcu_reader()
        od;
        assert((tmp_free == 0) || (tmp_removed == 1));
 
+       /* Reader has completed. */
+       reader_done = 1;
+
        /* Process any late-arriving memory-barrier requests. */
        do
        :: need_mb == 1 ->
                need_mb = 0;
-       :: 1 -> skip;
+       :: !updater_done -> skip;
        :: 1 -> break;
        od;
 }
@@ -248,6 +255,12 @@ proctype urcu_updater()
 
        /* free-up step, e.g., kfree(). */
        free = 1;
+
+       /*
+        * Signal updater done, ending any otherwise-infinite loops
+        * in the reading process.
+        */
+       updater_done = 1;
 }
 
 /*
This page took 0.026377 seconds and 4 git commands to generate.