2
* This model describes the interaction between ctx->notified
5
* Author: Paolo Bonzini <pbonzini@redhat.com>
7
* This file is in the public domain. If you really want a license,
10
* To verify the buggy version:
11
* spin -a -DBUG1 docs/aio_notify_bug.promela
16
* To verify the fixed version:
17
* spin -a docs/aio_notify_bug.promela
21
* Add -DCHECK_REQ to test an alternative invariant and the
22
* "notify_me" optimization.
32
#define USE_NOTIFY_ME 1
34
#define USE_NOTIFY_ME 0
38
#error Please define BUG1 or BUG2 instead.
41
active proctype notifier()
47
:: !USE_NOTIFY_ME || notify_me ->
49
/* CHECK_REQ does not detect this bug! */
54
:: !notified -> event = 1;
82
atomic { old = notified; notified = 0; } \
84
:: old -> event = 0; \
90
active proctype waiter()
99
/* Same as waiter(), but disappears after a while. */
100
active proctype temporary_waiter()
113
:: req -> goto accept_if_req_not_eventually_false;
117
accept_if_req_not_eventually_false:
119
:: req -> goto accept_if_req_not_eventually_false;
125
/* There must be infinitely many transitions of event as long
126
* as the notifier does not exit.
128
* If event stayed always true, the waiters would be busy looping.
129
* If event stayed always false, the waiters would be sleeping
134
:: !event -> goto accept_if_event_not_eventually_true;
135
:: event -> goto accept_if_event_not_eventually_false;
139
accept_if_event_not_eventually_true:
141
:: !event && notifier_done -> do :: true -> skip; od;
142
:: !event && !notifier_done -> goto accept_if_event_not_eventually_true;
146
accept_if_event_not_eventually_false:
148
:: event -> goto accept_if_event_not_eventually_false;