All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] CodeSamples: Add arm64 support
@ 2017-07-11 15:30 Akira Yokosawa
  2017-07-11 15:31 ` [PATCH 1/2] advsync: Add dependency to $(CUSTOM_HEADER) Akira Yokosawa
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Akira Yokosawa @ 2017-07-11 15:30 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

From 1908602500df34619ec496c787546d5584d01221 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Wed, 12 Jul 2017 00:01:30 +0900
Subject: [PATCH 0/2] CodeSamples: Add arm64 support

Hi Paul,

So, this patch set adds arm64 support for CodeSamples.

Patch 1 is a followup of the previous patch set. I missed the dependency
to the custom header file.
Patch 2 is the addition of arm64 support. It is based on arm support files.
I appended an "ish" operand to "dmb" in the definition of smp_mp().
Looks like the same change is necessary in arch-arm/arch-arm.h, but this
patch doesn't touch it.
Also, I rewrote the definition of get_timestamp() by using clock_gettime()
instead of gettimeofday(). For arm64 host, we can expect clock_gettime()
is supported.
In Makefile.arch, I chose the flags -mcpu=native and -mtune=native, since
this Makefile is intended for native build.
This is compile tested on an ARMv8 host. I didn't have enough time to
run all the programs. I tested a few under count/ and defer/ sub-directories.

        Thanks. Akira
--
Akira Yokosawa (2):
  advsync: Add dependency to $(CUSTOM_HEADER)
  CodeSamples: Add arm64 support

 CodeSamples/advsync/herd/Makefile    |  2 +-
 CodeSamples/arch-arm64/Makefile.arch |  2 ++
 CodeSamples/arch-arm64/arch-arm64.h  | 61 ++++++++++++++++++++++++++++++++++++
 CodeSamples/depends.mk               |  5 +++
 4 files changed, 69 insertions(+), 1 deletion(-)
 create mode 100644 CodeSamples/arch-arm64/Makefile.arch
 create mode 100644 CodeSamples/arch-arm64/arch-arm64.h

-- 
2.7.4


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

* [PATCH 1/2] advsync: Add dependency to $(CUSTOM_HEADER)
  2017-07-11 15:30 [PATCH 0/2] CodeSamples: Add arm64 support Akira Yokosawa
@ 2017-07-11 15:31 ` Akira Yokosawa
  2017-07-11 15:32 ` [PATCH 2/2] CodeSamples: Add arm64 support Akira Yokosawa
  2017-07-11 18:52 ` [PATCH 0/2] " Paul E. McKenney
  2 siblings, 0 replies; 4+ messages in thread
From: Akira Yokosawa @ 2017-07-11 15:31 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

From 69493e126b70589656c3331d34865d2a57b5cf36 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Sun, 9 Jul 2017 12:18:19 +0900
Subject: [PATCH 1/2] advsync: Add dependency to $(CUSTOM_HEADER)

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 CodeSamples/advsync/herd/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CodeSamples/advsync/herd/Makefile b/CodeSamples/advsync/herd/Makefile
index 056f5f9..96c4495 100644
--- a/CodeSamples/advsync/herd/Makefile
+++ b/CodeSamples/advsync/herd/Makefile
@@ -8,7 +8,7 @@ CUSTOM_HEADER := $(wildcard *.h)

 all: $(LITMUS_OUT)

-%.litmus.out: %.litmus
+%.litmus.out: %.litmus $(CUSTOM_HEADER)
 	litmus7 -r 1000 -carch X86 -ccopts "$(CCOPTS)" $< > $@ 2>&1

 cross-x86: TARGET = X86
-- 
2.7.4



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

* [PATCH 2/2] CodeSamples: Add arm64 support
  2017-07-11 15:30 [PATCH 0/2] CodeSamples: Add arm64 support Akira Yokosawa
  2017-07-11 15:31 ` [PATCH 1/2] advsync: Add dependency to $(CUSTOM_HEADER) Akira Yokosawa
@ 2017-07-11 15:32 ` Akira Yokosawa
  2017-07-11 18:52 ` [PATCH 0/2] " Paul E. McKenney
  2 siblings, 0 replies; 4+ messages in thread
From: Akira Yokosawa @ 2017-07-11 15:32 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: perfbook, Akira Yokosawa

From 1908602500df34619ec496c787546d5584d01221 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@gmail.com>
Date: Mon, 10 Jul 2017 23:46:32 +0900
Subject: [PATCH 2/2] CodeSamples: Add arm64 support

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 CodeSamples/arch-arm64/Makefile.arch |  2 ++
 CodeSamples/arch-arm64/arch-arm64.h  | 61 ++++++++++++++++++++++++++++++++++++
 CodeSamples/depends.mk               |  5 +++
 3 files changed, 68 insertions(+)
 create mode 100644 CodeSamples/arch-arm64/Makefile.arch
 create mode 100644 CodeSamples/arch-arm64/arch-arm64.h

diff --git a/CodeSamples/arch-arm64/Makefile.arch b/CodeSamples/arch-arm64/Makefile.arch
new file mode 100644
index 0000000..b886373
--- /dev/null
+++ b/CodeSamples/arch-arm64/Makefile.arch
@@ -0,0 +1,2 @@
+# http://www.ibm.com/developerworks/wikis/display/hpccentral/Tuning+options+to+consider+with+gcc#Tuningoptionstoconsiderwithgcc-mcpuandmtune
+GCC_ARGS=-g -O3 -Wall -mcpu=native -mtune=native
diff --git a/CodeSamples/arch-arm64/arch-arm64.h b/CodeSamples/arch-arm64/arch-arm64.h
new file mode 100644
index 0000000..354f1f2
--- /dev/null
+++ b/CodeSamples/arch-arm64/arch-arm64.h
@@ -0,0 +1,61 @@
+/*
+ * arch-arm64.h: Expose ARMv8_64 atomic instructions.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; but version 2 of the License only due
+ * to code included from the Linux kernel.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you can access it online at
+ * http://www.gnu.org/licenses/gpl-2.0.html.
+ *
+ * Copyright (c) 2010 Paul E. McKenney, IBM.
+ *
+ * Much code taken from the Linux kernel.  For such code, the option
+ * to redistribute under later versions of GPL might not be available.
+ */
+
+/*
+ * Machine parameters.
+ */
+
+#define CONFIG_SMP
+#define CONFIG_ARM64
+
+#define CACHE_LINE_SIZE 128
+#define ____cacheline_internodealigned_in_smp \
+	__attribute__((__aligned__(1 << 7)))
+
+/* The gcc primitives imply full memory barriers. */
+#define smp_mb__before_atomic_dec()	do { } while (0)
+#define smp_mb__after_atomic_dec()	do { } while (0)
+#define smp_mb__before_atomic_inc()	do { } while (0)
+#define smp_mb__after_atomic_inc()	do { } while (0)
+
+/* __sync_synchronize() is broken before gcc 4.4.1 on many ARM systems. */
+#define smp_mb()  __asm__ __volatile__("dmb ish" : : : "memory")
+
+
+#include <stdlib.h>
+#include <time.h>
+
+/*
+ * Generate 64-bit timestamp.
+ */
+static __inline__ unsigned long long get_timestamp(void)
+{
+	unsigned long long thetime;
+	struct timespec tv;
+
+	if (clock_gettime(CLOCK_MONOTONIC_RAW, &tv) != 0)
+		return 0;
+	thetime = ((unsigned long long)tv.tv_sec) * 1000000000ULL +
+		  ((unsigned long long)tv.tv_nsec);
+	return thetime;
+}
diff --git a/CodeSamples/depends.mk b/CodeSamples/depends.mk
index 8eb45b4..77a76bf 100644
--- a/CodeSamples/depends.mk
+++ b/CodeSamples/depends.mk
@@ -10,6 +10,8 @@ else ifeq ($(arch),ppc64)
 target := ppc64
 else ifeq ($(arch),ppc64le)
 target := ppc64
+else ifeq ($(arch),aarch64)
+target := arm64
 else ifneq (,$(findstring arm,$(arch)))
 target := arm
 else
@@ -27,6 +29,9 @@ arch_depend := $(top)/arch-ppc64/Makefile.arch
 else ifeq ($(target),arm)
 api_depend := $(top)/arch-arm/arch-arm.h
 arch_depend := $(top)/arch-arm/Makefile.arch
+else ifeq ($(target),arm64)
+api_depend := $(top)/arch-arm64/arch-arm64.h
+arch_depend := $(top)/arch-arm64/Makefile.arch
 else
 api_depend :=
 arch_depend :=
-- 
2.7.4



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

* Re: [PATCH 0/2] CodeSamples: Add arm64 support
  2017-07-11 15:30 [PATCH 0/2] CodeSamples: Add arm64 support Akira Yokosawa
  2017-07-11 15:31 ` [PATCH 1/2] advsync: Add dependency to $(CUSTOM_HEADER) Akira Yokosawa
  2017-07-11 15:32 ` [PATCH 2/2] CodeSamples: Add arm64 support Akira Yokosawa
@ 2017-07-11 18:52 ` Paul E. McKenney
  2 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2017-07-11 18:52 UTC (permalink / raw)
  To: Akira Yokosawa; +Cc: perfbook

On Wed, Jul 12, 2017 at 12:30:04AM +0900, Akira Yokosawa wrote:
> >From 1908602500df34619ec496c787546d5584d01221 Mon Sep 17 00:00:00 2001
> From: Akira Yokosawa <akiyks@gmail.com>
> Date: Wed, 12 Jul 2017 00:01:30 +0900
> Subject: [PATCH 0/2] CodeSamples: Add arm64 support
> 
> Hi Paul,
> 
> So, this patch set adds arm64 support for CodeSamples.
> 
> Patch 1 is a followup of the previous patch set. I missed the dependency
> to the custom header file.
> Patch 2 is the addition of arm64 support. It is based on arm support files.
> I appended an "ish" operand to "dmb" in the definition of smp_mp().
> Looks like the same change is necessary in arch-arm/arch-arm.h, but this
> patch doesn't touch it.
> Also, I rewrote the definition of get_timestamp() by using clock_gettime()
> instead of gettimeofday(). For arm64 host, we can expect clock_gettime()
> is supported.
> In Makefile.arch, I chose the flags -mcpu=native and -mtune=native, since
> this Makefile is intended for native build.
> This is compile tested on an ARMv8 host. I didn't have enough time to
> run all the programs. I tested a few under count/ and defer/ sub-directories.

I queued and pushed these, thank you!  If bugs appear, we will fix them.

							Thanx, Paul

>         Thanks. Akira
> --
> Akira Yokosawa (2):
>   advsync: Add dependency to $(CUSTOM_HEADER)
>   CodeSamples: Add arm64 support
> 
>  CodeSamples/advsync/herd/Makefile    |  2 +-
>  CodeSamples/arch-arm64/Makefile.arch |  2 ++
>  CodeSamples/arch-arm64/arch-arm64.h  | 61 ++++++++++++++++++++++++++++++++++++
>  CodeSamples/depends.mk               |  5 +++
>  4 files changed, 69 insertions(+), 1 deletion(-)
>  create mode 100644 CodeSamples/arch-arm64/Makefile.arch
>  create mode 100644 CodeSamples/arch-arm64/arch-arm64.h
> 
> -- 
> 2.7.4
> 


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

end of thread, other threads:[~2017-07-11 18:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-11 15:30 [PATCH 0/2] CodeSamples: Add arm64 support Akira Yokosawa
2017-07-11 15:31 ` [PATCH 1/2] advsync: Add dependency to $(CUSTOM_HEADER) Akira Yokosawa
2017-07-11 15:32 ` [PATCH 2/2] CodeSamples: Add arm64 support Akira Yokosawa
2017-07-11 18:52 ` [PATCH 0/2] " Paul E. McKenney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.