public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] basic perf support for sparc
@ 2009-07-29 11:25 Jens Axboe
  2009-07-29 19:28 ` Jens Axboe
  2009-08-02 20:17 ` [PATCH] basic perf support for sparc David Miller
  0 siblings, 2 replies; 41+ messages in thread
From: Jens Axboe @ 2009-07-29 11:25 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel, a.p.zijlstra, fweisbec, Ingo Molnar

Hi,

This adds the little necessary bits to get perf going at
least. Callgraph doesn't work, but basic profiling does.

Building the perf tool is somewhat involved on sparc64
though, since 64-bit versions of zlib/libelf/bfd aren't
directly available (at least on debian 5.x). But once you
get there, it runs :-). Would it be easier/functional
to build 32-bit userland perf instead?

$  perf record -f ls > /dev/null
[ perf record: Captured and wrote 0.004 MB perf.data (~194 samples) ]
$ perf report --sort comm,dso,symbol | head -n10
# Samples: 98
#
# Overhead  Command  Shared Object  Symbol
# ........  .......  .............  ......
#
    25.51%       ls       f7f62e00  [.] 0x000000f7f62e00
     6.12%     perf  [kernel]       [.] 0xfffff801007e4b38
     6.12%       ls  [kernel]       [k] sparc64_realfault_common
     3.06%       ls  [kernel]       [k] tg_shares_up
     3.06%       ls  [kernel]       [k] find_next_bit

$ perf record -f -g ls > /dev/null
[ perf record: Captured and wrote 0.005 MB perf.data (~223 samples) ]
$ perf report -g | head -n10
Warning: empty node in callchain tree
Warning: empty node in callchain tree
Warning: empty node in callchain tree
[...]

Patch is against latest -git.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 3f8b6a9..2f951a9 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -44,6 +44,7 @@ config SPARC64
 	select RTC_DRV_BQ4802
 	select RTC_DRV_SUN4V
 	select RTC_DRV_STARFIRE
+	select HAVE_PERF_COUNTERS
 
 config ARCH_DEFCONFIG
 	string
diff --git a/arch/sparc/include/asm/unistd.h b/arch/sparc/include/asm/unistd.h
index b2c406d..706df66 100644
--- a/arch/sparc/include/asm/unistd.h
+++ b/arch/sparc/include/asm/unistd.h
@@ -395,8 +395,9 @@
 #define __NR_preadv		324
 #define __NR_pwritev		325
 #define __NR_rt_tgsigqueueinfo	326
+#define __NR_perf_counter_open	327
 
-#define NR_SYSCALLS		327
+#define NR_SYSCALLS		328
 
 #ifdef __32bit_syscall_numbers__
 /* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index 6b3ee88..80ebf20 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -158,4 +158,4 @@ sys_call_table:
 /*310*/	.word sys_utimensat, sys_signalfd, sys_timerfd_create, sys_eventfd, sys_fallocate
 	.word sys_timerfd_settime, sys_timerfd_gettime, sys_signalfd4, sys_eventfd2, sys_epoll_create1
 /*320*/	.word sys_dup3, sys_pipe2, sys_inotify_init1, sys_accept4, sys_preadv
-	.word sys_pwritev, sys_rt_tgsigqueueinfo
+	.word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_counter_open

diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index e5148e2..2abeb20 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -41,6 +41,12 @@
 #define cpu_relax()	asm volatile("" ::: "memory");
 #endif
 
+#ifdef __sparc__
+#include "../../arch/sparc/include/asm/unistd.h"
+#define rmb()		asm volatile("":::"memory")
+#define cpu_relax()	asm volatile("":::"memory")
+#endif
+
 #include <time.h>
 #include <unistd.h>
 #include <sys/types.h>

-- 
Jens Axboe


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

end of thread, other threads:[~2009-09-04  9:56 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-29 11:25 [PATCH] basic perf support for sparc Jens Axboe
2009-07-29 19:28 ` Jens Axboe
2009-08-01  1:14   ` Anton Blanchard
2009-08-01  8:20     ` Jens Axboe
2009-08-01 18:22       ` Arnaldo Carvalho de Melo
2009-08-02 18:41         ` Ingo Molnar
2009-08-02 19:44           ` Kyle McMartin
2009-08-02 19:50             ` Ingo Molnar
2009-08-02 20:11               ` Kyle McMartin
2009-08-02 20:33                 ` Ingo Molnar
2009-08-02 20:47                 ` Arnaldo Carvalho de Melo
2009-08-03  1:54                   ` Arnaldo Carvalho de Melo
2009-08-04  3:33                     ` Kyle McMartin
2009-08-04  9:25                     ` Ingo Molnar
2009-08-04  9:29                       ` Peter Zijlstra
2009-08-04 13:02                         ` David Miller
2009-08-04 10:32                       ` Frederic Riss
2009-08-04 10:38                         ` Peter Zijlstra
2009-08-04 11:23                           ` Frederic Riss
2009-08-04 11:28                       ` Ingo Molnar
2009-08-05 12:10             ` Peter Zijlstra
2009-08-05 12:21               ` Jens Axboe
2009-08-05 12:33                 ` Ingo Molnar
2009-08-05 12:16       ` [tip:perfcounters/urgent] perf: Auto-detect libbfd tip-bot for Peter Zijlstra
2009-08-05 14:29         ` Peter Zijlstra
2009-08-05 18:58           ` Peter Zijlstra
2009-08-02 20:17 ` [PATCH] basic perf support for sparc David Miller
2009-08-02 20:25   ` Ingo Molnar
2009-08-06  7:02   ` Jens Axboe
2009-08-12 18:06     ` David Miller
2009-08-12 18:13       ` Jens Axboe
2009-08-17  1:31     ` David Miller
2009-08-17  6:48       ` Jens Axboe
2009-08-17  7:57         ` Ingo Molnar
2009-09-04  4:37         ` David Miller
2009-09-04  5:02           ` Ingo Molnar
2009-09-04  5:09             ` David Miller
2009-09-04  5:20               ` Jens Axboe
2009-09-04  6:34                 ` Jens Axboe
2009-09-04  6:44                   ` Ingo Molnar
2009-09-04  9:57                   ` David Miller

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