dual writer fix
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 23 Feb 2009 07:02:54 +0000 (02:02 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Mon, 23 Feb 2009 07:02:54 +0000 (02:02 -0500)
Make mutex between writers really atomic. Fixes the two flips run.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
formal-model/urcu/Makefile
formal-model/urcu/urcu.spin

index 7802c7f524b27c55fe00062607174003be3bd31b..7b395cbdd95c677dab4b3d2f2d31dcee57dc417c 100644 (file)
@@ -44,7 +44,7 @@ asserts: clean
        rm -f .input.spin.trail
        spin -a -X .input.spin
        gcc -w ${CFLAGS} -DSAFETY -o pan pan.c
-       ./pan -v -c1 -X -m10000 -w19
+       ./pan -v -c1 -X -m10000 -w20
        cp .input.spin $@.spin.input
        -cp .input.spin.trail $@.spin.input.trail
 
@@ -87,7 +87,7 @@ urcu_free_ltl:
        spin -f "!(`cat urcu_free.ltl | grep -v ^//`)" >> pan.ltl
 
 run: pan
-       ./pan -a -v -c1 -X -m10000 -w19
+       ./pan -a -v -c1 -X -m10000 -w20
 
 pan: pan.c
        gcc -w ${CFLAGS} -o pan pan.c
index 7f94d3b10232b7ff91520852a65d7236238f5385..5ac2f02dd9d80c3abd8d08f2b20136dd9a604635 100644 (file)
@@ -225,11 +225,16 @@ active [NR_WRITERS] proctype urcu_writer()
        ooo_mem(i);
 
        do
-       :: write_lock == 0 ->
-               write_lock = 1;
-               break;
-       :: else ->
-               skip;
+       :: 1 ->
+               atomic {
+                       if
+                       :: write_lock == 0 ->
+                               write_lock = 1;
+                               break;
+                       :: else ->
+                               skip;
+                       fi;
+               }
        od;
        smp_mb(i);
        ooo_mem(i);
@@ -251,11 +256,11 @@ active [NR_WRITERS] proctype urcu_writer()
 #endif
        ooo_mem(i);
        smp_mb(i);
-       /* free-up step, e.g., kfree(). */
        ooo_mem(i);
+       write_lock = 0;
+       /* free-up step, e.g., kfree(). */
        atomic {
                last_free_gen = old_gen;
                free_done = 1;
-               write_lock = 0;
        }
 }
This page took 0.026757 seconds and 4 git commands to generate.