ia64/xen-unstable

changeset 255:3ad7fdd91087

bitkeeper revision 1.105.1.5 (3e5f78b2JrROb7627ksGnXNIWgAM3w)

domain builder fix
author smh22@boulderdash.cl.cam.ac.uk
date Fri Feb 28 14:56:50 2003 +0000 (2003-02-28)
parents 2177b1e83599
children d88600b1da0e
files BitKeeper/etc/ignore tools/domain_builder/dom_builder.c xen/common/keyhandler.c
line diff
     1.1 --- a/BitKeeper/etc/ignore	Thu Feb 27 19:12:00 2003 +0000
     1.2 +++ b/BitKeeper/etc/ignore	Fri Feb 28 14:56:50 2003 +0000
     1.3 @@ -22,3 +22,134 @@ xenolinux-2.4.16-sparse/scripts/kconfig.
     1.4  xen-2.4.16/foo
     1.5  xen-2.4.16/common/domain.c.smh
     1.6  URK
     1.7 +tools/domain_builder/dom_builder.o
     1.8 +tools/domain_builder/dom_kill.o
     1.9 +tools/domain_builder/domain_builder
    1.10 +tools/domain_builder/kill_domain
    1.11 +xen/arch/i386/acpitable.o
    1.12 +xen/arch/i386/apic.o
    1.13 +xen/arch/i386/arch.o
    1.14 +xen/arch/i386/boot/boot.o
    1.15 +xen/arch/i386/delay.o
    1.16 +xen/arch/i386/entry.o
    1.17 +xen/arch/i386/extable.o
    1.18 +xen/arch/i386/i387.o
    1.19 +xen/arch/i386/i8259.o
    1.20 +xen/arch/i386/idle0_task.o
    1.21 +xen/arch/i386/io_apic.o
    1.22 +xen/arch/i386/ioremap.o
    1.23 +xen/arch/i386/irq.o
    1.24 +xen/arch/i386/mm.o
    1.25 +xen/arch/i386/mpparse.o
    1.26 +xen/arch/i386/pci-dma.o
    1.27 +xen/arch/i386/pci-i386.o
    1.28 +xen/arch/i386/pci-irq.o
    1.29 +xen/arch/i386/pci-pc.o
    1.30 +xen/arch/i386/process.o
    1.31 +xen/arch/i386/rwlock.o
    1.32 +xen/arch/i386/setup.o
    1.33 +xen/arch/i386/smp.o
    1.34 +xen/arch/i386/smpboot.o
    1.35 +xen/arch/i386/time.o
    1.36 +xen/arch/i386/trampoline.o
    1.37 +xen/arch/i386/traps.o
    1.38 +xen/arch/i386/usercopy.o
    1.39 +xen/common/ac_timer.o
    1.40 +xen/common/block.o
    1.41 +xen/common/brlock.o
    1.42 +xen/common/common.o
    1.43 +xen/common/dom0_ops.o
    1.44 +xen/common/domain.o
    1.45 +xen/common/domain_page.o
    1.46 +xen/common/event.o
    1.47 +xen/common/kernel.o
    1.48 +xen/common/keyhandler.o
    1.49 +xen/common/lib.o
    1.50 +xen/common/memory.o
    1.51 +xen/common/network.o
    1.52 +xen/common/page_alloc.o
    1.53 +xen/common/perfc.o
    1.54 +xen/common/resource.o
    1.55 +xen/common/schedule.o
    1.56 +xen/common/slab.o
    1.57 +xen/common/softirq.o
    1.58 +xen/common/timer.o
    1.59 +xen/common/vsprintf.o
    1.60 +xen/drivers/block/blkpg.o
    1.61 +xen/drivers/block/driver.o
    1.62 +xen/drivers/block/elevator.o
    1.63 +xen/drivers/block/genhd.o
    1.64 +xen/drivers/block/ll_rw_blk.o
    1.65 +xen/drivers/block/xen_block.o
    1.66 +xen/drivers/char/driver.o
    1.67 +xen/drivers/char/xen_kbd.o
    1.68 +xen/drivers/char/xen_serial.o
    1.69 +xen/drivers/ide/driver.o
    1.70 +xen/drivers/ide/ide-disk.o
    1.71 +xen/drivers/ide/ide-dma.o
    1.72 +xen/drivers/ide/ide-features.o
    1.73 +xen/drivers/ide/ide-geometry.o
    1.74 +xen/drivers/ide/ide-pci.o
    1.75 +xen/drivers/ide/ide-probe.o
    1.76 +xen/drivers/ide/ide-taskfile.o
    1.77 +xen/drivers/ide/ide-xeno.o
    1.78 +xen/drivers/ide/ide.o
    1.79 +xen/drivers/ide/piix.o
    1.80 +xen/drivers/net/3c59x.o
    1.81 +xen/drivers/net/Space.o
    1.82 +xen/drivers/net/driver.o
    1.83 +xen/drivers/net/e1000/e1000.o
    1.84 +xen/drivers/net/e1000/e1000_ethtool.o
    1.85 +xen/drivers/net/e1000/e1000_hw.o
    1.86 +xen/drivers/net/e1000/e1000_main.o
    1.87 +xen/drivers/net/e1000/e1000_param.o
    1.88 +xen/drivers/net/ne/8390.o
    1.89 +xen/drivers/net/ne/ne.o
    1.90 +xen/drivers/net/ne/ne_drv.o
    1.91 +xen/drivers/net/net_init.o
    1.92 +xen/drivers/net/setup.o
    1.93 +xen/drivers/net/tg3.o
    1.94 +xen/drivers/pci/classlist.h
    1.95 +xen/drivers/pci/compat.o
    1.96 +xen/drivers/pci/devlist.h
    1.97 +xen/drivers/pci/driver.o
    1.98 +xen/drivers/pci/gen-devlist
    1.99 +xen/drivers/pci/names.o
   1.100 +xen/drivers/pci/pci.o
   1.101 +xen/drivers/pci/quirks.o
   1.102 +xen/drivers/pci/setup-res.o
   1.103 +xen/drivers/scsi/aacraid/aachba.o
   1.104 +xen/drivers/scsi/aacraid/aacraid.o
   1.105 +xen/drivers/scsi/aacraid/commctrl.o
   1.106 +xen/drivers/scsi/aacraid/comminit.o
   1.107 +xen/drivers/scsi/aacraid/commsup.o
   1.108 +xen/drivers/scsi/aacraid/dpcsup.o
   1.109 +xen/drivers/scsi/aacraid/linit.o
   1.110 +xen/drivers/scsi/aacraid/rx.o
   1.111 +xen/drivers/scsi/aacraid/sa.o
   1.112 +xen/drivers/scsi/constants.o
   1.113 +xen/drivers/scsi/driver.o
   1.114 +xen/drivers/scsi/hosts.o
   1.115 +xen/drivers/scsi/scsi.o
   1.116 +xen/drivers/scsi/scsi_dma.o
   1.117 +xen/drivers/scsi/scsi_error.o
   1.118 +xen/drivers/scsi/scsi_ioctl.o
   1.119 +xen/drivers/scsi/scsi_lib.o
   1.120 +xen/drivers/scsi/scsi_merge.o
   1.121 +xen/drivers/scsi/scsi_proc.o
   1.122 +xen/drivers/scsi/scsi_queue.o
   1.123 +xen/drivers/scsi/scsi_scan.o
   1.124 +xen/drivers/scsi/scsi_syms.o
   1.125 +xen/drivers/scsi/scsicam.o
   1.126 +xen/drivers/scsi/sd.o
   1.127 +xen/image
   1.128 +xen/image.gz
   1.129 +xen/include/asm
   1.130 +xen/include/linux
   1.131 +xen/net/dev.o
   1.132 +xen/net/dev_mcast.o
   1.133 +xen/net/devinit.o
   1.134 +xen/net/eth.o
   1.135 +xen/net/network.o
   1.136 +xen/net/skbuff.o
   1.137 +xen/tools/elf-reloc
     2.1 --- a/tools/domain_builder/dom_builder.c	Thu Feb 27 19:12:00 2003 +0000
     2.2 +++ b/tools/domain_builder/dom_builder.c	Fri Feb 28 14:56:50 2003 +0000
     2.3 @@ -52,10 +52,10 @@ static void dom_mem_cleanup(dom_mem_t * 
     2.4      if(mem_fd < 0){
     2.5          perror(PERR_STRING);
     2.6      }
     2.7 -
     2.8 -	if(write(mem_fd, (dom_mem_t *)dom_mem, sizeof(dom_mem_t)) < 0){
     2.9 -		dbstatus("Error unmapping domain's memory.\n");
    2.10 -	}
    2.11 +    
    2.12 +    if(write(mem_fd, (dom_mem_t *)dom_mem, sizeof(dom_mem_t)) < 0){
    2.13 +	dbstatus("Error unmapping domain's memory.\n");
    2.14 +    }
    2.15  
    2.16      close(mem_fd);
    2.17  }
    2.18 @@ -163,7 +163,7 @@ static dom0_newdomain_t * create_new_dom
    2.19      close(id_fd);
    2.20      
    2.21      sprintf(cmd_path, "Reserved %ld kbytes memory and assigned id %d to the"
    2.22 -                    "new domain.", req_mem, dom_data->domain);
    2.23 +	    " new domain.", req_mem, dom_data->domain);
    2.24      dbstatus(cmd_path);
    2.25  
    2.26      return dom_data;
    2.27 @@ -386,6 +386,7 @@ static int launch_domain(dom_meminfo_t  
    2.28      dbstatus("Launched the new domain!");
    2.29  
    2.30      close(cmd_fd);
    2.31 +    return 0;
    2.32  }
    2.33  
    2.34  int main(int argc, char **argv)
    2.35 @@ -401,51 +402,45 @@ int main(int argc, char **argv)
    2.36      int kernel_fd;
    2.37      int count;
    2.38      int cmd_len;
    2.39 -    int ret = 0;
    2.40 +    int rc = -1;
    2.41  
    2.42 -	unsigned long addr;
    2.43 +    unsigned long addr;
    2.44  
    2.45 -    if(argc < 4){
    2.46 +    if(argc < 4) {
    2.47          dberr("Usage: dom_builder <kbytes_mem> <image> <num_vifs> "
    2.48 -                        "<boot_params>\n");
    2.49 -        ret = -1;
    2.50 +	      "<boot_params>\n");
    2.51          goto out;
    2.52      }
    2.53  
    2.54      /* create new domain and set up all the neccessary mappings */
    2.55  
    2.56      kernel_fd = do_kernel_chcks(argv[2], atol(argv[1]), &load_addr, &ksize);
    2.57 -    if(kernel_fd < 0){
    2.58 -        ret = -1;
    2.59 +    if(kernel_fd < 0) {
    2.60 +	rc = errno; 
    2.61          goto out;
    2.62      }
    2.63 -
    2.64 +    
    2.65      /* request the creation of new domain */
    2.66 -    dom_data = create_new_domain(atol(argv[1]));
    2.67 -    if(dom_data == 0){
    2.68 -        ret = -1;
    2.69 +    if(!(dom_data = create_new_domain(atol(argv[1])))) 
    2.70          goto out;
    2.71 -    }
    2.72  
    2.73      /* map domain's memory */
    2.74 -    if(map_dom_mem(dom_data->pg_head, dom_data->memory_kb >> (PAGE_SHIFT - 10), 
    2.75 -        dom_data->domain, &dom_os_image)){
    2.76 -        ret = -1;
    2.77 +    if(map_dom_mem(dom_data->pg_head, dom_data->memory_kb >> (PAGE_SHIFT-10), 
    2.78 +		   dom_data->domain, &dom_os_image))
    2.79          goto out;
    2.80 -    }
    2.81  
    2.82      /* the following code does the actual domain building */
    2.83 -    meminfo = setup_guestos(dom_data->domain, kernel_fd, load_addr, ksize, 
    2.84 -        &dom_os_image);
    2.85 -    if(meminfo == NULL){
    2.86 -		printf("Domain Builder: debug: meminfo NULL\n");
    2.87 -        ret = -1;
    2.88 -        dom_mem_cleanup(&dom_os_image);
    2.89 +    meminfo = setup_guestos(dom_data->domain, kernel_fd, load_addr, 
    2.90 +			    ksize, &dom_os_image); 
    2.91 +    
    2.92 +    /* and unmap the new domain's memory image since we no longer need it */
    2.93 +    dom_mem_cleanup(&dom_os_image);
    2.94 +
    2.95 +    if(!meminfo) { 
    2.96 +	printf("Domain Builder: debug: meminfo NULL\n");
    2.97          goto out;
    2.98      }
    2.99  
   2.100 -    dom_mem_cleanup(&dom_os_image);
   2.101 -
   2.102      meminfo->virt_load_addr = load_addr;
   2.103      meminfo->num_vifs = atoi(argv[3]);
   2.104      meminfo->cmd_line[0] = '\0';
   2.105 @@ -471,13 +466,11 @@ int main(int argc, char **argv)
   2.106      dbstatus(status);
   2.107      
   2.108      /* and launch the domain */
   2.109 -    if(launch_domain(meminfo) != 0)
   2.110 -	ret = -1;
   2.111 -
   2.112 +    rc = launch_domain(meminfo); 
   2.113      
   2.114  out:
   2.115 -    if( ret >= 0 )
   2.116 +    if( rc >= 0 )
   2.117         return meminfo->domain;
   2.118      else 
   2.119 -       return ret;
   2.120 +       return rc;
   2.121  }
     3.1 --- a/xen/common/keyhandler.c	Thu Feb 27 19:12:00 2003 +0000
     3.2 +++ b/xen/common/keyhandler.c	Fri Feb 28 14:56:50 2003 +0000
     3.3 @@ -76,7 +76,7 @@ void halt_machine(u_char key, void *dev_
     3.4  /* XXX SMH: this is keir's fault */
     3.5  static char *task_states[] = 
     3.6  { 
     3.7 -    "Running", 
     3.8 +    "Runnable", 
     3.9      "Interruptible Sleep", 
    3.10      "Uninterruptible Sleep", 
    3.11      NULL, "Stopped", 
    3.12 @@ -104,9 +104,8 @@ void do_task_queues(u_char key, void *de
    3.13  	    printk("Notifying guest...\n"); 
    3.14  	    set_bit(_EVENT_DEBUG, &s->events); 
    3.15  	}
    3.16 -    }
    3.17 +    } while ( (p = p->next_task) != &idle0_task );
    3.18  
    3.19 -    while ( (p = p->next_task) != &idle0_task );
    3.20      read_unlock_irqrestore(&tasklist_lock, flags); 
    3.21  }
    3.22