Skip to contentSkip to conversation

s390 (6/6): oprofile for s390.

PATCH In review Martin Schwidefsky 2 participants 2 messages Apr 28, 2004 – Apr 29, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390 (6/6): oprofile for s390.

[PATCH] s390: oprofile.

From: Martin Schwidefsky <[email protected]>

Add oprofile support for s/390.

diffstat:

 arch/s390/Kconfig                 |    1 
 arch/s390/Makefile                |    3 ++
 arch/s390/defconfig               |    5 +++
 arch/s390/kernel/Makefile         |    2 -
 arch/s390/kernel/compat_wrapper.S |    8 +++++
 arch/s390/kernel/profile.c        |   56 ++++++++++++++++++++++++++++++++++++++
 arch/s390/kernel/syscalls.S       |    2 -
 arch/s390/kernel/time.c           |   50 +++++++++++++++++++++++++++++++++
 arch/s390/oprofile/Kconfig        |   23 +++++++++++++++
 arch/s390/oprofile/Makefile       |    9 ++++++
 arch/s390/oprofile/init.c         |   26 +++++++++++++++++
 drivers/s390/cio/cio.c            |    9 ------
 include/asm-s390/unistd.h         |    1 
 13 files changed, 184 insertions(+), 11 deletions(-)
arch/s390/Kconfig +1 -0
diff -urN linux-2.6/arch/s390/Kconfig linux-2.6-s390/arch/s390/Kconfig
@@ -368,6 +368,7 @@
 
 source "fs/Kconfig"
 
+source "arch/s390/oprofile/Kconfig"
 
 menu "Kernel hacking"
 
arch/s390/Makefile +3 -0
diff -urN linux-2.6/arch/s390/Makefile linux-2.6-s390/arch/s390/Makefile
@@ -50,6 +50,9 @@
 drivers-y	+= drivers/s390/
 drivers-$(CONFIG_MATHEMU) += arch/$(ARCH)/math-emu/
 
+# must be linked after kernel
+drivers-$(CONFIG_OPROFILE)	+= arch/s390/oprofile/
+
 boot		:= arch/$(ARCH)/boot
 
 all: image
arch/s390/defconfig +5 -0
diff -urN linux-2.6/arch/s390/defconfig linux-2.6-s390/arch/s390/defconfig
@@ -464,6 +464,11 @@
 # CONFIG_NLS is not set
 
 #
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
 # Kernel hacking
 #
 CONFIG_DEBUG_KERNEL=y
arch/s390/kernel/Makefile +1 -1
diff -urN linux-2.6/arch/s390/kernel/Makefile linux-2.6-s390/arch/s390/kernel/Makefile
@@ -6,7 +6,7 @@
 
 obj-y	:=  bitmap.o traps.o time.o process.o \
             setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
-            semaphore.o s390_ext.o debug.o
+            semaphore.o s390_ext.o debug.o profile.o
 
 extra-$(CONFIG_ARCH_S390_31)	+= head.o 
 extra-$(CONFIG_ARCH_S390X)	+= head64.o 
arch/s390/kernel/compat_wrapper.S +8 -0
diff -urN linux-2.6/arch/s390/kernel/compat_wrapper.S linux-2.6-s390/arch/s390/kernel/compat_wrapper.S
@@ -1234,6 +1234,14 @@
 	lgfr	%r5,%r5			# int
 	jg	sys_epoll_wait		# branch to system call
 
+	.globl	sys32_lookup_dcookie_wrapper
+sys32_lookup_dcookie_wrapper:
+	sllg	%r2,%r2,32		# get high word of 64bit dcookie
+	or	%r2,%r3			# get low word of 64bit dcookie
+	llgtr	%r3,%r4			# char *
+	llgfr	%r4,%r5			# size_t
+	jg	sys_lookup_dcookie
+
 	.globl	sys32_fadvise64_wrapper
 sys32_fadvise64_wrapper:
 	lgfr	%r2,%r2			# int
arch/s390/kernel/profile.c +56 -0

56 lines not on this page · raw message

arch/s390/kernel/syscalls.S +1 -1
diff -urN linux-2.6/arch/s390/kernel/syscalls.S linux-2.6-s390/arch/s390/kernel/syscalls.S
@@ -118,7 +118,7 @@
 SYSCALL(sys_newlstat,sys_newlstat,compat_sys_newlstat_wrapper)
 SYSCALL(sys_newfstat,sys_newfstat,compat_sys_newfstat_wrapper)
 NI_SYSCALL							/* old uname syscall */
-NI_SYSCALL							/* reserved for sys_lookup_dcache */
+SYSCALL(sys_lookup_dcookie,sys_lookup_dcookie,sys32_lookup_dcookie_wrapper)	/* 110 */
 SYSCALL(sys_vhangup,sys_vhangup,sys_vhangup)
 NI_SYSCALL							/* old "idle" system call */
 NI_SYSCALL							/* vm86old for i386 */
arch/s390/kernel/time.c +50 -0

68 lines not on this page · raw message

arch/s390/oprofile/Kconfig +23 -0
diff -urN linux-2.6/arch/s390/oprofile/Kconfig linux-2.6-s390/arch/s390/oprofile/Kconfig
@@ -0,0 +1,23 @@
+
+menu "Profiling support"
+	depends on EXPERIMENTAL
+
+config PROFILING
+	bool "Profiling support (EXPERIMENTAL)"
+	help
+	  Say Y here to enable the extended profiling support mechanisms used
+	  by profilers such as OProfile.
+
+
+config OPROFILE
+	tristate "OProfile system profiling (EXPERIMENTAL)"
+	depends on PROFILING
+	help
+	  OProfile is a profiling system capable of profiling the
+	  whole system, include the kernel, kernel modules, libraries,
+	  and applications.
+
+	  If unsure, say N.
+
+endmenu
+
arch/s390/oprofile/Makefile +9 -0
diff -urN linux-2.6/arch/s390/oprofile/Makefile linux-2.6-s390/arch/s390/oprofile/Makefile
@@ -0,0 +1,9 @@
+obj-$(CONFIG_OPROFILE) += oprofile.o
+
+DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
+		oprof.o cpu_buffer.o buffer_sync.o \
+		event_buffer.o oprofile_files.o \
+		oprofilefs.o oprofile_stats.o  \
+		timer_int.o )
+
+oprofile-y				:= $(DRIVER_OBJS) init.o
arch/s390/oprofile/init.c +26 -0
diff -urN linux-2.6/arch/s390/oprofile/init.c linux-2.6-s390/arch/s390/oprofile/init.c
@@ -0,0 +1,26 @@
+/**
+ * arch/s390/oprofile/init.c
+ *
+ * S390 Version
+ *   Copyright (C) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ *   Author(s): Thomas Spatzier ([email protected])
+ *
+ * @remark Copyright 2002 OProfile authors
+ */
+
+#include <linux/oprofile.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+
+//extern int irq_init(struct oprofile_operations** ops);
+extern void timer_init(struct oprofile_operations** ops);
+
+int __init oprofile_arch_init(struct oprofile_operations** ops)
+{
+	timer_init(ops);
+	return 0;
+}
+
+void oprofile_arch_exit(void)
+{
+}
drivers/s390/cio/cio.c +0 -9
diff -urN linux-2.6/drivers/s390/cio/cio.c linux-2.6-s390/drivers/s390/cio/cio.c
@@ -52,15 +52,6 @@
 
 __setup ("cio_msg=", cio_setup);
 
-
-#ifdef CONFIG_PROC_FS
-void
-init_irq_proc(void)
-{
-	/* For now, nothing... */
-}
-#endif
-
 /*
  * Function: cio_debug_init
  * Initializes three debug logs (under /proc/s390dbf) for common I/O:
include/asm-s390/unistd.h +1 -0
diff -urN linux-2.6/include/asm-s390/unistd.h linux-2.6-s390/include/asm-s390/unistd.h
@@ -105,6 +105,7 @@
 #define __NR_stat               106
 #define __NR_lstat              107
 #define __NR_fstat              108
+#define __NR_lookup_dcookie     110
 #define __NR_vhangup            111
 #define __NR_idle               112
 #define __NR_wait4              114
#1 lore raw
Quoted 5 lines · Martin Schwidefsky

[PATCH] s390: oprofile.

From: Martin Schwidefsky <[email protected]>

Add oprofile support for s/390.

we ack'ed this on oprofile mail list except:

Quoted 4 lines

--- linux-2.6/arch/s390/kernel/time.c Wed Apr 28 17:51:14 2004

+#if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE)

this must depend on CONFIG_PROFILING ?

arch/s390/kernel/time.c line 192

Quoted 3 lines

+ */

arch/s390/kernel/time.c +2 -0
+static inline void s390_do_profile(struct pt_regs * regs)
+{

regards,
Phil