public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: linux-ia64@vger.kernel.org
Subject: RE: Fix ia64 bit ops: Full barriers for bit operations returning a value
Date: Mon, 03 Apr 2006 23:11:44 +0000	[thread overview]
Message-ID: <200604032310.k33NAfx31676@unix-os.sc.intel.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0604031129510.21064@schroedinger.engr.sgi.com>

Christoph Lameter wrote on Monday, April 03, 2006 11:33 AM
> On Sat, 1 Apr 2006, Nick Piggin wrote:
> 
> > All bitop and atomic test_and_set, inc_return, etc etc (ie. everything
> > that modifies the operand and returns something) needs to be a full
> > barrier before and after too.
> 
> Fix ia64 bitops: full barriers in bitops returning a value
> 
> This fixes up bitops so that they provide a full barrier which are 
> required according to Documentation/atomic_ops.txt. Bit operations use a 
> cmpxchg with a prior load from a volatile pointer. This load is an acquire 
> operation. I think we can simply make the cmpxchg have release semantics 
> in order to produce a full acquire / release cycle.
> 
> Note that this only fixes up the bit operations if used together with the
> earlier fix for the clear_bit barriers. We still need a fix for general 
> atomic operations.
> 
> Signed-off-by: Christoph Lameter <clameter@sgi.com>


Looks good to me.
Acked-by: Ken Chen <kenneth.w.chen@intel.com>



> Index: linux-2.6.16-mm2/include/asm-ia64/bitops.h
> =================================> --- linux-2.6.16-mm2.orig/include/asm-ia64/bitops.h	2006-03-31 11:17:53.000000000 -0800
> +++ linux-2.6.16-mm2/include/asm-ia64/bitops.h	2006-04-03 11:19:45.000000000 -0700
> @@ -163,13 +163,14 @@ test_and_set_bit (int nr, volatile void 
>  	volatile __u32 *m;
>  	CMPXCHG_BUGCHECK_DECL
>  
> +	/* Volatile load = acquire */
>  	m = (volatile __u32 *) addr + (nr >> 5);
>  	bit = 1 << (nr & 31);
>  	do {
>  		CMPXCHG_BUGCHECK(m);
>  		old = *m;
>  		new = old | bit;
> -	} while (cmpxchg_acq(m, old, new) != old);
> +	} while (cmpxchg_rel(m, old, new) != old);
>  	return (old & bit) != 0;
>  }
>  
> @@ -208,13 +209,14 @@ test_and_clear_bit (int nr, volatile voi
>  	volatile __u32 *m;
>  	CMPXCHG_BUGCHECK_DECL
>  
> +	/* Volatile load = acquire */
>  	m = (volatile __u32 *) addr + (nr >> 5);
>  	mask = ~(1 << (nr & 31));
>  	do {
>  		CMPXCHG_BUGCHECK(m);
>  		old = *m;
>  		new = old & mask;
> -	} while (cmpxchg_acq(m, old, new) != old);
> +	} while (cmpxchg_rel(m, old, new) != old);
>  	return (old & ~mask) != 0;
>  }
>  
> @@ -253,13 +255,14 @@ test_and_change_bit (int nr, volatile vo
>  	volatile __u32 *m;
>  	CMPXCHG_BUGCHECK_DECL
>  
> +	/* Volatile load = acquire */
>  	m = (volatile __u32 *) addr + (nr >> 5);
>  	bit = (1 << (nr & 31));
>  	do {
>  		CMPXCHG_BUGCHECK(m);
>  		old = *m;
>  		new = old ^ bit;
> -	} while (cmpxchg_acq(m, old, new) != old);
> +	} while (cmpxchg_rel(m, old, new) != old);
>  	return (old & bit) != 0;
>  }
 

  reply	other threads:[~2006-04-03 23:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-03 18:32 Fix ia64 bit ops: Full barriers for bit operations returning a value Christoph Lameter
2006-04-03 23:11 ` Chen, Kenneth W [this message]
2006-04-04  1:05 ` Fix ia64 bit ops: Full barriers for bit operations returning Nick Piggin
2006-04-04  2:11 ` Fix ia64 bit ops: Full barriers for bit operations returning a Christoph Lameter
2006-04-04 13:30 ` Fix ia64 bit ops: Full barriers for bit operations returning a value Chen, Kenneth W
2006-04-04 14:40 ` Fix ia64 bit ops: Full barriers for bit operations returning a Christoph Lameter
2006-04-04 16:48 ` Fix ia64 bit ops: Full barriers for bit operations returning Zoltan Menyhart
2006-04-05 15:30 ` Zoltan Menyhart
2006-04-05 16:17 ` Fix ia64 bit ops: Full barriers for bit operations returning a Christoph Lameter
2006-04-05 16:44 ` Fix ia64 bit ops: Full barriers for bit operations returning Zoltan Menyhart
2006-04-05 17:31 ` Fix ia64 bit ops: Full barriers for bit operations returning a Christoph Lameter

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=200604032310.k33NAfx31676@unix-os.sc.intel.com \
    --to=kenneth.w.chen@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    /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