From: Mathieu Desnoyers Date: Mon, 23 Feb 2009 06:31:11 +0000 (-0500) Subject: Run 2 writers and show single flip error case X-Git-Tag: v0.1~277 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2ba2a48d02164a7f51fbd1686173080240579002;p=urcu.git Run 2 writers and show single flip error case Signed-off-by: Mathieu Desnoyers --- diff --git a/formal-model/urcu/Makefile b/formal-model/urcu/Makefile index 0dc8b2c..7802c7f 100644 --- a/formal-model/urcu/Makefile +++ b/formal-model/urcu/Makefile @@ -26,6 +26,7 @@ default: make urcu_free_no_rmb | tee urcu_free_no_rmb.log make urcu_free_no_wmb | tee urcu_free_no_wmb.log make urcu_free_no_mb | tee urcu_free_no_mb.log + make urcu_free_single_flip | tee urcu_free_single_flip.log make asserts | tee asserts.log make summary @@ -72,6 +73,13 @@ urcu_free_no_mb: clean urcu_free_ltl urcu_free_no_mb_define run urcu_free_no_mb_define: cp urcu_free_no_mb.define .input.define +urcu_free_single_flip: clean urcu_free_ltl urcu_free_single_flip_define run + cp .input.spin $@.spin.input + -cp .input.spin.trail $@.spin.input.trail + +urcu_free_single_flip_define: + cp urcu_free_single_flip.define .input.define + urcu_free_ltl: touch .input.define cat DEFINES > pan.ltl diff --git a/formal-model/urcu/urcu.spin b/formal-model/urcu/urcu.spin index cc84e51..7f94d3b 100644 --- a/formal-model/urcu/urcu.spin +++ b/formal-model/urcu/urcu.spin @@ -21,9 +21,9 @@ /* Promela validation variables. */ #define NR_READERS 1 -#define NR_WRITERS 1 +#define NR_WRITERS 2 -#define NR_PROCS 2 +#define NR_PROCS 3 #define get_pid() (_pid) @@ -123,6 +123,8 @@ bit free_done = 0; byte read_generation = 1; bit data_access = 0; +bit write_lock = 0; + inline ooo_mem(i) { atomic { @@ -222,6 +224,13 @@ active [NR_WRITERS] proctype urcu_writer() } ooo_mem(i); + do + :: write_lock == 0 -> + write_lock = 1; + break; + :: else -> + skip; + od; smp_mb(i); ooo_mem(i); tmp = READ_CACHED_VAR(urcu_gp_ctr); @@ -231,6 +240,7 @@ active [NR_WRITERS] proctype urcu_writer() //smp_mc(i); wait_for_quiescent_state(tmp, i, j); //smp_mc(i); +#ifndef SINGLE_FLIP ooo_mem(i); tmp = READ_CACHED_VAR(urcu_gp_ctr); ooo_mem(i); @@ -238,6 +248,7 @@ active [NR_WRITERS] proctype urcu_writer() //smp_mc(i); ooo_mem(i); wait_for_quiescent_state(tmp, i, j); +#endif ooo_mem(i); smp_mb(i); /* free-up step, e.g., kfree(). */ @@ -245,5 +256,6 @@ active [NR_WRITERS] proctype urcu_writer() atomic { last_free_gen = old_gen; free_done = 1; + write_lock = 0; } }