ia64/xen-unstable

changeset 10717:b875c036839f

[XENOPROF] Some fixes for xenoprof passive domain support.

Currently, passive domain samples are being assigned to the wrong
kernel functions. This patch fixes this problem. In addition the patch changes the
encoding of domain switch ESCAPE codes (marks used to separate samples
in oprofile buffers associated with different domains). Instead of
using 2 codes, one for START and one for END of passive domain
samples, a single escape CODE value is used to indicate a domain switch (no
need for a STOP followed by a START). Finally there some other minor style
fixes.

Signed-off-by: Jose Renato Santos <jsantos@hpl.hp.com>
author kfraser@localhost.localdomain
date Mon Jul 10 16:05:44 2006 +0100 (2006-07-10)
parents 3c74df4f33f0
children 3cdb93867f81
files linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c patches/linux-2.6.16.13/xenoprof-generic.patch
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c	Mon Jul 10 15:57:56 2006 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c	Mon Jul 10 16:05:44 2006 +0100
     1.3 @@ -29,6 +29,7 @@
     1.4  #include <xen/interface/xen.h>
     1.5  #include <xen/interface/xenoprof.h>
     1.6  #include <../../../drivers/oprofile/cpu_buffer.h>
     1.7 +#include <../../../drivers/oprofile/event_buffer.h>
     1.8  
     1.9  static int xenoprof_start(void);
    1.10  static void xenoprof_stop(void);
    1.11 @@ -151,16 +152,27 @@ static void xenoprof_add_pc(xenoprof_buf
    1.12  static void xenoprof_handle_passive(void)
    1.13  {
    1.14  	int i, j;
    1.15 -
    1.16 -	for (i = 0; i < pdomains; i++)
    1.17 +	int flag_domain, flag_switch = 0;
    1.18 +	
    1.19 +	for (i = 0; i < pdomains; i++) {
    1.20 +		flag_domain = 0;
    1.21  		for (j = 0; j < passive_domains[i].nbuf; j++) {
    1.22  			xenoprof_buf_t *buf = p_xenoprof_buf[i][j];
    1.23  			if (buf->event_head == buf->event_tail)
    1.24  				continue;
    1.25 -                        oprofile_add_pc(IGNORED_PC, CPU_MODE_PASSIVE_START, passive_domains[i].domain_id);
    1.26 +			if (!flag_domain) {
    1.27 +				if (!oprofile_add_domain_switch(passive_domains[i].
    1.28 +								domain_id))
    1.29 +					goto done;
    1.30 +				flag_domain = 1;
    1.31 +			}
    1.32  			xenoprof_add_pc(buf, 1);
    1.33 -                        oprofile_add_pc(IGNORED_PC, CPU_MODE_PASSIVE_STOP, passive_domains[i].domain_id);
    1.34 -		}			
    1.35 +			flag_switch = 1;
    1.36 +		}
    1.37 +	}
    1.38 +done:
    1.39 +	if (flag_switch)
    1.40 +		oprofile_add_domain_switch(COORDINATOR_DOMAIN);
    1.41  }
    1.42  
    1.43  static irqreturn_t 
    1.44 @@ -177,6 +189,7 @@ xenoprof_ovf_interrupt(int irq, void * d
    1.45  
    1.46  	if (is_primary && !test_and_set_bit(0, &flag)) {
    1.47  		xenoprof_handle_passive();
    1.48 +		smp_mb__before_clear_bit();
    1.49  		clear_bit(0, &flag);
    1.50  	}
    1.51  
     2.1 --- a/patches/linux-2.6.16.13/xenoprof-generic.patch	Mon Jul 10 15:57:56 2006 +0100
     2.2 +++ b/patches/linux-2.6.16.13/xenoprof-generic.patch	Mon Jul 10 16:05:44 2006 +0100
     2.3 @@ -1,6 +1,6 @@
     2.4 -diff -pru ../pristine-linux-2.6.16.13/drivers/oprofile/buffer_sync.c ./drivers/oprofile/buffer_sync.c
     2.5 ---- ../pristine-linux-2.6.16.13/drivers/oprofile/buffer_sync.c	2006-05-03 05:38:44.000000000 +0800
     2.6 -+++ ./drivers/oprofile/buffer_sync.c	2006-06-27 12:14:53.000000000 +0800
     2.7 +diff -Naur orig/drivers/oprofile/buffer_sync.c new/drivers/oprofile/buffer_sync.c
     2.8 +--- orig/drivers/oprofile/buffer_sync.c	2006-05-02 14:38:44.000000000 -0700
     2.9 ++++ new/drivers/oprofile/buffer_sync.c	2006-07-06 18:19:05.000000000 -0700
    2.10  @@ -6,6 +6,10 @@
    2.11    *
    2.12    * @author John Levon <levon@movementarian.org>
    2.13 @@ -12,7 +12,7 @@ diff -pru ../pristine-linux-2.6.16.13/dr
    2.14    * This is the core of the buffer management. Each
    2.15    * CPU buffer is processed and entered into the
    2.16    * global event buffer. Such processing is necessary
    2.17 -@@ -275,15 +279,30 @@ static void add_cpu_switch(int i)
    2.18 +@@ -275,15 +279,31 @@
    2.19   	last_cookie = INVALID_COOKIE;
    2.20   }
    2.21   
    2.22 @@ -34,22 +34,23 @@ diff -pru ../pristine-linux-2.6.16.13/dr
    2.23  +	case CPU_MODE_XEN:
    2.24  +		add_event_entry(XEN_ENTER_SWITCH_CODE);
    2.25  +	  	break;
    2.26 -+        case CPU_MODE_PASSIVE_START:
    2.27 -+                add_event_entry(PASSIVE_START_CODE);
    2.28 -+                break;
    2.29 -+        case CPU_MODE_PASSIVE_STOP:
    2.30 -+                add_event_entry(PASSIVE_STOP_CODE);
    2.31 -+                break;
    2.32  +	default:
    2.33  +		break;
    2.34  +	}
    2.35   }
    2.36  - 
    2.37  +
    2.38 ++static void add_domain_switch(unsigned long domain_id)
    2.39 ++{
    2.40 ++	add_event_entry(ESCAPE_CODE);
    2.41 ++	add_event_entry(DOMAIN_SWITCH_CODE);
    2.42 ++	add_event_entry(domain_id);
    2.43 ++}
    2.44 ++
    2.45   static void
    2.46   add_user_ctx_switch(struct task_struct const * task, unsigned long cookie)
    2.47   {
    2.48 -@@ -348,9 +367,9 @@ static int add_us_sample(struct mm_struc
    2.49 +@@ -348,9 +368,9 @@
    2.50    * for later lookup from userspace.
    2.51    */
    2.52   static int
    2.53 @@ -61,7 +62,7 @@ diff -pru ../pristine-linux-2.6.16.13/dr
    2.54   		add_sample_entry(s->eip, s->event);
    2.55   		return 1;
    2.56   	} else if (mm) {
    2.57 -@@ -496,10 +515,11 @@ void sync_buffer(int cpu)
    2.58 +@@ -496,10 +516,11 @@
    2.59   	struct mm_struct *mm = NULL;
    2.60   	struct task_struct * new;
    2.61   	unsigned long cookie = 0;
    2.62 @@ -70,34 +71,35 @@ diff -pru ../pristine-linux-2.6.16.13/dr
    2.63   	unsigned int i;
    2.64   	sync_buffer_state state = sb_buffer_start;
    2.65   	unsigned long available;
    2.66 -+	int domain_switch = NO_DOMAIN_SWITCH;
    2.67 ++	int domain_switch = 0;
    2.68   
    2.69   	down(&buffer_sem);
    2.70    
    2.71 -@@ -513,12 +533,19 @@ void sync_buffer(int cpu)
    2.72 +@@ -512,16 +533,18 @@
    2.73 + 	for (i = 0; i < available; ++i) {
    2.74   		struct op_sample * s = &cpu_buf->buffer[cpu_buf->tail_pos];
    2.75    
    2.76 - 		if (is_code(s->eip)) {
    2.77 +-		if (is_code(s->eip)) {
    2.78  -			if (s->event <= CPU_IS_KERNEL) {
    2.79 -+			if (s->event < CPU_TRACE_BEGIN) {
    2.80 - 				/* kernel/userspace switch */
    2.81 +-				/* kernel/userspace switch */
    2.82  -				in_kernel = s->event;
    2.83 ++		if (is_code(s->eip) && !domain_switch) {
    2.84 ++			if (s->event <= CPU_MODE_XEN) {
    2.85 ++				/* xen/kernel/userspace switch */
    2.86  +				cpu_mode = s->event;
    2.87   				if (state == sb_buffer_start)
    2.88   					state = sb_sample_start;
    2.89  -				add_kernel_ctx_switch(s->event);
    2.90 -+
    2.91 -+				if (s->event == CPU_MODE_PASSIVE_START)
    2.92 -+					domain_switch = DOMAIN_SWITCH_START_EVENT1;
    2.93 -+				else if (s->event == CPU_MODE_PASSIVE_STOP)
    2.94 -+					domain_switch = DOMAIN_SWITCH_STOP_EVENT1;
    2.95 -+
    2.96 -+				if (domain_switch != DOMAIN_SWITCH_START_EVENT2)
    2.97 -+					add_cpu_mode_switch(s->event);
    2.98 ++				add_cpu_mode_switch(s->event);
    2.99   			} else if (s->event == CPU_TRACE_BEGIN) {
   2.100   				state = sb_bt_start;
   2.101   				add_trace_begin();
   2.102 -@@ -535,11 +562,20 @@ void sync_buffer(int cpu)
   2.103 ++			} else if (s->event == CPU_DOMAIN_SWITCH) {
   2.104 ++					domain_switch = 1;				
   2.105 + 			} else {
   2.106 + 				struct mm_struct * oldmm = mm;
   2.107 + 
   2.108 +@@ -535,11 +558,16 @@
   2.109   				add_user_ctx_switch(new, cookie);
   2.110   			}
   2.111   		} else {
   2.112 @@ -106,13 +108,9 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.113  -				if (state == sb_bt_start) {
   2.114  -					state = sb_bt_ignore;
   2.115  -					atomic_inc(&oprofile_stats.bt_lost_no_mapping);
   2.116 -+			if (domain_switch == DOMAIN_SWITCH_START_EVENT1) {
   2.117 -+			        add_event_entry(s->event);
   2.118 -+				domain_switch = DOMAIN_SWITCH_START_EVENT2;
   2.119 -+			} else if (domain_switch == DOMAIN_SWITCH_START_EVENT1) {
   2.120 -+				add_sample_entry(s->eip, s->event);
   2.121 -+			} else if (domain_switch == DOMAIN_SWITCH_STOP_EVENT1) {
   2.122 -+				domain_switch = NO_DOMAIN_SWITCH;
   2.123 ++			if (domain_switch) {
   2.124 ++				add_domain_switch(s->eip);
   2.125 ++				domain_switch = 0;
   2.126  +			} else {
   2.127  +				if (state >= sb_bt_start &&
   2.128  +				    !add_sample(mm, s, cpu_mode)) {
   2.129 @@ -123,24 +121,9 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.130   				}
   2.131   			}
   2.132   		}
   2.133 -diff -pru ../pristine-linux-2.6.16.13/drivers/oprofile/buffer_sync.h ./drivers/oprofile/buffer_sync.h
   2.134 ---- ../pristine-linux-2.6.16.13/drivers/oprofile/buffer_sync.h	2006-05-03 05:38:44.000000000 +0800
   2.135 -+++ ./drivers/oprofile/buffer_sync.h	2006-06-27 12:12:09.000000000 +0800
   2.136 -@@ -9,6 +9,11 @@
   2.137 - 
   2.138 - #ifndef OPROFILE_BUFFER_SYNC_H
   2.139 - #define OPROFILE_BUFFER_SYNC_H
   2.140 -+
   2.141 -+#define NO_DOMAIN_SWITCH		-1
   2.142 -+#define DOMAIN_SWITCH_START_EVENT1	0
   2.143 -+#define DOMAIN_SWITCH_START_EVENT2	1
   2.144 -+#define DOMAIN_SWITCH_STOP_EVENT1	2
   2.145 -  
   2.146 - /* add the necessary profiling hooks */
   2.147 - int sync_start(void);
   2.148 -diff -pru ../pristine-linux-2.6.16.13/drivers/oprofile/cpu_buffer.c ./drivers/oprofile/cpu_buffer.c
   2.149 ---- ../pristine-linux-2.6.16.13/drivers/oprofile/cpu_buffer.c	2006-05-03 05:38:44.000000000 +0800
   2.150 -+++ ./drivers/oprofile/cpu_buffer.c	2006-06-19 22:43:53.000000000 +0800
   2.151 +diff -Naur orig/drivers/oprofile/cpu_buffer.c new/drivers/oprofile/cpu_buffer.c
   2.152 +--- orig/drivers/oprofile/cpu_buffer.c	2006-05-02 14:38:44.000000000 -0700
   2.153 ++++ new/drivers/oprofile/cpu_buffer.c	2006-07-06 18:19:05.000000000 -0700
   2.154  @@ -6,6 +6,10 @@
   2.155    *
   2.156    * @author John Levon <levon@movementarian.org>
   2.157 @@ -152,7 +135,16 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.158    * Each CPU has a local buffer that stores PC value/event
   2.159    * pairs. We also log context switches when we notice them.
   2.160    * Eventually each CPU's buffer is processed into the global
   2.161 -@@ -58,7 +62,7 @@ int alloc_cpu_buffers(void)
   2.162 +@@ -34,6 +38,8 @@
   2.163 + #define DEFAULT_TIMER_EXPIRE (HZ / 10)
   2.164 + static int work_enabled;
   2.165 + 
   2.166 ++static int32_t current_domain = COORDINATOR_DOMAIN;
   2.167 ++
   2.168 + void free_cpu_buffers(void)
   2.169 + {
   2.170 + 	int i;
   2.171 +@@ -58,7 +64,7 @@
   2.172   			goto fail;
   2.173    
   2.174   		b->last_task = NULL;
   2.175 @@ -161,7 +153,7 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.176   		b->tracing = 0;
   2.177   		b->buffer_size = buffer_size;
   2.178   		b->tail_pos = 0;
   2.179 -@@ -114,7 +118,7 @@ void cpu_buffer_reset(struct oprofile_cp
   2.180 +@@ -114,7 +120,7 @@
   2.181   	 * collected will populate the buffer with proper
   2.182   	 * values to initialize the buffer
   2.183   	 */
   2.184 @@ -170,7 +162,7 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.185   	cpu_buf->last_task = NULL;
   2.186   }
   2.187   
   2.188 -@@ -164,13 +168,13 @@ add_code(struct oprofile_cpu_buffer * bu
   2.189 +@@ -164,13 +170,13 @@
   2.190    * because of the head/tail separation of the writer and reader
   2.191    * of the CPU buffer.
   2.192    *
   2.193 @@ -188,7 +180,7 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.194   {
   2.195   	struct task_struct * task;
   2.196   
   2.197 -@@ -181,16 +185,14 @@ static int log_sample(struct oprofile_cp
   2.198 +@@ -181,18 +187,18 @@
   2.199   		return 0;
   2.200   	}
   2.201   
   2.202 @@ -207,12 +199,43 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.203  -
   2.204  +	
   2.205   	/* notice a task switch */
   2.206 - 	if (cpu_buf->last_task != task) {
   2.207 +-	if (cpu_buf->last_task != task) {
   2.208 ++	/* if not processing other domain samples */
   2.209 ++	if ((cpu_buf->last_task != task) &&
   2.210 ++	    (current_domain == COORDINATOR_DOMAIN)) {
   2.211   		cpu_buf->last_task = task;
   2.212 -diff -pru ../pristine-linux-2.6.16.13/drivers/oprofile/cpu_buffer.h ./drivers/oprofile/cpu_buffer.h
   2.213 ---- ../pristine-linux-2.6.16.13/drivers/oprofile/cpu_buffer.h	2006-05-03 05:38:44.000000000 +0800
   2.214 -+++ ./drivers/oprofile/cpu_buffer.h	2006-06-27 10:38:08.000000000 +0800
   2.215 -@@ -36,7 +36,7 @@ struct oprofile_cpu_buffer {
   2.216 + 		add_code(cpu_buf, (unsigned long)task);
   2.217 + 	}
   2.218 +@@ -269,6 +275,25 @@
   2.219 + 	add_sample(cpu_buf, pc, 0);
   2.220 + }
   2.221 + 
   2.222 ++int oprofile_add_domain_switch(int32_t domain_id)
   2.223 ++{
   2.224 ++	struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()];
   2.225 ++
   2.226 ++	/* should have space for switching into and out of domain 
   2.227 ++	   (2 slots each) plus one sample and one cpu mode switch */
   2.228 ++	if (((nr_available_slots(cpu_buf) < 6) && 
   2.229 ++	     (domain_id != COORDINATOR_DOMAIN)) ||
   2.230 ++	    (nr_available_slots(cpu_buf) < 2))
   2.231 ++		return 0;
   2.232 ++
   2.233 ++	add_code(cpu_buf, CPU_DOMAIN_SWITCH);
   2.234 ++	add_sample(cpu_buf, domain_id, 0);
   2.235 ++
   2.236 ++	current_domain = domain_id;
   2.237 ++
   2.238 ++	return 1;
   2.239 ++}
   2.240 ++
   2.241 + /*
   2.242 +  * This serves to avoid cpu buffer overflow, and makes sure
   2.243 +  * the task mortuary progresses
   2.244 +diff -Naur orig/drivers/oprofile/cpu_buffer.h new/drivers/oprofile/cpu_buffer.h
   2.245 +--- orig/drivers/oprofile/cpu_buffer.h	2006-05-02 14:38:44.000000000 -0700
   2.246 ++++ new/drivers/oprofile/cpu_buffer.h	2006-07-06 18:19:05.000000000 -0700
   2.247 +@@ -36,7 +36,7 @@
   2.248   	volatile unsigned long tail_pos;
   2.249   	unsigned long buffer_size;
   2.250   	struct task_struct * last_task;
   2.251 @@ -221,7 +244,7 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.252   	int tracing;
   2.253   	struct op_sample * buffer;
   2.254   	unsigned long sample_received;
   2.255 -@@ -51,7 +51,13 @@ extern struct oprofile_cpu_buffer cpu_bu
   2.256 +@@ -51,7 +51,10 @@
   2.257   void cpu_buffer_reset(struct oprofile_cpu_buffer * cpu_buf);
   2.258   
   2.259   /* transient events for the CPU buffer -> event buffer */
   2.260 @@ -230,17 +253,14 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.261  +#define CPU_MODE_USER           0
   2.262  +#define CPU_MODE_KERNEL         1
   2.263  +#define CPU_MODE_XEN            2
   2.264 -+#define CPU_MODE_PASSIVE_START  3
   2.265 -+#define CPU_MODE_PASSIVE_STOP   4
   2.266 -+#define CPU_TRACE_BEGIN         5
   2.267 -+
   2.268 -+#define IGNORED_PC              0
   2.269 ++#define CPU_TRACE_BEGIN         3
   2.270 ++#define CPU_DOMAIN_SWITCH       4
   2.271   
   2.272   #endif /* OPROFILE_CPU_BUFFER_H */
   2.273 -diff -pru ../pristine-linux-2.6.16.13/drivers/oprofile/event_buffer.h ./drivers/oprofile/event_buffer.h
   2.274 ---- ../pristine-linux-2.6.16.13/drivers/oprofile/event_buffer.h	2006-05-03 05:38:44.000000000 +0800
   2.275 -+++ ./drivers/oprofile/event_buffer.h	2006-06-19 22:43:53.000000000 +0800
   2.276 -@@ -29,11 +29,14 @@ void wake_up_buffer_waiter(void);
   2.277 +diff -Naur orig/drivers/oprofile/event_buffer.h new/drivers/oprofile/event_buffer.h
   2.278 +--- orig/drivers/oprofile/event_buffer.h	2006-05-02 14:38:44.000000000 -0700
   2.279 ++++ new/drivers/oprofile/event_buffer.h	2006-07-06 18:19:05.000000000 -0700
   2.280 +@@ -29,15 +29,20 @@
   2.281   #define CPU_SWITCH_CODE 		2
   2.282   #define COOKIE_SWITCH_CODE 		3
   2.283   #define KERNEL_ENTER_SWITCH_CODE	4
   2.284 @@ -251,14 +271,20 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.285   #define TRACE_BEGIN_CODE		8
   2.286   #define TRACE_END_CODE			9
   2.287  +#define XEN_ENTER_SWITCH_CODE		10
   2.288 -+#define PASSIVE_START_CODE		11
   2.289 -+#define PASSIVE_STOP_CODE		12
   2.290 ++#define DOMAIN_SWITCH_CODE		11
   2.291    
   2.292   #define INVALID_COOKIE ~0UL
   2.293   #define NO_COOKIE 0UL
   2.294 -diff -pru ../pristine-linux-2.6.16.13/drivers/oprofile/oprof.c ./drivers/oprofile/oprof.c
   2.295 ---- ../pristine-linux-2.6.16.13/drivers/oprofile/oprof.c	2006-05-03 05:38:44.000000000 +0800
   2.296 -+++ ./drivers/oprofile/oprof.c	2006-06-19 23:45:17.000000000 +0800
   2.297 + 
   2.298 ++/* Constant used to refer to coordinator domain (Xen) */
   2.299 ++#define COORDINATOR_DOMAIN -1
   2.300 ++
   2.301 + /* add data to the event buffer */
   2.302 + void add_event_entry(unsigned long data);
   2.303 +  
   2.304 +diff -Naur orig/drivers/oprofile/oprof.c new/drivers/oprofile/oprof.c
   2.305 +--- orig/drivers/oprofile/oprof.c	2006-05-02 14:38:44.000000000 -0700
   2.306 ++++ new/drivers/oprofile/oprof.c	2006-07-06 18:19:05.000000000 -0700
   2.307  @@ -5,6 +5,10 @@
   2.308    * @remark Read the file COPYING
   2.309    *
   2.310 @@ -279,7 +305,7 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.311   struct oprofile_operations oprofile_ops;
   2.312   
   2.313   unsigned long oprofile_started;
   2.314 -@@ -33,6 +37,32 @@ static DECLARE_MUTEX(start_sem);
   2.315 +@@ -33,6 +37,32 @@
   2.316    */
   2.317   static int timer = 0;
   2.318   
   2.319 @@ -312,10 +338,10 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.320   int oprofile_setup(void)
   2.321   {
   2.322   	int err;
   2.323 -diff -pru ../pristine-linux-2.6.16.13/drivers/oprofile/oprof.h ./drivers/oprofile/oprof.h
   2.324 ---- ../pristine-linux-2.6.16.13/drivers/oprofile/oprof.h	2006-05-03 05:38:44.000000000 +0800
   2.325 -+++ ./drivers/oprofile/oprof.h	2006-06-19 23:42:36.000000000 +0800
   2.326 -@@ -35,5 +35,8 @@ void oprofile_create_files(struct super_
   2.327 +diff -Naur orig/drivers/oprofile/oprof.h new/drivers/oprofile/oprof.h
   2.328 +--- orig/drivers/oprofile/oprof.h	2006-05-02 14:38:44.000000000 -0700
   2.329 ++++ new/drivers/oprofile/oprof.h	2006-07-06 18:19:05.000000000 -0700
   2.330 +@@ -35,5 +35,8 @@
   2.331   void oprofile_timer_init(struct oprofile_operations * ops);
   2.332   
   2.333   int oprofile_set_backtrace(unsigned long depth);
   2.334 @@ -324,9 +350,9 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.335  +int oprofile_set_passive(int passive_domains[], unsigned int pdomains);
   2.336    
   2.337   #endif /* OPROF_H */
   2.338 -diff -pru ../pristine-linux-2.6.16.13/drivers/oprofile/oprofile_files.c ./drivers/oprofile/oprofile_files.c
   2.339 ---- ../pristine-linux-2.6.16.13/drivers/oprofile/oprofile_files.c	2006-05-03 05:38:44.000000000 +0800
   2.340 -+++ ./drivers/oprofile/oprofile_files.c	2006-06-19 23:29:07.000000000 +0800
   2.341 +diff -Naur orig/drivers/oprofile/oprofile_files.c new/drivers/oprofile/oprofile_files.c
   2.342 +--- orig/drivers/oprofile/oprofile_files.c	2006-05-02 14:38:44.000000000 -0700
   2.343 ++++ new/drivers/oprofile/oprofile_files.c	2006-07-06 18:19:05.000000000 -0700
   2.344  @@ -5,15 +5,21 @@
   2.345    * @remark Read the file COPYING
   2.346    *
   2.347 @@ -350,7 +376,7 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.348   unsigned long fs_buffer_size = 131072;
   2.349   unsigned long fs_cpu_buffer_size = 8192;
   2.350   unsigned long fs_buffer_watershed = 32768; /* FIXME: tune */
   2.351 -@@ -117,11 +123,202 @@ static ssize_t dump_write(struct file * 
   2.352 +@@ -117,11 +123,202 @@
   2.353   static struct file_operations dump_fops = {
   2.354   	.write		= dump_write,
   2.355   };
   2.356 @@ -554,8 +580,9 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.357   	oprofilefs_create_file(sb, root, "buffer", &event_buffer_fops);
   2.358   	oprofilefs_create_ulong(sb, root, "buffer_size", &fs_buffer_size);
   2.359   	oprofilefs_create_ulong(sb, root, "buffer_watershed", &fs_buffer_watershed);
   2.360 ---- ../pristine-linux-2.6.16.13/include/linux/oprofile.h	2006-05-03 05:38:44.000000000 +0800
   2.361 -+++ ./include/linux/oprofile.h	2006-06-19 23:52:00.000000000 +0800
   2.362 +diff -Naur orig/include/linux/oprofile.h new/include/linux/oprofile.h
   2.363 +--- orig/include/linux/oprofile.h	2006-05-02 14:38:44.000000000 -0700
   2.364 ++++ new/include/linux/oprofile.h	2006-07-06 18:19:31.000000000 -0700
   2.365  @@ -16,6 +16,8 @@
   2.366   #include <linux/types.h>
   2.367   #include <linux/spinlock.h>
   2.368 @@ -565,7 +592,7 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.369    
   2.370   struct super_block;
   2.371   struct dentry;
   2.372 -@@ -27,6 +29,11 @@ struct oprofile_operations {
   2.373 +@@ -27,6 +29,11 @@
   2.374   	/* create any necessary configuration files in the oprofile fs.
   2.375   	 * Optional. */
   2.376   	int (*create_files)(struct super_block * sb, struct dentry * root);
   2.377 @@ -577,3 +604,12 @@ diff -pru ../pristine-linux-2.6.16.13/dr
   2.378   	/* Do any necessary interrupt setup. Optional. */
   2.379   	int (*setup)(void);
   2.380   	/* Do any necessary interrupt shutdown. Optional. */
   2.381 +@@ -68,6 +75,8 @@
   2.382 + /* add a backtrace entry, to be called from the ->backtrace callback */
   2.383 + void oprofile_add_trace(unsigned long eip);
   2.384 + 
   2.385 ++/* add a domain switch entry */
   2.386 ++int oprofile_add_domain_switch(int32_t domain_id);
   2.387 + 
   2.388 + /**
   2.389 +  * Create a file of the given name as a child of the given root, with