debuggers.hg
changeset 620:01725801761a
bitkeeper revision 1.322 (3f0d22cccb17_me9ZBYMkbZaFLovQg)
Get the new segment probing stuff to actually return useful
information...
Get the new segment probing stuff to actually return useful
information...
author | sos22@labyrinth.cl.cam.ac.uk |
---|---|
date | Thu Jul 10 08:24:44 2003 +0000 (2003-07-10) |
parents | 3539152a9fab |
children | 28609bfc41a3 |
files | .rootkeys BitKeeper/etc/ignore xen/drivers/block/xen_block.c xen/drivers/block/xen_segment.c xen/include/hypervisor-ifs/block.h xen/include/hypervisor-ifs/segment.h xen/include/xeno/segment.h xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_segment_proc.c xenolinux-2.4.21-sparse/include/asm-xeno/dom0.h |
line diff
1.1 --- a/.rootkeys Wed Jul 09 15:39:13 2003 +0000 1.2 +++ b/.rootkeys Thu Jul 10 08:24:44 2003 +0000 1.3 @@ -385,6 +385,7 @@ 3ddb79c2PMeWTK86y4C3F4MzHw4A1g xen/inclu 1.4 3ddb79c25UE59iu4JJcbRalx95mvcg xen/include/hypervisor-ifs/hypervisor-if.h 1.5 3ead095dE_VF-QA88rl_5cWYRWtRVQ xen/include/hypervisor-ifs/kbd.h 1.6 3ddb79c2oRPrzClk3zbTkRHlpumzKA xen/include/hypervisor-ifs/network.h 1.7 +3f0d22cbroqp_BkoDPwkfRJhaw1LiQ xen/include/hypervisor-ifs/segment.h 1.8 3ddb79c4qbCoOFHrv9sCGshbWzBVlQ xen/include/scsi/scsi.h 1.9 3ddb79c4R4iVwqIIeychVQYmIH4FUg xen/include/scsi/scsi_ioctl.h 1.10 3ddb79c4yw_mfd4Uikn3v_IOPRpa1Q xen/include/scsi/scsicam.h
2.1 --- a/BitKeeper/etc/ignore Wed Jul 09 15:39:13 2003 +0000 2.2 +++ b/BitKeeper/etc/ignore Thu Jul 10 08:24:44 2003 +0000 2.3 @@ -436,3 +436,4 @@ xen/drivers/block/xen_physdisk.c~ 2.4 tools/internal/xi_phys_grant.c~ 2.5 tools/internal/xi_phys_probe.c~ 2.6 tools/internal/xi_phys_revoke.c~ 2.7 +xen/include/hypervisor-ifs/segment.h~
3.1 --- a/xen/drivers/block/xen_block.c Wed Jul 09 15:39:13 2003 +0000 3.2 +++ b/xen/drivers/block/xen_block.c Thu Jul 10 08:24:44 2003 +0000 3.3 @@ -571,10 +571,8 @@ static void dispatch_probe_blk(struct ta 3.4 make_response(p, blk_ring->ring[index].req.id, XEN_BLOCK_PROBE_BLK, rc); 3.5 } 3.6 3.7 -static void dispatch_probe_seg_common(struct task_struct *p, 3.8 - struct task_struct *target, 3.9 - int type, 3.10 - int index) 3.11 +static void dispatch_probe_seg(struct task_struct *p, 3.12 + int index) 3.13 { 3.14 extern void xen_segment_probe(struct task_struct *, xen_disk_info_t *); 3.15 3.16 @@ -597,22 +595,43 @@ static void dispatch_probe_seg_common(st 3.17 spin_unlock_irqrestore(&p->page_lock, flags); 3.18 3.19 xdi = phys_to_virt(buffer); 3.20 - xen_segment_probe(target, xdi); 3.21 + xen_segment_probe(p, xdi); 3.22 3.23 unlock_buffer(p, buffer, sizeof(xen_disk_info_t), 1); 3.24 3.25 out: 3.26 - make_response(p, blk_ring->ring[index].req.id, type, rc); 3.27 -} 3.28 - 3.29 -static void dispatch_probe_seg(struct task_struct *p, int index) 3.30 -{ 3.31 - dispatch_probe_seg_common(p, p, XEN_BLOCK_PROBE_SEG, index); 3.32 + make_response(p, blk_ring->ring[index].req.id, XEN_BLOCK_PROBE_SEG, rc); 3.33 } 3.34 3.35 static void dispatch_probe_seg_all(struct task_struct *p, int index) 3.36 { 3.37 - dispatch_probe_seg_common(p, NULL, XEN_BLOCK_PROBE_SEG_ALL, index); 3.38 + extern void xen_segment_probe_all(xen_segment_info_t *); 3.39 + 3.40 + blk_ring_t *blk_ring = p->blk_ring_base; 3.41 + xen_segment_info_t *xsi; 3.42 + unsigned long flags, buffer; 3.43 + int rc = 0; 3.44 + 3.45 + buffer = blk_ring->ring[index].req.buffer_and_sects[0] & ~0x1FF; 3.46 + 3.47 + spin_lock_irqsave(&p->page_lock, flags); 3.48 + if ( !__buffer_is_valid(p, buffer, sizeof(xen_segment_info_t), 1) ) 3.49 + { 3.50 + DPRINTK("Bad buffer in dispatch_probe_seg_all\n"); 3.51 + spin_unlock_irqrestore(&p->page_lock, flags); 3.52 + rc = 1; 3.53 + goto out; 3.54 + } 3.55 + __lock_buffer(buffer, sizeof(xen_segment_info_t), 1); 3.56 + spin_unlock_irqrestore(&p->page_lock, flags); 3.57 + 3.58 + xsi = phys_to_virt(buffer); 3.59 + xen_segment_probe_all(xsi); 3.60 + 3.61 + unlock_buffer(p, buffer, sizeof(xen_segment_info_t), 1); 3.62 + 3.63 + out: 3.64 + make_response(p, blk_ring->ring[index].req.id, XEN_BLOCK_PROBE_SEG_ALL, rc); 3.65 } 3.66 3.67 static void dispatch_rw_block_io(struct task_struct *p, int index)
4.1 --- a/xen/drivers/block/xen_segment.c Wed Jul 09 15:39:13 2003 +0000 4.2 +++ b/xen/drivers/block/xen_segment.c Thu Jul 10 08:24:44 2003 +0000 4.3 @@ -162,7 +162,7 @@ void xen_segment_probe(struct task_struc 4.4 for ( loop = 0; loop < XEN_MAX_SEGMENTS; loop++ ) 4.5 { 4.6 if ( (xsegments[loop].mode == XEN_SEGMENT_UNUSED) || 4.7 - (p && xsegments[loop].domain != p->domain) ) 4.8 + (xsegments[loop].domain != p->domain) ) 4.9 continue; 4.10 4.11 device = MK_VIRTUAL_XENDEV(xsegments[loop].segment_number); 4.12 @@ -178,6 +178,39 @@ void xen_segment_probe(struct task_struc 4.13 } 4.14 4.15 /* 4.16 + * xen_segment_probe_all 4.17 + * 4.18 + * return a list of all segments to domain 0 4.19 + */ 4.20 +void xen_segment_probe_all(xen_segment_info_t *raw_xsi) 4.21 +{ 4.22 + int loop; 4.23 + xen_segment_info_t *xsi = map_domain_mem(virt_to_phys(raw_xsi)); 4.24 + unsigned long device; 4.25 + 4.26 + xsi->count = 0; 4.27 + for ( loop = 0; loop < XEN_MAX_SEGMENTS; loop++ ) 4.28 + { 4.29 + if ( xsegments[loop].mode == XEN_SEGMENT_UNUSED ) 4.30 + continue; 4.31 + 4.32 + device = MK_VIRTUAL_XENDEV(xsegments[loop].segment_number); 4.33 + 4.34 + printk("Doing seg %d.\n", xsi->count); 4.35 + xsi->segments[xsi->count].device = device; 4.36 + xsi->segments[xsi->count].domain = xsegments[loop].domain; 4.37 + memcpy(xsi->segments[xsi->count].key, 4.38 + xsegments[loop].key, 4.39 + XEN_SEGMENT_KEYSIZE); 4.40 + xsi->segments[xsi->count].seg_nr = xsegments[loop].segment_number; 4.41 + printk("Done.\n"); 4.42 + xsi->count++; 4.43 + } 4.44 + 4.45 + unmap_domain_mem(xsi); 4.46 +} 4.47 + 4.48 +/* 4.49 * xen_refresh_segment_list 4.50 * 4.51 * find all segments associated with a domain and assign 4.52 @@ -230,6 +263,7 @@ int xen_segment_create(xv_disk_t *xvd_in 4.53 xsegments[idx].mode = xvd->mode; 4.54 xsegments[idx].domain = xvd->domain; 4.55 xsegments[idx].segment_number = xvd->segment; 4.56 + memcpy(xsegments[idx].key, xvd->key, XEN_SEGMENT_KEYSIZE); 4.57 xsegments[idx].num_extents = xvd->ext_count; 4.58 xsegments[idx].extents = (extent_t *)kmalloc( 4.59 sizeof(extent_t)*xvd->ext_count,
5.1 --- a/xen/include/hypervisor-ifs/block.h Wed Jul 09 15:39:13 2003 +0000 5.2 +++ b/xen/include/hypervisor-ifs/block.h Thu Jul 10 08:24:44 2003 +0000 5.3 @@ -135,11 +135,14 @@ typedef struct xv_extent 5.4 unsigned long size; /* size in blocks */ 5.5 } xv_extent_t; 5.6 5.7 +#define XEN_SEGMENT_KEYSIZE 10 5.8 + 5.9 typedef struct xv_disk 5.10 { 5.11 int mode; /* XEN_DISK_READ_WRITE or XEN_DISK_READ_ONLY */ 5.12 int domain; /* domain */ 5.13 int segment; /* segment number */ 5.14 + char key[XEN_SEGMENT_KEYSIZE]; /* key for benefit of dom0 userspace */ 5.15 int ext_count; /* number of xv_extent_t to follow */ 5.16 xv_extent_t extents[XEN_MAX_DISK_COUNT]; /* arbitrary reuse of constant */ 5.17 } xv_disk_t;
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/xen/include/hypervisor-ifs/segment.h Thu Jul 10 08:24:44 2003 +0000 6.3 @@ -0,0 +1,17 @@ 6.4 +#ifndef __HYP_IFS_SEGMENT_H__ 6.5 +#define __HYP_IFS_SEGMENT_H__ 6.6 + 6.7 +#define XEN_MAX_SEGMENTS 100 /* total number of segments across all doms */ 6.8 + 6.9 +typedef struct xen_segment_info 6.10 +{ 6.11 + int count; 6.12 + struct { 6.13 + unsigned domain; 6.14 + unsigned seg_nr; 6.15 + char key[XEN_SEGMENT_KEYSIZE]; 6.16 + unsigned short device; 6.17 + } segments[XEN_MAX_SEGMENTS]; 6.18 +} xen_segment_info_t; 6.19 + 6.20 +#endif /* __HYP_IFS_SEGMENT_H__ */
7.1 --- a/xen/include/xeno/segment.h Wed Jul 09 15:39:13 2003 +0000 7.2 +++ b/xen/include/xeno/segment.h Thu Jul 10 08:24:44 2003 +0000 7.3 @@ -2,6 +2,7 @@ 7.4 #define __SEGMENT_H__ 7.5 7.6 #include <hypervisor-ifs/block.h> 7.7 +#include <hypervisor-ifs/segment.h> 7.8 7.9 /* Describes a physical disk extent. */ 7.10 typedef struct { 7.11 @@ -11,6 +12,8 @@ typedef struct { 7.12 unsigned long buffer; 7.13 } phys_seg_t; 7.14 7.15 +struct task_struct; 7.16 + 7.17 void xen_segment_initialize(void); 7.18 void xen_refresh_segment_list (struct task_struct *p); 7.19 int xen_segment_create(xv_disk_t *xvd); 7.20 @@ -19,8 +22,6 @@ int xen_segment_map_request( 7.21 unsigned short segment_number, 7.22 unsigned long sect_nr, unsigned long buffer, unsigned short nr_sects); 7.23 7.24 -#define XEN_MAX_SEGMENTS 100 /* total number of segments across all doms */ 7.25 - 7.26 /* 7.27 * virtual hard disks 7.28 * 7.29 @@ -43,6 +44,7 @@ typedef struct segment 7.30 int mode; /* UNUSED, RO, or RW */ 7.31 int domain; 7.32 int segment_number; /* segment number for domain */ 7.33 + char key[XEN_SEGMENT_KEYSIZE]; /* for the userspace tools in dom0 */ 7.34 int num_extents; /* number of extents */ 7.35 extent_t *extents; 7.36 } segment_t;
8.1 --- a/xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_segment_proc.c Wed Jul 09 15:39:13 2003 +0000 8.2 +++ b/xenolinux-2.4.21-sparse/arch/xeno/drivers/block/xl_segment_proc.c Thu Jul 10 08:24:44 2003 +0000 8.3 @@ -8,6 +8,7 @@ 8.4 #include <linux/proc_fs.h> 8.5 #include <linux/delay.h> 8.6 #include <linux/seq_file.h> 8.7 +#include <asm/hypervisor-ifs/segment.h> 8.8 8.9 static struct proc_dir_entry *vhd; 8.10 8.11 @@ -15,7 +16,7 @@ extern unsigned short xldev_to_physdev(k 8.12 8.13 static void *proc_vhd_next(struct seq_file *s, void *v, loff_t *pos) 8.14 { 8.15 - xen_disk_info_t *data; 8.16 + xen_segment_info_t *data; 8.17 8.18 if ( pos != NULL ) 8.19 ++(*pos); 8.20 @@ -27,7 +28,7 @@ static void *proc_vhd_next(struct seq_fi 8.21 static void *proc_vhd_start(struct seq_file *s, loff_t *ppos) 8.22 { 8.23 loff_t pos = *ppos; 8.24 - xen_disk_info_t *data; 8.25 + xen_segment_info_t *data; 8.26 8.27 data = kmalloc(sizeof(*data), GFP_KERNEL); 8.28 xenolinux_control_msg(XEN_BLOCK_PROBE_SEG_ALL, (char *)data, sizeof(*data)); 8.29 @@ -42,13 +43,14 @@ static void *proc_vhd_start(struct seq_f 8.30 8.31 static int proc_vhd_show(struct seq_file *s, void *v) 8.32 { 8.33 - xen_disk_info_t *data = v; 8.34 + xen_segment_info_t *data = v; 8.35 8.36 seq_printf (s, 8.37 - "%4x %4x %lx\n", 8.38 - data->disks[data->count - 1].device, 8.39 - data->disks[data->count - 1].type, 8.40 - data->disks[data->count - 1].capacity); 8.41 + "%x %x %10.10s %x\n", 8.42 + data->segments[data->count - 1].domain, 8.43 + data->segments[data->count - 1].seg_nr, 8.44 + data->segments[data->count - 1].key, 8.45 + data->segments[data->count - 1].device); 8.46 8.47 return 0; 8.48 } 8.49 @@ -201,6 +203,22 @@ static int proc_write_vhd(struct file *f 8.50 } 8.51 xvd.segment = (int) to_number(string); 8.52 8.53 + string = get_string(NULL); /* look for key */ 8.54 + if (string == NULL || (*string != 'k' && *string != 'K')) 8.55 + { 8.56 + printk (KERN_ALERT 8.57 + "error: key specifier missing [%s]. should be \"key\".\n", 8.58 + string); 8.59 + goto out; 8.60 + } 8.61 + string = get_string(NULL); 8.62 + if (string == NULL || strlen(string) != XEN_SEGMENT_KEYSIZE) 8.63 + { 8.64 + printk (KERN_ALERT "error: key missing\n"); 8.65 + goto out; 8.66 + } 8.67 + memcpy(xvd.key, string, XEN_SEGMENT_KEYSIZE); 8.68 + 8.69 string = get_string(NULL); /* look for Extents */ 8.70 if (string == NULL || (*string != 'e' && *string != 'E')) 8.71 {
9.1 --- a/xenolinux-2.4.21-sparse/include/asm-xeno/dom0.h Wed Jul 09 15:39:13 2003 +0000 9.2 +++ b/xenolinux-2.4.21-sparse/include/asm-xeno/dom0.h Thu Jul 10 08:24:44 2003 +0000 9.3 @@ -33,4 +33,4 @@ struct dom0_dopgupdates_args 9.4 unsigned long num_pgt_updates; 9.5 }; 9.6 9.7 -#endif __DOM0_H__ /* __DOM0_H__ */ 9.8 +#endif /* __DOM0_H__ */