* [PATCH] Perf-tool/MIPS: support cross compiling of tools/perf for MIPS
@ 2010-04-28 11:54 Deng-Cheng Zhu
2010-04-28 13:14 ` Wu Zhangjin
0 siblings, 1 reply; 2+ messages in thread
From: Deng-Cheng Zhu @ 2010-04-28 11:54 UTC (permalink / raw)
To: ralf, ddaney, linux-mips; +Cc: dengcheng.zhu
With the kernel facility of Linux performance counters, we want the user
level tool tools/perf to be cross compiled for MIPS platform. To do this,
we need to include unistd.h, add rmb() and cpu_relax() in perf.h.
Your review comments are especially required for the definition of rmb():
In perf.h, we need to have a proper rmb() for _all_ MIPS platforms. And
we don't have CONFIG_* things for use in here. Looking at barrier.h,
rmb() goes into barrier() and __sync() for CAVIUM OCTEON and other CPUs,
respectively. What's more, __sync() has different versions as well.
Referring to BARRIER() in dump_tlb.c, I propose the "common" definition
for perf tool rmb() in this patch. Do you have any comments?
In addition, for testing the kernel part code I sent several days
ago, I was using the "particular" rmb() version for 24K/34K/74K cores:
#define rmb() asm volatile( \
".set push\n\t" \
".set noreorder\n\t" \
".set mips2\n\t" \
"sync\n\t" \
".set pop" \
: /* no output */ \
: /* no input */ \
: "memory")
This is the definition of __sync() for CONFIG_CPU_HAS_SYNC.
Thanks,
Deng-Cheng
Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
---
tools/perf/perf.h | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 6fb379b..cd05284 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -69,6 +69,18 @@
#define cpu_relax() asm volatile("":::"memory")
#endif
+#ifdef __mips__
+#include "../../arch/mips/include/asm/unistd.h"
+#define rmb() asm volatile( \
+ ".set noreorder\n\t" \
+ "nop;nop;nop;nop;nop;nop;nop\n\t" \
+ ".set reorder" \
+ : /* no output */ \
+ : /* no input */ \
+ : "memory")
+#define cpu_relax() asm volatile("" ::: "memory")
+#endif
+
#include <time.h>
#include <unistd.h>
#include <sys/types.h>
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] Perf-tool/MIPS: support cross compiling of tools/perf for MIPS
2010-04-28 11:54 [PATCH] Perf-tool/MIPS: support cross compiling of tools/perf for MIPS Deng-Cheng Zhu
@ 2010-04-28 13:14 ` Wu Zhangjin
0 siblings, 0 replies; 2+ messages in thread
From: Wu Zhangjin @ 2010-04-28 13:14 UTC (permalink / raw)
To: Deng-Cheng Zhu; +Cc: ralf, ddaney, linux-mips
On Wed, 2010-04-28 at 19:54 +0800, Deng-Cheng Zhu wrote:
> With the kernel facility of Linux performance counters, we want the user
> level tool tools/perf to be cross compiled for MIPS platform. To do this,
> we need to include unistd.h, add rmb() and cpu_relax() in perf.h.
>
Just found local-compiling also need rmb().
BTW: for local-compiling in a debian linux on MIPS machines, we need to
copy linux-source-code/{tools/perf, include, lib} to the machine and
install libdw-dev and libelf-dev, so the basic procedure for making perf
work on a debian/MIPS:
0. prepare
For tools/perf
copy the directory {tools/perf, include, lib} of linux
$ apt-get install libdw-dev libelf-dev
For the kernel support
apply deng-cheng's latest patch and ensure CONFIG_HW_PERF_EVENTS=y
then boot into the new kernel.
1. compile tools/perf
$ ls
include lib tools
$ ls tools/
perf
$ cd tools/perf
$ make
2. usage
$ ./perf list
For a non-raw event
$ ./perf stat -e cycles ls -l
For a raw event
$ ./perf stat -e r120 ls -l
Regard,
> Your review comments are especially required for the definition of rmb():
> In perf.h, we need to have a proper rmb() for _all_ MIPS platforms. And
> we don't have CONFIG_* things for use in here. Looking at barrier.h,
> rmb() goes into barrier() and __sync() for CAVIUM OCTEON and other CPUs,
> respectively. What's more, __sync() has different versions as well.
> Referring to BARRIER() in dump_tlb.c, I propose the "common" definition
> for perf tool rmb() in this patch. Do you have any comments?
>
> In addition, for testing the kernel part code I sent several days
> ago, I was using the "particular" rmb() version for 24K/34K/74K cores:
>
> #define rmb() asm volatile( \
> ".set push\n\t" \
> ".set noreorder\n\t" \
> ".set mips2\n\t" \
> "sync\n\t" \
> ".set pop" \
> : /* no output */ \
> : /* no input */ \
> : "memory")
>
> This is the definition of __sync() for CONFIG_CPU_HAS_SYNC.
>
>
> Thanks,
>
> Deng-Cheng
>
> Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
> ---
> tools/perf/perf.h | 12 ++++++++++++
> 1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/tools/perf/perf.h b/tools/perf/perf.h
> index 6fb379b..cd05284 100644
> --- a/tools/perf/perf.h
> +++ b/tools/perf/perf.h
> @@ -69,6 +69,18 @@
> #define cpu_relax() asm volatile("":::"memory")
> #endif
>
> +#ifdef __mips__
> +#include "../../arch/mips/include/asm/unistd.h"
> +#define rmb() asm volatile( \
> + ".set noreorder\n\t" \
> + "nop;nop;nop;nop;nop;nop;nop\n\t" \
> + ".set reorder" \
> + : /* no output */ \
> + : /* no input */ \
> + : "memory")
> +#define cpu_relax() asm volatile("" ::: "memory")
> +#endif
> +
> #include <time.h>
> #include <unistd.h>
> #include <sys/types.h>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-04-28 13:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-28 11:54 [PATCH] Perf-tool/MIPS: support cross compiling of tools/perf for MIPS Deng-Cheng Zhu
2010-04-28 13:14 ` Wu Zhangjin
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.