mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch, resend, 2.6, ppc32] enable OProfile profiling driver
@ 2004-07-01  8:22 Jens Schmalzing
  2004-07-01  8:48 ` Colin LEROY
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Schmalzing @ 2004-07-01  8:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: linuxppc-dev

Hi,

please find enclosed a patch to enable to OProfile profiling driver
for ppc32, forward ported from Ben's development tree.  I sent an
incomplete version some time ago, this time I didn't forget anything
(hopefully).

Regards, Jens.

diff -Nur kernel-source-2.6.6/arch/ppc/Makefile linuxppc-2.5-benh/arch/ppc/Makefile
--- kernel-source-2.6.6/arch/ppc/Makefile   2004-06-16 07:18:57.000000000 +0200
+++ linuxppc-2.5-benh/arch/ppc/Makefile   2004-06-24 12:43:55.995114195 +0200
@@ -43,6 +43,7 @@
 drivers-$(CONFIG_8xx)		+= arch/ppc/8xx_io/
 drivers-$(CONFIG_4xx)		+= arch/ppc/4xx_io/
 drivers-$(CONFIG_8260)		+= arch/ppc/8260_io/
+drivers-$(CONFIG_OPROFILE)	+= arch/ppc/oprofile/
 
 BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
 
diff -Nur kernel-source-2.6.6/arch/ppc/Kconfig linuxppc-2.5-benh/arch/ppc/Kconfig
--- kernel-source-2.6.6/arch/ppc/Kconfig        2004-04-05 11:49:23.000000000 +0200
+++ linuxppc-2.5-benh/arch/ppc/Kconfig  2004-03-29 08:34:26.000000000 +0200
@@ -1154,6 +1154,7 @@
 
 source "lib/Kconfig"
 
+source "arch/ppc/oprofile/Kconfig"
 
 menu "Kernel hacking"
 
diff -Nur kernel-source-2.6.6/arch/ppc/kernel/time.c linuxppc-2.5-benh/arch/ppc/kernel/time.c
--- kernel-source-2.6.5/arch/ppc/kernel/time.c	2004-03-11 03:55:37.000000000 +0100
+++ linuxppc-2.5-benh/arch/ppc/kernel/time.c	2004-03-04 03:04:26.000000000 +0100
@@ -56,6 +56,7 @@
 #include <linux/mc146818rtc.h>
 #include <linux/time.h>
 #include <linux/init.h>
+#include <linux/profile.h>
 
 #include <asm/segment.h>
 #include <asm/io.h>
@@ -107,17 +108,23 @@
 	return delta;
 }
 
-extern unsigned long prof_cpu_mask;
-extern unsigned int * prof_buffer;
-extern unsigned long prof_len;
-extern unsigned long prof_shift;
 extern char _stext;
 
-static inline void ppc_do_profile (unsigned long nip)
+static inline void ppc_do_profile(struct pt_regs *regs)
 {
+	unsigned long nip;
+	extern unsigned long prof_cpu_mask;
+
+	profile_hook(regs);
+
+	if (user_mode(regs))
+		return;
+
 	if (!prof_buffer)
 		return;
 
+	nip = instruction_pointer(regs);
+
 	/*
 	 * Only measure the CPUs specified by /proc/irq/prof_cpu_mask.
 	 * (default is all CPUs.)
@@ -156,8 +170,7 @@
 
 	while ((next_dec = tb_ticks_per_jiffy - tb_delta(&jiffy_stamp)) < 0) {
 		jiffy_stamp += tb_ticks_per_jiffy;
-		if (!user_mode(regs))
-			ppc_do_profile(instruction_pointer(regs));
+		ppc_do_profile(regs);
 	  	if (smp_processor_id())
 			continue;
 
diff -Nur kernel-source-2.6.6/arch/ppc/oprofile/Kconfig linuxppc-2.5-benh/arch/ppc/oprofile/Kconfig
--- kernel-source-2.6.6/arch/ppc/oprofile/Kconfig	1970-01-01 01:00:00.000000000 +0100
+++ linuxppc-2.5-benh/arch/ppc/oprofile/Kconfig	2003-12-31 03:50:43.000000000 +0100
@@ -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
+
diff -Nur kernel-source-2.6.6/arch/ppc/oprofile/Makefile linuxppc-2.5-benh/arch/ppc/oprofile/Makefile
--- kernel-source-2.6.6/arch/ppc/oprofile/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ linuxppc-2.5-benh/arch/ppc/oprofile/Makefile	2003-12-31 03:50:44.000000000 +0100
@@ -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
diff -Nur kernel-source-2.6.6/arch/ppc/oprofile/init.c linuxppc-2.5-benh/arch/ppc/oprofile/init.c
--- kernel-source-2.6.6/arch/ppc/oprofile/init.c	1970-01-01 01:00:00.000000000 +0100
+++ linuxppc-2.5-benh/arch/ppc/oprofile/init.c	2003-12-31 03:50:45.000000000 +0100
@@ -0,0 +1,25 @@
+/**
+ * @file init.c
+ *
+ * @remark Copyright 2002 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author John Levon <levon@movementarian.org>
+ */
+
+#include <linux/kernel.h>
+#include <linux/oprofile.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+
+extern void timer_init(struct oprofile_operations ** ops);
+
+int __init oprofile_arch_init(struct oprofile_operations ** ops)
+{
+	return -ENODEV;
+}
+
+
+void oprofile_arch_exit(void)
+{
+}


-- 
J'qbpbe, le m'en fquz pe j'qbpbe!
Le veux aimeb et mqubib panz je pézqbpbe je djuz tqtaj!

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

* Re: [patch, resend, 2.6, ppc32] enable OProfile profiling driver
  2004-07-01  8:22 [patch, resend, 2.6, ppc32] enable OProfile profiling driver Jens Schmalzing
@ 2004-07-01  8:48 ` Colin LEROY
  2004-07-01  9:19   ` Jens Schmalzing
  0 siblings, 1 reply; 3+ messages in thread
From: Colin LEROY @ 2004-07-01  8:48 UTC (permalink / raw)
  To: Jens Schmalzing, linux-kernel; +Cc: linuxppc-dev

Hi Jens,

> please find enclosed a patch to enable to OProfile profiling driver
> for ppc32, forward ported from Ben's development tree.  I sent an
> incomplete version some time ago, this time I didn't forget anything
> (hopefully).

Didn't I see this go into main tree a few days ago?
http://linux.bkbits.net:8080/linux-2.5/cset@40d927aaJblmtCelKR4_ifsBqvZ2kA

Or was it something else?

-- 
Colin

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

* Re: [patch, resend, 2.6, ppc32] enable OProfile profiling driver
  2004-07-01  8:48 ` Colin LEROY
@ 2004-07-01  9:19   ` Jens Schmalzing
  0 siblings, 0 replies; 3+ messages in thread
From: Jens Schmalzing @ 2004-07-01  9:19 UTC (permalink / raw)
  To: linux-kernel, linuxppc-dev

Hi,

Colin LEROY writes:

> > please find enclosed a patch to enable to OProfile profiling
> > driver for ppc32,

> Didn't I see this go into main tree a few days ago?

Indeed.  I only checked 2.6.7.

Regards, Jens.

-- 
J'qbpbe, le m'en fquz pe j'qbpbe!
Le veux aimeb et mqubib panz je pézqbpbe je djuz tqtaj!

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

end of thread, other threads:[~2004-07-01  9:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-01  8:22 [patch, resend, 2.6, ppc32] enable OProfile profiling driver Jens Schmalzing
2004-07-01  8:48 ` Colin LEROY
2004-07-01  9:19   ` Jens Schmalzing

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

all inboxes | Powered by JetHome®