RE: Synchronizing Bit operations V2

From: Christoph Lameter <clameter_at_sgi.com>
Date: 2006-03-31 13:37:32
On Thu, 30 Mar 2006, Chen, Kenneth W wrote:

> > > Option (1):
> > > 
> > > #define clear_bit                     clear_bit_mode(..., RELEASE)
> > > #define Smp_mb__before_clear_bit      do { } while (0)
> > > #define Smp_mb__after_clear_bit       smp_mb()
> > > 
> > > Or option (2):
> > > 
> > > #define clear_bit                     clear_bit_mode(..., ACQUIRE)
> > > #define Smp_mb__before_clear_bit      smp_mb()
> > > #define Smp_mb__after_clear_bit       do { } while (0)
> > > 
> > > I'm fine with either one.
> > 
> > Neither one is correct because there will always be one combination of 
> > clear_bit with these macros that does not generate the required memory 
> > barrier.
> 
> Can you give an example?  Which combination?

For Option(1)

smp_mb__before_clear_bit()
clear_bit(...)(

For Option(2)

clear_bit()
smb_mp_after_clear_bit();

Both have either acquire or release semantics but do not have the effect 
of a barrier as required by the macros.

Note that both before and after are used in the core kernel code. Both 
must work correctly.

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Fri Mar 31 13:38:21 2006

This archive was generated by hypermail 2.1.8 : 2006-03-31 13:38:30 EST