direct-io.hg

changeset 12318:0b8f79563bcd

Merge
author Alastair Tse <atse@xensource.com>
date Thu Nov 09 13:18:58 2006 +0000 (2006-11-09)
parents a14732833603 b1a68f065fbd
children 9b65a87f140f
files
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c	Thu Nov 09 13:16:55 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/vbd.c	Thu Nov 09 13:18:58 2006 +0000
     1.3 @@ -50,7 +50,7 @@
     1.4   */
     1.5  
     1.6  #define NUM_IDE_MAJORS 10
     1.7 -#define NUM_SCSI_MAJORS 9
     1.8 +#define NUM_SCSI_MAJORS 17
     1.9  #define NUM_VBD_MAJORS 1
    1.10  
    1.11  static struct xlbd_type_info xlbd_ide_type = {
    1.12 @@ -165,8 +165,11 @@ xlbd_get_major_info(int vdevice)
    1.13  	case SCSI_DISK1_MAJOR ... SCSI_DISK7_MAJOR:
    1.14  		index = 11 + major - SCSI_DISK1_MAJOR;
    1.15  		break;
    1.16 -	case SCSI_CDROM_MAJOR: index = 18; break;
    1.17 -	default: index = 19; break;
    1.18 +        case SCSI_DISK8_MAJOR ... SCSI_DISK15_MAJOR:
    1.19 +                index = 18 + major - SCSI_DISK8_MAJOR;
    1.20 +                break;
    1.21 +        case SCSI_CDROM_MAJOR: index = 26; break;
    1.22 +        default: index = 27; break;
    1.23  	}
    1.24  
    1.25  	mi = ((major_info[index] != NULL) ? major_info[index] :
    1.26 @@ -227,6 +230,7 @@ xlvbd_alloc_gendisk(int minor, blkif_sec
    1.27  	struct xlbd_major_info *mi;
    1.28  	int nr_minors = 1;
    1.29  	int err = -ENODEV;
    1.30 +	unsigned int offset;
    1.31  
    1.32  	BUG_ON(info->gd != NULL);
    1.33  	BUG_ON(info->mi != NULL);
    1.34 @@ -244,15 +248,33 @@ xlvbd_alloc_gendisk(int minor, blkif_sec
    1.35  	if (gd == NULL)
    1.36  		goto out;
    1.37  
    1.38 -	if (nr_minors > 1)
    1.39 -		sprintf(gd->disk_name, "%s%c", mi->type->diskname,
    1.40 -			'a' + mi->index * mi->type->disks_per_major +
    1.41 -			(minor >> mi->type->partn_shift));
    1.42 -	else
    1.43 -		sprintf(gd->disk_name, "%s%c%d", mi->type->diskname,
    1.44 -			'a' + mi->index * mi->type->disks_per_major +
    1.45 -			(minor >> mi->type->partn_shift),
    1.46 -			minor & ((1 << mi->type->partn_shift) - 1));
    1.47 +	offset =  mi->index * mi->type->disks_per_major +
    1.48 +			(minor >> mi->type->partn_shift);
    1.49 +	if (nr_minors > 1) {
    1.50 +		if (offset < 26) {
    1.51 +			sprintf(gd->disk_name, "%s%c",
    1.52 +				 mi->type->diskname, 'a' + offset );
    1.53 +		}
    1.54 +		else {
    1.55 +			sprintf(gd->disk_name, "%s%c%c",
    1.56 +				mi->type->diskname,
    1.57 +				'a' + ((offset/26)-1), 'a' + (offset%26) );
    1.58 +		}
    1.59 +	}
    1.60 +	else {
    1.61 +		if (offset < 26) {
    1.62 +			sprintf(gd->disk_name, "%s%c%d",
    1.63 +				mi->type->diskname,
    1.64 +				'a' + offset,
    1.65 +				minor & ((1 << mi->type->partn_shift) - 1));
    1.66 +		}
    1.67 +		else {
    1.68 +			sprintf(gd->disk_name, "%s%c%c%d",
    1.69 +				mi->type->diskname,
    1.70 +				'a' + ((offset/26)-1), 'a' + (offset%26),
    1.71 +				minor & ((1 << mi->type->partn_shift) - 1));
    1.72 +		}
    1.73 +	}
    1.74  
    1.75  	gd->major = mi->major;
    1.76  	gd->first_minor = minor;
     2.1 --- a/patches/linux-2.6.16.29/xenoprof-generic.patch	Thu Nov 09 13:16:55 2006 +0000
     2.2 +++ b/patches/linux-2.6.16.29/xenoprof-generic.patch	Thu Nov 09 13:18:58 2006 +0000
     2.3 @@ -1,6 +1,6 @@
     2.4  diff -pruN ../orig-linux-2.6.16.29/drivers/oprofile/buffer_sync.c ./drivers/oprofile/buffer_sync.c
     2.5 ---- ../orig-linux-2.6.16.29/drivers/oprofile/buffer_sync.c	2006-09-12 19:02:10.000000000 +0100
     2.6 -+++ ./drivers/oprofile/buffer_sync.c	2006-09-19 14:06:05.000000000 +0100
     2.7 +--- ../orig-linux-2.6.16.29/drivers/oprofile/buffer_sync.c	2006-11-06 14:46:52.000000000 -0800
     2.8 ++++ ./drivers/oprofile/buffer_sync.c	2006-11-06 15:16:52.000000000 -0800
     2.9  @@ -6,6 +6,10 @@
    2.10    *
    2.11    * @author John Levon <levon@movementarian.org>
    2.12 @@ -12,7 +12,27 @@ diff -pruN ../orig-linux-2.6.16.29/drive
    2.13    * This is the core of the buffer management. Each
    2.14    * CPU buffer is processed and entered into the
    2.15    * global event buffer. Such processing is necessary
    2.16 -@@ -275,15 +279,31 @@ static void add_cpu_switch(int i)
    2.17 +@@ -38,6 +42,7 @@ static cpumask_t marked_cpus = CPU_MASK_
    2.18 + static DEFINE_SPINLOCK(task_mortuary);
    2.19 + static void process_task_mortuary(void);
    2.20 + 
    2.21 ++static int cpu_current_domain[NR_CPUS];
    2.22 + 
    2.23 + /* Take ownership of the task struct and place it on the
    2.24 +  * list for processing. Only after two full buffer syncs
    2.25 +@@ -146,6 +151,11 @@ static void end_sync(void)
    2.26 + int sync_start(void)
    2.27 + {
    2.28 + 	int err;
    2.29 ++	int i;
    2.30 ++
    2.31 ++	for (i = 0; i < NR_CPUS; i++) {
    2.32 ++		cpu_current_domain[i] = COORDINATOR_DOMAIN;
    2.33 ++	}
    2.34 + 
    2.35 + 	start_cpu_work();
    2.36 + 
    2.37 +@@ -275,15 +285,31 @@ static void add_cpu_switch(int i)
    2.38   	last_cookie = INVALID_COOKIE;
    2.39   }
    2.40   
    2.41 @@ -50,7 +70,7 @@ diff -pruN ../orig-linux-2.6.16.29/drive
    2.42   static void
    2.43   add_user_ctx_switch(struct task_struct const * task, unsigned long cookie)
    2.44   {
    2.45 -@@ -348,9 +368,9 @@ static int add_us_sample(struct mm_struc
    2.46 +@@ -348,9 +374,9 @@ static int add_us_sample(struct mm_struc
    2.47    * for later lookup from userspace.
    2.48    */
    2.49   static int
    2.50 @@ -62,7 +82,7 @@ diff -pruN ../orig-linux-2.6.16.29/drive
    2.51   		add_sample_entry(s->eip, s->event);
    2.52   		return 1;
    2.53   	} else if (mm) {
    2.54 -@@ -496,10 +516,11 @@ void sync_buffer(int cpu)
    2.55 +@@ -496,15 +522,21 @@ void sync_buffer(int cpu)
    2.56   	struct mm_struct *mm = NULL;
    2.57   	struct task_struct * new;
    2.58   	unsigned long cookie = 0;
    2.59 @@ -75,7 +95,17 @@ diff -pruN ../orig-linux-2.6.16.29/drive
    2.60   
    2.61   	down(&buffer_sem);
    2.62    
    2.63 -@@ -512,16 +533,18 @@ void sync_buffer(int cpu)
    2.64 + 	add_cpu_switch(cpu);
    2.65 + 
    2.66 ++	/* We need to assign the first samples in this CPU buffer to the
    2.67 ++	   same domain that we were processing at the last sync_buffer */
    2.68 ++	if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
    2.69 ++		add_domain_switch(cpu_current_domain[cpu]);
    2.70 ++	}
    2.71 + 	/* Remember, only we can modify tail_pos */
    2.72 + 
    2.73 + 	available = get_slots(cpu_buf);
    2.74 +@@ -512,16 +544,18 @@ void sync_buffer(int cpu)
    2.75   	for (i = 0; i < available; ++i) {
    2.76   		struct op_sample * s = &cpu_buf->buffer[cpu_buf->tail_pos];
    2.77    
    2.78 @@ -99,7 +129,7 @@ diff -pruN ../orig-linux-2.6.16.29/drive
    2.79   			} else {
    2.80   				struct mm_struct * oldmm = mm;
    2.81   
    2.82 -@@ -535,11 +558,16 @@ void sync_buffer(int cpu)
    2.83 +@@ -535,11 +569,21 @@ void sync_buffer(int cpu)
    2.84   				add_user_ctx_switch(new, cookie);
    2.85   			}
    2.86   		} else {
    2.87 @@ -109,10 +139,15 @@ diff -pruN ../orig-linux-2.6.16.29/drive
    2.88  -					state = sb_bt_ignore;
    2.89  -					atomic_inc(&oprofile_stats.bt_lost_no_mapping);
    2.90  +			if (domain_switch) {
    2.91 ++				cpu_current_domain[cpu] = s->eip;
    2.92  +				add_domain_switch(s->eip);
    2.93  +				domain_switch = 0;
    2.94  +			} else {
    2.95 -+				if (state >= sb_bt_start &&
    2.96 ++				if (cpu_current_domain[cpu] !=
    2.97 ++				    COORDINATOR_DOMAIN) {
    2.98 ++					add_sample_entry(s->eip, s->event);
    2.99 ++				}
   2.100 ++				else  if (state >= sb_bt_start &&
   2.101  +				    !add_sample(mm, s, cpu_mode)) {
   2.102  +					if (state == sb_bt_start) {
   2.103  +						state = sb_bt_ignore;
   2.104 @@ -121,9 +156,21 @@ diff -pruN ../orig-linux-2.6.16.29/drive
   2.105   				}
   2.106   			}
   2.107   		}
   2.108 +@@ -548,6 +592,11 @@ void sync_buffer(int cpu)
   2.109 + 	}
   2.110 + 	release_mm(mm);
   2.111 + 
   2.112 ++	/* We reset domain to COORDINATOR at each CPU switch */
   2.113 ++	if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
   2.114 ++		add_domain_switch(COORDINATOR_DOMAIN);
   2.115 ++	}
   2.116 ++
   2.117 + 	mark_done(cpu);
   2.118 + 
   2.119 + 	up(&buffer_sem);
   2.120  diff -pruN ../orig-linux-2.6.16.29/drivers/oprofile/cpu_buffer.c ./drivers/oprofile/cpu_buffer.c
   2.121 ---- ../orig-linux-2.6.16.29/drivers/oprofile/cpu_buffer.c	2006-09-12 19:02:10.000000000 +0100
   2.122 -+++ ./drivers/oprofile/cpu_buffer.c	2006-09-19 14:06:05.000000000 +0100
   2.123 +--- ../orig-linux-2.6.16.29/drivers/oprofile/cpu_buffer.c	2006-11-06 14:46:52.000000000 -0800
   2.124 ++++ ./drivers/oprofile/cpu_buffer.c	2006-11-06 14:47:55.000000000 -0800
   2.125  @@ -6,6 +6,10 @@
   2.126    *
   2.127    * @author John Levon <levon@movementarian.org>
   2.128 @@ -233,8 +280,8 @@ diff -pruN ../orig-linux-2.6.16.29/drive
   2.129    * This serves to avoid cpu buffer overflow, and makes sure
   2.130    * the task mortuary progresses
   2.131  diff -pruN ../orig-linux-2.6.16.29/drivers/oprofile/cpu_buffer.h ./drivers/oprofile/cpu_buffer.h
   2.132 ---- ../orig-linux-2.6.16.29/drivers/oprofile/cpu_buffer.h	2006-09-12 19:02:10.000000000 +0100
   2.133 -+++ ./drivers/oprofile/cpu_buffer.h	2006-09-19 14:06:05.000000000 +0100
   2.134 +--- ../orig-linux-2.6.16.29/drivers/oprofile/cpu_buffer.h	2006-11-06 14:46:52.000000000 -0800
   2.135 ++++ ./drivers/oprofile/cpu_buffer.h	2006-11-06 14:47:55.000000000 -0800
   2.136  @@ -36,7 +36,7 @@ struct oprofile_cpu_buffer {
   2.137   	volatile unsigned long tail_pos;
   2.138   	unsigned long buffer_size;
   2.139 @@ -258,8 +305,8 @@ diff -pruN ../orig-linux-2.6.16.29/drive
   2.140   
   2.141   #endif /* OPROFILE_CPU_BUFFER_H */
   2.142  diff -pruN ../orig-linux-2.6.16.29/drivers/oprofile/event_buffer.h ./drivers/oprofile/event_buffer.h
   2.143 ---- ../orig-linux-2.6.16.29/drivers/oprofile/event_buffer.h	2006-09-12 19:02:10.000000000 +0100
   2.144 -+++ ./drivers/oprofile/event_buffer.h	2006-09-19 14:06:05.000000000 +0100
   2.145 +--- ../orig-linux-2.6.16.29/drivers/oprofile/event_buffer.h	2006-11-06 14:46:52.000000000 -0800
   2.146 ++++ ./drivers/oprofile/event_buffer.h	2006-11-06 14:47:55.000000000 -0800
   2.147  @@ -29,15 +29,20 @@ void wake_up_buffer_waiter(void);
   2.148   #define CPU_SWITCH_CODE 		2
   2.149   #define COOKIE_SWITCH_CODE 		3
   2.150 @@ -283,8 +330,8 @@ diff -pruN ../orig-linux-2.6.16.29/drive
   2.151   void add_event_entry(unsigned long data);
   2.152    
   2.153  diff -pruN ../orig-linux-2.6.16.29/drivers/oprofile/oprof.c ./drivers/oprofile/oprof.c
   2.154 ---- ../orig-linux-2.6.16.29/drivers/oprofile/oprof.c	2006-09-12 19:02:10.000000000 +0100
   2.155 -+++ ./drivers/oprofile/oprof.c	2006-09-19 14:06:05.000000000 +0100
   2.156 +--- ../orig-linux-2.6.16.29/drivers/oprofile/oprof.c	2006-11-06 14:46:52.000000000 -0800
   2.157 ++++ ./drivers/oprofile/oprof.c	2006-11-06 14:47:55.000000000 -0800
   2.158  @@ -5,6 +5,10 @@
   2.159    * @remark Read the file COPYING
   2.160    *
   2.161 @@ -339,8 +386,8 @@ diff -pruN ../orig-linux-2.6.16.29/drive
   2.162   {
   2.163   	int err;
   2.164  diff -pruN ../orig-linux-2.6.16.29/drivers/oprofile/oprof.h ./drivers/oprofile/oprof.h
   2.165 ---- ../orig-linux-2.6.16.29/drivers/oprofile/oprof.h	2006-09-12 19:02:10.000000000 +0100
   2.166 -+++ ./drivers/oprofile/oprof.h	2006-09-19 14:06:05.000000000 +0100
   2.167 +--- ../orig-linux-2.6.16.29/drivers/oprofile/oprof.h	2006-11-06 14:46:52.000000000 -0800
   2.168 ++++ ./drivers/oprofile/oprof.h	2006-11-06 14:47:55.000000000 -0800
   2.169  @@ -35,5 +35,8 @@ void oprofile_create_files(struct super_
   2.170   void oprofile_timer_init(struct oprofile_operations * ops);
   2.171   
   2.172 @@ -351,8 +398,8 @@ diff -pruN ../orig-linux-2.6.16.29/drive
   2.173    
   2.174   #endif /* OPROF_H */
   2.175  diff -pruN ../orig-linux-2.6.16.29/drivers/oprofile/oprofile_files.c ./drivers/oprofile/oprofile_files.c
   2.176 ---- ../orig-linux-2.6.16.29/drivers/oprofile/oprofile_files.c	2006-09-12 19:02:10.000000000 +0100
   2.177 -+++ ./drivers/oprofile/oprofile_files.c	2006-09-19 14:06:05.000000000 +0100
   2.178 +--- ../orig-linux-2.6.16.29/drivers/oprofile/oprofile_files.c	2006-11-06 14:46:52.000000000 -0800
   2.179 ++++ ./drivers/oprofile/oprofile_files.c	2006-11-06 14:47:55.000000000 -0800
   2.180  @@ -5,15 +5,21 @@
   2.181    * @remark Read the file COPYING
   2.182    *
   2.183 @@ -581,8 +628,8 @@ diff -pruN ../orig-linux-2.6.16.29/drive
   2.184   	oprofilefs_create_ulong(sb, root, "buffer_size", &fs_buffer_size);
   2.185   	oprofilefs_create_ulong(sb, root, "buffer_watershed", &fs_buffer_watershed);
   2.186  diff -pruN ../orig-linux-2.6.16.29/include/linux/oprofile.h ./include/linux/oprofile.h
   2.187 ---- ../orig-linux-2.6.16.29/include/linux/oprofile.h	2006-09-12 19:02:10.000000000 +0100
   2.188 -+++ ./include/linux/oprofile.h	2006-09-19 14:06:05.000000000 +0100
   2.189 +--- ../orig-linux-2.6.16.29/include/linux/oprofile.h	2006-11-06 14:46:42.000000000 -0800
   2.190 ++++ ./include/linux/oprofile.h	2006-11-06 14:47:55.000000000 -0800
   2.191  @@ -16,6 +16,8 @@
   2.192   #include <linux/types.h>
   2.193   #include <linux/spinlock.h>
     3.1 --- a/tools/python/xen/util/blkif.py	Thu Nov 09 13:16:55 2006 +0000
     3.2 +++ b/tools/python/xen/util/blkif.py	Thu Nov 09 13:18:58 2006 +0000
     3.3 @@ -23,8 +23,15 @@ def blkdev_name_to_number(name):
     3.4      except Exception, ex:
     3.5          pass
     3.6  
     3.7 -    if re.match( '/dev/sd[a-p]([1-9]|1[0-5])?', n):
     3.8 -        return 8 * 256 + 16 * (ord(n[7:8]) - ord('a')) + int(n[8:] or 0)
     3.9 +    scsi_major = [ 8, 65, 66, 67, 68, 69, 70, 71, 128, 129, 130, 131, 132, 133, 134, 135 ]
    3.10 +    if re.match( '/dev/sd[a-z]([1-9]|1[0-5])?$', n):
    3.11 +        major = scsi_major[(ord(n[7:8]) - ord('a')) / 16]
    3.12 +        minor = ((ord(n[7:8]) - ord('a')) % 16) * 16 + int(n[8:] or 0)
    3.13 +        return major * 256 + minor
    3.14 +    if re.match( '/dev/sd[a-i][a-z]([1-9]|1[0-5])?$', n):
    3.15 +        major = scsi_major[((ord(n[7:8]) - ord('a') + 1) * 26 + (ord(n[8:9]) - ord('a'))) / 16 ]
    3.16 +        minor = (((ord(n[7:8]) - ord('a') + 1 ) * 26 + (ord(n[8:9]) - ord('a'))) % 16) * 16 + int(n[9:] or 0)
    3.17 +        return major * 256 + minor
    3.18  
    3.19      if re.match( '/dev/hd[a-t]([1-9]|[1-5][0-9]|6[0-3])?', n):
    3.20          ide_majors = [ 3, 22, 33, 34, 56, 57, 88, 89, 90, 91 ]