From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: ltt-dev@lists.casi.polymtl.ca
Cc: compudj@krystal.dyndns.org, bert.wesarg@googlemail.com,
bob@watson.ibm.com, linux-kernel@vger.kernel.org
Subject: [PATCH URCU formal] Remove spurious read-side infinite loops.
Date: Thu, 19 Feb 2009 17:56:53 -0800 [thread overview]
Message-ID: <20090220015653.GA19434@linux.vnet.ibm.com> (raw)
Remove spurious read-side infinite loops from urcu_reader() model.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
formal-model/urcu.spin | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/formal-model/urcu.spin b/formal-model/urcu.spin
index 611464b..eea18e8 100644
--- a/formal-model/urcu.spin
+++ b/formal-model/urcu.spin
@@ -27,6 +27,10 @@ bit free = 0; /* Has RCU reclamation happened, e.g., kfree()? */
bit need_mb = 0; /* =1 says need reader mb, =0 for reader response. */
byte reader_progress[4];
/* Count of read-side statement executions. */
+bit reader_done = 0;
+ /* =0 says reader still running, =1 says done. */
+bit updater_done = 0;
+ /* =0 says updater still running, =1 says done. */
/* urcu definitions and variables, taken straight from the algorithm. */
@@ -50,7 +54,7 @@ proctype urcu_reader()
do
:: need_mb == 1 ->
need_mb = 0;
- :: 1 -> skip;
+ :: !updater_done -> skip;
:: 1 -> break;
od;
@@ -92,7 +96,7 @@ proctype urcu_reader()
reader_progress[2] +
reader_progress[3] == 0) && need_mb == 1 ->
need_mb = 0;
- :: 1 -> skip;
+ :: !updater_done -> skip;
:: 1 -> break;
od;
urcu_active_readers = tmp;
@@ -150,7 +154,7 @@ proctype urcu_reader()
do
:: need_mb == 1 ->
need_mb = 0;
- :: 1 -> skip;
+ :: !updater_done -> skip;
:: 1 -> break;
od;
:: else -> skip;
@@ -167,11 +171,14 @@ proctype urcu_reader()
od;
assert((tmp_free == 0) || (tmp_removed == 1));
+ /* Reader has completed. */
+ reader_done = 1;
+
/* Process any late-arriving memory-barrier requests. */
do
:: need_mb == 1 ->
need_mb = 0;
- :: 1 -> skip;
+ :: !updater_done -> skip;
:: 1 -> break;
od;
}
@@ -248,6 +255,12 @@ proctype urcu_updater()
/* free-up step, e.g., kfree(). */
free = 1;
+
+ /*
+ * Signal updater done, ending any otherwise-infinite loops
+ * in the reading process.
+ */
+ updater_done = 1;
}
/*
--
1.5.2.5
next reply other threads:[~2009-02-20 1:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-20 1:56 Paul E. McKenney [this message]
2009-02-20 17:15 ` [PATCH URCU formal] Remove spurious read-side infinite loops Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090220015653.GA19434@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=bert.wesarg@googlemail.com \
--cc=bob@watson.ibm.com \
--cc=compudj@krystal.dyndns.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ltt-dev@lists.casi.polymtl.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.