Skip to contentSkip to conversation

xenoprofile x86_64

PATCH New Andrew Theurer 1 participant 1 message Aug 22, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xenoprofile x86_64

Attached are patches for xenoprofile on x86_64. These are not "production ready", but they do work on EM64T so far. I have not added support for Opteron just yet (but will very soon). I wanted to get these out ASAP in case anyone wanted to try them. There are not too many changes from Renato's patches, mainly use of KERNEL_MODE instead of RING_1, u64's here and there, and new x86_64 specific files. I have not tested these patches on i386 (some changes needed). These should apply on changeset 6315.

-Andrew

xen/arch/x86/Makefile renamed from xen-unstable.hg-6251/xen/arch/x86/Makefile +7 -0
diff -Naurp ../xen-unstable.hg-6251/xen/arch/x86/Makefile ./xen/arch/x86/Makefile
@@ -33,7 +33,10 @@ ifneq ($(crash_debug),y)
 OBJS := $(patsubst cdb%.o,,$(OBJS))
 endif
 
+OBJS += oprofile/oprofile.o
+
 default: $(TARGET)
+	make -C oprofile
 
 $(TARGET): $(TARGET)-syms boot/mkelf32
 	./boot/mkelf32 $(TARGET)-syms $(TARGET) 0x100000
@@ -60,6 +63,9 @@ asm-offsets.s: $(TARGET_SUBARCH)/asm-off
 boot/mkelf32: boot/mkelf32.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
 
+oprofile/oprofile.o:
+	$(MAKE) -C oprofile
+
 clean:
 	rm -f *.o *.s *~ core boot/*.o boot/*~ boot/core boot/mkelf32
 	rm -f x86_32/*.o x86_32/*~ x86_32/core
@@ -68,5 +74,6 @@ clean:
 	rm -f acpi/*.o acpi/*~ acpi/core
 	rm -f genapic/*.o genapic/*~ genapic/core
 	rm -f cpu/*.o cpu/*~ cpu/core
+	rm -f oprofile/*.o
 
 .PHONY: default clean
xen/arch/x86/nmi.c renamed from xen-unstable.hg-6251/xen/arch/x86/nmi.c +97 -2

132 lines not on this page · raw message

xen/arch/x86/oprofile/Makefile renamed from xen-unstable.hg-6251/xen/arch/x86/oprofile/Makefile +9 -0
diff -Naurp ../xen-unstable.hg-6251/xen/arch/x86/oprofile/Makefile ./xen/arch/x86/oprofile/Makefile
@@ -0,0 +1,9 @@
+
+include $(BASEDIR)/Rules.mk
+                                     
+default: $(OBJS) 
+	$(LD) $(LDFLAGS) -r -o oprofile.o $(OBJS)
+
+%.o: %.c $(HDRS) Makefile
+	$(CC) $(CFLAGS) -c $< -o $@
+
xen/arch/x86/oprofile/nmi_int.c renamed from xen-unstable.hg-6251/xen/arch/x86/oprofile/nmi_int.c +444 -0

444 lines not on this page · raw message

xen/arch/x86/oprofile/op_counter.h renamed from xen-unstable.hg-6251/xen/arch/x86/oprofile/op_counter.h +33 -0
diff -Naurp ../xen-unstable.hg-6251/xen/arch/x86/oprofile/op_counter.h ./xen/arch/x86/oprofile/op_counter.h
@@ -0,0 +1,33 @@
+/**
+ * @file op_counter.h
+ *
+ * @remark Copyright 2002 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author John Levon
+ *
+ * Modified by Aravind Menon for Xen
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
+ */
+ 
+#ifndef OP_COUNTER_H
+#define OP_COUNTER_H
+ 
+#define OP_MAX_COUNTER 8
+ 
+/* Per-perfctr configuration as set via
+ * oprofilefs.
+ */
+struct op_counter_config {
+        unsigned long count;
+        unsigned long enabled;
+        unsigned long event;
+        unsigned long kernel;
+        unsigned long user;
+        unsigned long unit_mask;
+};
+
+extern struct op_counter_config counter_config[];
+
+#endif /* OP_COUNTER_H */
xen/arch/x86/oprofile/op_model_p4.c renamed from xen-unstable.hg-6251/xen/arch/x86/oprofile/op_model_p4.c +748 -0

748 lines not on this page · raw message

xen/arch/x86/oprofile/op_model_ppro.c renamed from xen-unstable.hg-6251/xen/arch/x86/oprofile/op_model_ppro.c +168 -0

168 lines not on this page · raw message

xen/arch/x86/oprofile/op_x86_model.h renamed from xen-unstable.hg-6251/xen/arch/x86/oprofile/op_x86_model.h +16 -0
diff -Naurp ../xen-unstable.hg-6251/xen/arch/x86/oprofile/op_x86_model.h ./xen/arch/x86/oprofile/op_x86_model.h
@@ -0,0 +1,55 @@
+/**
+ * @file op_x86_model.h
+ * interface to x86 model-specific MSR operations
+ *
+ * @remark Copyright 2002 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author Graydon Hoare
+ *
+ * Modified by Aravind Menon for Xen
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
+ */
+
+#ifndef OP_X86_MODEL_H
+#define OP_X86_MODEL_H

+
+struct op_saved_msr {
+ unsigned int high;
+ unsigned int low;
+};
+
+struct op_msr {
+ unsigned long addr;
+ struct op_saved_msr saved;
+};
+
+struct op_msrs {
+ struct op_msr * counters;
+ struct op_msr * controls;
+};
+
+struct pt_regs;
+
+/* The model vtable abstracts the differences between
+ * various x86 CPU model's perfctr support.
+ */
+struct op_x86_model_spec {
+ unsigned int const num_counters;
+ unsigned int const num_controls;
+ void (*fill_in_addresses)(struct op_msrs * const msrs);
+ void (*setup_ctrs)(struct op_msrs const * const msrs);
+ int (*check_ctrs)(unsigned int const cpu,
+ struct op_msrs const * const msrs,
+ struct cpu_user_regs * const regs);
+ void (*start)(struct op_msrs const * const msrs);
+ void (*stop)(struct op_msrs const * const msrs);
+};
+
+extern struct op_x86_model_spec const op_ppro_spec; +extern struct op_x86_model_spec const op_p4_spec; +extern struct op_x86_model_spec const op_p4_ht2_spec; +extern struct op_x86_model_spec const op_athlon_spec; +
+#endif /* OP_X86_MODEL_H */

xen/arch/x86/oprofile/pmc.c renamed from xen-unstable.hg-6251/xen/arch/x86/oprofile/pmc.c +308 -0

308 lines not on this page · raw message

xen/arch/x86/traps.c renamed from xen-unstable.hg-6251/xen/arch/x86/traps.c +35 -1
diff -Naurp ../xen-unstable.hg-6251/xen/arch/x86/traps.c ./xen/arch/x86/traps.c
@@ -2,6 +2,10 @@
  * arch/x86/traps.c
  * 
  * Modifications to Linux original are copyright (c) 2002-2004, K A Fraser
+ *
+ * Modified by Aravind Menon for supporting oprofile
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
  * 
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -54,6 +58,7 @@
 #include <asm/debugger.h>
 #include <asm/msr.h>
 #include <asm/x86_emulate.h>
+#include <asm/nmi.h>
 
 /*
  * opt_nmi: one of 'ignore', 'dom0', or 'fatal'.
@@ -1040,7 +1045,7 @@ static void unknown_nmi_error(unsigned c
     printk("Do you have a strange power saving mode enabled?\n");
 }
 
-asmlinkage void do_nmi(struct cpu_user_regs *regs, unsigned long reason)
+static void default_do_nmi(struct cpu_user_regs * regs, unsigned long reason)
 {
     ++nmi_count(smp_processor_id());
 
@@ -1055,6 +1060,35 @@ asmlinkage void do_nmi(struct cpu_user_r
         unknown_nmi_error((unsigned char)(reason&0xff));
 }
 
+static int dummy_nmi_callback(struct cpu_user_regs * regs, int cpu)
+{
+        return 0;
+}
+
+static nmi_callback_t nmi_callback = dummy_nmi_callback;
+
+asmlinkage void do_nmi(struct cpu_user_regs * regs, unsigned long reason)
+{
+	int cpu;
+    cpu = smp_processor_id();
+
+    if (!nmi_callback(regs, cpu)) 
+        default_do_nmi(regs, reason);
+}
+
+void set_nmi_callback(nmi_callback_t callback)
+{
+    nmi_callback = callback;
+}
+ 
+void unset_nmi_callback(void)
+{
+    nmi_callback = dummy_nmi_callback;
+}
+ 
+EXPORT_SYMBOL(set_nmi_callback);
+EXPORT_SYMBOL(unset_nmi_callback);
+ 
 asmlinkage int math_state_restore(struct cpu_user_regs *regs)
 {
     /* Prevent recursion. */
xen/arch/x86/x86_32/entry.S renamed from xen-unstable.hg-6251/xen/arch/x86/x86_32/entry.S +2 -1
diff -Naurp ../xen-unstable.hg-6251/xen/arch/x86/x86_32/entry.S ./xen/arch/x86/x86_32/entry.S
@@ -763,7 +763,8 @@ ENTRY(hypercall_table)
         .long do_boot_vcpu
         .long do_ni_hypercall       /* 25 */
         .long do_mmuext_op
-        .long do_acm_op             /* 27 */
+        .long do_acm_op
+	.long do_pmc_op             /* 28 */
         .rept NR_hypercalls-((.-hypercall_table)/4)
         .long do_ni_hypercall
         .endr
xen/arch/x86/x86_64/entry.S renamed from xen-unstable.hg-6251/xen/arch/x86/x86_64/entry.S +1 -0
diff -Naurp ../xen-unstable.hg-6251/xen/arch/x86/x86_64/entry.S ./xen/arch/x86/x86_64/entry.S
@@ -593,6 +593,7 @@ ENTRY(hypercall_table)
         .quad do_set_segment_base   /* 25 */
         .quad do_mmuext_op
         .quad do_acm_op
+	.quad do_pmc_op
         .rept NR_hypercalls-((.-hypercall_table)/4)
         .quad do_ni_hypercall
         .endr
xen/include/asm-x86/msr.h renamed from xen-unstable.hg-6251/xen/include/asm-x86/msr.h +83 -0

89 lines not on this page · raw message

xen/include/asm-x86/nmi.h renamed from xen-unstable.hg-6251/xen/include/asm-x86/nmi.h +26 -0
diff -Naurp ../xen-unstable.hg-6251/xen/include/asm-x86/nmi.h ./xen/include/asm-x86/nmi.h
@@ -0,0 +1,26 @@
+/*
+ *  linux/include/asm-i386/nmi.h
+ */
+#ifndef ASM_NMI_H
+#define ASM_NMI_H
+
+struct cpu_user_regs;
+ 
+typedef int (*nmi_callback_t)(struct cpu_user_regs * regs, int cpu);
+ 
+/** 
+ * set_nmi_callback
+ *
+ * Set a handler for an NMI. Only one handler may be
+ * set. Return 1 if the NMI was handled.
+ */
+void set_nmi_callback(nmi_callback_t callback);
+ 
+/** 
+ * unset_nmi_callback
+ *
+ * Remove the handler previously set.
+ */
+void unset_nmi_callback(void);
+ 
+#endif /* ASM_NMI_H */
xen/include/public/xen.h renamed from xen-unstable.hg-6251/xen/include/public/xen.h +39 -1
diff -Naurp ../xen-unstable.hg-6251/xen/include/public/xen.h ./xen/include/public/xen.h
@@ -4,6 +4,10 @@
  * Guest OS interface to Xen.
  * 
  * Copyright (c) 2004, K A Fraser
+ *
+ * Modified by Aravind Menon for supporting oprofile
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
  */
 
 #ifndef __XEN_PUBLIC_XEN_H__
@@ -59,6 +63,7 @@
 #define __HYPERVISOR_set_segment_base     25 /* x86/64 only */
 #define __HYPERVISOR_mmuext_op            26
 #define __HYPERVISOR_acm_op               27
+#define __HYPERVISOR_pmc_op               28
 
 /* 
  * VIRTUAL INTERRUPTS
@@ -72,7 +77,8 @@
 #define VIRQ_PARITY_ERR 4  /* (DOM0) NMI parity error.                    */
 #define VIRQ_IO_ERR     5  /* (DOM0) NMI I/O error.                       */
 #define VIRQ_DEBUGGER   6  /* (DOM0) A domain has paused for debugging.   */
-#define NR_VIRQS        7
+#define VIRQ_PMC_OVF	7  /* PMC Overflow */
+#define NR_VIRQS        8
 
 /*
  * MMU-UPDATE REQUESTS
@@ -239,6 +245,21 @@ struct mmuext_op {
 #define VMASST_TYPE_writable_pagetables  2
 #define MAX_VMASST_TYPE 2
 
+/*
+ * Commands to HYPERVISOR_pmc_op().
+ */
+#define PMC_INIT		0
+#define PMC_SET_ACTIVE		1
+#define PMC_SET_PASSIVE		2
+#define PMC_RESERVE_COUNTERS	3
+#define PMC_SETUP_EVENTS	4
+#define PMC_ENABLE_VIRQ		5
+#define PMC_START		6
+#define PMC_STOP		7
+#define PMC_DISABLE_VIRQ	8
+#define PMC_RELEASE_COUNTERS	9
+#define PMC_SHUTDOWN		10
+
 #ifndef __ASSEMBLY__
 
 typedef u16 domid_t;
@@ -291,6 +312,8 @@ typedef struct
 /* Event channel endpoints per domain. */
 #define NR_EVENT_CHANNELS 1024
 
+#define MAX_OPROF_EVENTS	32
+#define MAX_OPROF_DOMAINS	25	
 /*
  * Per-VCPU information goes here. This will be cleaned up more when Xen 
  * actually supports multi-VCPU guests.
@@ -406,6 +429,21 @@ typedef struct shared_info {
     u32 wc_nsec;         /* Nsecs 00:00:00 UTC, Jan 1, 1970.  */
 
     arch_shared_info_t arch;
+
+    /* Oprofile structures */
+    u8 event_head;
+    u8 event_tail;
+    struct {
+	u64 eip;
+	u8 mode;
+	u8 event;
+    } event_log[MAX_OPROF_EVENTS];
+    u8 losing_samples;
+    u64 samples_lost;
+    u32 nmi_restarts;
+    u64 active_samples;
+    u64 passive_samples;
+    u64 other_samples;
 
 } shared_info_t;
 
linux-2.6.12-xen0/arch/xen/Kconfig +2 -0
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/arch/xen/Kconfig xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/arch/xen/Kconfig
@@ -200,4 +200,6 @@ source "crypto/Kconfig"
 
 source "lib/Kconfig"
 
+source "arch/xen/oprofile/Kconfig"
+
 source "arch/xen/Kconfig.debug"
linux-2.6.12-xen0/arch/xen/Makefile +2 -0
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/arch/xen/Makefile xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/arch/xen/Makefile
@@ -32,6 +32,8 @@ ifneq ($(KBUILD_SRC),)
 	$(Q)ln -fsn ../include/asm-$(XENARCH) include2/asm
 endif
 
+drivers-$(CONFIG_OPROFILE)    += arch/xen/oprofile/
+
 include/.asm-ignore: include/asm
 	@rm -f include/.asm-ignore
 	@mv include/asm include/.asm-ignore
linux-2.6.12-xen0/arch/xen/configs/xen0_defconfig_x86_32 +6 -0
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/arch/xen/configs/xen0_defconfig_x86_32 xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/arch/xen/configs/xen0_defconfig_x86_32
@@ -79,6 +79,12 @@ CONFIG_OBSOLETE_MODPARM=y
 CONFIG_KMOD=y
 
 #
+# OProfile options
+#
+CONFIG_PROFILING=y
+CONFIG_OPROFILE=m
+
+#
 # X86 Processor Configuration
 #
 CONFIG_XENARCH="i386"
linux-2.6.12-xen0/arch/xen/configs/xenU_defconfig_x86_32 +6 -0
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/arch/xen/configs/xenU_defconfig_x86_32 xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/arch/xen/configs/xenU_defconfig_x86_32
@@ -76,6 +76,12 @@ CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
 #
+# OProfile options
+#
+CONFIG_PROFILING=y
+CONFIG_OPROFILE=m
+
+#
 # X86 Processor Configuration
 #
 CONFIG_XENARCH="i386"
linux-2.6.12-xen0/arch/xen/i386/Makefile +0 -1
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/arch/xen/i386/Makefile xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/arch/xen/i386/Makefile
@@ -84,7 +84,6 @@ core-y					+= arch/xen/i386/kernel/ \
 drivers-$(CONFIG_MATH_EMULATION)	+= arch/i386/math-emu/
 drivers-$(CONFIG_PCI)			+= arch/xen/i386/pci/
 # must be linked after kernel/
-drivers-$(CONFIG_OPROFILE)		+= arch/i386/oprofile/
 drivers-$(CONFIG_PM)			+= arch/i386/power/
 
 # for clean
linux-2.6.12-xen0/arch/xen/kernel/evtchn.c +14 -0
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/arch/xen/kernel/evtchn.c xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/arch/xen/kernel/evtchn.c
@@ -44,11 +44,16 @@
 #include <asm-xen/hypervisor.h>
 #include <asm-xen/evtchn.h>
 
+int virq_to_phys(int virq);
+
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 EXPORT_SYMBOL(force_evtchn_callback);
 EXPORT_SYMBOL(evtchn_do_upcall);
 EXPORT_SYMBOL(bind_evtchn_to_irq);
 EXPORT_SYMBOL(unbind_evtchn_from_irq);
+EXPORT_SYMBOL(virq_to_phys);
+EXPORT_SYMBOL(bind_virq_to_irq);
+EXPORT_SYMBOL(unbind_virq_from_irq);
 #endif
 
 /*
@@ -178,6 +183,15 @@ static int find_unbound_irq(void)
         panic("No available IRQ to bind to: increase NR_IRQS!\n");
 
     return irq;
+}
+
+int virq_to_phys(int virq)
+{
+        int cpu = smp_processor_id();
+
+	if (virq >= NR_VIRQS)
+		return -1;
+	return per_cpu(virq_to_irq,cpu)[virq];
 }
 
 int bind_virq_to_irq(int virq)
linux-2.6.12-xen0/arch/xen/oprofile/Kconfig +23 -0
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/arch/xen/oprofile/Kconfig xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/arch/xen/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
+
linux-2.6.12-xen0/arch/xen/oprofile/Makefile +9 -0
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/arch/xen/oprofile/Makefile xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/arch/xen/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) pmc.o
linux-2.6.12-xen0/arch/xen/oprofile/op_counter.h +29 -0
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/arch/xen/oprofile/op_counter.h xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/arch/xen/oprofile/op_counter.h
@@ -0,0 +1,29 @@
+/**
+ * @file op_counter.h
+ *
+ * @remark Copyright 2002 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author John Levon
+ */
+ 
+#ifndef OP_COUNTER_H
+#define OP_COUNTER_H
+
+#define OP_MAX_COUNTER 8
+ 
+/* Per-perfctr configuration as set via
+ * oprofilefs.
+ */
+struct op_counter_config {
+        unsigned long count;
+        unsigned long enabled;
+        unsigned long event;
+        unsigned long kernel;
+        unsigned long user;
+        unsigned long unit_mask;
+};
+
+extern struct op_counter_config counter_config[];
+
+#endif /* OP_COUNTER_H */
linux-2.6.12-xen0/arch/xen/oprofile/pmc.c +323 -0

323 lines not on this page · raw message

linux-2.6.12-xen0/arch/xen/x86_64/Makefile +0 -1
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/arch/xen/x86_64/Makefile xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/arch/xen/x86_64/Makefile
@@ -69,7 +69,6 @@ libs-y 					+= arch/x86_64/lib/
 core-y					+= arch/xen/x86_64/kernel/ arch/xen/x86_64/mm/
 core-$(CONFIG_IA32_EMULATION)		+= arch/xen/x86_64/ia32/
 drivers-$(CONFIG_PCI)			+= arch/xen/x86_64/pci/
-drivers-$(CONFIG_OPROFILE)		+= arch/x86_64/oprofile/
 
 # for clean
 obj-	+= kernel/ mm/ pci/
linux-2.6.12-xen0/drivers/oprofile/buffer_sync.c +55 -17

123 lines not on this page · raw message

linux-2.6.12-xen0/drivers/oprofile/cpu_buffer.c +43 -16

100 lines not on this page · raw message

linux-2.6.12-xen0/drivers/oprofile/cpu_buffer.h +10 -3
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/drivers/oprofile/cpu_buffer.h xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/drivers/oprofile/cpu_buffer.h
@@ -36,7 +36,7 @@ struct oprofile_cpu_buffer {
 	volatile unsigned long tail_pos;
 	unsigned long buffer_size;
 	struct task_struct * last_task;
-	int last_is_kernel;
+	int last_cpu_mode;
 	int tracing;
 	struct op_sample * buffer;
 	unsigned long sample_received;
@@ -51,7 +51,14 @@ extern struct oprofile_cpu_buffer cpu_bu
 void cpu_buffer_reset(struct oprofile_cpu_buffer * cpu_buf);
 
 /* transient events for the CPU buffer -> event buffer */
-#define CPU_IS_KERNEL 1
-#define CPU_TRACE_BEGIN 2
+#define CPU_MODE_USER    0
+#define CPU_MODE_KERNEL  1
+#define CPU_MODE_XEN     2
+#define CPU_MODE_MAX     2
+#define CPU_TRACE_BEGIN  3
 
+/* special escape code for indicating next sample in the CPU */
+/* buffer is from another Xen domain */
+#define DOMAIN_SWITCH_ESCAPE_CODE ~1UL
+ 
 #endif /* OPROFILE_CPU_BUFFER_H */
linux-2.6.12-xen0/drivers/oprofile/event_buffer.c +1 -0
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/drivers/oprofile/event_buffer.c xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/drivers/oprofile/event_buffer.c
@@ -56,6 +56,7 @@ void add_event_entry(unsigned long value
 /* Wake up the waiting process if any. This happens
  * on "echo 0 >/dev/oprofile/enable" so the daemon
  * processes the data remaining in the event buffer.
+ * also called on echo 1 > /dev/oprofile/dump
  */
 void wake_up_buffer_waiter(void)
 {
linux-2.6.12-xen0/drivers/oprofile/event_buffer.h +7 -1
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/drivers/oprofile/event_buffer.h xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/drivers/oprofile/event_buffer.h
@@ -5,6 +5,10 @@
  * @remark Read the file COPYING
  *
  * @author John Levon <[email protected]>
+ *
+ * Modified by Aravind Menon for Xen
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
  */
 
 #ifndef EVENT_BUFFER_H
@@ -29,11 +33,13 @@ void wake_up_buffer_waiter(void);
 #define CPU_SWITCH_CODE 		2
 #define COOKIE_SWITCH_CODE 		3
 #define KERNEL_ENTER_SWITCH_CODE	4
-#define KERNEL_EXIT_SWITCH_CODE		5
+#define USER_ENTER_SWITCH_CODE		5
 #define MODULE_LOADED_CODE		6
 #define CTX_TGID_CODE			7
 #define TRACE_BEGIN_CODE		8
 #define TRACE_END_CODE			9
+#define XEN_ENTER_SWITCH_CODE		10
+#define DOMAIN_SWITCH_CODE		11
  
 /* add data to the event buffer */
 void add_event_entry(unsigned long data);
linux-2.6.12-xen0/drivers/oprofile/oprof.c +23 -0
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/drivers/oprofile/oprof.c xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/drivers/oprofile/oprof.c
@@ -5,6 +5,10 @@
  * @remark Read the file COPYING
  *
  * @author John Levon <[email protected]>
+ *
+ * Modified by Aravind Menon for Xen
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
  */
 
 #include <linux/kernel.h>
@@ -32,6 +36,25 @@ static DECLARE_MUTEX(start_sem);
    1 - use the timer int mechanism regardless
  */
 static int timer = 0;
+
+extern unsigned int adomains, pdomains;
+extern int active_domains[MAX_OPROF_DOMAINS], passive_domains[MAX_OPROF_DOMAINS];
+
+int oprofile_set_active(void)
+{
+	if (oprofile_ops.set_active)
+		return oprofile_ops.set_active(active_domains, adomains);
+
+	return -EINVAL;
+}
+
+int oprofile_set_passive(void)
+{
+	if (oprofile_ops.set_passive)
+		return oprofile_ops.set_passive(passive_domains, pdomains);
+
+	return -EINVAL;
+}
 
 int oprofile_setup(void)
 {
linux-2.6.12-xen0/drivers/oprofile/oprofile_files.c +136 -1

70 lines not on this page · raw message

linux-2.6.12-xen0/include/asm-xen/asm-i386/hypercall.h +17 -0
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/include/asm-xen/asm-i386/hypercall.h xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/include/asm-xen/asm-i386/hypercall.h

Lines of this file are not shown. View the raw message.

linux-2.6.12-xen0/include/asm-xen/asm-x86_64/hypercall.h +15 -0
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/include/asm-xen/asm-x86_64/hypercall.h xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/include/asm-xen/asm-x86_64/hypercall.h

Lines of this file are not shown. View the raw message.

linux-2.6.12-xen0/include/asm-xen/xen-public/xen.h +39 -1
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/include/asm-xen/xen-public/xen.h xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/include/asm-xen/xen-public/xen.h

Lines of this file are not shown. View the raw message.

linux-2.6.12-xen0/include/linux/oprofile.h +17 -0
diff -Naurp xen-unstable.hg-20050822/linux-2.6.12-xen0/include/linux/oprofile.h xen-unstable.hg-20050822-oprofile/linux-2.6.12-xen0/include/linux/oprofile.h

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Part of the diff is not shown here. View the raw message.