/* All signal readers have same PID and uses same reader variable */
#ifdef TEST_SIGNAL_ON_WRITE
-#define get_pid() ((_pid < 1) -> 0 : 1)
+
+#define NR_READERS 1 /* the writer is also a signal reader */
+#define NR_WRITERS 1
+
+#define NR_PROCS 1
+
+#define get_pid() (0)
+
#elif defined(TEST_SIGNAL_ON_READ)
+
#define get_pid() ((_pid < 2) -> 0 : 1)
+
+#define NR_READERS 1
+#define NR_WRITERS 1
+
+#define NR_PROCS 2
+
#else
+
#define get_pid() (_pid)
+
+#define NR_READERS 1
+#define NR_WRITERS 1
+
+#define NR_PROCS 2
+
#endif
#define get_readerid() (get_pid())
* We are not modeling the whole rendez-vous between readers and writers here,
* we just let the writer update each reader's caches remotely.
*/
-inline smp_mb(i, j)
+inline smp_mb_writer(i, j)
{
- if
- :: get_pid() >= NR_READERS ->
- smp_mb_pid(get_pid(), j);
- i = 0;
- do
- :: i < NR_READERS ->
- smp_mb_pid(i, j);
- i++;
- :: i >= NR_READERS -> break
- od;
- smp_mb_pid(get_pid(), j);
- :: else -> skip;
- fi;
+ smp_mb_pid(get_pid(), j);
+ i = 0;
+ do
+ :: i < NR_READERS ->
+ smp_mb_pid(i, j);
+ i++;
+ :: i >= NR_READERS -> break
+ od;
+ smp_mb_pid(get_pid(), j);
+}
+
+inline smp_mb_reader(i, j)
+{
+ skip;
}
#else
}
}
+inline smp_mb_writer(i, j)
+{
+ smp_mb(i, j);
+}
+
+inline smp_mb_reader(i, j)
+{
+ smp_mb(i, j);
+}
+
#endif
/* Keep in sync manually with smp_rmb, wmp_wmb, ooo_mem and init() */
&& ((tmp2 ^ READ_CACHED_VAR(urcu_gp_ctr))
& RCU_GP_CTR_BIT) ->
#ifndef GEN_ERROR_WRITER_PROGRESS
- smp_mb(i, j);
+ smp_mb_writer(i, j);
#else
ooo_mem(i);
#endif
/* Model the RCU read-side critical section. */
+#ifndef TEST_SIGNAL_ON_WRITE
+
inline urcu_one_read(i, j, nest_i, tmp, tmp2)
{
nest_i = 0;
WRITE_CACHED_VAR(urcu_active_readers[get_readerid()],
tmp + 1);
fi;
- smp_mb(i, j);
+ smp_mb_reader(i, j);
dispatch_sighand_read_exec();
nest_i++;
:: nest_i >= READER_NEST_LEVEL -> break;
nest_i = 0;
do
:: nest_i < READER_NEST_LEVEL ->
- smp_mb(i, j);
+ smp_mb_reader(i, j);
dispatch_sighand_read_exec();
tmp2 = READ_CACHED_VAR(urcu_active_readers[get_readerid()]);
ooo_mem(i);
* progress when it's blocked by an always progressing reader.
*/
#ifdef READER_PROGRESS
- /* Only test progress of one random reader. They are all the
- * same. */
- if
- :: get_readerid() == 0 ->
progress_reader:
- skip;
- fi;
#endif
urcu_one_read(i, j, nest_i, tmp, tmp2);
od;
}
+#endif //!TEST_SIGNAL_ON_WRITE
+
#ifdef TEST_SIGNAL
/* signal handler reader */
WRITE_CACHED_VAR(urcu_active_readers[get_readerid()],
tmp + 1);
fi;
- smp_mb(i, j);
+ smp_mb_reader(i, j);
nest_i++;
:: nest_i >= READER_NEST_LEVEL -> break;
od;
nest_i = 0;
do
:: nest_i < READER_NEST_LEVEL ->
- smp_mb(i, j);
+ smp_mb_reader(i, j);
tmp2 = READ_CACHED_VAR(urcu_active_readers[get_readerid()]);
ooo_mem(i);
WRITE_CACHED_VAR(urcu_active_readers[get_readerid()], tmp2 - 1);
* progress when it's blocked by an always progressing reader.
*/
#ifdef READER_PROGRESS
- /* Only test progress of one random reader. They are all the
- * same. */
- if
- :: get_readerid() == 0 ->
progress_reader:
- skip;
- fi;
#endif
urcu_one_read_sig(i, j, nest_i, tmp, tmp2);
od;
fi;
}
od;
- smp_mb(i, j);
+ smp_mb_writer(i, j);
dispatch_sighand_write_exec();
tmp = READ_CACHED_VAR(urcu_gp_ctr);
ooo_mem(i);
dispatch_sighand_write_exec();
wait_for_quiescent_state(tmp, tmp2, i, j);
#endif
- smp_mb(i, j);
+ smp_mb_writer(i, j);
dispatch_sighand_write_exec();
write_lock = 0;
/* free-up step, e.g., kfree(). */