Add phase 3 : scalability run
[urcu.git] / formal-model / results / urcu-controldataflow-no-ipi / result-ipi-urcu_free / urcu.spin.bkp.b4ptr
CommitLineData
dbf69285
MD
1/*
2 * mem.spin: Promela code to validate memory barriers with OOO memory
3 * and out-of-order instruction scheduling.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *
19 * Copyright (c) 2009 Mathieu Desnoyers
20 */
21
22/* Promela validation variables. */
23
24/* specific defines "included" here */
25/* DEFINES file "included" here */
26
27#define NR_READERS 1
28#define NR_WRITERS 1
29
30#define NR_PROCS 2
31
32#define get_pid() (_pid)
33
34#define get_readerid() (get_pid())
35
36/*
37 * Produced process control and data flow. Updated after each instruction to
38 * show which variables are ready. Using one-hot bit encoding per variable to
39 * save state space. Used as triggers to execute the instructions having those
40 * variables as input. Leaving bits active to inhibit instruction execution.
41 * Scheme used to make instruction disabling and automatic dependency fall-back
42 * automatic.
43 */
44
45#define CONSUME_TOKENS(state, bits, notbits) \
46 ((!(state & (notbits))) && (state & (bits)) == (bits))
47
48#define PRODUCE_TOKENS(state, bits) \
49 state = state | (bits);
50
51#define CLEAR_TOKENS(state, bits) \
52 state = state & ~(bits)
53
54/*
55 * Types of dependency :
56 *
57 * Data dependency
58 *
59 * - True dependency, Read-after-Write (RAW)
60 *
61 * This type of dependency happens when a statement depends on the result of a
62 * previous statement. This applies to any statement which needs to read a
63 * variable written by a preceding statement.
64 *
65 * - False dependency, Write-after-Read (WAR)
66 *
67 * Typically, variable renaming can ensure that this dependency goes away.
68 * However, if the statements must read and then write from/to the same variable
69 * in the OOO memory model, renaming may be impossible, and therefore this
70 * causes a WAR dependency.
71 *
72 * - Output dependency, Write-after-Write (WAW)
73 *
74 * Two writes to the same variable in subsequent statements. Variable renaming
75 * can ensure this is not needed, but can be required when writing multiple
76 * times to the same OOO mem model variable.
77 *
78 * Control dependency
79 *
80 * Execution of a given instruction depends on a previous instruction evaluating
81 * in a way that allows its execution. E.g. : branches.
82 *
83 * Useful considerations for joining dependencies after branch
84 *
85 * - Pre-dominance
86 *
87 * "We say box i dominates box j if every path (leading from input to output
88 * through the diagram) which passes through box j must also pass through box
89 * i. Thus box i dominates box j if box j is subordinate to box i in the
90 * program."
91 *
92 * http://www.hipersoft.rice.edu/grads/publications/dom14.pdf
93 * Other classic algorithm to calculate dominance : Lengauer-Tarjan (in gcc)
94 *
95 * - Post-dominance
96 *
97 * Just as pre-dominance, but with arcs of the data flow inverted, and input vs
98 * output exchanged. Therefore, i post-dominating j ensures that every path
99 * passing by j will pass by i before reaching the output.
100 *
101 * Other considerations
102 *
103 * Note about "volatile" keyword dependency : The compiler will order volatile
104 * accesses so they appear in the right order on a given CPU. They can be
105 * reordered by the CPU instruction scheduling. This therefore cannot be
106 * considered as a depencency.
107 *
108 * References :
109 *
110 * Cooper, Keith D.; & Torczon, Linda. (2005). Engineering a Compiler. Morgan
111 * Kaufmann. ISBN 1-55860-698-X.
112 * Kennedy, Ken; & Allen, Randy. (2001). Optimizing Compilers for Modern
113 * Architectures: A Dependence-based Approach. Morgan Kaufmann. ISBN
114 * 1-55860-286-0.
115 * Muchnick, Steven S. (1997). Advanced Compiler Design and Implementation.
116 * Morgan Kaufmann. ISBN 1-55860-320-4.
117 */
118
119/*
120 * Note about loops and nested calls
121 *
122 * To keep this model simple, loops expressed in the framework will behave as if
123 * there was a core synchronizing instruction between loops. To see the effect
124 * of loop unrolling, manually unrolling loops is required. Note that if loops
125 * end or start with a core synchronizing instruction, the model is appropriate.
126 * Nested calls are not supported.
127 */
128
129/*
130 * Each process have its own data in cache. Caches are randomly updated.
131 * smp_wmb and smp_rmb forces cache updates (write and read), smp_mb forces
132 * both.
133 */
134
135typedef per_proc_byte {
136 byte val[NR_PROCS];
137};
138
139/* Bitfield has a maximum of 8 procs */
140typedef per_proc_bit {
141 byte bitfield;
142};
143
144#define DECLARE_CACHED_VAR(type, x) \
145 type mem_##x; \
146 per_proc_##type cached_##x; \
147 per_proc_bit cache_dirty_##x;
148
149#define INIT_CACHED_VAR(x, v, j) \
150 mem_##x = v; \
151 cache_dirty_##x.bitfield = 0; \
152 j = 0; \
153 do \
154 :: j < NR_PROCS -> \
155 cached_##x.val[j] = v; \
156 j++ \
157 :: j >= NR_PROCS -> break \
158 od;
159
160#define IS_CACHE_DIRTY(x, id) (cache_dirty_##x.bitfield & (1 << id))
161
162#define READ_CACHED_VAR(x) (cached_##x.val[get_pid()])
163
164#define WRITE_CACHED_VAR(x, v) \
165 atomic { \
166 cached_##x.val[get_pid()] = v; \
167 cache_dirty_##x.bitfield = \
168 cache_dirty_##x.bitfield | (1 << get_pid()); \
169 }
170
171#define CACHE_WRITE_TO_MEM(x, id) \
172 if \
173 :: IS_CACHE_DIRTY(x, id) -> \
174 mem_##x = cached_##x.val[id]; \
175 cache_dirty_##x.bitfield = \
176 cache_dirty_##x.bitfield & (~(1 << id)); \
177 :: else -> \
178 skip \
179 fi;
180
181#define CACHE_READ_FROM_MEM(x, id) \
182 if \
183 :: !IS_CACHE_DIRTY(x, id) -> \
184 cached_##x.val[id] = mem_##x;\
185 :: else -> \
186 skip \
187 fi;
188
189/*
190 * May update other caches if cache is dirty, or not.
191 */
192#define RANDOM_CACHE_WRITE_TO_MEM(x, id)\
193 if \
194 :: 1 -> CACHE_WRITE_TO_MEM(x, id); \
195 :: 1 -> skip \
196 fi;
197
198#define RANDOM_CACHE_READ_FROM_MEM(x, id)\
199 if \
200 :: 1 -> CACHE_READ_FROM_MEM(x, id); \
201 :: 1 -> skip \
202 fi;
203
204/* Must consume all prior read tokens. All subsequent reads depend on it. */
205inline smp_rmb(i, j)
206{
207 atomic {
208 CACHE_READ_FROM_MEM(urcu_gp_ctr, get_pid());
209 i = 0;
210 do
211 :: i < NR_READERS ->
212 CACHE_READ_FROM_MEM(urcu_active_readers[i], get_pid());
213 i++
214 :: i >= NR_READERS -> break
215 od;
216 CACHE_READ_FROM_MEM(generation_ptr, get_pid());
217 }
218}
219
220/* Must consume all prior write tokens. All subsequent writes depend on it. */
221inline smp_wmb(i, j)
222{
223 atomic {
224 CACHE_WRITE_TO_MEM(urcu_gp_ctr, get_pid());
225 i = 0;
226 do
227 :: i < NR_READERS ->
228 CACHE_WRITE_TO_MEM(urcu_active_readers[i], get_pid());
229 i++
230 :: i >= NR_READERS -> break
231 od;
232 CACHE_WRITE_TO_MEM(generation_ptr, get_pid());
233 }
234}
235
236/* Synchronization point. Must consume all prior read and write tokens. All
237 * subsequent reads and writes depend on it. */
238inline smp_mb(i, j)
239{
240 atomic {
241 smp_wmb(i, j);
242 smp_rmb(i, j);
243 }
244}
245
246#ifdef REMOTE_BARRIERS
247
248bit reader_barrier[NR_READERS];
249
250/*
251 * We cannot leave the barriers dependencies in place in REMOTE_BARRIERS mode
252 * because they would add unexisting core synchronization and would therefore
253 * create an incomplete model.
254 * Therefore, we model the read-side memory barriers by completely disabling the
255 * memory barriers and their dependencies from the read-side. One at a time
256 * (different verification runs), we make a different instruction listen for
257 * signals.
258 */
259
260#define smp_mb_reader(i, j)
261
262/*
263 * Service 0, 1 or many barrier requests.
264 */
265inline smp_mb_recv(i, j)
266{
267 do
268 :: (reader_barrier[get_readerid()] == 1) ->
269 smp_mb(i, j);
270 reader_barrier[get_readerid()] = 0;
271 :: 1 ->
272 /*
273 * Busy-looping waiting for other barrier requests is not considered as
274 * non-progress.
275 */
276#ifdef READER_PROGRESS
277progress_reader2:
278#endif
279#ifdef WRITER_PROGRESS
280//progress_writer_from_reader1:
281#endif
282 skip;
283 :: 1 ->
284 /* We choose to ignore writer's non-progress caused from the
285 * reader ignoring the writer's mb() requests */
286#ifdef WRITER_PROGRESS
287//progress_writer_from_reader2:
288#endif
289 break;
290 od;
291}
292
293#ifdef WRITER_PROGRESS
294#define PROGRESS_LABEL(progressid) progress_writer_progid_##progressid:
295#else
296#define PROGRESS_LABEL(progressid)
297#endif
298
299#define smp_mb_send(i, j, progressid) \
300{ \
301 smp_mb(i, j); \
302 i = 0; \
303 do \
304 :: i < NR_READERS -> \
305 reader_barrier[i] = 1; \
306 /* \
307 * Busy-looping waiting for reader barrier handling is of little\
308 * interest, given the reader has the ability to totally ignore \
309 * barrier requests. \
310 */ \
311PROGRESS_LABEL(progressid) \
312 do \
313 :: (reader_barrier[i] == 1) -> skip; \
314 :: (reader_barrier[i] == 0) -> break; \
315 od; \
316 i++; \
317 :: i >= NR_READERS -> \
318 break \
319 od; \
320 smp_mb(i, j); \
321}
322
323#else
324
325#define smp_mb_send(i, j, progressid) smp_mb(i, j)
326#define smp_mb_reader smp_mb
327#define smp_mb_recv(i, j)
328
329#endif
330
331/* Keep in sync manually with smp_rmb, wmp_wmb, ooo_mem and init() */
332DECLARE_CACHED_VAR(byte, urcu_gp_ctr);
333/* Note ! currently only two readers */
334DECLARE_CACHED_VAR(byte, urcu_active_readers[NR_READERS]);
335/* pointer generation */
336DECLARE_CACHED_VAR(byte, generation_ptr);
337
338byte last_free_gen = 0;
339bit free_done = 0;
340byte read_generation[NR_READERS];
341bit data_access[NR_READERS];
342
343bit write_lock = 0;
344
345bit init_done = 0;
346
347bit sighand_exec = 0;
348
349inline wait_init_done()
350{
351 do
352 :: init_done == 0 -> skip;
353 :: else -> break;
354 od;
355}
356
357inline ooo_mem(i)
358{
359 atomic {
360 RANDOM_CACHE_WRITE_TO_MEM(urcu_gp_ctr, get_pid());
361 i = 0;
362 do
363 :: i < NR_READERS ->
364 RANDOM_CACHE_WRITE_TO_MEM(urcu_active_readers[i],
365 get_pid());
366 i++
367 :: i >= NR_READERS -> break
368 od;
369 RANDOM_CACHE_WRITE_TO_MEM(generation_ptr, get_pid());
370 RANDOM_CACHE_READ_FROM_MEM(urcu_gp_ctr, get_pid());
371 i = 0;
372 do
373 :: i < NR_READERS ->
374 RANDOM_CACHE_READ_FROM_MEM(urcu_active_readers[i],
375 get_pid());
376 i++
377 :: i >= NR_READERS -> break
378 od;
379 RANDOM_CACHE_READ_FROM_MEM(generation_ptr, get_pid());
380 }
381}
382
383/*
384 * Bit encoding, urcu_reader :
385 */
386
387int _proc_urcu_reader;
388#define proc_urcu_reader _proc_urcu_reader
389
390/* Body of PROCEDURE_READ_LOCK */
391#define READ_PROD_A_READ (1 << 0)
392#define READ_PROD_B_IF_TRUE (1 << 1)
393#define READ_PROD_B_IF_FALSE (1 << 2)
394#define READ_PROD_C_IF_TRUE_READ (1 << 3)
395
396#define PROCEDURE_READ_LOCK(base, consumetoken, producetoken) \
397 :: CONSUME_TOKENS(proc_urcu_reader, consumetoken, READ_PROD_A_READ << base) -> \
398 ooo_mem(i); \
399 tmp = READ_CACHED_VAR(urcu_active_readers[get_readerid()]); \
400 PRODUCE_TOKENS(proc_urcu_reader, READ_PROD_A_READ << base); \
401 :: CONSUME_TOKENS(proc_urcu_reader, \
402 READ_PROD_A_READ << base, /* RAW, pre-dominant */ \
403 (READ_PROD_B_IF_TRUE | READ_PROD_B_IF_FALSE) << base) -> \
404 if \
405 :: (!(tmp & RCU_GP_CTR_NEST_MASK)) -> \
406 PRODUCE_TOKENS(proc_urcu_reader, READ_PROD_B_IF_TRUE << base); \
407 :: else -> \
408 PRODUCE_TOKENS(proc_urcu_reader, READ_PROD_B_IF_FALSE << base); \
409 fi; \
410 /* IF TRUE */ \
411 :: CONSUME_TOKENS(proc_urcu_reader, READ_PROD_B_IF_TRUE << base, \
412 READ_PROD_C_IF_TRUE_READ << base) -> \
413 ooo_mem(i); \
414 tmp2 = READ_CACHED_VAR(urcu_gp_ctr); \
415 PRODUCE_TOKENS(proc_urcu_reader, READ_PROD_C_IF_TRUE_READ << base); \
416 :: CONSUME_TOKENS(proc_urcu_reader, \
417 (READ_PROD_C_IF_TRUE_READ /* pre-dominant */ \
418 | READ_PROD_A_READ) << base, /* WAR */ \
419 producetoken) -> \
420 ooo_mem(i); \
421 WRITE_CACHED_VAR(urcu_active_readers[get_readerid()], tmp2); \
422 PRODUCE_TOKENS(proc_urcu_reader, producetoken); \
423 /* IF_MERGE implies \
424 * post-dominance */ \
425 /* ELSE */ \
426 :: CONSUME_TOKENS(proc_urcu_reader, \
427 (READ_PROD_B_IF_FALSE /* pre-dominant */ \
428 | READ_PROD_A_READ) << base, /* WAR */ \
429 producetoken) -> \
430 ooo_mem(i); \
431 WRITE_CACHED_VAR(urcu_active_readers[get_readerid()], \
432 tmp + 1); \
433 PRODUCE_TOKENS(proc_urcu_reader, producetoken); \
434 /* IF_MERGE implies \
435 * post-dominance */ \
436 /* ENDIF */ \
437 skip
438
439/* Body of PROCEDURE_READ_LOCK */
440#define READ_PROC_READ_UNLOCK (1 << 0)
441
442#define PROCEDURE_READ_UNLOCK(base, consumetoken, producetoken) \
443 :: CONSUME_TOKENS(proc_urcu_reader, \
444 consumetoken, \
445 READ_PROC_READ_UNLOCK << base) -> \
446 ooo_mem(i); \
447 tmp2 = READ_CACHED_VAR(urcu_active_readers[get_readerid()]); \
448 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_READ_UNLOCK << base); \
449 :: CONSUME_TOKENS(proc_urcu_reader, \
450 consumetoken \
451 | (READ_PROC_READ_UNLOCK << base), /* WAR */ \
452 producetoken) -> \
453 ooo_mem(i); \
454 WRITE_CACHED_VAR(urcu_active_readers[get_readerid()], tmp2 - 1); \
455 PRODUCE_TOKENS(proc_urcu_reader, producetoken); \
456 skip
457
458
459#define READ_PROD_NONE (1 << 0)
460
461/* PROCEDURE_READ_LOCK base = << 1 : 1 to 5 */
462#define READ_LOCK_BASE 1
463#define READ_LOCK_OUT (1 << 5)
464
465#define READ_PROC_FIRST_MB (1 << 6)
466
467/* PROCEDURE_READ_LOCK (NESTED) base : << 7 : 7 to 11 */
468#define READ_LOCK_NESTED_BASE 7
469#define READ_LOCK_NESTED_OUT (1 << 11)
470
471#define READ_PROC_READ_GEN (1 << 12)
472#define READ_PROC_ACCESS_GEN (1 << 13)
473
474/* PROCEDURE_READ_UNLOCK (NESTED) base = << 14 : 14 to 15 */
475#define READ_UNLOCK_NESTED_BASE 14
476#define READ_UNLOCK_NESTED_OUT (1 << 15)
477
478#define READ_PROC_SECOND_MB (1 << 16)
479
480/* PROCEDURE_READ_UNLOCK base = << 17 : 17 to 18 */
481#define READ_UNLOCK_BASE 17
482#define READ_UNLOCK_OUT (1 << 18)
483
484/* PROCEDURE_READ_LOCK_UNROLL base = << 19 : 19 to 23 */
485#define READ_LOCK_UNROLL_BASE 19
486#define READ_LOCK_OUT_UNROLL (1 << 23)
487
488#define READ_PROC_THIRD_MB (1 << 24)
489
490#define READ_PROC_READ_GEN_UNROLL (1 << 25)
491#define READ_PROC_ACCESS_GEN_UNROLL (1 << 26)
492
493#define READ_PROC_FOURTH_MB (1 << 27)
494
495/* PROCEDURE_READ_UNLOCK_UNROLL base = << 28 : 28 to 29 */
496#define READ_UNLOCK_UNROLL_BASE 28
497#define READ_UNLOCK_OUT_UNROLL (1 << 29)
498
499
500/* Should not include branches */
501#define READ_PROC_ALL_TOKENS (READ_PROD_NONE \
502 | READ_LOCK_OUT \
503 | READ_PROC_FIRST_MB \
504 | READ_LOCK_NESTED_OUT \
505 | READ_PROC_READ_GEN \
506 | READ_PROC_ACCESS_GEN \
507 | READ_UNLOCK_NESTED_OUT \
508 | READ_PROC_SECOND_MB \
509 | READ_UNLOCK_OUT \
510 | READ_LOCK_OUT_UNROLL \
511 | READ_PROC_THIRD_MB \
512 | READ_PROC_READ_GEN_UNROLL \
513 | READ_PROC_ACCESS_GEN_UNROLL \
514 | READ_PROC_FOURTH_MB \
515 | READ_UNLOCK_OUT_UNROLL)
516
517/* Must clear all tokens, including branches */
518#define READ_PROC_ALL_TOKENS_CLEAR ((1 << 30) - 1)
519
520inline urcu_one_read(i, j, nest_i, tmp, tmp2)
521{
522 PRODUCE_TOKENS(proc_urcu_reader, READ_PROD_NONE);
523
524#ifdef NO_MB
525 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_FIRST_MB);
526 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_SECOND_MB);
527 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_THIRD_MB);
528 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_FOURTH_MB);
529#endif
530
531#ifdef REMOTE_BARRIERS
532 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_FIRST_MB);
533 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_SECOND_MB);
534 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_THIRD_MB);
535 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_FOURTH_MB);
536#endif
537
538 do
539 :: 1 ->
540
541#ifdef REMOTE_BARRIERS
542 /*
543 * Signal-based memory barrier will only execute when the
544 * execution order appears in program order.
545 */
546 if
547 :: 1 ->
548 atomic {
549 if
550 :: CONSUME_TOKENS(proc_urcu_reader, READ_PROD_NONE,
551 READ_LOCK_OUT | READ_LOCK_NESTED_OUT
552 | READ_PROC_READ_GEN | READ_PROC_ACCESS_GEN | READ_UNLOCK_NESTED_OUT
553 | READ_UNLOCK_OUT
554 | READ_LOCK_OUT_UNROLL
555 | READ_PROC_READ_GEN_UNROLL | READ_PROC_ACCESS_GEN_UNROLL | READ_UNLOCK_OUT_UNROLL)
556 || CONSUME_TOKENS(proc_urcu_reader, READ_PROD_NONE | READ_LOCK_OUT,
557 READ_LOCK_NESTED_OUT
558 | READ_PROC_READ_GEN | READ_PROC_ACCESS_GEN | READ_UNLOCK_NESTED_OUT
559 | READ_UNLOCK_OUT
560 | READ_LOCK_OUT_UNROLL
561 | READ_PROC_READ_GEN_UNROLL | READ_PROC_ACCESS_GEN_UNROLL | READ_UNLOCK_OUT_UNROLL)
562 || CONSUME_TOKENS(proc_urcu_reader, READ_PROD_NONE | READ_LOCK_OUT | READ_LOCK_NESTED_OUT,
563 READ_PROC_READ_GEN | READ_PROC_ACCESS_GEN | READ_UNLOCK_NESTED_OUT
564 | READ_UNLOCK_OUT
565 | READ_LOCK_OUT_UNROLL
566 | READ_PROC_READ_GEN_UNROLL | READ_PROC_ACCESS_GEN_UNROLL | READ_UNLOCK_OUT_UNROLL)
567 || CONSUME_TOKENS(proc_urcu_reader, READ_PROD_NONE | READ_LOCK_OUT
568 | READ_LOCK_NESTED_OUT | READ_PROC_READ_GEN,
569 READ_PROC_ACCESS_GEN | READ_UNLOCK_NESTED_OUT
570 | READ_UNLOCK_OUT
571 | READ_LOCK_OUT_UNROLL
572 | READ_PROC_READ_GEN_UNROLL | READ_PROC_ACCESS_GEN_UNROLL | READ_UNLOCK_OUT_UNROLL)
573 || CONSUME_TOKENS(proc_urcu_reader, READ_PROD_NONE | READ_LOCK_OUT
574 | READ_LOCK_NESTED_OUT | READ_PROC_READ_GEN | READ_PROC_ACCESS_GEN,
575 READ_UNLOCK_NESTED_OUT
576 | READ_UNLOCK_OUT
577 | READ_LOCK_OUT_UNROLL
578 | READ_PROC_READ_GEN_UNROLL | READ_PROC_ACCESS_GEN_UNROLL | READ_UNLOCK_OUT_UNROLL)
579 || CONSUME_TOKENS(proc_urcu_reader, READ_PROD_NONE | READ_LOCK_OUT
580 | READ_LOCK_NESTED_OUT | READ_PROC_READ_GEN
581 | READ_PROC_ACCESS_GEN | READ_UNLOCK_NESTED_OUT,
582 READ_UNLOCK_OUT
583 | READ_LOCK_OUT_UNROLL
584 | READ_PROC_READ_GEN_UNROLL | READ_PROC_ACCESS_GEN_UNROLL | READ_UNLOCK_OUT_UNROLL)
585 || CONSUME_TOKENS(proc_urcu_reader, READ_PROD_NONE | READ_LOCK_OUT
586 | READ_LOCK_NESTED_OUT | READ_PROC_READ_GEN
587 | READ_PROC_ACCESS_GEN | READ_UNLOCK_NESTED_OUT
588 | READ_UNLOCK_OUT,
589 READ_LOCK_OUT_UNROLL
590 | READ_PROC_READ_GEN_UNROLL | READ_PROC_ACCESS_GEN_UNROLL | READ_UNLOCK_OUT_UNROLL)
591 || CONSUME_TOKENS(proc_urcu_reader, READ_PROD_NONE | READ_LOCK_OUT
592 | READ_LOCK_NESTED_OUT | READ_PROC_READ_GEN
593 | READ_PROC_ACCESS_GEN | READ_UNLOCK_NESTED_OUT
594 | READ_UNLOCK_OUT | READ_LOCK_OUT_UNROLL,
595 READ_PROC_READ_GEN_UNROLL | READ_PROC_ACCESS_GEN_UNROLL | READ_UNLOCK_OUT_UNROLL)
596 || CONSUME_TOKENS(proc_urcu_reader, READ_PROD_NONE | READ_LOCK_OUT
597 | READ_LOCK_NESTED_OUT | READ_PROC_READ_GEN
598 | READ_PROC_ACCESS_GEN | READ_UNLOCK_NESTED_OUT
599 | READ_UNLOCK_OUT | READ_LOCK_OUT_UNROLL
600 | READ_PROC_READ_GEN_UNROLL,
601 READ_PROC_ACCESS_GEN_UNROLL | READ_UNLOCK_OUT_UNROLL)
602 || CONSUME_TOKENS(proc_urcu_reader, READ_PROD_NONE | READ_LOCK_OUT
603 | READ_LOCK_NESTED_OUT | READ_PROC_READ_GEN
604 | READ_PROC_ACCESS_GEN | READ_UNLOCK_NESTED_OUT
605 | READ_UNLOCK_OUT | READ_LOCK_OUT_UNROLL
606 | READ_PROC_READ_GEN_UNROLL | READ_PROC_ACCESS_GEN_UNROLL,
607 READ_UNLOCK_OUT_UNROLL)
608 || CONSUME_TOKENS(proc_urcu_reader, READ_PROD_NONE | READ_LOCK_OUT
609 | READ_LOCK_NESTED_OUT | READ_PROC_READ_GEN | READ_PROC_ACCESS_GEN | READ_UNLOCK_NESTED_OUT
610 | READ_UNLOCK_OUT | READ_LOCK_OUT_UNROLL
611 | READ_PROC_READ_GEN_UNROLL | READ_PROC_ACCESS_GEN_UNROLL | READ_UNLOCK_OUT_UNROLL,
612 0) ->
613 goto non_atomic3;
614non_atomic3_end:
615 skip;
616 fi;
617 }
618 :: 1 -> skip;
619 fi;
620
621 goto non_atomic3_skip;
622non_atomic3:
623 smp_mb_recv(i, j);
624 goto non_atomic3_end;
625non_atomic3_skip:
626
627#endif /* REMOTE_BARRIERS */
628
629 atomic {
630 if
631 PROCEDURE_READ_LOCK(READ_LOCK_BASE, READ_PROD_NONE, READ_LOCK_OUT);
632
633 :: CONSUME_TOKENS(proc_urcu_reader,
634 READ_LOCK_OUT, /* post-dominant */
635 READ_PROC_FIRST_MB) ->
636 smp_mb_reader(i, j);
637 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_FIRST_MB);
638
639 PROCEDURE_READ_LOCK(READ_LOCK_NESTED_BASE, READ_PROC_FIRST_MB | READ_LOCK_OUT,
640 READ_LOCK_NESTED_OUT);
641
642 :: CONSUME_TOKENS(proc_urcu_reader,
643 READ_PROC_FIRST_MB, /* mb() orders reads */
644 READ_PROC_READ_GEN) ->
645 ooo_mem(i);
646 read_generation[get_readerid()] =
647 READ_CACHED_VAR(generation_ptr);
648 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_READ_GEN);
649
650 :: CONSUME_TOKENS(proc_urcu_reader,
651 READ_PROC_FIRST_MB /* mb() orders reads */
652 | READ_PROC_READ_GEN,
653 READ_PROC_ACCESS_GEN) ->
654 ooo_mem(i);
655 goto non_atomic;
656non_atomic_end:
657 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_ACCESS_GEN);
658
659
660 /* Note : we remove the nested memory barrier from the read unlock
661 * model, given it is not usually needed. The implementation has the barrier
662 * because the performance impact added by a branch in the common case does not
663 * justify it.
664 */
665
666 PROCEDURE_READ_UNLOCK(READ_UNLOCK_NESTED_BASE,
667 READ_PROC_FIRST_MB
668 | READ_LOCK_OUT
669 | READ_LOCK_NESTED_OUT,
670 READ_UNLOCK_NESTED_OUT);
671
672
673 :: CONSUME_TOKENS(proc_urcu_reader,
674 READ_PROC_ACCESS_GEN /* mb() orders reads */
675 | READ_PROC_READ_GEN /* mb() orders reads */
676 | READ_PROC_FIRST_MB /* mb() ordered */
677 | READ_LOCK_OUT /* post-dominant */
678 | READ_LOCK_NESTED_OUT /* post-dominant */
679 | READ_UNLOCK_NESTED_OUT,
680 READ_PROC_SECOND_MB) ->
681 smp_mb_reader(i, j);
682 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_SECOND_MB);
683
684 PROCEDURE_READ_UNLOCK(READ_UNLOCK_BASE,
685 READ_PROC_SECOND_MB /* mb() orders reads */
686 | READ_PROC_FIRST_MB /* mb() orders reads */
687 | READ_LOCK_NESTED_OUT /* RAW */
688 | READ_LOCK_OUT /* RAW */
689 | READ_UNLOCK_NESTED_OUT, /* RAW */
690 READ_UNLOCK_OUT);
691
692 /* Unrolling loop : second consecutive lock */
693 /* reading urcu_active_readers, which have been written by
694 * READ_UNLOCK_OUT : RAW */
695 PROCEDURE_READ_LOCK(READ_LOCK_UNROLL_BASE,
696 READ_UNLOCK_OUT /* RAW */
697 | READ_PROC_SECOND_MB /* mb() orders reads */
698 | READ_PROC_FIRST_MB /* mb() orders reads */
699 | READ_LOCK_NESTED_OUT /* RAW */
700 | READ_LOCK_OUT /* RAW */
701 | READ_UNLOCK_NESTED_OUT, /* RAW */
702 READ_LOCK_OUT_UNROLL);
703
704
705 :: CONSUME_TOKENS(proc_urcu_reader,
706 READ_PROC_FIRST_MB /* mb() ordered */
707 | READ_PROC_SECOND_MB /* mb() ordered */
708 | READ_LOCK_OUT_UNROLL /* post-dominant */
709 | READ_LOCK_NESTED_OUT
710 | READ_LOCK_OUT
711 | READ_UNLOCK_NESTED_OUT
712 | READ_UNLOCK_OUT,
713 READ_PROC_THIRD_MB) ->
714 smp_mb_reader(i, j);
715 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_THIRD_MB);
716
717 :: CONSUME_TOKENS(proc_urcu_reader,
718 READ_PROC_FIRST_MB /* mb() orders reads */
719 | READ_PROC_SECOND_MB /* mb() orders reads */
720 | READ_PROC_THIRD_MB, /* mb() orders reads */
721 READ_PROC_READ_GEN_UNROLL) ->
722 ooo_mem(i);
723 read_generation[get_readerid()] =
724 READ_CACHED_VAR(generation_ptr);
725 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_READ_GEN_UNROLL);
726
727 :: CONSUME_TOKENS(proc_urcu_reader,
728 READ_PROC_READ_GEN_UNROLL
729 | READ_PROC_FIRST_MB /* mb() orders reads */
730 | READ_PROC_SECOND_MB /* mb() orders reads */
731 | READ_PROC_THIRD_MB, /* mb() orders reads */
732 READ_PROC_ACCESS_GEN_UNROLL) ->
733 ooo_mem(i);
734 goto non_atomic2;
735non_atomic2_end:
736 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_ACCESS_GEN_UNROLL);
737
738 :: CONSUME_TOKENS(proc_urcu_reader,
739 READ_PROC_READ_GEN_UNROLL /* mb() orders reads */
740 | READ_PROC_ACCESS_GEN_UNROLL /* mb() orders reads */
741 | READ_PROC_FIRST_MB /* mb() ordered */
742 | READ_PROC_SECOND_MB /* mb() ordered */
743 | READ_PROC_THIRD_MB /* mb() ordered */
744 | READ_LOCK_OUT_UNROLL /* post-dominant */
745 | READ_LOCK_NESTED_OUT
746 | READ_LOCK_OUT
747 | READ_UNLOCK_NESTED_OUT
748 | READ_UNLOCK_OUT,
749 READ_PROC_FOURTH_MB) ->
750 smp_mb_reader(i, j);
751 PRODUCE_TOKENS(proc_urcu_reader, READ_PROC_FOURTH_MB);
752
753 PROCEDURE_READ_UNLOCK(READ_UNLOCK_UNROLL_BASE,
754 READ_PROC_FOURTH_MB /* mb() orders reads */
755 | READ_PROC_THIRD_MB /* mb() orders reads */
756 | READ_LOCK_OUT_UNROLL /* RAW */
757 | READ_PROC_SECOND_MB /* mb() orders reads */
758 | READ_PROC_FIRST_MB /* mb() orders reads */
759 | READ_LOCK_NESTED_OUT /* RAW */
760 | READ_LOCK_OUT /* RAW */
761 | READ_UNLOCK_NESTED_OUT, /* RAW */
762 READ_UNLOCK_OUT_UNROLL);
763 :: CONSUME_TOKENS(proc_urcu_reader, READ_PROC_ALL_TOKENS, 0) ->
764 CLEAR_TOKENS(proc_urcu_reader, READ_PROC_ALL_TOKENS_CLEAR);
765 break;
766 fi;
767 }
768 od;
769 /*
770 * Dependency between consecutive loops :
771 * RAW dependency on
772 * WRITE_CACHED_VAR(urcu_active_readers[get_readerid()], tmp2 - 1)
773 * tmp = READ_CACHED_VAR(urcu_active_readers[get_readerid()]);
774 * between loops.
775 * _WHEN THE MB()s are in place_, they add full ordering of the
776 * generation pointer read wrt active reader count read, which ensures
777 * execution will not spill across loop execution.
778 * However, in the event mb()s are removed (execution using signal
779 * handler to promote barrier()() -> smp_mb()), nothing prevents one loop
780 * to spill its execution on other loop's execution.
781 */
782 goto end;
783non_atomic:
784 data_access[get_readerid()] = 1;
785 data_access[get_readerid()] = 0;
786 goto non_atomic_end;
787non_atomic2:
788 data_access[get_readerid()] = 1;
789 data_access[get_readerid()] = 0;
790 goto non_atomic2_end;
791end:
792 skip;
793}
794
795
796
797active proctype urcu_reader()
798{
799 byte i, j, nest_i;
800 byte tmp, tmp2;
801
802 wait_init_done();
803
804 assert(get_pid() < NR_PROCS);
805
806end_reader:
807 do
808 :: 1 ->
809 /*
810 * We do not test reader's progress here, because we are mainly
811 * interested in writer's progress. The reader never blocks
812 * anyway. We have to test for reader/writer's progress
813 * separately, otherwise we could think the writer is doing
814 * progress when it's blocked by an always progressing reader.
815 */
816#ifdef READER_PROGRESS
817progress_reader:
818#endif
819 urcu_one_read(i, j, nest_i, tmp, tmp2);
820 od;
821}
822
823/* no name clash please */
824#undef proc_urcu_reader
825
826
827/* Model the RCU update process. */
828
829/*
830 * Bit encoding, urcu_writer :
831 * Currently only supports one reader.
832 */
833
834int _proc_urcu_writer;
835#define proc_urcu_writer _proc_urcu_writer
836
837#define WRITE_PROD_NONE (1 << 0)
838
839#define WRITE_PROC_FIRST_MB (1 << 1)
840
841/* first flip */
842#define WRITE_PROC_FIRST_READ_GP (1 << 2)
843#define WRITE_PROC_FIRST_WRITE_GP (1 << 3)
844#define WRITE_PROC_FIRST_WAIT (1 << 4)
845#define WRITE_PROC_FIRST_WAIT_LOOP (1 << 5)
846
847/* second flip */
848#define WRITE_PROC_SECOND_READ_GP (1 << 6)
849#define WRITE_PROC_SECOND_WRITE_GP (1 << 7)
850#define WRITE_PROC_SECOND_WAIT (1 << 8)
851#define WRITE_PROC_SECOND_WAIT_LOOP (1 << 9)
852
853#define WRITE_PROC_SECOND_MB (1 << 10)
854
855#define WRITE_PROC_ALL_TOKENS (WRITE_PROD_NONE \
856 | WRITE_PROC_FIRST_MB \
857 | WRITE_PROC_FIRST_READ_GP \
858 | WRITE_PROC_FIRST_WRITE_GP \
859 | WRITE_PROC_FIRST_WAIT \
860 | WRITE_PROC_SECOND_READ_GP \
861 | WRITE_PROC_SECOND_WRITE_GP \
862 | WRITE_PROC_SECOND_WAIT \
863 | WRITE_PROC_SECOND_MB)
864
865#define WRITE_PROC_ALL_TOKENS_CLEAR ((1 << 11) - 1)
866
867active proctype urcu_writer()
868{
869 byte i, j;
870 byte tmp, tmp2, tmpa;
871 byte old_gen;
872 byte cur_gp_val = 0; /*
873 * Keep a local trace of the current parity so
874 * we don't add non-existing dependencies on the global
875 * GP update. Needed to test single flip case.
876 */
877
878 wait_init_done();
879
880 assert(get_pid() < NR_PROCS);
881
882 do
883 :: (READ_CACHED_VAR(generation_ptr) < 5) ->
884#ifdef WRITER_PROGRESS
885progress_writer1:
886#endif
887 ooo_mem(i);
888 atomic {
889 old_gen = READ_CACHED_VAR(generation_ptr);
890 WRITE_CACHED_VAR(generation_ptr, old_gen + 1);
891 }
892 ooo_mem(i);
893
894 do
895 :: 1 ->
896 atomic {
897 if
898 :: write_lock == 0 ->
899 write_lock = 1;
900 break;
901 :: else ->
902 skip;
903 fi;
904 }
905 od;
906
907 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROD_NONE);
908
909#ifdef NO_MB
910 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_FIRST_MB);
911 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_SECOND_MB);
912#endif
913
914#ifdef SINGLE_FLIP
915 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_SECOND_READ_GP);
916 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_SECOND_WRITE_GP);
917 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_SECOND_WAIT);
918 /* For single flip, we need to know the current parity */
919 cur_gp_val = cur_gp_val ^ RCU_GP_CTR_BIT;
920#endif
921
922 do :: 1 ->
923 atomic {
924 if
925 :: CONSUME_TOKENS(proc_urcu_writer,
926 WRITE_PROD_NONE,
927 WRITE_PROC_FIRST_MB) ->
928 goto smp_mb_send1;
929smp_mb_send1_end:
930 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_FIRST_MB);
931
932 /* first flip */
933 :: CONSUME_TOKENS(proc_urcu_writer,
934 WRITE_PROC_FIRST_MB,
935 WRITE_PROC_FIRST_READ_GP) ->
936 tmpa = READ_CACHED_VAR(urcu_gp_ctr);
937 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_FIRST_READ_GP);
938 :: CONSUME_TOKENS(proc_urcu_writer,
939 WRITE_PROC_FIRST_MB | WRITE_PROC_FIRST_READ_GP,
940 WRITE_PROC_FIRST_WRITE_GP) ->
941 ooo_mem(i);
942 WRITE_CACHED_VAR(urcu_gp_ctr, tmpa ^ RCU_GP_CTR_BIT);
943 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_FIRST_WRITE_GP);
944
945 :: CONSUME_TOKENS(proc_urcu_writer,
946 //WRITE_PROC_FIRST_WRITE_GP /* TEST ADDING SYNC CORE */
947 WRITE_PROC_FIRST_MB, /* can be reordered before/after flips */
948 WRITE_PROC_FIRST_WAIT | WRITE_PROC_FIRST_WAIT_LOOP) ->
949 ooo_mem(i);
950 /* ONLY WAITING FOR READER 0 */
951 tmp2 = READ_CACHED_VAR(urcu_active_readers[0]);
952#ifndef SINGLE_FLIP
953 /* In normal execution, we are always starting by
954 * waiting for the even parity.
955 */
956 cur_gp_val = RCU_GP_CTR_BIT;
957#endif
958 if
959 :: (tmp2 & RCU_GP_CTR_NEST_MASK)
960 && ((tmp2 ^ cur_gp_val) & RCU_GP_CTR_BIT) ->
961 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_FIRST_WAIT_LOOP);
962 :: else ->
963 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_FIRST_WAIT);
964 fi;
965
966 :: CONSUME_TOKENS(proc_urcu_writer,
967 //WRITE_PROC_FIRST_WRITE_GP /* TEST ADDING SYNC CORE */
968 WRITE_PROC_FIRST_WRITE_GP
969 | WRITE_PROC_FIRST_READ_GP
970 | WRITE_PROC_FIRST_WAIT_LOOP
971 | WRITE_PROC_FIRST_MB, /* can be reordered before/after flips */
972 0) ->
973#ifndef GEN_ERROR_WRITER_PROGRESS
974 goto smp_mb_send2;
975smp_mb_send2_end:
976#else
977 ooo_mem(i);
978#endif
979 /* This instruction loops to WRITE_PROC_FIRST_WAIT */
980 CLEAR_TOKENS(proc_urcu_writer, WRITE_PROC_FIRST_WAIT_LOOP | WRITE_PROC_FIRST_WAIT);
981
982 /* second flip */
983 :: CONSUME_TOKENS(proc_urcu_writer,
984 WRITE_PROC_FIRST_WAIT /* Control dependency : need to branch out of
985 * the loop to execute the next flip (CHECK) */
986 | WRITE_PROC_FIRST_WRITE_GP
987 | WRITE_PROC_FIRST_READ_GP
988 | WRITE_PROC_FIRST_MB,
989 WRITE_PROC_SECOND_READ_GP) ->
990 ooo_mem(i);
991 tmpa = READ_CACHED_VAR(urcu_gp_ctr);
992 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_SECOND_READ_GP);
993 :: CONSUME_TOKENS(proc_urcu_writer,
994 WRITE_PROC_FIRST_MB
995 | WRITE_PROC_FIRST_READ_GP
996 | WRITE_PROC_FIRST_WRITE_GP
997 | WRITE_PROC_SECOND_READ_GP,
998 WRITE_PROC_SECOND_WRITE_GP) ->
999 ooo_mem(i);
1000 WRITE_CACHED_VAR(urcu_gp_ctr, tmpa ^ RCU_GP_CTR_BIT);
1001 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_SECOND_WRITE_GP);
1002
1003 :: CONSUME_TOKENS(proc_urcu_writer,
1004 //WRITE_PROC_FIRST_WRITE_GP /* TEST ADDING SYNC CORE */
1005 WRITE_PROC_FIRST_WAIT
1006 | WRITE_PROC_FIRST_MB, /* can be reordered before/after flips */
1007 WRITE_PROC_SECOND_WAIT | WRITE_PROC_SECOND_WAIT_LOOP) ->
1008 ooo_mem(i);
1009 /* ONLY WAITING FOR READER 0 */
1010 tmp2 = READ_CACHED_VAR(urcu_active_readers[0]);
1011 if
1012 :: (tmp2 & RCU_GP_CTR_NEST_MASK)
1013 && ((tmp2 ^ 0) & RCU_GP_CTR_BIT) ->
1014 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_SECOND_WAIT_LOOP);
1015 :: else ->
1016 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_SECOND_WAIT);
1017 fi;
1018
1019 :: CONSUME_TOKENS(proc_urcu_writer,
1020 //WRITE_PROC_FIRST_WRITE_GP /* TEST ADDING SYNC CORE */
1021 WRITE_PROC_SECOND_WRITE_GP
1022 | WRITE_PROC_FIRST_WRITE_GP
1023 | WRITE_PROC_SECOND_READ_GP
1024 | WRITE_PROC_FIRST_READ_GP
1025 | WRITE_PROC_SECOND_WAIT_LOOP
1026 | WRITE_PROC_FIRST_MB, /* can be reordered before/after flips */
1027 0) ->
1028#ifndef GEN_ERROR_WRITER_PROGRESS
1029 goto smp_mb_send3;
1030smp_mb_send3_end:
1031#else
1032 ooo_mem(i);
1033#endif
1034 /* This instruction loops to WRITE_PROC_SECOND_WAIT */
1035 CLEAR_TOKENS(proc_urcu_writer, WRITE_PROC_SECOND_WAIT_LOOP | WRITE_PROC_SECOND_WAIT);
1036
1037
1038 :: CONSUME_TOKENS(proc_urcu_writer,
1039 WRITE_PROC_FIRST_WAIT
1040 | WRITE_PROC_SECOND_WAIT
1041 | WRITE_PROC_FIRST_READ_GP
1042 | WRITE_PROC_SECOND_READ_GP
1043 | WRITE_PROC_FIRST_WRITE_GP
1044 | WRITE_PROC_SECOND_WRITE_GP
1045 | WRITE_PROC_FIRST_MB,
1046 WRITE_PROC_SECOND_MB) ->
1047 goto smp_mb_send4;
1048smp_mb_send4_end:
1049 PRODUCE_TOKENS(proc_urcu_writer, WRITE_PROC_SECOND_MB);
1050
1051 :: CONSUME_TOKENS(proc_urcu_writer, WRITE_PROC_ALL_TOKENS, 0) ->
1052 CLEAR_TOKENS(proc_urcu_writer, WRITE_PROC_ALL_TOKENS_CLEAR);
1053 break;
1054 fi;
1055 }
1056 od;
1057
1058 write_lock = 0;
1059 /* free-up step, e.g., kfree(). */
1060 atomic {
1061 last_free_gen = old_gen;
1062 free_done = 1;
1063 }
1064 :: else -> break;
1065 od;
1066 /*
1067 * Given the reader loops infinitely, let the writer also busy-loop
1068 * with progress here so, with weak fairness, we can test the
1069 * writer's progress.
1070 */
1071end_writer:
1072 do
1073 :: 1 ->
1074#ifdef WRITER_PROGRESS
1075progress_writer2:
1076#endif
1077 skip;
1078 od;
1079
1080 /* Non-atomic parts of the loop */
1081 goto end;
1082smp_mb_send1:
1083 smp_mb_send(i, j, 1);
1084 goto smp_mb_send1_end;
1085#ifndef GEN_ERROR_WRITER_PROGRESS
1086smp_mb_send2:
1087 smp_mb_send(i, j, 2);
1088 goto smp_mb_send2_end;
1089smp_mb_send3:
1090 smp_mb_send(i, j, 3);
1091 goto smp_mb_send3_end;
1092#endif
1093smp_mb_send4:
1094 smp_mb_send(i, j, 4);
1095 goto smp_mb_send4_end;
1096end:
1097 skip;
1098}
1099
1100/* no name clash please */
1101#undef proc_urcu_writer
1102
1103
1104/* Leave after the readers and writers so the pid count is ok. */
1105init {
1106 byte i, j;
1107
1108 atomic {
1109 INIT_CACHED_VAR(urcu_gp_ctr, 1, j);
1110 INIT_CACHED_VAR(generation_ptr, 0, j);
1111
1112 i = 0;
1113 do
1114 :: i < NR_READERS ->
1115 INIT_CACHED_VAR(urcu_active_readers[i], 0, j);
1116 read_generation[i] = 1;
1117 data_access[i] = 0;
1118 i++;
1119 :: i >= NR_READERS -> break
1120 od;
1121 init_done = 1;
1122 }
1123}
This page took 0.062737 seconds and 4 git commands to generate.