Skip to contentSkip to conversation

s390 (7/9): oprofile for s390.

PATCH In review Martin Schwidefsky 2 participants 2 messages Apr 21, 2004

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

PATCH 1/1 s390 (7/9): 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/irq.c            |   72 ++++++++++++++++++++++++++++++++++++++
 arch/s390/kernel/sys_s390.c       |    1 
 arch/s390/kernel/syscalls.S       |    2 -
 arch/s390/kernel/time.c           |   50 ++++++++++++++++++++++++++
 arch/s390/oprofile/Kconfig        |   23 ++++++++++++
 arch/s390/oprofile/Makefile       |   12 ++++++
 arch/s390/oprofile/init.c         |   26 +++++++++++++
 drivers/s390/cio/cio.c            |    9 ----
 include/asm-s390/unistd.h         |    1 
 14 files changed, 204 insertions(+), 11 deletions(-)
arch/s390/Kconfig +1 -0
diff -urN linux-2.6/arch/s390/Kconfig linux-2.6-s390/arch/s390/Kconfig
@@ -349,6 +349,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/
 
+#based on arch/i386/Makefile: "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
@@ -463,6 +463,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 irq.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/irq.c +72 -0

72 lines not on this page · raw message

arch/s390/kernel/sys_s390.c +1 -0
diff -urN linux-2.6/arch/s390/kernel/sys_s390.c linux-2.6-s390/arch/s390/kernel/sys_s390.c
@@ -4,6 +4,7 @@
  *  S390 version
  *    Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
  *    Author(s): Martin Schwidefsky ([email protected]),
+ *               Thomas Spatzier ([email protected])
  *
  *  Derived from "arch/i386/kernel/sys_i386.c"
  *
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 +12 -0
diff -urN linux-2.6/arch/s390/oprofile/Makefile linux-2.6-s390/arch/s390/oprofile/Makefile
@@ -0,0 +1,12 @@
+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
+#oprofile-$(CONFIG_X86_LOCAL_APIC) 	+= nmi_int.o op_model_athlon.o \
+					   op_model_ppro.o op_model_p4.o
+#oprofile-$(CONFIG_X86_IO_APIC)		+= nmi_timer_int.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

arch/s390/kernel/irq.c line 10

Quoted 12 lines · Martin Schwidefsky

+++ linux-2.6-s390/arch/s390/kernel/irq.c Wed Apr 21 16:29:40 2004

arch/s390/kernel/irq.c +10 -0
@@ -0,0 +1,72 @@
+/*
+ * arch/s390/kernel/irq.c
+ *
+ * Contains functions related to oprofile taken from patch
+ * linux-2.4.20-s390-oprofile.patch.
+ *
+ * Copyrith (C) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation
+ * Author(s): Thomas Spatzier ([email protected])
+ *
+ */

Don't you think the name for this file is completly wrong? And a patch name in the comment about this file doesn't exactly help either..

arch/s390/kernel/irq.c line 12

Quoted 1 line
arch/s390/kernel/irq.c +1 -0
+#include <linux/smp_lock.h>

What do you need this one for?

Review line 12

Quoted 1 line
(quoted diff) +1 -0
+#include <linux/init.h>

doesn't seem to be need either.

arch/s390/kernel/irq.c line 16

Quoted 1 line
arch/s390/kernel/irq.c +1 -0
+#include <asm/system.h>

dito?

arch/s390/kernel/irq.c line 17

Quoted 1 line
arch/s390/kernel/irq.c +1 -0
+#include <asm/io.h>

dito. I wonder why this actually exists on s390..

arch/s390/kernel/irq.c line 19

Quoted 2 lines
arch/s390/kernel/irq.c +2 -0
+#include <asm/pgtable.h>
+#include <asm/delay.h>

dito.

Quoted 10 lines
arch/s390/kernel/time.c +10 -0
+static inline void s390_do_profile(struct pt_regs * regs)
+{
+	unsigned long eip;
+	extern unsigned long prof_cpu_mask;
+
+	profile_hook(regs);
+
+	if (user_mode(regs))
+		return;
+

arch/s390/kernel/time.c line 210

Quoted 10 lines
arch/s390/kernel/time.c +10 -0
+	if (!prof_buffer)
+		return;
+
+	eip = instruction_pointer(regs);
+
+	/*
+	 * Only measure the CPUs specified by /proc/irq/prof_cpu_mask.
+	 * (default is all CPUs.)
+	 */
+	if (!((1<<smp_processor_id()) & prof_cpu_mask))

shouldn't this be cpumask_t arithmetic?

arch/s390/oprofile/init.c line 15

Quoted 1 line
arch/s390/oprofile/init.c +1 -0
+//extern int irq_init(struct oprofile_operations** ops);

why this?