public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* Add full memory fence for test_and_*_bit operation
@ 2006-03-29  0:49 Chen, Kenneth W
  2006-03-29  1:44 ` Grant Grundler
  0 siblings, 1 reply; 2+ messages in thread
From: Chen, Kenneth W @ 2006-03-29  0:49 UTC (permalink / raw)
  To: linux-ia64

OK, semi-big-hammer to enforce full memory fence on ia64 for
test_and_set_bit
test_and_clear_bit
test_and_change_bit

It's sad we don't have something like:

test_and_set_bit_used_like_a_lock
test_and_set_bit_used_like_an_unlock
test_and_set_bit_full_memory_fence
test_and_clear_bit_used_like_a_lock
test_and_clear_bit_used_like_an_unlock
test_and_clear_bit_full_memory_fence
test_and_change_bit_used_like_a_lock
test_and_change_bit_used_like_an_unlock
test_and_change_bit_full_memory_fence

- Ken


Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>

--- ./include/asm-ia64/bitops.h.orig	2006-03-28 17:30:33.000000000 -0800
+++ ./include/asm-ia64/bitops.h	2006-03-28 17:31:30.000000000 -0800
@@ -166,7 +166,7 @@ test_and_set_bit (int nr, volatile void 
 		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;
 }
 
@@ -211,7 +211,7 @@ test_and_clear_bit (int nr, volatile voi
 		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;
 }
 
@@ -256,7 +256,7 @@ test_and_change_bit (int nr, volatile vo
 		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;
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Add full memory fence for test_and_*_bit operation
  2006-03-29  0:49 Add full memory fence for test_and_*_bit operation Chen, Kenneth W
@ 2006-03-29  1:44 ` Grant Grundler
  0 siblings, 0 replies; 2+ messages in thread
From: Grant Grundler @ 2006-03-29  1:44 UTC (permalink / raw)
  To: linux-ia64

On Tue, Mar 28, 2006 at 04:49:24PM -0800, Chen, Kenneth W wrote:
> OK, semi-big-hammer to enforce full memory fence on ia64 for
> test_and_set_bit
> test_and_clear_bit
> test_and_change_bit
> 
> It's sad we don't have something like:
> 
> test_and_set_bit_used_like_a_lock
...

Normally the arch specific (e.g. __set_bit or __raw_readl) provide
different semantics than the "portable" versions (e.g set_bit and readl).
Can folks who know what they are doing can use arch specific versions
at the expense of portability?

I expect the driver to compile and work correctly on all arches,
it will just be a bit more of a PITA to maintain.

grant

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-29  1:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-29  0:49 Add full memory fence for test_and_*_bit operation Chen, Kenneth W
2006-03-29  1:44 ` Grant Grundler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox