Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1471343 > unrolled thread

[PATCH 4/4] qspinlock for x86: smp_mb__after_spin_lock() is free

Started byManfred Spraul <manfred@colorfullife.com>
First post2016-08-28 14:00 +0200
Last post2016-08-29 13:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4/4] qspinlock for x86: smp_mb__after_spin_lock() is free Manfred Spraul <manfred@colorfullife.com> - 2016-08-28 14:00 +0200
    Re: [PATCH 4/4] qspinlock for x86: smp_mb__after_spin_lock() is free Peter Zijlstra <peterz@infradead.org> - 2016-08-29 13:00 +0200

#1471343 — [PATCH 4/4] qspinlock for x86: smp_mb__after_spin_lock() is free

FromManfred Spraul <manfred@colorfullife.com>
Date2016-08-28 14:00 +0200
Subject[PATCH 4/4] qspinlock for x86: smp_mb__after_spin_lock() is free
Message-ID<sb6UO-1cS-15@gated-at.bofh.it>
For x86 qspinlocks, no additional memory barrier is required in
smp_mb__after_spin_lock:

Theoretically, for qspinlock we could define two barriers:
- smp_mb__after_spin_lock: Free for x86, not free for powerpc
- smp_mb__between_spin_lock_and_spin_unlock_wait():
	Free for all archs, see queued_spin_unlock_wait for details.

As smp_mb__between_spin_lock_and_spin_unlock_wait() is not used
in any hotpaths, the patch does not create that define yet.

Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
---
 arch/x86/include/asm/qspinlock.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h
index eaba080..da06433 100644
--- a/arch/x86/include/asm/qspinlock.h
+++ b/arch/x86/include/asm/qspinlock.h
@@ -61,6 +61,17 @@ static inline bool virt_spin_lock(struct qspinlock *lock)
 }
 #endif /* CONFIG_PARAVIRT */
 
+#ifndef smp_mb__after_spin_lock
+/**
+ * smp_mb__after_spin_lock() - Provide smp_mb() after spin_lock
+ *
+ * queued_spin_lock() provides full memory barriers semantics,
+ * thus no further memory barrier is required. See
+ * queued_spin_unlock_wait() for further details.
+ */
+#define smp_mb__after_spin_lock()	barrier()
+#endif
+
 #include <asm-generic/qspinlock.h>
 
 #endif /* _ASM_X86_QSPINLOCK_H */
-- 
2.5.5

[toc] | [next] | [standalone]


#1471721

FromPeter Zijlstra <peterz@infradead.org>
Date2016-08-29 13:00 +0200
Message-ID<sbssi-6gC-21@gated-at.bofh.it>
In reply to#1471343
On Sun, Aug 28, 2016 at 01:56:16PM +0200, Manfred Spraul wrote:
> For x86 qspinlocks, no additional memory barrier is required in
> smp_mb__after_spin_lock:
> 
> Theoretically, for qspinlock we could define two barriers:
> - smp_mb__after_spin_lock: Free for x86, not free for powerpc
> - smp_mb__between_spin_lock_and_spin_unlock_wait():
> 	Free for all archs, see queued_spin_unlock_wait for details.
> 
> As smp_mb__between_spin_lock_and_spin_unlock_wait() is not used
> in any hotpaths, the patch does not create that define yet.
> 
> Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
> ---
>  arch/x86/include/asm/qspinlock.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/x86/include/asm/qspinlock.h b/arch/x86/include/asm/qspinlock.h
> index eaba080..da06433 100644
> --- a/arch/x86/include/asm/qspinlock.h
> +++ b/arch/x86/include/asm/qspinlock.h
> @@ -61,6 +61,17 @@ static inline bool virt_spin_lock(struct qspinlock *lock)
>  }
>  #endif /* CONFIG_PARAVIRT */
>  
> +#ifndef smp_mb__after_spin_lock
> +/**
> + * smp_mb__after_spin_lock() - Provide smp_mb() after spin_lock
> + *
> + * queued_spin_lock() provides full memory barriers semantics,
> + * thus no further memory barrier is required. See
> + * queued_spin_unlock_wait() for further details.
> + */
> +#define smp_mb__after_spin_lock()	barrier()
> +#endif


I don't get this barrier, and I from my understanding this isn't
correct.

Please explain more.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web