Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [ltt-dev] [PATCH 0/4] v3: Add gcc primitives, ia64 support, ARMv7L support, and kill unknown
@ 2010-06-17 22:11 Paul E. McKenney
  2010-06-17 22:12 ` [ltt-dev] [PATCH 1/4] Add header files supporting gcc __sync_ primitives Paul E. McKenney
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Paul E. McKenney @ 2010-06-17 22:11 UTC (permalink / raw)


Hello!

This set of four patches does the following:

o	Add header files providing definitions based on the gcc __sync_
	set of primitives.

o	Add IA64 support based on the gcc definitions.

o	Add native ARMv7L support.

o	Force build failures on unknown architectures.

Updates since v2:

o	Apply Paolo's feedback to avoid redundant code.

Updates since v1:

o	Add note that this works back to at least 2.6.15 kernels.

							Thanx, Paul

 b/configure.ac                |    1 
 b/urcu/arch_armv7l.h          |   56 ++++++++++++++++++++++++++++++++++++++++++
 b/urcu/arch_gcc.h             |   54 ++++++++++++++++++++++++++++++++++++++++
 b/urcu/arch_unknown.h         |   28 +++++++++++++++++++++
 b/urcu/uatomic_arch_armv7l.h  |   50 +++++++++++++++++++++++++++++++++++++
 b/urcu/uatomic_arch_gcc.h     |   46 ++++++++++++++++++++++++++++++++++
 b/urcu/uatomic_arch_unknown.h |   25 ++++++++++++++++++
 configure.ac                  |   13 ++++-----
 8 files changed, 266 insertions(+), 7 deletions(-)




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

* [ltt-dev] [PATCH 1/4] Add header files supporting gcc __sync_ primitives
  2010-06-17 22:11 [ltt-dev] [PATCH 0/4] v3: Add gcc primitives, ia64 support, ARMv7L support, and kill unknown Paul E. McKenney
@ 2010-06-17 22:12 ` Paul E. McKenney
  2010-06-17 22:12 ` [ltt-dev] [PATCH 2/4] Add ia64 architecture based on gcc primitives Paul E. McKenney
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Paul E. McKenney @ 2010-06-17 22:12 UTC (permalink / raw)


Add a urcu/arch_gcc.h and urcu/uatomic_arch_gcc.h whose primitives are
based on the gcc __sync_ primitives.  This should be usable for all
systems that have correctly implemented __sync_ primitives, which sadly
does not include all combinations of systems and compilers.  In addition,
specific systems may gain higher performance with hand-coded primitives.
Nevertheless, this is nice for getting a new architecture up and running
quickly.

As suggested by Paolo Bonzini, defer the definition of mb() to the common
arch_generic.h file, and also defer the uatomic*() primitives to
uatomic_generic.h.

Signed-off-by: Paul E. McKenney <paulmck at linux.vnet.ibm.com>
---
 urcu/arch_gcc.h         |   54 +++++++++++++++++++++++++++++++++++++++++++++++
 urcu/uatomic_arch_gcc.h |   46 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 100 insertions(+), 0 deletions(-)
 create mode 100644 urcu/arch_gcc.h
 create mode 100644 urcu/uatomic_arch_gcc.h

diff --git a/urcu/arch_gcc.h b/urcu/arch_gcc.h
new file mode 100644
index 0000000..dfea28d
--- /dev/null
+++ b/urcu/arch_gcc.h
@@ -0,0 +1,54 @@
+#ifndef _URCU_ARCH_GCC_H
+#define _URCU_ARCH_GCC_H
+
+/*
+ * arch_unknown.h: trivial definitions for architectures using gcc __sync_
+ *
+ * Copyright (c) 2010 Paul E. McKenney, IBM Corporation.
+ * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers at polymtl.ca>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <urcu/compiler.h>
+#include <urcu/config.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif 
+
+#include <stdlib.h>
+#include <sys/time.h>
+
+typedef unsigned long long cycles_t;
+
+static inline cycles_t get_cycles (void)
+{
+	cycles_t thetime;
+	struct timeval tv;
+
+	if (gettimeofday(&tv, NULL) != 0)
+		return 0;
+	thetime = ((cycles_t)tv.tv_sec) * 1000000ULL + ((cycles_t)tv.tv_usec);
+	return (cycles_t)thetime;
+}
+
+#ifdef __cplusplus 
+}
+#endif
+
+#include <urcu/arch_generic.h>
+
+#endif /* _URCU_ARCH_GCC_H */
diff --git a/urcu/uatomic_arch_gcc.h b/urcu/uatomic_arch_gcc.h
new file mode 100644
index 0000000..4aa32fd
--- /dev/null
+++ b/urcu/uatomic_arch_gcc.h
@@ -0,0 +1,46 @@
+#ifndef _URCU_ARCH_UATOMIC_GCC_H
+#define _URCU_ARCH_UATOMIC_GCC_H
+
+/* 
+ * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
+ * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
+ * Copyright (c) 2009      Mathieu Desnoyers
+ * Copyright (c) 2010      Paul E. McKenney, IBM Corporation
+ *			   (Adapted from uatomic_arch_ppc.h)
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose,  provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ * Code inspired from libuatomic_ops-1.2, inherited in part from the
+ * Boehm-Demers-Weiser conservative garbage collector.
+ */
+
+#include <urcu/compiler.h>
+#include <urcu/system.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif 
+
+/*
+ * If your platform doesn't have a full set of atomics, you will need
+ * a separate uatomic_arch_*.h file for your architecture.  Otherwise,
+ * just rely on the definitions in uatomic_generic.h.
+ */
+#define UATOMIC_HAS_ATOMIC_BYTE
+#define UATOMIC_HAS_ATOMIC_SHORT
+
+#ifdef __cplusplus 
+}
+#endif
+
+#include <urcu/uatomic_generic.h>
+
+#endif /* _URCU_ARCH_UATOMIC_GCC_H */
-- 
1.7.0.6





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

* [ltt-dev] [PATCH 2/4] Add ia64 architecture based on gcc primitives
  2010-06-17 22:11 [ltt-dev] [PATCH 0/4] v3: Add gcc primitives, ia64 support, ARMv7L support, and kill unknown Paul E. McKenney
  2010-06-17 22:12 ` [ltt-dev] [PATCH 1/4] Add header files supporting gcc __sync_ primitives Paul E. McKenney
@ 2010-06-17 22:12 ` Paul E. McKenney
  2010-06-17 22:12 ` [ltt-dev] [PATCH 3/4] Add native ARM port for armv7l Paul E. McKenney
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Paul E. McKenney @ 2010-06-17 22:12 UTC (permalink / raw)


This of course assumes that ia64 gcc correctly implements the various
__sync_ primitives.  ;-)

Signed-off-by: Paul E. McKenney <paulmck at linux.vnet.ibm.com>
---
 configure.ac |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1b1ca65..61a0d76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,6 +51,7 @@ case $host_cpu in
 	s390x) ARCHTYPE="s390" ;;
 	sparc64) ARCHTYPE="sparc64" ;;
 	alpha*) ARCHTYPE="alpha" ;;
+	ia64) ARCHTYPE="gcc" ;;
 	*) ARCHTYPE="unknown";;
 esac
 
-- 
1.7.0.6





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

* [ltt-dev] [PATCH 3/4] Add native ARM port for armv7l
  2010-06-17 22:11 [ltt-dev] [PATCH 0/4] v3: Add gcc primitives, ia64 support, ARMv7L support, and kill unknown Paul E. McKenney
  2010-06-17 22:12 ` [ltt-dev] [PATCH 1/4] Add header files supporting gcc __sync_ primitives Paul E. McKenney
  2010-06-17 22:12 ` [ltt-dev] [PATCH 2/4] Add ia64 architecture based on gcc primitives Paul E. McKenney
@ 2010-06-17 22:12 ` Paul E. McKenney
  2010-06-17 22:12 ` [ltt-dev] [PATCH 4/4] Force build failure on unknown architectures Paul E. McKenney
  2010-06-18 16:27 ` [ltt-dev] [PATCH 0/4] v3: Add gcc primitives, ia64 support, ARMv7L support, and kill unknown Mathieu Desnoyers
  4 siblings, 0 replies; 7+ messages in thread
From: Paul E. McKenney @ 2010-06-17 22:12 UTC (permalink / raw)


Add native support for armv7l.  Other variants of ARM will likely require
separate ports.  The gcc __sync_ approach works back to at least 2.6.15
kernels.

As suggested by Paolo Bonzini, defer the definition of CACHE_LINE_SIZE
to arch_generic.h.

Signed-off-by: Paul E. McKenney <paulmck at linux.vnet.ibm.com>
---
 configure.ac               |    4 +++
 urcu/arch_armv7l.h         |   56 ++++++++++++++++++++++++++++++++++++++++++++
 urcu/uatomic_arch_armv7l.h |   50 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 110 insertions(+), 0 deletions(-)
 create mode 100644 urcu/arch_armv7l.h
 create mode 100644 urcu/uatomic_arch_armv7l.h

diff --git a/configure.ac b/configure.ac
index 61a0d76..7b46004 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,6 +52,7 @@ case $host_cpu in
 	sparc64) ARCHTYPE="sparc64" ;;
 	alpha*) ARCHTYPE="alpha" ;;
 	ia64) ARCHTYPE="gcc" ;;
+	armv7l) ARCHTYPE="armv7l" ;;
 	*) ARCHTYPE="unknown";;
 esac
 
@@ -67,6 +68,9 @@ if test "x$ARCHTYPE" != xx86 -a "x$ARCHTYPE" != xppc; then
 else
 	APISRC=tests/api_$ARCHTYPE.h
 fi
+if test "$ARCHTYPE" == "armv7l"; then
+	CFLAGS="-mcpu=cortex-a9 -mtune=cortex-a9 -O"
+fi
 
 AC_SUBST(ARCHTYPE)
 AC_SUBST(SUBARCHTYPE)
diff --git a/urcu/arch_armv7l.h b/urcu/arch_armv7l.h
new file mode 100644
index 0000000..b4049cd
--- /dev/null
+++ b/urcu/arch_armv7l.h
@@ -0,0 +1,56 @@
+#ifndef _URCU_ARCH_ARMV7L_H
+#define _URCU_ARCH_ARMV7L_H
+
+/*
+ * arch_armv7l.h: trivial definitions for the ARMv7 architecture.
+ *
+ * Copyright (c) 2010 Paul E. McKenney, IBM Corporation.
+ * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers at polymtl.ca>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <urcu/compiler.h>
+#include <urcu/config.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif 
+
+#define mb()    asm volatile("dmb":::"memory")
+
+#include <stdlib.h>
+#include <sys/time.h>
+
+typedef unsigned long long cycles_t;
+
+static inline cycles_t get_cycles (void)
+{
+	cycles_t thetime;
+	struct timeval tv;
+
+	if (gettimeofday(&tv, NULL) != 0)
+		return 0;
+	thetime = ((cycles_t)tv.tv_sec) * 1000000ULL + ((cycles_t)tv.tv_usec);
+	return (cycles_t)thetime;
+}
+
+#ifdef __cplusplus 
+}
+#endif
+
+#include <urcu/arch_generic.h>
+
+#endif /* _URCU_ARCH_ARMV7L_H */
diff --git a/urcu/uatomic_arch_armv7l.h b/urcu/uatomic_arch_armv7l.h
new file mode 100644
index 0000000..b68c818
--- /dev/null
+++ b/urcu/uatomic_arch_armv7l.h
@@ -0,0 +1,50 @@
+#ifndef _URCU_ARCH_UATOMIC_ARMV7L_H
+#define _URCU_ARCH_UATOMIC_ARMV7L_H
+
+/* 
+ * Atomics for ARMv7.  This approach is usable on kernels back to 2.6.15.
+ *
+ * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
+ * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
+ * Copyright (c) 2009      Mathieu Desnoyers
+ * Copyright (c) 2010      Paul E. McKenney, IBM Corporation
+ *			   (Adapted from uatomic_arch_ppc.h)
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose,  provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ * Code inspired from libuatomic_ops-1.2, inherited in part from the
+ * Boehm-Demers-Weiser conservative garbage collector.
+ */
+
+#include <urcu/compiler.h>
+#include <urcu/system.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif 
+
+/* xchg */
+#define uatomic_xchg(addr, v) __sync_lock_test_and_set(addr, v)
+
+/* cmpxchg */
+#define uatomic_cmpxchg(addr, old, _new) \
+	__sync_val_compare_and_swap(addr, old, _new)
+
+/* uatomic_add_return */
+#define uatomic_add_return(addr, v) __sync_add_and_fetch(addr, v)
+
+#ifdef __cplusplus 
+}
+#endif
+
+#include <urcu/uatomic_generic.h>
+
+#endif /* _URCU_ARCH_UATOMIC_ARMV7L_H */
-- 
1.7.0.6





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

* [ltt-dev] [PATCH 4/4] Force build failure on unknown architectures
  2010-06-17 22:11 [ltt-dev] [PATCH 0/4] v3: Add gcc primitives, ia64 support, ARMv7L support, and kill unknown Paul E. McKenney
                   ` (2 preceding siblings ...)
  2010-06-17 22:12 ` [ltt-dev] [PATCH 3/4] Add native ARM port for armv7l Paul E. McKenney
@ 2010-06-17 22:12 ` Paul E. McKenney
  2010-06-18 16:27 ` [ltt-dev] [PATCH 0/4] v3: Add gcc primitives, ia64 support, ARMv7L support, and kill unknown Mathieu Desnoyers
  4 siblings, 0 replies; 7+ messages in thread
From: Paul E. McKenney @ 2010-06-17 22:12 UTC (permalink / raw)


Create urcu/arch_unknown.h and urcu/uatomic_arch_unknown.h, which
contain only #error statements and explanatory comments.  This forces
build failures on unrecognized architectures in preference to trying
to guess at what operations might be safe on such architectures.

One other semi-feasible alternative is to use hashed arrays of locks
that are acquired with signals disabled.  However, this seems a bit
too ornate, especially for architectures for which the gcc __sync_
primitives work correctly.

Signed-off-by: Paul E. McKenney <paulmck at linux.vnet.ibm.com>
---
 configure.ac                |    9 ++-------
 urcu/arch_unknown.h         |   28 ++++++++++++++++++++++++++++
 urcu/uatomic_arch_unknown.h |   25 +++++++++++++++++++++++++
 3 files changed, 55 insertions(+), 7 deletions(-)
 create mode 100644 urcu/arch_unknown.h
 create mode 100644 urcu/uatomic_arch_unknown.h

diff --git a/configure.ac b/configure.ac
index 7b46004..4daf3ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,13 +56,8 @@ case $host_cpu in
 	*) ARCHTYPE="unknown";;
 esac
 
-if test "$ARCHTYPE" != "unknown"; then
-	UATOMICSRC=urcu/uatomic_arch_$ARCHTYPE.h
-	ARCHSRC=urcu/arch_$ARCHTYPE.h
-else
-	UATOMICSRC=urcu/uatomic_generic.h
-	ARCHSRC=urcu/arch_generic.h
-fi
+UATOMICSRC=urcu/uatomic_arch_$ARCHTYPE.h
+ARCHSRC=urcu/arch_$ARCHTYPE.h
 if test "x$ARCHTYPE" != xx86 -a "x$ARCHTYPE" != xppc; then
 	APISRC=tests/api_gcc.h
 else
diff --git a/urcu/arch_unknown.h b/urcu/arch_unknown.h
new file mode 100644
index 0000000..2de6a6b
--- /dev/null
+++ b/urcu/arch_unknown.h
@@ -0,0 +1,28 @@
+#ifndef _URCU_ARCH_UNKNOWN_H
+#define _URCU_ARCH_UNKNOWN_H
+
+/*
+ * arch_unknown.h: #error to prevent build on unknown architectures.
+ *
+ * Copyright (c) 2010 Paul E. McKenney, IBM Corporation.
+ * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers at polymtl.ca>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* See configure.ac for the list of recognized architectures.  */
+#error "Cannot build: unrecognized architecture detected."
+
+#endif /* _URCU_ARCH_UNKNOWN_H */
diff --git a/urcu/uatomic_arch_unknown.h b/urcu/uatomic_arch_unknown.h
new file mode 100644
index 0000000..6fb4eb3
--- /dev/null
+++ b/urcu/uatomic_arch_unknown.h
@@ -0,0 +1,25 @@
+#ifndef _URCU_ARCH_UATOMIC_UNKNOWN_H
+#define _URCU_ARCH_UATOMIC_UNKNOWN_H
+
+/* 
+ * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
+ * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
+ * Copyright (c) 2009      Mathieu Desnoyers
+ * Copyright (c) 2010      Paul E. McKenney, IBM Corporation
+ *			   (Adapted from uatomic_arch_ppc.h)
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose,  provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/* See configure.ac for the list of recognized architectures.  */
+#error "Cannot build: unrecognized architecture detected."
+
+#endif /* _URCU_ARCH_UATOMIC_UNKNOWN_H */
-- 
1.7.0.6





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

* [ltt-dev] [PATCH 0/4] v3: Add gcc primitives, ia64 support, ARMv7L support, and kill unknown
  2010-06-17 22:11 [ltt-dev] [PATCH 0/4] v3: Add gcc primitives, ia64 support, ARMv7L support, and kill unknown Paul E. McKenney
                   ` (3 preceding siblings ...)
  2010-06-17 22:12 ` [ltt-dev] [PATCH 4/4] Force build failure on unknown architectures Paul E. McKenney
@ 2010-06-18 16:27 ` Mathieu Desnoyers
  4 siblings, 0 replies; 7+ messages in thread
From: Mathieu Desnoyers @ 2010-06-18 16:27 UTC (permalink / raw)


* Paul E. McKenney (paulmck at linux.vnet.ibm.com) wrote:
> Hello!
> 
> This set of four patches does the following:
> 
> o	Add header files providing definitions based on the gcc __sync_
> 	set of primitives.
> 
> o	Add IA64 support based on the gcc definitions.
> 
> o	Add native ARMv7L support.
> 
> o	Force build failures on unknown architectures.
> 
> Updates since v2:
> 
> o	Apply Paolo's feedback to avoid redundant code.
> 
> Updates since v1:
> 
> o	Add note that this works back to at least 2.6.15 kernels.
> 
> 							Thanx, Paul

All merged and pushed, thanks Paul !

Mathieu

> 
>  b/configure.ac                |    1 
>  b/urcu/arch_armv7l.h          |   56 ++++++++++++++++++++++++++++++++++++++++++
>  b/urcu/arch_gcc.h             |   54 ++++++++++++++++++++++++++++++++++++++++
>  b/urcu/arch_unknown.h         |   28 +++++++++++++++++++++
>  b/urcu/uatomic_arch_armv7l.h  |   50 +++++++++++++++++++++++++++++++++++++
>  b/urcu/uatomic_arch_gcc.h     |   46 ++++++++++++++++++++++++++++++++++
>  b/urcu/uatomic_arch_unknown.h |   25 ++++++++++++++++++
>  configure.ac                  |   13 ++++-----
>  8 files changed, 266 insertions(+), 7 deletions(-)

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com




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

* [ltt-dev] [PATCH 4/4] Force build failure on unknown architectures
  2010-06-16 21:04 [ltt-dev] [PATCH 0/4] " Paul E. McKenney
@ 2010-06-16 21:05 ` Paul E. McKenney
  0 siblings, 0 replies; 7+ messages in thread
From: Paul E. McKenney @ 2010-06-16 21:05 UTC (permalink / raw)


Create urcu/arch_unknown.h and urcu/uatomic_arch_unknown.h, which
contain only #error statements and explanatory comments.  This forces
build failures on unrecognized architectures in preference to trying
to guess at what operations might be safe on such architectures.

One other semi-feasible alternative is to use hashed arrays of locks
that are acquired with signals disabled.  However, this seems a bit
too ornate, especially for architectures for which the gcc __sync_
primitives work correctly.

Signed-off-by: Paul E. McKenney <paulmck at linux.vnet.ibm.com>
---
 configure.ac                |    9 ++-------
 urcu/arch_unknown.h         |   28 ++++++++++++++++++++++++++++
 urcu/uatomic_arch_unknown.h |   25 +++++++++++++++++++++++++
 3 files changed, 55 insertions(+), 7 deletions(-)
 create mode 100644 urcu/arch_unknown.h
 create mode 100644 urcu/uatomic_arch_unknown.h

diff --git a/configure.ac b/configure.ac
index 7b46004..4daf3ba 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,13 +56,8 @@ case $host_cpu in
 	*) ARCHTYPE="unknown";;
 esac
 
-if test "$ARCHTYPE" != "unknown"; then
-	UATOMICSRC=urcu/uatomic_arch_$ARCHTYPE.h
-	ARCHSRC=urcu/arch_$ARCHTYPE.h
-else
-	UATOMICSRC=urcu/uatomic_generic.h
-	ARCHSRC=urcu/arch_generic.h
-fi
+UATOMICSRC=urcu/uatomic_arch_$ARCHTYPE.h
+ARCHSRC=urcu/arch_$ARCHTYPE.h
 if test "x$ARCHTYPE" != xx86 -a "x$ARCHTYPE" != xppc; then
 	APISRC=tests/api_gcc.h
 else
diff --git a/urcu/arch_unknown.h b/urcu/arch_unknown.h
new file mode 100644
index 0000000..2de6a6b
--- /dev/null
+++ b/urcu/arch_unknown.h
@@ -0,0 +1,28 @@
+#ifndef _URCU_ARCH_UNKNOWN_H
+#define _URCU_ARCH_UNKNOWN_H
+
+/*
+ * arch_unknown.h: #error to prevent build on unknown architectures.
+ *
+ * Copyright (c) 2010 Paul E. McKenney, IBM Corporation.
+ * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers at polymtl.ca>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* See configure.ac for the list of recognized architectures.  */
+#error "Cannot build: unrecognized architecture detected."
+
+#endif /* _URCU_ARCH_UNKNOWN_H */
diff --git a/urcu/uatomic_arch_unknown.h b/urcu/uatomic_arch_unknown.h
new file mode 100644
index 0000000..6fb4eb3
--- /dev/null
+++ b/urcu/uatomic_arch_unknown.h
@@ -0,0 +1,25 @@
+#ifndef _URCU_ARCH_UATOMIC_UNKNOWN_H
+#define _URCU_ARCH_UATOMIC_UNKNOWN_H
+
+/* 
+ * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
+ * Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
+ * Copyright (c) 1999-2004 Hewlett-Packard Development Company, L.P.
+ * Copyright (c) 2009      Mathieu Desnoyers
+ * Copyright (c) 2010      Paul E. McKenney, IBM Corporation
+ *			   (Adapted from uatomic_arch_ppc.h)
+ *
+ * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
+ * OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
+ *
+ * Permission is hereby granted to use or copy this program
+ * for any purpose,  provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ */
+
+/* See configure.ac for the list of recognized architectures.  */
+#error "Cannot build: unrecognized architecture detected."
+
+#endif /* _URCU_ARCH_UATOMIC_UNKNOWN_H */
-- 
1.7.0.6





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

end of thread, other threads:[~2010-06-18 16:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-17 22:11 [ltt-dev] [PATCH 0/4] v3: Add gcc primitives, ia64 support, ARMv7L support, and kill unknown Paul E. McKenney
2010-06-17 22:12 ` [ltt-dev] [PATCH 1/4] Add header files supporting gcc __sync_ primitives Paul E. McKenney
2010-06-17 22:12 ` [ltt-dev] [PATCH 2/4] Add ia64 architecture based on gcc primitives Paul E. McKenney
2010-06-17 22:12 ` [ltt-dev] [PATCH 3/4] Add native ARM port for armv7l Paul E. McKenney
2010-06-17 22:12 ` [ltt-dev] [PATCH 4/4] Force build failure on unknown architectures Paul E. McKenney
2010-06-18 16:27 ` [ltt-dev] [PATCH 0/4] v3: Add gcc primitives, ia64 support, ARMv7L support, and kill unknown Mathieu Desnoyers
  -- strict thread matches above, loose matches on Subject: below --
2010-06-16 21:04 [ltt-dev] [PATCH 0/4] " Paul E. McKenney
2010-06-16 21:05 ` [ltt-dev] [PATCH 4/4] Force build failure on unknown architectures Paul E. McKenney

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