From: William Cohen <wcohen@redhat.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Add minimal support for software performance counters for ia64
Date: Wed, 19 Aug 2009 15:04:10 -0400 [thread overview]
Message-ID: <4A8C4CAA.5070101@redhat.com> (raw)
In-Reply-To: <1250698351.8282.106.camel@twins>
[-- Attachment #1: Type: text/plain, Size: 713 bytes --]
Peter Zijlstra wrote:
> On Wed, 2009-08-19 at 12:04 -0400, William Cohen wrote:
>> +#ifdef __ia64__
>> +#include "../../arch/ia64/include/asm/unistd.h"
>> +#define rmb() asm volatile("" ::: "memory")
>> +#define cpu_relax() asm volatile("" ::: "memory");
>> +#endif
>
> Surely the itanic has a real memory barrier? The kernel seems to use
> something along the lines of mf.
>
> Also, cpu_relax() seems to end up being asm volatile("hint @pause" :::
> "memory"), although we don't seem to have an actual user of cpu_relax()
> in perf atm.
>
>
>
Peter, thanks for the comment. I took a look at the rmb() and cpu_relax() code
in the kernel and revised the patch with the appropriate defines
-Will
[-- Attachment #2: perf_ia64b.patch --]
[-- Type: text/plain, Size: 4010 bytes --]
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 170042b..8471526 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -29,6 +29,7 @@ config IA64
select HAVE_KVM
select HAVE_ARCH_TRACEHOOK
select HAVE_DMA_API_DEBUG
+ select HAVE_PERF_COUNTERS
default y
help
The Itanium Processor Family is Intel's 64-bit successor to
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index 5a5347f..f69d1c9 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -311,11 +311,12 @@
#define __NR_preadv 1319
#define __NR_pwritev 1320
#define __NR_rt_tgsigqueueinfo 1321
+#define __NR_perf_counter_open 1322
#ifdef __KERNEL__
-#define NR_syscalls 298 /* length of syscall table */
+#define NR_syscalls 299 /* length of syscall table */
/*
* The following defines stop scripts/checksyscalls.sh from complaining about
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index d0e7d37..4cf88b0 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1806,6 +1806,7 @@ sys_call_table:
data8 sys_preadv
data8 sys_pwritev // 1320
data8 sys_rt_tgsigqueueinfo
+ data8 sys_perf_counter_open
.org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
#endif /* __IA64_ASM_PARAVIRTUALIZED_NATIVE */
diff --git a/include/asm-ia64/perf_counter.h b/include/asm-ia64/perf_counter.h
new file mode 100644
index 0000000..cab4352
--- /dev/null
+++ b/include/asm-ia64/perf_counter.h
@@ -0,0 +1,9 @@
+#ifndef __ASM_IA64_PERF_COUNTER_H
+#define __ASM_IA64_PERF_COUNTER_H
+
+/* IA64 only supports software counters through this interface. */
+static inline void set_perf_counter_pending(void) {}
+
+#define PERF_COUNTER_INDEX_OFFSET 0
+
+#endif /* __ASM_IA64_PERF_COUNTER_H */
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index c481a51..69db3de 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -159,8 +159,10 @@ uname_V := $(shell sh -c 'uname -v 2>/dev/null || echo not')
# If we're on a 64-bit kernel, use -m64
ifndef NO_64BIT
- ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M))
- M64 := -m64
+ ifeq ($(patsubst %ia64,%,$(uname_M)),$(uname_M))
+ ifneq ($(patsubst %64,%,$(uname_M)),$(uname_M))
+ M64 := -m64
+ endif
endif
endif
@@ -169,9 +171,9 @@ endif
#
# Include saner warnings here, which can catch bugs:
#
-EXTRA_WARNINGS = -Wcast-align -Wformat -Wformat-security -Wformat-y2k -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement
+EXTRA_WARNINGS = -Wformat -Wformat-security -Wformat-y2k -Wshadow -Winit-self -Wpacked -Wredundant-decls -Wstack-protector -Wstrict-aliasing=3 -Wswitch-default -Wswitch-enum -Wno-system-headers -Wundef -Wvolatile-register-var -Wwrite-strings -Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wdeclaration-after-statement
-CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 $(EXTRA_WARNINGS)
+CFLAGS = $(M64) -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6 -fstack-protector-all -D_FORTIFY_SOURCE=2 -fno-strict-aliasing $(EXTRA_WARNINGS)
LDFLAGS = -lpthread -lrt -lelf -lm
ALL_CFLAGS = $(CFLAGS)
ALL_LDFLAGS = $(LDFLAGS)
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index e5148e2..c849337 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -41,6 +41,12 @@
#define cpu_relax() asm volatile("" ::: "memory");
#endif
+#ifdef __ia64__
+#include "../../arch/ia64/include/asm/unistd.h"
+#define rmb() asm volatile("mf" ::: "memory")
+#define cpu_relax() asm volatile("hint @pause" ::: "memory")
+#endif
+
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
next prev parent reply other threads:[~2009-08-19 19:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-19 16:04 [PATCH] Add minimal support for software performance counters for ia64 William Cohen
2009-08-19 16:12 ` Peter Zijlstra
2009-08-19 19:04 ` William Cohen [this message]
2009-08-19 19:06 ` Peter Zijlstra
2009-08-20 21:19 ` William Cohen
2009-08-21 14:25 ` Ingo Molnar
2009-08-21 15:09 ` William Cohen
2009-08-21 16:37 ` [PATCH, V2] perf_counter, IA64: Add support for software performance counters Ingo Molnar
2009-08-19 16:12 ` [PATCH] Add minimal " Ingo Molnar
2009-08-19 16:12 ` [PATCH] Add minimal support for software performance counters for ia64 Ingo Molnar
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=4A8C4CAA.5070101@redhat.com \
--to=wcohen@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
/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 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.