2 * This model describes a bug in aio_notify. If ctx->notifier is
3 * cleared too late, a wakeup could be lost.
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 -DBUG docs/aio_notify_bug.promela
15 * To verify the fixed version:
16 * spin -a docs/aio_notify_bug.promela
20 * Add -DCHECK_REQ to test an alternative invariant and the
21 * "notify_me" optimization.
30 #define USE_NOTIFY_ME 1
32 #define USE_NOTIFY_ME 0
35 active proctype notifier()
41 :: !USE_NOTIFY_ME || notify_me -> event = 1;
82 active proctype waiter()
89 /* Same as waiter(), but disappears after a while. */
90 active proctype temporary_waiter()
101 :: req -> goto accept_if_req_not_eventually_false;
105 accept_if_req_not_eventually_false:
107 :: req -> goto accept_if_req_not_eventually_false;
113 /* There must be infinitely many transitions of event as long
114 * as the notifier does not exit.
116 * If event stayed always true, the waiters would be busy looping.
117 * If event stayed always false, the waiters would be sleeping
122 :: !event -> goto accept_if_event_not_eventually_true;
123 :: event -> goto accept_if_event_not_eventually_false;
127 accept_if_event_not_eventually_true:
129 :: !event && notifier_done -> do :: true -> skip; od;
130 :: !event && !notifier_done -> goto accept_if_event_not_eventually_true;
134 accept_if_event_not_eventually_false:
136 :: event -> goto accept_if_event_not_eventually_false;