Blame src/perfctr-2.6.x/patches/patch-kernel-2.6.28

Packit 577717
--- linux-2.6.28.perfctr26/CREDITS.~1~	2008-12-25 15:54:13.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/CREDITS	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -2739,6 +2739,7 @@ N: Mikael Pettersson
Packit 577717
 E: mikpe@it.uu.se
Packit 577717
 W: http://user.it.uu.se/~mikpe/linux/
Packit 577717
 D: Miscellaneous fixes
Packit 577717
+D: Performance-monitoring counters driver
Packit 577717
 
Packit 577717
 N: Reed H. Petty
Packit 577717
 E: rhp@draper.net
Packit 577717
--- linux-2.6.28.perfctr26/Documentation/ioctl/ioctl-number.txt.~1~	2008-12-25 15:54:13.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/Documentation/ioctl/ioctl-number.txt	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -193,6 +193,8 @@ Code	Seq#	Include File		Comments
Packit 577717
 0xB1	00-1F	PPPoX			<mailto:mostrows@styx.uwaterloo.ca>
Packit 577717
 0xCB	00-1F	CBM serial IEC bus	in development:
Packit 577717
 					<mailto:michael.klein@puffin.lb.shuttle.de>
Packit 577717
+0xD0	all	performance counters	see drivers/perfctr/
Packit 577717
+					<mailto:mikpe@it.uu.se>
Packit 577717
 0xDD	00-3F	ZFCP device driver	see drivers/s390/scsi/
Packit 577717
 					<mailto:aherrman@de.ibm.com>
Packit 577717
 0xF3	00-3F	video/sisfb.h		sisfb (in development)
Packit 577717
--- linux-2.6.28.perfctr26/MAINTAINERS.~1~	2008-12-25 15:54:13.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/MAINTAINERS	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -3355,6 +3355,12 @@ M:	balbir@linux.vnet.ibm.com
Packit 577717
 L:	linux-kernel@vger.kernel.org
Packit 577717
 S:	Maintained
Packit 577717
 
Packit 577717
+PERFORMANCE-MONITORING COUNTERS DRIVER
Packit 577717
+P:	Mikael Pettersson
Packit 577717
+M:	mikpe@it.uu.se
Packit 577717
+W:	http://user.it.uu.se/~mikpe/linux/perfctr/
Packit 577717
+S:	Maintained
Packit 577717
+
Packit 577717
 PERSONALITY HANDLING
Packit 577717
 P:	Christoph Hellwig
Packit 577717
 M:	hch@infradead.org
Packit 577717
--- linux-2.6.28.perfctr26/arch/arm/Kconfig.~1~	2008-12-25 15:54:13.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/arm/Kconfig	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -647,6 +647,10 @@ config IWMMXT
Packit 577717
 	  Enable support for iWMMXt context switching at run time if
Packit 577717
 	  running on a CPU that supports it.
Packit 577717
 
Packit 577717
+if CPU_XSCALE
Packit 577717
+source drivers/perfctr/Kconfig
Packit 577717
+endif
Packit 577717
+
Packit 577717
 #  bool 'Use XScale PMU as timer source' CONFIG_XSCALE_PMU_TIMER
Packit 577717
 config XSCALE_PMU
Packit 577717
 	bool
Packit 577717
--- linux-2.6.28.perfctr26/arch/arm/include/asm/processor.h.~1~	2008-12-25 15:54:13.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/arm/include/asm/processor.h	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -50,6 +50,10 @@ struct thread_struct {
Packit 577717
 	unsigned long		error_code;
Packit 577717
 							/* debugging	  */
Packit 577717
 	struct debug_info	debug;
Packit 577717
+
Packit 577717
+#ifdef CONFIG_PERFCTR_VIRTUAL
Packit 577717
+	struct vperfctr		*perfctr;		/* performance counters */
Packit 577717
+#endif
Packit 577717
 };
Packit 577717
 
Packit 577717
 #define INIT_THREAD  {	}
Packit 577717
--- linux-2.6.28.perfctr26/arch/arm/include/asm/system.h.~1~	2008-12-25 15:54:13.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/arm/include/asm/system.h	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -211,7 +211,9 @@ extern struct task_struct *__switch_to(s
Packit 577717
 
Packit 577717
 #define switch_to(prev,next,last)					\
Packit 577717
 do {									\
Packit 577717
+	perfctr_suspend_thread(&(prev)->thread);			\
Packit 577717
 	last = __switch_to(prev,task_thread_info(prev), task_thread_info(next));	\
Packit 577717
+	perfctr_resume_thread(&(current)->thread);			\
Packit 577717
 } while (0)
Packit 577717
 
Packit 577717
 #if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110)
Packit 577717
--- linux-2.6.28.perfctr26/arch/arm/kernel/process.c.~1~	2008-12-25 15:54:13.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/arm/kernel/process.c	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -26,6 +26,7 @@
Packit 577717
 #include <linux/cpu.h>
Packit 577717
 #include <linux/elfcore.h>
Packit 577717
 #include <linux/pm.h>
Packit 577717
+#include <linux/perfctr.h>
Packit 577717
 #include <linux/tick.h>
Packit 577717
 #include <linux/utsname.h>
Packit 577717
 #include <linux/uaccess.h>
Packit 577717
@@ -272,6 +273,7 @@ void show_regs(struct pt_regs * regs)
Packit 577717
  */
Packit 577717
 void exit_thread(void)
Packit 577717
 {
Packit 577717
+	perfctr_exit_thread(&current->thread);
Packit 577717
 }
Packit 577717
 
Packit 577717
 ATOMIC_NOTIFIER_HEAD(thread_notify_head);
Packit 577717
@@ -317,6 +319,8 @@ copy_thread(int nr, unsigned long clone_
Packit 577717
 	if (clone_flags & CLONE_SETTLS)
Packit 577717
 		thread->tp_value = regs->ARM_r3;
Packit 577717
 
Packit 577717
+	perfctr_copy_task(p, regs);
Packit 577717
+
Packit 577717
 	return 0;
Packit 577717
 }
Packit 577717
 
Packit 577717
--- linux-2.6.28.perfctr26/arch/powerpc/include/asm/processor.h.~1~	2008-10-11 10:43:49.000000000 +0200
Packit 577717
+++ linux-2.6.28.perfctr26/arch/powerpc/include/asm/processor.h	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -199,6 +199,9 @@ struct thread_struct {
Packit 577717
 	unsigned long	spefscr;	/* SPE & eFP status */
Packit 577717
 	int		used_spe;	/* set if process has used spe */
Packit 577717
 #endif /* CONFIG_SPE */
Packit 577717
+#ifdef CONFIG_PERFCTR_VIRTUAL
Packit 577717
+	struct vperfctr *perfctr;	/* performance counters */
Packit 577717
+#endif
Packit 577717
 };
Packit 577717
 
Packit 577717
 #define ARCH_MIN_TASKALIGN 16
Packit 577717
--- linux-2.6.28.perfctr26/arch/powerpc/kernel/process.c.~1~	2008-10-11 10:43:50.000000000 +0200
Packit 577717
+++ linux-2.6.28.perfctr26/arch/powerpc/kernel/process.c	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -30,6 +30,7 @@
Packit 577717
 #include <linux/init_task.h>
Packit 577717
 #include <linux/module.h>
Packit 577717
 #include <linux/kallsyms.h>
Packit 577717
+#include <linux/perfctr.h>
Packit 577717
 #include <linux/mqueue.h>
Packit 577717
 #include <linux/hardirq.h>
Packit 577717
 #include <linux/utsname.h>
Packit 577717
@@ -405,8 +406,10 @@ struct task_struct *__switch_to(struct t
Packit 577717
 	 * window where the kernel stack SLB and the kernel stack are out
Packit 577717
 	 * of sync. Hard disable here.
Packit 577717
 	 */
Packit 577717
+	perfctr_suspend_thread(&prev->thread);
Packit 577717
 	hard_irq_disable();
Packit 577717
 	last = _switch(old_thread, new_thread);
Packit 577717
+	perfctr_resume_thread(&current->thread);
Packit 577717
 
Packit 577717
 	local_irq_restore(flags);
Packit 577717
 
Packit 577717
@@ -544,6 +547,7 @@ void show_regs(struct pt_regs * regs)
Packit 577717
 void exit_thread(void)
Packit 577717
 {
Packit 577717
 	discard_lazy_cpu_state();
Packit 577717
+	perfctr_exit_thread(&current->thread);
Packit 577717
 }
Packit 577717
 
Packit 577717
 void flush_thread(void)
Packit 577717
@@ -670,6 +674,8 @@ int copy_thread(int nr, unsigned long cl
Packit 577717
 	kregs->nip = (unsigned long)ret_from_fork;
Packit 577717
 #endif
Packit 577717
 
Packit 577717
+	perfctr_copy_task(p, regs);
Packit 577717
+
Packit 577717
 	return 0;
Packit 577717
 }
Packit 577717
 
Packit 577717
--- linux-2.6.28.perfctr26/arch/powerpc/platforms/Kconfig.cputype.~1~	2008-12-25 15:54:14.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/powerpc/platforms/Kconfig.cputype	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -256,4 +256,8 @@ config NOT_COHERENT_CACHE
Packit 577717
 config CHECK_CACHE_COHERENCY
Packit 577717
 	bool
Packit 577717
 
Packit 577717
+if PPC32
Packit 577717
+source "drivers/perfctr/Kconfig"
Packit 577717
+endif
Packit 577717
+
Packit 577717
 endmenu
Packit 577717
--- linux-2.6.28.perfctr26/arch/x86/Kconfig.~1~	2008-12-25 15:54:14.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/x86/Kconfig	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -1293,6 +1293,8 @@ config CC_STACKPROTECTOR_ALL
Packit 577717
 	  functions that use large-ish on-stack buffers. By enabling
Packit 577717
 	  this option, GCC will be asked to do this for ALL functions.
Packit 577717
 
Packit 577717
+source "drivers/perfctr/Kconfig"
Packit 577717
+
Packit 577717
 source kernel/Kconfig.hz
Packit 577717
 
Packit 577717
 config KEXEC
Packit 577717
--- linux-2.6.28.perfctr26/arch/x86/include/asm/irq_vectors.h.~1~	2008-12-25 15:54:14.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/x86/include/asm/irq_vectors.h	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -85,9 +85,10 @@
Packit 577717
  * sources per level' errata.
Packit 577717
  */
Packit 577717
 #define LOCAL_TIMER_VECTOR	0xef
Packit 577717
+#define LOCAL_PERFCTR_VECTOR	0xee
Packit 577717
 
Packit 577717
 /*
Packit 577717
- * First APIC vector available to drivers: (vectors 0x30-0xee) we
Packit 577717
+ * First APIC vector available to drivers: (vectors 0x30-0xed) we
Packit 577717
  * start at 0x31(0x41) to spread out vectors evenly between priority
Packit 577717
  * levels. (0x80 is the syscall vector)
Packit 577717
  */
Packit 577717
--- linux-2.6.28.perfctr26/arch/x86/include/asm/processor.h.~1~	2008-12-25 15:54:14.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/x86/include/asm/processor.h	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -429,6 +429,8 @@ struct thread_struct {
Packit 577717
 	unsigned long		iopl;
Packit 577717
 	/* Max allowed port in the bitmap, in bytes: */
Packit 577717
 	unsigned		io_bitmap_max;
Packit 577717
+/* performance counters */
Packit 577717
+	struct vperfctr		*perfctr;
Packit 577717
 /* MSR_IA32_DEBUGCTLMSR value to switch in if TIF_DEBUGCTLMSR is set.  */
Packit 577717
 	unsigned long	debugctlmsr;
Packit 577717
 #ifdef CONFIG_X86_DS
Packit 577717
--- linux-2.6.28.perfctr26/arch/x86/include/asm/system.h.~1~	2008-12-25 15:54:14.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/x86/include/asm/system.h	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -37,6 +37,7 @@ do {									\
Packit 577717
 	 * __switch_to())						\
Packit 577717
 	 */								\
Packit 577717
 	unsigned long ebx, ecx, edx, esi, edi;				\
Packit 577717
+	perfctr_suspend_thread(&(prev)->thread);			\
Packit 577717
 									\
Packit 577717
 	asm volatile("pushfl\n\t"		/* save    flags */	\
Packit 577717
 		     "pushl %%ebp\n\t"		/* save    EBP   */	\
Packit 577717
@@ -87,7 +88,8 @@ do {									\
Packit 577717
 	  "r12", "r13", "r14", "r15"
Packit 577717
 
Packit 577717
 /* Save restore flags to clear handle leaking NT */
Packit 577717
-#define switch_to(prev, next, last) \
Packit 577717
+#define switch_to(prev, next, last) do { \
Packit 577717
+	perfctr_suspend_thread(&(prev)->thread); \
Packit 577717
 	asm volatile(SAVE_CONTEXT						    \
Packit 577717
 	     "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */	  \
Packit 577717
 	     "movq %P[threadrsp](%[next]),%%rsp\n\t" /* restore RSP */	  \
Packit 577717
@@ -107,7 +109,8 @@ do {									\
Packit 577717
 	       [tif_fork] "i" (TIF_FORK),			  	  \
Packit 577717
 	       [thread_info] "i" (offsetof(struct task_struct, stack)),   \
Packit 577717
 	       [pda_pcurrent] "i" (offsetof(struct x8664_pda, pcurrent))  \
Packit 577717
-	     : "memory", "cc" __EXTRA_CLOBBER)
Packit 577717
+	     : "memory", "cc" __EXTRA_CLOBBER); \
Packit 577717
+} while (0)
Packit 577717
 #endif
Packit 577717
 
Packit 577717
 #ifdef __KERNEL__
Packit 577717
--- linux-2.6.28.perfctr26/arch/x86/kernel/entry_32.S.~1~	2008-12-25 15:54:14.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/x86/kernel/entry_32.S	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -678,6 +678,23 @@ ENDPROC(name)
Packit 577717
 /* The include is where all of the SMP etc. interrupts come from */
Packit 577717
 #include "entry_arch.h"
Packit 577717
 
Packit 577717
+#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_KPERFCTR)
Packit 577717
+ENTRY(perfctr_interrupt)
Packit 577717
+	RING0_INT_FRAME
Packit 577717
+	pushl $~(LOCAL_PERFCTR_VECTOR)
Packit 577717
+	CFI_ADJUST_CFA_OFFSET 4
Packit 577717
+	SAVE_ALL
Packit 577717
+	TRACE_IRQS_OFF
Packit 577717
+	pushl %esp
Packit 577717
+	CFI_ADJUST_CFA_OFFSET 4
Packit 577717
+	call smp_perfctr_interrupt
Packit 577717
+	addl $4, %esp
Packit 577717
+	CFI_ADJUST_CFA_OFFSET -4
Packit 577717
+	jmp ret_from_intr
Packit 577717
+	CFI_ENDPROC
Packit 577717
+ENDPROC(perfctr_interrupt)
Packit 577717
+#endif
Packit 577717
+
Packit 577717
 KPROBE_ENTRY(page_fault)
Packit 577717
 	RING0_EC_FRAME
Packit 577717
 	pushl $do_page_fault
Packit 577717
--- linux-2.6.28.perfctr26/arch/x86/kernel/entry_64.S.~1~	2008-12-25 15:54:14.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/x86/kernel/entry_64.S	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -870,6 +870,12 @@ ENTRY(spurious_interrupt)
Packit 577717
 	apicinterrupt SPURIOUS_APIC_VECTOR,smp_spurious_interrupt
Packit 577717
 END(spurious_interrupt)
Packit 577717
 				
Packit 577717
+#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_KPERFCTR)
Packit 577717
+ENTRY(perfctr_interrupt)
Packit 577717
+	apicinterrupt LOCAL_PERFCTR_VECTOR,smp_perfctr_interrupt
Packit 577717
+END(perfctr_interrupt)
Packit 577717
+#endif
Packit 577717
+
Packit 577717
 /*
Packit 577717
  * Exception entry points.
Packit 577717
  */ 		
Packit 577717
--- linux-2.6.28.perfctr26/arch/x86/kernel/irqinit_32.c.~1~	2008-12-25 15:54:14.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/x86/kernel/irqinit_32.c	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -20,6 +20,7 @@
Packit 577717
 #include <asm/apic.h>
Packit 577717
 #include <asm/arch_hooks.h>
Packit 577717
 #include <asm/i8259.h>
Packit 577717
+#include <asm/perfctr.h>
Packit 577717
 
Packit 577717
 
Packit 577717
 
Packit 577717
@@ -175,6 +176,8 @@ void __init native_init_IRQ(void)
Packit 577717
 	 */
Packit 577717
 	intr_init_hook();
Packit 577717
 
Packit 577717
+	perfctr_vector_init();
Packit 577717
+
Packit 577717
 	/*
Packit 577717
 	 * External FPU? Set up irq13 if so, for
Packit 577717
 	 * original braindamaged IBM FERR coupling.
Packit 577717
--- linux-2.6.28.perfctr26/arch/x86/kernel/irqinit_64.c.~1~	2008-12-25 15:54:14.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/x86/kernel/irqinit_64.c	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -21,6 +21,7 @@
Packit 577717
 #include <asm/delay.h>
Packit 577717
 #include <asm/desc.h>
Packit 577717
 #include <asm/apic.h>
Packit 577717
+#include <asm/perfctr.h>
Packit 577717
 #include <asm/i8259.h>
Packit 577717
 
Packit 577717
 /*
Packit 577717
@@ -224,6 +225,8 @@ void __init native_init_IRQ(void)
Packit 577717
 
Packit 577717
 	apic_intr_init();
Packit 577717
 
Packit 577717
+	perfctr_vector_init();
Packit 577717
+
Packit 577717
 	if (!acpi_ioapic)
Packit 577717
 		setup_irq(2, &irq2);
Packit 577717
 }
Packit 577717
--- linux-2.6.28.perfctr26/arch/x86/kernel/process_32.c.~1~	2008-12-25 15:54:14.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/x86/kernel/process_32.c	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -28,6 +28,7 @@
Packit 577717
 #include <linux/delay.h>
Packit 577717
 #include <linux/reboot.h>
Packit 577717
 #include <linux/init.h>
Packit 577717
+#include <linux/perfctr.h>
Packit 577717
 #include <linux/mc146818rtc.h>
Packit 577717
 #include <linux/module.h>
Packit 577717
 #include <linux/kallsyms.h>
Packit 577717
@@ -250,6 +251,7 @@ void exit_thread(void)
Packit 577717
 		tss->x86_tss.io_bitmap_base = INVALID_IO_BITMAP_OFFSET;
Packit 577717
 		put_cpu();
Packit 577717
 	}
Packit 577717
+	perfctr_exit_thread(&current->thread);
Packit 577717
 #ifdef CONFIG_X86_DS
Packit 577717
 	/* Free any DS contexts that have not been properly released. */
Packit 577717
 	if (unlikely(current->thread.ds_ctx)) {
Packit 577717
@@ -315,6 +317,8 @@ int copy_thread(int nr, unsigned long cl
Packit 577717
 
Packit 577717
 	savesegment(gs, p->thread.gs);
Packit 577717
 
Packit 577717
+	perfctr_copy_task(p, regs);
Packit 577717
+
Packit 577717
 	tsk = current;
Packit 577717
 	if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) {
Packit 577717
 		p->thread.io_bitmap_ptr = kmemdup(tsk->thread.io_bitmap_ptr,
Packit 577717
@@ -629,6 +633,8 @@ struct task_struct * __switch_to(struct 
Packit 577717
 
Packit 577717
 	x86_write_percpu(current_task, next_p);
Packit 577717
 
Packit 577717
+	perfctr_resume_thread(next);
Packit 577717
+
Packit 577717
 	return prev_p;
Packit 577717
 }
Packit 577717
 
Packit 577717
--- linux-2.6.28.perfctr26/arch/x86/kernel/process_64.c.~1~	2008-12-25 15:54:14.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/arch/x86/kernel/process_64.c	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -31,6 +31,7 @@
Packit 577717
 #include <linux/delay.h>
Packit 577717
 #include <linux/module.h>
Packit 577717
 #include <linux/ptrace.h>
Packit 577717
+#include <linux/perfctr.h>
Packit 577717
 #include <linux/random.h>
Packit 577717
 #include <linux/notifier.h>
Packit 577717
 #include <linux/kprobes.h>
Packit 577717
@@ -235,6 +236,7 @@ void exit_thread(void)
Packit 577717
 		t->io_bitmap_max = 0;
Packit 577717
 		put_cpu();
Packit 577717
 	}
Packit 577717
+	perfctr_exit_thread(t);
Packit 577717
 #ifdef CONFIG_X86_DS
Packit 577717
 	/* Free any DS contexts that have not been properly released. */
Packit 577717
 	if (unlikely(t->ds_ctx)) {
Packit 577717
@@ -347,6 +349,8 @@ int copy_thread(int nr, unsigned long cl
Packit 577717
 	savesegment(es, p->thread.es);
Packit 577717
 	savesegment(ds, p->thread.ds);
Packit 577717
 
Packit 577717
+	perfctr_copy_task(p, regs);
Packit 577717
+
Packit 577717
 	if (unlikely(test_tsk_thread_flag(me, TIF_IO_BITMAP))) {
Packit 577717
 		p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
Packit 577717
 		if (!p->thread.io_bitmap_ptr) {
Packit 577717
@@ -671,6 +675,9 @@ __switch_to(struct task_struct *prev_p, 
Packit 577717
 	 */
Packit 577717
 	if (tsk_used_math(next_p) && next_p->fpu_counter > 5)
Packit 577717
 		math_state_restore();
Packit 577717
+
Packit 577717
+	perfctr_resume_thread(next);
Packit 577717
+
Packit 577717
 	return prev_p;
Packit 577717
 }
Packit 577717
 
Packit 577717
--- linux-2.6.28.perfctr26/drivers/Makefile.~1~	2008-12-25 15:54:14.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/drivers/Makefile	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -89,6 +89,7 @@ obj-$(CONFIG_MEMSTICK)		+= memstick/
Packit 577717
 obj-$(CONFIG_NEW_LEDS)		+= leds/
Packit 577717
 obj-$(CONFIG_INFINIBAND)	+= infiniband/
Packit 577717
 obj-$(CONFIG_SGI_SN)		+= sn/
Packit 577717
+obj-$(CONFIG_KPERFCTR)		+= perfctr/
Packit 577717
 obj-y				+= firmware/
Packit 577717
 obj-$(CONFIG_CRYPTO)		+= crypto/
Packit 577717
 obj-$(CONFIG_SUPERH)		+= sh/
Packit 577717
--- linux-2.6.28.perfctr26/fs/exec.c.~1~	2008-12-25 15:54:16.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/fs/exec.c	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -49,6 +49,7 @@
Packit 577717
 #include <linux/tsacct_kern.h>
Packit 577717
 #include <linux/cn_proc.h>
Packit 577717
 #include <linux/audit.h>
Packit 577717
+#include <linux/perfctr.h>
Packit 577717
 #include <linux/tracehook.h>
Packit 577717
 #include <linux/kmod.h>
Packit 577717
 
Packit 577717
@@ -999,6 +1000,7 @@ int flush_old_exec(struct linux_binprm *
Packit 577717
 	set_task_comm(current, tcomm);
Packit 577717
 
Packit 577717
 	current->flags &= ~PF_RANDOMIZE;
Packit 577717
+	perfctr_flush_thread(&current->thread);
Packit 577717
 	flush_thread();
Packit 577717
 
Packit 577717
 	/* Set the new mm task size. We have to do that late because it may
Packit 577717
--- linux-2.6.28.perfctr26/kernel/exit.c.~1~	2008-12-25 15:54:17.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/kernel/exit.c	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -30,6 +30,7 @@
Packit 577717
 #include <linux/proc_fs.h>
Packit 577717
 #include <linux/kthread.h>
Packit 577717
 #include <linux/mempolicy.h>
Packit 577717
+#include <linux/perfctr.h>
Packit 577717
 #include <linux/taskstats_kern.h>
Packit 577717
 #include <linux/delayacct.h>
Packit 577717
 #include <linux/freezer.h>
Packit 577717
@@ -198,6 +199,7 @@ repeat:
Packit 577717
 			leader->exit_state = EXIT_DEAD;
Packit 577717
 	}
Packit 577717
 
Packit 577717
+	perfctr_release_task(p);
Packit 577717
 	write_unlock_irq(&tasklist_lock);
Packit 577717
 	release_thread(p);
Packit 577717
 	call_rcu(&p->rcu, delayed_put_task_struct);
Packit 577717
--- linux-2.6.28.perfctr26/kernel/sched.c.~1~	2008-12-25 15:54:17.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/kernel/sched.c	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -54,6 +54,7 @@
Packit 577717
 #include <linux/cpu.h>
Packit 577717
 #include <linux/cpuset.h>
Packit 577717
 #include <linux/percpu.h>
Packit 577717
+#include <linux/perfctr.h>
Packit 577717
 #include <linux/kthread.h>
Packit 577717
 #include <linux/proc_fs.h>
Packit 577717
 #include <linux/seq_file.h>
Packit 577717
@@ -5967,6 +5968,8 @@ int set_cpus_allowed_ptr(struct task_str
Packit 577717
 	struct rq *rq;
Packit 577717
 	int ret = 0;
Packit 577717
 
Packit 577717
+	perfctr_set_cpus_allowed(p, *new_mask); /* XXX: convert to _ptr */
Packit 577717
+
Packit 577717
 	rq = task_rq_lock(p, &flags);
Packit 577717
 	if (!cpus_intersects(*new_mask, cpu_online_map)) {
Packit 577717
 		ret = -EINVAL;
Packit 577717
--- linux-2.6.28.perfctr26/kernel/timer.c.~1~	2008-12-25 15:54:17.000000000 +0100
Packit 577717
+++ linux-2.6.28.perfctr26/kernel/timer.c	2008-12-25 16:06:06.000000000 +0100
Packit 577717
@@ -33,6 +33,7 @@
Packit 577717
 #include <linux/jiffies.h>
Packit 577717
 #include <linux/posix-timers.h>
Packit 577717
 #include <linux/cpu.h>
Packit 577717
+#include <linux/perfctr.h>
Packit 577717
 #include <linux/syscalls.h>
Packit 577717
 #include <linux/delay.h>
Packit 577717
 #include <linux/tick.h>
Packit 577717
@@ -1044,6 +1045,7 @@ void update_process_times(int user_tick)
Packit 577717
 
Packit 577717
 	/* Note: this timer irq context must be accounted for as well. */
Packit 577717
 	account_process_tick(p, user_tick);
Packit 577717
+	perfctr_sample_thread(&p->thread);
Packit 577717
 	run_local_timers();
Packit 577717
 	if (rcu_pending(cpu))
Packit 577717
 		rcu_check_callbacks(cpu, user_tick);