[ltt-dev] [PATCH 2/3] Incorporate feedback from Mathieu

Paul E. McKenney paulmck at linux.vnet.ibm.com
Fri Jun 11 16:00:29 EDT 2010


Change ARM references to "unknown".  Get rid of stray PowerPC references.
Remove the unused sync_core() definition from arch_unknown.h.  Adjust
CACHE_LINE_SIZE to 128.  Got rid of the perror() and abort() in the
"unknown" implementation of get_cycles().  Remove the unused ILLEGAL_INSTR
definition.

Signed-off-by: Paul E. McKenney <paulmck at linux.vnet.ibm.com>
---
 urcu/arch_unknown.h         |   27 ++++++++++-----------------
 urcu/uatomic_arch_unknown.h |   15 +++------------
 2 files changed, 13 insertions(+), 29 deletions(-)

diff --git a/urcu/arch_unknown.h b/urcu/arch_unknown.h
index 3f78310..5b89312 100644
--- a/urcu/arch_unknown.h
+++ b/urcu/arch_unknown.h
@@ -1,8 +1,8 @@
-#ifndef _URCU_ARCH_ARMV7_H
-#define _URCU_ARCH_ARMV7_H
+#ifndef _URCU_ARCH_UNKNOWN_H
+#define _URCU_ARCH_UNKNOWN_H
 
 /*
- * arch_armv7.h: trivial definitions for the ARMv7-A/R architecture.
+ * arch_unknown.h: trivial definitions for the "unknown" architecture.
  *
  * Copyright (c) 2010 Paul E. McKenney, IBM Corporation.
  * Copyright (c) 2009 Mathieu Desnoyers <mathieu.desnoyers at polymtl.ca>
@@ -11,7 +11,7 @@
  * 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
@@ -30,7 +30,7 @@ extern "C" {
 #endif 
 
 /* We don't know, so guess!!! */
-#define CACHE_LINE_SIZE	64
+#define CACHE_LINE_SIZE	128
 
 #define mb()    \
 	do { \
@@ -55,11 +55,6 @@ extern "C" {
 		} \
 	} while (0)
 
-/*
- * Serialize core instruction execution. Also acts as a compiler barrier.
- */
-#define sync_core()	asm volatile("isb" : : : "memory")
-
 #include <stdlib.h>
 #include <sys/time.h>
 
@@ -67,14 +62,12 @@ typedef unsigned long long cycles_t;
 
 static inline cycles_t get_cycles (void)
 {
-	long long thetime;
+	cycles_t thetime;
 	struct timeval tv;
 
-	if (gettimeofday(&tv, NULL) != 0) {
-		perror("gettimeofday");
-		abort();
-	}
-	thetime = ((long long)tv.tv_sec) * 1000000ULL + ((long long)tv.tv_usec);
+	if (gettimeofday(&tv, NULL) != 0)
+		return 0;
+	thetime = ((cycles_t)tv.tv_sec) * 1000000ULL + ((cycles_t)tv.tv_usec);
 	return (cycles_t)thetime;
 }
 
@@ -84,4 +77,4 @@ static inline cycles_t get_cycles (void)
 
 #include <urcu/arch_generic.h>
 
-#endif /* _URCU_ARCH_ARMV7_H */
+#endif /* _URCU_ARCH_UNKNOWN_H */
diff --git a/urcu/uatomic_arch_unknown.h b/urcu/uatomic_arch_unknown.h
index d1cf93e..832d685 100644
--- a/urcu/uatomic_arch_unknown.h
+++ b/urcu/uatomic_arch_unknown.h
@@ -1,5 +1,5 @@
-#ifndef _URCU_ARCH_UATOMIC_ARMV7_H
-#define _URCU_ARCH_UATOMIC_ARMV7_H
+#ifndef _URCU_ARCH_UATOMIC_UNKNOWN_H
+#define _URCU_ARCH_UATOMIC_UNKNOWN_H
 
 /* 
  * Copyright (c) 1991-1994 by Xerox Corporation.  All rights reserved.
@@ -29,15 +29,6 @@
 extern "C" {
 #endif 
 
-#define ILLEGAL_INSTR	".long	0xd00d00" /* @@@FIXME from ppc to ARM. */
-
-/*
- * Using a isync as second barrier for exchange to provide acquire semantic.
- * According to uatomic_ops/sysdeps/gcc/powerpc.h, the documentation is "fairly
- * explicit that this also has acquire semantics."
- * Derived from AO_compare_and_swap(), but removed the comparison.
- */
-
 /* xchg */
 #define uatomic_xchg(addr, v)	 __sync_lock_test_and_set(addr, v);
 
@@ -54,4 +45,4 @@ extern "C" {
 
 #include <urcu/uatomic_generic.h>
 
-#endif /* _URCU_ARCH_UATOMIC_ARMV7_H */
+#endif /* _URCU_ARCH_UATOMIC_UNKNOWN_H */
-- 
1.7.0.6





More information about the lttng-dev mailing list