Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: jason.wessel@windriver.com (Jason Wessel)
Subject: [ltt-dev] [PATCH 3/3] Add a test for the dmb instruction on ARM
Date: Wed, 23 Feb 2011 15:47:59 -0600	[thread overview]
Message-ID: <1298497679-31323-4-git-send-email-jason.wessel@windriver.com> (raw)
In-Reply-To: <1298497679-31323-1-git-send-email-jason.wessel@windriver.com>

The dmb instruction is used to implement a memory barrier on modern
ARM hardware.  The older generations of processors which are included
in single processor systems can get by on the generic implementation
of the cmm_mb().  This will allow the user space rcu to work on many
other ARM systems.

Signed-off-by: Jason Wessel <jason.wessel at windriver.com>
---
 configure.ac    |   20 ++++++++++++++++++++
 urcu/arch_arm.h |    2 ++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 69ce396..3e1b501 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,7 @@ AH_TEMPLATE([CONFIG_RCU_HAVE_FENCE], [Defined when on a system that has memory f
 AH_TEMPLATE([CONFIG_RCU_HAVE_FUTEX], [Defined when on a system with futex support.])
 AH_TEMPLATE([CONFIG_RCU_COMPAT_ARCH], [Compatibility mode for i386 which lacks
 cmpxchg instruction.])
+AH_TEMPLATE([CONFIG_ARM_HAVE_DMB], [Use the dmb instruction is available for use on ARM.])
 
 # Checks for programs.
 AC_PROG_CC
@@ -56,6 +57,25 @@ case $host_cpu in
 	*) ARCHTYPE="unknown";;
 esac
 
+if test "x$ARCHTYPE" = "xarm" ; then
+AC_MSG_CHECKING([checking for dmb instruction])
+AC_TRY_COMPILE(
+[
+],
+[
+asm volatile("dmb":::"memory");
+],
+[
+	AC_MSG_RESULT([yes])
+	AC_DEFINE([CONFIG_ARM_HAVE_DMB], [1])
+]
+,
+[
+	AC_MSG_RESULT([no])
+]
+)
+fi
+
 UATOMICSRC=urcu/uatomic_arch_$ARCHTYPE.h
 ARCHSRC=urcu/arch_$ARCHTYPE.h
 if test "x$ARCHTYPE" != xx86 -a "x$ARCHTYPE" != xppc; then
diff --git a/urcu/arch_arm.h b/urcu/arch_arm.h
index e25457d..83cbb60 100644
--- a/urcu/arch_arm.h
+++ b/urcu/arch_arm.h
@@ -29,7 +29,9 @@
 extern "C" {
 #endif 
 
+#ifdef CONFIG_ARM_HAVE_DMB
 #define cmm_mb()    asm volatile("dmb":::"memory")
+#endif /* CONFIG_ARM_HAVE_DMB */
 
 #include <stdlib.h>
 #include <sys/time.h>
-- 
1.7.0




  parent reply	other threads:[~2011-02-23 21:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-23 21:47 [ltt-dev] [PATCH 0/3] Support for user space rcu for ARM < v7 Jason Wessel
2011-02-23 21:47 ` [ltt-dev] [PATCH 1/3] Make armv7l headers generic for the arm architecture Jason Wessel
2011-02-23 21:47 ` [ltt-dev] [PATCH 2/3] Change the arm headers to remove all the references to v7 Jason Wessel
2011-02-23 21:47 ` Jason Wessel [this message]
2011-02-28 16:36 ` [ltt-dev] [PATCH 0/3] Support for user space rcu for ARM < v7 Mathieu Desnoyers
2011-02-28 16:40 ` Mathieu Desnoyers

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=1298497679-31323-4-git-send-email-jason.wessel@windriver.com \
    --to=jason.wessel@windriver.com \
    /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