lkml.org 
[lkml]   [2010]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 1/3] Create spin lock/spin unlock with distinct memory barrier
* Nick Piggin (npiggin@suse.de) wrote:
> On Sun, Jan 31, 2010 at 03:52:55PM -0500, Mathieu Desnoyers wrote:
> > +/*
> > + * X86 spinlock-mb mappings. Use standard spinlocks with acquire/release
> > + * semantics. Associated memory barriers are defined as no-ops, because the
> > + * spinlock LOCK-prefixed atomic operations imply a full memory barrier.
> > + */
> > +
> > +#define spin_lock__no_acquire spin_lock
> > +#define spin_unlock__no_release spin_unlock
> > +
> > +#define spin_lock_irq__no_acquire spin_lock_irq
> > +#define spin_unlock_irq__no_release spin_unlock_irq
> > +
> > +#define raw_spin_lock__no_acquire raw_spin_lock
> > +#define raw_spin_unlock__no_release raw_spin_unlock
> > +
> > +#define raw_spin_lock_irq__no_acquire raw_spin_lock_irq
> > +#define raw_spin_unlock_irq__no_release raw_spin_unlock_irq
> > +
> > +#define smp_acquire__after_spin_lock() do { } while (0)
> > +#define smp_release__before_spin_unlock() do { } while (0)
> > +
> > +#define smp_mb__after_spin_lock() do { } while (0)
> > +#define smp_mb__before_spin_unlock() do { } while (0)
>
> Oh, and that one's wrong. loads can pass spin_unlock on x86 so it
> needs to be smp_mb().
>

Good catch !

#if defined(CONFIG_X86_32) && \
(defined(CONFIG_X86_OOSTORE) || defined(CONFIG_X86_PPRO_FENCE))
/*
* On PPro SMP or if we are using OOSTORE, we use a locked operation to unlock
* (PPro errata 66, 92)
*/
# define UNLOCK_LOCK_PREFIX LOCK_PREFIX
#else
# define UNLOCK_LOCK_PREFIX
#endif

Thanks,

Mathieu


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


\
 
 \ /
  Last update: 2010-02-01 15:17    [W:0.099 / U:1.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site