public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <compudj@krystal.dyndns.org>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: ltt-dev@lists.casi.polymtl.ca, bert.wesarg@googlemail.com,
	bob@watson.ibm.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH URCU formal] Remove spurious read-side infinite loops.
Date: Fri, 20 Feb 2009 12:15:16 -0500	[thread overview]
Message-ID: <20090220171516.GF1179@Krystal> (raw)
In-Reply-To: <20090220015653.GA19434@linux.vnet.ibm.com>

* Paul E. McKenney (paulmck@linux.vnet.ibm.com) wrote:
> Remove spurious read-side infinite loops from urcu_reader() model.
> 

Merged, thanks !

Mathieu

> 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
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68

      reply	other threads:[~2009-02-20 17:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20  1:56 [PATCH URCU formal] Remove spurious read-side infinite loops Paul E. McKenney
2009-02-20 17:15 ` Mathieu Desnoyers [this message]

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=20090220171516.GF1179@Krystal \
    --to=compudj@krystal.dyndns.org \
    --cc=bert.wesarg@googlemail.com \
    --cc=bob@watson.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ltt-dev@lists.casi.polymtl.ca \
    --cc=paulmck@linux.vnet.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox