ia64/xen-unstable

changeset 2261:0cc2746cbe19

bitkeeper revision 1.1159.1.71 (41222dd4fZJ-eLP-14ipE-SQAgV3uQ)

Merge ssh://xenbk@gandalf.hpl.hp.com//var/bk/xeno-unstable.bk
into labyrinth.cl.cam.ac.uk:/auto/anfs/scratch/labyrinth/iap10/xeno-clone/xeno.bk
author iap10@labyrinth.cl.cam.ac.uk
date Tue Aug 17 16:09:56 2004 +0000 (2004-08-17)
parents 613af610be8a a7d13ecf88c5
children dff63a2cfa54 0dd4b96ce798
files .rootkeys linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c linux-2.6.7-xen-sparse/arch/xen/i386/mm/mmap.c linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6.7-xen-sparse/drivers/xen/netfront/netfront.c linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mmu_context.h linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/processor.h linux-2.6.7-xen-sparse/include/asm-xen/hypervisor.h linux-2.6.7-xen-sparse/include/asm-xen/suspend.h tools/libxc/xc_linux_build.c tools/libxc/xc_linux_restore.c tools/libxc/xc_linux_save.c tools/libxc/xc_netbsd_build.c tools/libxc/xc_private.h tools/python/xen/sv/CreateDomain.py tools/python/xen/sv/DomInfo.py tools/python/xen/sv/DomList.py tools/python/xen/sv/HTMLBase.py tools/python/xen/sv/Main.py tools/python/xen/sv/NodeInfo.py tools/python/xen/sv/util.py tools/sv/Makefile tools/sv/images/destroy.png tools/sv/images/small-destroy.png tools/sv/images/small-pause.png tools/sv/images/small-unpause.png tools/sv/inc/script.js xen/common/dom_mem_ops.c xen/include/hypervisor-ifs/grant_table.h xen/include/hypervisor-ifs/hypervisor-if.h xen/include/hypervisor-ifs/io/domain_controller.h
line diff
     1.1 --- a/.rootkeys	Mon Aug 16 09:59:28 2004 +0000
     1.2 +++ b/.rootkeys	Tue Aug 17 16:09:56 2004 +0000
     1.3 @@ -218,6 +218,7 @@ 40f5623aDLxmbOtUHvkWztKjAO4EjA linux-2.6
     1.4  41062ab7HMSSuaUv3_Z4agLpjSO88A linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/pci-functions.h
     1.5  40f5623aDMCsWOFO0jktZ4e8sjwvEg linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h
     1.6  40f5623arsFXkGdPvIqvFi3yFXGR0Q linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_pre.h
     1.7 +4120f807GCO0uqsLqdZj9csxR1Wthw linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mmu_context.h
     1.8  40f5623aFTyFTR-vdiA-KaGxk5JOKQ linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/msr.h
     1.9  40f5623adgjZq9nAgCt0IXdWl7udSA linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/page.h
    1.10  40f5623a54NuG-7qHihGYmw4wWQnMA linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/param.h
    1.11 @@ -442,6 +443,7 @@ 40cf2937PSslwBliN1g7ofDy2H_RhA tools/pyt
    1.12  40cf2937Z8WCNOnO2FcWdubvEAF9QQ tools/python/xen/xm/shutdown.py
    1.13  40fcefb2K1xqVVT4D-p7nL2GzS4scg tools/sv/Main.rpy
    1.14  40ffbcb66Dj5F-1kCK9BcgSqCWkt1w tools/sv/Makefile
    1.15 +4120b0e5L_nW-u0MWRfIdXg4ng4OjA tools/sv/images/destroy.png
    1.16  4107c921_OR9NTSv2dKFiLCXxrXoxA tools/sv/images/finish.png
    1.17  40fcefb3wXQMsl9WkgQAVtdrupm4sw tools/sv/images/left-end-highlight.jpg
    1.18  40fcefb3K6ESt5sQhD9aCQRscQIlXQ tools/sv/images/left-end-no-highlight.jpg
    1.19 @@ -459,6 +461,9 @@ 40fcefb3qNbAZR5FYGPAZ9sFPVMTDA tools/sv/
    1.20  40fcefb3dgsa24WLk_BJeYQHrDLuOg tools/sv/images/seperator-right-highlight.jpg
    1.21  40fcefb3FtiX4Pd2kT8wDlp8u8xRhQ tools/sv/images/seperator.jpg
    1.22  41013a82sUdUqBv8EoAUJii3gsZ-4g tools/sv/images/shutdown.png
    1.23 +4120b0e5RyNoIQNMjUs4A2kshovjaQ tools/sv/images/small-destroy.png
    1.24 +4120b0e6vW66wW6WvjQyFD0AZH2tng tools/sv/images/small-pause.png
    1.25 +4120b0e6USof7ieyGxEvtCdTMpxaQw tools/sv/images/small-unpause.png
    1.26  4104ffca-jPHLVOrW0n0VghEXXtKxg tools/sv/images/unpause.png
    1.27  40fcefb3yMSrZvApO9ToIi-iQwnchA tools/sv/images/xen.png
    1.28  41013a83z27rKvWIxAfUBMVZ1eDCDg tools/sv/inc/script.js
    1.29 @@ -682,6 +687,7 @@ 404f1bc68SXxmv0zQpXBWGrCzSyp8w xen/inclu
    1.30  404f1bc7IwU-qnH8mJeVu0YsNGMrcw xen/include/hypervisor-ifs/arch-x86_64.h
    1.31  3ddb79c2PMeWTK86y4C3F4MzHw4A1g xen/include/hypervisor-ifs/dom0_ops.h
    1.32  403cd194j2pyLqXD8FJ-ukvZzkPenw xen/include/hypervisor-ifs/event_channel.h
    1.33 +4121d149udGfSUGhn3k1ECz0bM31nQ xen/include/hypervisor-ifs/grant_table.h
    1.34  3ddb79c25UE59iu4JJcbRalx95mvcg xen/include/hypervisor-ifs/hypervisor-if.h
    1.35  40f5623bqoi4GEoBiiUc6TZk1HjsMg xen/include/hypervisor-ifs/io/blkif.h
    1.36  40dc4076pVeE1kEEWzcUaNZin65kCA xen/include/hypervisor-ifs/io/domain_controller.h
     2.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c	Mon Aug 16 09:59:28 2004 +0000
     2.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c	Tue Aug 17 16:09:56 2004 +0000
     2.3 @@ -502,10 +502,10 @@ struct task_struct fastcall * __switch_t
     2.4  				 *next = &next_p->thread;
     2.5  	int cpu = smp_processor_id();
     2.6  	struct tss_struct *tss = init_tss + cpu;
     2.7 -	unsigned long flags;
     2.8  	dom0_op_t op;
     2.9  
    2.10 -	local_irq_save(flags);
    2.11 +        /* NB. No need to disable interrupts as already done in sched.c */
    2.12 +        /* __cli(); */
    2.13  
    2.14  	/*
    2.15  	 * Save away %fs and %gs. No need to save %es and %ds, as
    2.16 @@ -569,8 +569,7 @@ struct task_struct fastcall * __switch_t
    2.17  
    2.18  	/* EXECUTE ALL TASK SWITCH XEN SYSCALLS AT THIS POINT. */
    2.19  	execute_multicall_list();
    2.20 -
    2.21 -	local_irq_restore(flags);
    2.22 +        /* __sti(); */
    2.23  
    2.24  	/*
    2.25  	 * Restore %fs and %gs if needed.
     3.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/mmap.c	Mon Aug 16 09:59:28 2004 +0000
     3.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/mm/mmap.c	Tue Aug 17 16:09:56 2004 +0000
     3.3 @@ -27,7 +27,7 @@ arch_get_unmapped_area(struct file *filp
     3.4  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     3.5  	start_addr = addr = mm->free_area_cache;
     3.6  #else
     3.7 -	addr = PAGE_ALIGN(TASK_UNMAPPED_BASE);
     3.8 +	start_addr = addr = PAGE_ALIGN(TASK_UNMAPPED_BASE);
     3.9  #endif
    3.10  
    3.11  full_search:
    3.12 @@ -61,7 +61,10 @@ unsigned long
    3.13  arch_check_fixed_mapping(struct file *filp, unsigned long addr,
    3.14  		unsigned long len, unsigned long pgoff, unsigned long flags)
    3.15  {
    3.16 -	if ( addr < (FIRST_USER_PGD_NR<<PGDIR_SHIFT) )
    3.17 +	if (addr < (FIRST_USER_PGD_NR<<PGDIR_SHIFT)) {
    3.18 +		printk(KERN_ALERT "WARNING: Preventing a mmap() request by %s at 0x%08lx, len %08lx\n",
    3.19 +		current->comm, addr, len);
    3.20  		return -EINVAL;
    3.21 +	}
    3.22  	return 0;
    3.23  }
     4.1 --- a/linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c	Mon Aug 16 09:59:28 2004 +0000
     4.2 +++ b/linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c	Tue Aug 17 16:09:56 2004 +0000
     4.3 @@ -49,15 +49,6 @@ static int recovery = 0;           /* "R
     4.4  #define BLKIF_RING_FULL (((req_prod - resp_cons) == BLKIF_RING_SIZE) || \
     4.5                           (blkif_state != BLKIF_STATE_CONNECTED))
     4.6  
     4.7 -/*
     4.8 - * Request queues with outstanding work, but ring is currently full.
     4.9 - * We need no special lock here, as we always access this with the
    4.10 - * blkif_io_lock held. We only need a small maximum list.
    4.11 - */
    4.12 -#define MAX_PENDING 8
    4.13 -static request_queue_t *pending_queues[MAX_PENDING];
    4.14 -static int nr_pending;
    4.15 -
    4.16  static inline void translate_req_to_mfn(blkif_request_t *xreq,
    4.17                                          blkif_request_t *req);
    4.18  
    4.19 @@ -99,6 +90,23 @@ static inline void ADD_ID_TO_FREELIST( u
    4.20  
    4.21  __initcall(xlblk_init);
    4.22  
    4.23 +
    4.24 +static void kick_pending_request_queues(void)
    4.25 +{
    4.26 +
    4.27 +    if ( (xlbd_blk_queue != NULL) &&
    4.28 +         test_bit(QUEUE_FLAG_STOPPED, &xlbd_blk_queue->queue_flags) )
    4.29 +    {
    4.30 +        blk_start_queue(xlbd_blk_queue);
    4.31 +        /* XXXcl call to request_fn should not be needed but
    4.32 +         * we get stuck without...  needs investigating
    4.33 +         */
    4.34 +        xlbd_blk_queue->request_fn(xlbd_blk_queue);
    4.35 +    }
    4.36 +
    4.37 +}
    4.38 +
    4.39 +
    4.40  int blkif_open(struct inode *inode, struct file *filep)
    4.41  {
    4.42      struct gendisk *gd = inode->i_bdev->bd_disk;
    4.43 @@ -244,7 +252,7 @@ static int blkif_queue_request(struct re
    4.44      id = GET_ID_FROM_FREELIST();
    4.45      rec_ring[id].id = (unsigned long) req;
    4.46  
    4.47 -//printk("r: %d req %p (%ld)\n",req_prod,req,id);
    4.48 +//printk(KERN_ALERT"r: %d req %p (%ld)\n",req_prod,req,id);
    4.49  
    4.50      ring_req->id = id;
    4.51      ring_req->operation = rq_data_dir(req) ? BLKIF_OP_WRITE :
    4.52 @@ -291,6 +299,8 @@ void do_blkif_request(request_queue_t *r
    4.53  
    4.54      DPRINTK("Entered do_blkif_request\n"); 
    4.55  
    4.56 +//printk(KERN_ALERT"r: %d req\n",req_prod);
    4.57 +
    4.58      queued = 0;
    4.59  
    4.60      while ((req = elv_next_request(rq)) != NULL) {
    4.61 @@ -347,7 +357,7 @@ static irqreturn_t blkif_int(int irq, vo
    4.62  	id = bret->id;
    4.63  	req = (struct request *)rec_ring[id].id;
    4.64  
    4.65 -//printk("i: %d req %p (%ld)\n",i,req,id);
    4.66 +//printk(KERN_ALERT"i: %d req %p (%ld)\n",i,req,id);
    4.67  
    4.68  	ADD_ID_TO_FREELIST(id);  // overwrites req
    4.69  
    4.70 @@ -378,15 +388,7 @@ static irqreturn_t blkif_int(int irq, vo
    4.71      
    4.72      resp_cons = i;
    4.73  
    4.74 -    if ( (xlbd_blk_queue != NULL) &&
    4.75 -         test_bit(QUEUE_FLAG_STOPPED, &xlbd_blk_queue->queue_flags) )
    4.76 -    {
    4.77 -        blk_start_queue(xlbd_blk_queue);
    4.78 -        /* XXXcl call to request_fn should not be needed but
    4.79 -         * we get stuck without...  needs investigating
    4.80 -         */
    4.81 -        xlbd_blk_queue->request_fn(xlbd_blk_queue);
    4.82 -    }
    4.83 +    kick_pending_request_queues();
    4.84  
    4.85      spin_unlock_irqrestore(&blkif_io_lock, flags);
    4.86  
    4.87 @@ -400,6 +402,16 @@ static kdev_t        sg_dev;
    4.88  static int           sg_operation = -1;
    4.89  static unsigned long sg_next_sect;
    4.90  
    4.91 +/*
    4.92 + * Request queues with outstanding work, but ring is currently full.
    4.93 + * We need no special lock here, as we always access this with the
    4.94 + * blkif_io_lock held. We only need a small maximum list.
    4.95 + */
    4.96 +#define MAX_PENDING 8
    4.97 +static request_queue_t *pending_queues[MAX_PENDING];
    4.98 +static int nr_pending;
    4.99 +
   4.100 +
   4.101  #define DISABLE_SCATTERGATHER() (sg_operation = -1)
   4.102  
   4.103  #define blkif_io_lock io_request_lock
   4.104 @@ -418,6 +430,18 @@ static void update_vbds_task(void *unuse
   4.105  }
   4.106  #endif
   4.107  
   4.108 +static void kick_pending_request_queues(void)
   4.109 +{
   4.110 +    /* We kick pending request queues if the ring is reasonably empty. */
   4.111 +    if ( (nr_pending != 0) && 
   4.112 +         ((req_prod - resp_cons) < (BLKIF_RING_SIZE >> 1)) )
   4.113 +    {
   4.114 +        /* Attempt to drain the queue, but bail if the ring becomes full. */
   4.115 +        while ( (nr_pending != 0) && !BLKIF_RING_FULL )
   4.116 +            do_blkif_request(pending_queues[--nr_pending]);
   4.117 +    }
   4.118 +}
   4.119 +
   4.120  int blkif_open(struct inode *inode, struct file *filep)
   4.121  {
   4.122      short xldev = inode->i_rdev; 
   4.123 @@ -949,24 +973,13 @@ static inline void translate_req_to_mfn(
   4.124  static inline void flush_requests(void)
   4.125  {
   4.126      DISABLE_SCATTERGATHER();
   4.127 +//printk(KERN_ALERT"flush %d\n",req_prod);
   4.128      wmb(); /* Ensure that the frontend can see the requests. */
   4.129      blk_ring->req_prod = req_prod;
   4.130      notify_via_evtchn(blkif_evtchn);
   4.131  }
   4.132  
   4.133  
   4.134 -static void kick_pending_request_queues(void)
   4.135 -{
   4.136 -    /* We kick pending request queues if the ring is reasonably empty. */
   4.137 -    if ( (nr_pending != 0) && 
   4.138 -         ((req_prod - resp_cons) < (BLKIF_RING_SIZE >> 1)) )
   4.139 -    {
   4.140 -        /* Attempt to drain the queue, but bail if the ring becomes full. */
   4.141 -        while ( (nr_pending != 0) && !BLKIF_RING_FULL )
   4.142 -            do_blkif_request(pending_queues[--nr_pending]);
   4.143 -    }
   4.144 -}
   4.145 -
   4.146  void blkif_control_send(blkif_request_t *req, blkif_response_t *rsp)
   4.147  {
   4.148      unsigned long flags, id;
   4.149 @@ -1016,6 +1029,7 @@ static void blkif_status_change(blkif_fe
   4.150  {
   4.151      ctrl_msg_t                   cmsg;
   4.152      blkif_fe_interface_connect_t up;
   4.153 +    long rc;
   4.154  
   4.155      if ( status->handle != 0 )
   4.156      {
   4.157 @@ -1075,11 +1089,13 @@ static void blkif_status_change(blkif_fe
   4.158                     " in state %d\n", blkif_state);
   4.159              break;
   4.160          }
   4.161 -
   4.162          blkif_evtchn = status->evtchn;
   4.163          blkif_irq = bind_evtchn_to_irq(blkif_evtchn);
   4.164 -        (void)request_irq(blkif_irq, blkif_int, 
   4.165 -                          SA_SAMPLE_RANDOM, "blkif", NULL);
   4.166 +        if ( (rc=request_irq(blkif_irq, blkif_int, 
   4.167 +                          SA_SAMPLE_RANDOM, "blkif", NULL)) )
   4.168 +	{
   4.169 +	    printk(KERN_ALERT"blkfront request_irq failed (%ld)\n",rc);
   4.170 +	}
   4.171  
   4.172          if ( recovery )
   4.173          {
     5.1 --- a/linux-2.6.7-xen-sparse/drivers/xen/netfront/netfront.c	Mon Aug 16 09:59:28 2004 +0000
     5.2 +++ b/linux-2.6.7-xen-sparse/drivers/xen/netfront/netfront.c	Tue Aug 17 16:09:56 2004 +0000
     5.3 @@ -17,6 +17,7 @@
     5.4  #include <linux/etherdevice.h>
     5.5  #include <linux/skbuff.h>
     5.6  #include <linux/init.h>
     5.7 +#include <linux/bitops.h>
     5.8  #include <net/sock.h>
     5.9  #include <net/pkt_sched.h>
    5.10  #include <asm/io.h>
    5.11 @@ -427,9 +428,7 @@ static int netif_poll(struct net_device 
    5.12           */
    5.13          if ( unlikely(rx->status <= 0) )
    5.14          {
    5.15 -            /* Gate this error. We get a (valid) slew of them on suspend. */
    5.16 -            if ( np->user_state == UST_OPEN )
    5.17 -                printk(KERN_ALERT "bad buffer on RX ring!(%d)\n", rx->status);
    5.18 +	    printk(KERN_ALERT "bad buffer on RX ring!(%d)\n", rx->status);
    5.19              np->rx->ring[MASK_NETIF_RX_IDX(np->rx->req_prod)].req.id = rx->id;
    5.20              wmb();
    5.21              np->rx->req_prod++;
    5.22 @@ -470,6 +469,15 @@ static int netif_poll(struct net_device 
    5.23          mcl->args[2] = 0;
    5.24          mcl++;
    5.25          (void)HYPERVISOR_multicall(rx_mcl, mcl - rx_mcl);
    5.26 +
    5.27 +#if 0 
    5.28 +	if (unlikely(rx_mcl[0].args[5] != 0))
    5.29 +	    printk(KERN_ALERT"Hypercall0 failed %u\n",np->rx->resp_prod);
    5.30 +
    5.31 +	if (unlikely(rx_mcl[1].args[5] != 0))
    5.32 +	    printk(KERN_ALERT"Hypercall1 failed %u\n",np->rx->resp_prod);
    5.33 +#endif
    5.34 +
    5.35      }
    5.36  
    5.37      while ( (skb = __skb_dequeue(&rxq)) != NULL )
    5.38 @@ -595,6 +603,7 @@ static void network_connect(struct net_d
    5.39  printk(KERN_ALERT"Netfront recovered tx=%d rxfree=%d\n",
    5.40         np->tx->req_prod,np->rx->req_prod);
    5.41  
    5.42 +
    5.43      /* Step 3: All public and private state should now be sane.  Get
    5.44       * ready to start sending and receiving packets and give the driver
    5.45       * domain a kick because we've probably just requeued some
    5.46 @@ -712,7 +721,6 @@ static void netif_status_change(netif_fe
    5.47          np->irq = bind_evtchn_to_irq(np->evtchn);
    5.48          (void)request_irq(np->irq, netif_int, SA_SAMPLE_RANDOM, 
    5.49                            dev->name, dev);
    5.50 -        
    5.51          netctrl_connected_count();
    5.52          break;
    5.53  
    5.54 @@ -897,10 +905,9 @@ void netif_suspend(void)
    5.55  	sprintf(name,"eth%d",i);
    5.56  	dev = __dev_get_by_name(name);
    5.57  
    5.58 -	if ( dev && (dev->flags & IFF_UP) )
    5.59 +	if ( dev )
    5.60  	{
    5.61  	    np  = dev->priv;
    5.62 -
    5.63  	    free_irq(np->irq, dev);
    5.64              unbind_evtchn_from_irq(np->evtchn);
    5.65  	}    
    5.66 @@ -932,6 +939,9 @@ void netif_resume(void)
    5.67  
    5.68  	    // stop bad things from happening until we're back up
    5.69  	    np->backend_state = BEST_DISCONNECTED;
    5.70 +	    
    5.71 +	    memset(np->tx,0,PAGE_SIZE);
    5.72 +	    memset(np->rx,0,PAGE_SIZE);
    5.73  
    5.74  	    cmsg.type      = CMSG_NETIF_FE;
    5.75  	    cmsg.subtype   = CMSG_NETIF_FE_INTERFACE_CONNECT;
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mmu_context.h	Tue Aug 17 16:09:56 2004 +0000
     6.3 @@ -0,0 +1,75 @@
     6.4 +#ifndef __I386_SCHED_H
     6.5 +#define __I386_SCHED_H
     6.6 +
     6.7 +#include <linux/config.h>
     6.8 +#include <asm/desc.h>
     6.9 +#include <asm/atomic.h>
    6.10 +#include <asm/pgalloc.h>
    6.11 +#include <asm/tlbflush.h>
    6.12 +
    6.13 +/*
    6.14 + * Used for LDT copy/destruction.
    6.15 + */
    6.16 +int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
    6.17 +void destroy_context(struct mm_struct *mm);
    6.18 +
    6.19 +
    6.20 +static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
    6.21 +{
    6.22 +#ifdef CONFIG_SMP
    6.23 +	unsigned cpu = smp_processor_id();
    6.24 +	if (cpu_tlbstate[cpu].state == TLBSTATE_OK)
    6.25 +		cpu_tlbstate[cpu].state = TLBSTATE_LAZY;	
    6.26 +#endif
    6.27 +}
    6.28 +
    6.29 +static inline void switch_mm(struct mm_struct *prev,
    6.30 +			     struct mm_struct *next,
    6.31 +			     struct task_struct *tsk)
    6.32 +{
    6.33 +	int cpu = smp_processor_id();
    6.34 +
    6.35 +	if (likely(prev != next)) {
    6.36 +		/* stop flush ipis for the previous mm */
    6.37 +		cpu_clear(cpu, prev->cpu_vm_mask);
    6.38 +#ifdef CONFIG_SMP
    6.39 +		cpu_tlbstate[cpu].state = TLBSTATE_OK;
    6.40 +		cpu_tlbstate[cpu].active_mm = next;
    6.41 +#endif
    6.42 +		cpu_set(cpu, next->cpu_vm_mask);
    6.43 +
    6.44 +		/* Re-load page tables */
    6.45 +		load_cr3_noflush(next->pgd);
    6.46 +
    6.47 +		/*
    6.48 +		 * load the LDT, if the LDT is different:
    6.49 +		 */
    6.50 +		if (unlikely(prev->context.ldt != next->context.ldt))
    6.51 +			load_LDT_nolock(&next->context, cpu);
    6.52 +	}
    6.53 +#ifdef CONFIG_SMP
    6.54 +	else {
    6.55 +		cpu_tlbstate[cpu].state = TLBSTATE_OK;
    6.56 +		BUG_ON(cpu_tlbstate[cpu].active_mm != next);
    6.57 +
    6.58 +		if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) {
    6.59 +			/* We were in lazy tlb mode and leave_mm disabled 
    6.60 +			 * tlb flush IPI delivery. We must reload %cr3.
    6.61 +			 */
    6.62 +			load_cr3_noflush(next->pgd);
    6.63 +			load_LDT_nolock(&next->context, cpu);
    6.64 +		}
    6.65 +	}
    6.66 +#endif
    6.67 +}
    6.68 +
    6.69 +#define deactivate_mm(tsk, mm) \
    6.70 +	asm("movl %0,%%fs ; movl %0,%%gs": :"r" (0))
    6.71 +
    6.72 +#define activate_mm(prev, next) \
    6.73 +do { \
    6.74 +	switch_mm((prev),(next),NULL); \
    6.75 +	flush_page_update_queue();			\
    6.76 +} while ( 0 )
    6.77 +
    6.78 +#endif
     7.1 --- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/processor.h	Mon Aug 16 09:59:28 2004 +0000
     7.2 +++ b/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/processor.h	Tue Aug 17 16:09:56 2004 +0000
     7.3 @@ -186,6 +186,11 @@ static inline unsigned int cpuid_edx(uns
     7.4  	cur_pgd = pgdir;	/* XXXsmp */		\
     7.5  } while (/* CONSTCOND */0)
     7.6  
     7.7 +#define load_cr3_noflush(pgdir) do {			\
     7.8 +	queue_pt_switch(__pa(pgdir));			\
     7.9 +	cur_pgd = pgdir;	/* XXXsmp */		\
    7.10 +} while (/* CONSTCOND */0)
    7.11 +
    7.12  
    7.13  /*
    7.14   * Intel CPU features in CR4
     8.1 --- a/linux-2.6.7-xen-sparse/include/asm-xen/hypervisor.h	Mon Aug 16 09:59:28 2004 +0000
     8.2 +++ b/linux-2.6.7-xen-sparse/include/asm-xen/hypervisor.h	Tue Aug 17 16:09:56 2004 +0000
     8.3 @@ -21,7 +21,7 @@
     8.4  /* arch/xen/i386/kernel/setup.c */
     8.5  union start_info_union
     8.6  {
     8.7 -    extended_start_info_t start_info;
     8.8 +    start_info_t start_info;
     8.9      char padding[512];
    8.10  };
    8.11  extern union start_info_union start_info_union;
    8.12 @@ -374,7 +374,8 @@ static inline int HYPERVISOR_dom_mem_op(
    8.13      __asm__ __volatile__ (
    8.14          TRAP_INSTR
    8.15          : "=a" (ret) : "0" (__HYPERVISOR_dom_mem_op),
    8.16 -        "b" (op), "c" (extent_list), "d" (nr_extents), "S" (extent_order)
    8.17 +        "b" (op), "c" (extent_list), "d" (nr_extents), "S" (extent_order),
    8.18 +	"D" (DOMID_SELF)
    8.19          : "memory" );
    8.20  
    8.21      return ret;
     9.1 --- a/linux-2.6.7-xen-sparse/include/asm-xen/suspend.h	Mon Aug 16 09:59:28 2004 +0000
     9.2 +++ b/linux-2.6.7-xen-sparse/include/asm-xen/suspend.h	Tue Aug 17 16:09:56 2004 +0000
     9.3 @@ -12,7 +12,7 @@
     9.4  
     9.5  typedef struct suspend_record_st {
     9.6      /* To be filled in before resume. */
     9.7 -    extended_start_info_t resume_info;
     9.8 +    start_info_t resume_info;
     9.9      /*
    9.10       * The number of a machine frame containing, in sequence, the number of
    9.11       * each machine frame that contains PFN -> MFN translation table data.
    10.1 --- a/tools/libxc/xc_linux_build.c	Mon Aug 16 09:59:28 2004 +0000
    10.2 +++ b/tools/libxc/xc_linux_build.c	Tue Aug 17 16:09:56 2004 +0000
    10.3 @@ -85,7 +85,7 @@ static int setup_guestos(int xc_handle,
    10.4      unsigned long l2tab;
    10.5      unsigned long l1tab;
    10.6      unsigned long count, i;
    10.7 -    extended_start_info_t *start_info;
    10.8 +    start_info_t *start_info;
    10.9      shared_info_t *shared_info;
   10.10      mmu_t *mmu = NULL;
   10.11      void  *pm_handle=NULL;
    11.1 --- a/tools/libxc/xc_linux_restore.c	Mon Aug 16 09:59:28 2004 +0000
    11.2 +++ b/tools/libxc/xc_linux_restore.c	Tue Aug 17 16:09:56 2004 +0000
    11.3 @@ -504,6 +504,54 @@ printf("XXXXXXXXXXXXXXX pin L2\n");
    11.4  
    11.5      xcio_info(ioctxt, "\b\b\b\b100%%\nMemory reloaded.\n");
    11.6  
    11.7 +    /* Get the list of PFNs that are not in the psuedo-phys map */
    11.8 +    {
    11.9 +	unsigned int count, *pfntab;
   11.10 +	int rc;
   11.11 +	if ( xcio_read(ioctxt, &count, sizeof(count)) )
   11.12 +	{
   11.13 +	    xcio_error(ioctxt, "Error when reading from state file");
   11.14 +	    goto out;
   11.15 +	}
   11.16 +
   11.17 +	pfntab = malloc( sizeof(unsigned int) * count );
   11.18 +	if ( !pfntab )
   11.19 +	{
   11.20 +	    xcio_error(ioctxt, "Out of memory");
   11.21 +	    goto out;
   11.22 +	}
   11.23 +
   11.24 +	if ( xcio_read(ioctxt, pfntab, sizeof(unsigned int)*count) )
   11.25 +	{
   11.26 +	    xcio_error(ioctxt, "Error when reading pfntab from state file");
   11.27 +	    goto out;
   11.28 +	}
   11.29 +
   11.30 +	for(i=0;i<count;i++)
   11.31 +	{
   11.32 +	    unsigned long pfn = pfntab[i];
   11.33 +	    pfntab[i]=pfn_to_mfn_table[pfn];
   11.34 +	    pfn_to_mfn_table[pfn] = 0x80000001;  // not in pmap
   11.35 +	}
   11.36 +
   11.37 +	if ( count>0 )
   11.38 +	{
   11.39 +	    if ( (rc = do_dom_mem_op( xc_handle,
   11.40 +				       MEMOP_decrease_reservation,
   11.41 +				       pfntab, count, 0, dom )) <0 )
   11.42 +	    {
   11.43 +		xcio_error(ioctxt, "Could not decrease reservation : %d",rc);
   11.44 +		goto out;
   11.45 +	    }
   11.46 +	    else
   11.47 +	    {
   11.48 +		printf("Decreased reservation by %d pages\n", count);
   11.49 +	    }
   11.50 +	}
   11.51 +	
   11.52 +    }
   11.53 +
   11.54 +
   11.55  
   11.56      if ( xcio_read(ioctxt, &ctxt,       sizeof(ctxt)) ||
   11.57           xcio_read(ioctxt, shared_info, PAGE_SIZE) )
    12.1 --- a/tools/libxc/xc_linux_save.c	Mon Aug 16 09:59:28 2004 +0000
    12.2 +++ b/tools/libxc/xc_linux_save.c	Tue Aug 17 16:09:56 2004 +0000
    12.3 @@ -463,10 +463,6 @@ int xc_linux_save(int xc_handle, XcIOCon
    12.4  	    goto out;
    12.5  	}
    12.6  
    12.7 -	printf("SUSPPPPPPPP flags %08lx shinfo %08lx eip %08lx esi %08lx\n", 
    12.8 -	       op.u.getdomaininfo.flags, op.u.getdomaininfo.shared_info_frame,
    12.9 -	       ctxt.cpu_ctxt.eip, ctxt.cpu_ctxt.esi );
   12.10 -
   12.11      }
   12.12  
   12.13      /* calculate the power of 2 order of nr_pfns, e.g.
   12.14 @@ -866,9 +862,41 @@ printf("type fail: page %i mfn %08lx\n",
   12.15          goto out;
   12.16      }
   12.17  
   12.18 -printf("SUSPPPPPPPP flags %08lx shinfo %08lx eip %08lx esi %08lx\n", 
   12.19 -       op.u.getdomaininfo.flags, op.u.getdomaininfo.shared_info_frame,
   12.20 -       ctxt.cpu_ctxt.eip, ctxt.cpu_ctxt.esi );
   12.21 +    /* Send through a list of all the PFNs that were not in map at the close */
   12.22 +    {
   12.23 +	unsigned int i,j;
   12.24 +	unsigned int pfntab[1024];
   12.25 +
   12.26 +	for ( i = 0, j = 0; i < nr_pfns; i++ )
   12.27 +	{
   12.28 +	    if ( live_pfn_to_mfn_table[i] >= 0x80000000UL )
   12.29 +		j++;
   12.30 +	}
   12.31 +
   12.32 +	if ( xcio_write(ioctxt, &j, sizeof(unsigned int)) )
   12.33 +	{
   12.34 +	    xcio_error(ioctxt, "Error when writing to state file (6a)");
   12.35 +	    goto out;
   12.36 +	}	
   12.37 +
   12.38 +	for ( i = 0, j = 0; i < nr_pfns; )
   12.39 +	{
   12.40 +	    if ( live_pfn_to_mfn_table[i] >= 0x80000000UL )
   12.41 +	    {
   12.42 +		pfntab[j++] = i;
   12.43 +	    }
   12.44 +	    i++;
   12.45 +	    if ( j == 1024 || i == nr_pfns )
   12.46 +	    {
   12.47 +		if ( xcio_write(ioctxt, &pfntab, sizeof(unsigned long)*j) )
   12.48 +		{
   12.49 +		    xcio_error(ioctxt, "Error when writing to state file (6b)");
   12.50 +		    goto out;
   12.51 +		}	
   12.52 +		j = 0;
   12.53 +	    }
   12.54 +	}
   12.55 +    }
   12.56  
   12.57      /* Map the suspend-record MFN to pin it. The page must be owned by 
   12.58         domid for this to succeed. */
    13.1 --- a/tools/libxc/xc_netbsd_build.c	Mon Aug 16 09:59:28 2004 +0000
    13.2 +++ b/tools/libxc/xc_netbsd_build.c	Tue Aug 17 16:09:56 2004 +0000
    13.3 @@ -73,7 +73,7 @@ static int setup_guestos(int xc_handle,
    13.4      unsigned long l1tab;
    13.5      unsigned long count, pt_start;
    13.6      unsigned long symtab_addr = 0, symtab_len = 0;
    13.7 -    extended_start_info_t *start_info;
    13.8 +    start_info_t *start_info;
    13.9      shared_info_t *shared_info;
   13.10      unsigned long ksize;
   13.11      mmu_t *mmu = NULL;
    14.1 --- a/tools/libxc/xc_private.h	Mon Aug 16 09:59:28 2004 +0000
    14.2 +++ b/tools/libxc/xc_private.h	Tue Aug 17 16:09:56 2004 +0000
    14.3 @@ -127,6 +127,42 @@ static inline int do_multicall_op(int xc
    14.4   out1: return ret;
    14.5  }
    14.6  
    14.7 +
    14.8 +static inline int do_dom_mem_op(int            xc_handle,
    14.9 +				unsigned int   memop, 
   14.10 +				unsigned int *extent_list, 
   14.11 +				unsigned int  nr_extents,
   14.12 +				unsigned int   extent_order,
   14.13 +				domid_t        domid)
   14.14 +{
   14.15 +    privcmd_hypercall_t hypercall;
   14.16 +    long ret = -EINVAL;
   14.17 +	
   14.18 +    hypercall.op     = __HYPERVISOR_dom_mem_op;
   14.19 +    hypercall.arg[0] = (unsigned long)memop;
   14.20 +    hypercall.arg[1] = (unsigned long)extent_list;
   14.21 +    hypercall.arg[2] = (unsigned long)nr_extents;
   14.22 +    hypercall.arg[3] = (unsigned long)extent_order;
   14.23 +    hypercall.arg[4] = (unsigned long)domid;
   14.24 +
   14.25 +    if ( mlock(extent_list, nr_extents*sizeof(unsigned long)) != 0 )
   14.26 +    {
   14.27 +        PERROR("Could not lock memory for Xen hypercall");
   14.28 +        goto out1;
   14.29 +    }
   14.30 +
   14.31 +    if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
   14.32 +    {
   14.33 +	fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
   14.34 +                    " rebuild the user-space tool set?\n",ret,errno);
   14.35 +        goto out2;
   14.36 +    }
   14.37 +
   14.38 + out2: (void)munlock(extent_list, nr_extents*sizeof(unsigned long));
   14.39 + out1: return ret;
   14.40 +}    
   14.41 +
   14.42 +
   14.43  /*
   14.44   * PFN mapping.
   14.45   */
    15.1 --- a/tools/python/xen/sv/CreateDomain.py	Mon Aug 16 09:59:28 2004 +0000
    15.2 +++ b/tools/python/xen/sv/CreateDomain.py	Tue Aug 17 16:09:56 2004 +0000
    15.3 @@ -25,6 +25,7 @@ class CreatePage0( Sheet ):
    15.4          self.addControl( InputControl( 'name', 'VM Name', 'VM Name:', "[\\w|\\S]+", "You must enter a name in this field" ) )
    15.5          self.addControl( InputControl( 'memory', '64', 'Memory (Mb):', "[\\d]+", "You must enter a number in this field" ) )
    15.6          self.addControl( InputControl( 'cpu', '0', 'CPU:', "[\\d]+", "You must enter a number in this feild" ) )
    15.7 +        self.addControl( InputControl( 'cpu_weight', '1', 'CPU Weight:', "[\\d]+", "You must enter a number in this feild" ) )
    15.8                          
    15.9  class CreatePage1( Sheet ):
   15.10  
   15.11 @@ -83,9 +84,16 @@ class CreateFinish( Sheet ):
   15.12          
   15.13          xend_sxp = self.translate_sxp( string2sxp( self.passback ) )
   15.14          
   15.15 -        dom_sxp = server.xend_domain_create( xend_sxp )
   15.16 +        try:
   15.17 +            dom_sxp = server.xend_domain_create( xend_sxp )
   15.18 +            success = "Your domain was successfully created.\n"
   15.19 +        except:
   15.20 +            success = "There was an error creating your domain.\nThe configuration used is as follows:\n"
   15.21 +            dom_sxp = xend_sxp
   15.22 +            
   15.23 +            
   15.24          
   15.25 -        pt = PreTab( sxp2prettystring( dom_sxp ) )
   15.26 +        pt = PreTab( success + sxp2prettystring( dom_sxp ) )
   15.27          pt.write_BODY( request )
   15.28  
   15.29          request.write( "<input type='hidden' name='passback' value=\"%s\"></p>" % self.passback )
   15.30 @@ -106,6 +114,7 @@ class CreateFinish( Sheet ):
   15.31          vals.name = 	get( 'name' )
   15.32          vals.memory = 	get( 'memory' )
   15.33          vals.cpu =  	get( 'cpu' )
   15.34 +        vals.cpu_weight = get( 'cpu_weight' )
   15.35          
   15.36          vals.builder =  get( 'builder' )       
   15.37          vals.kernel =   get( 'kernel' )
   15.38 @@ -121,7 +130,7 @@ class CreateFinish( Sheet ):
   15.39          
   15.40          vals.disk = vbds    
   15.41              
   15.42 -        #misc crap
   15.43 +        #misc
   15.44          
   15.45          vals.pci = []
   15.46          
   15.47 @@ -145,4 +154,8 @@ class CreateFinish( Sheet ):
   15.48          
   15.49          vals.cmdline_ip = "%s:%s:%s:%s:%s:eth0:%s" % (ip, nfs, gate, mask, host, dhcp)
   15.50          
   15.51 -        return make_config( vals )
   15.52 +        try:
   15.53 +            return make_config( vals )
   15.54 +        except:
   15.55 +            return [["Error creating domain config."]]    
   15.56 +        
    16.1 --- a/tools/python/xen/sv/DomInfo.py	Mon Aug 16 09:59:28 2004 +0000
    16.2 +++ b/tools/python/xen/sv/DomInfo.py	Tue Aug 17 16:09:56 2004 +0000
    16.3 @@ -5,6 +5,8 @@ from xen.sv.HTMLBase import HTMLBase
    16.4  from xen.sv.util import *
    16.5  from xen.sv.GenTabbed import *
    16.6  
    16.7 +DEBUG=1
    16.8 +
    16.9  class DomInfo( GenTabbed ):
   16.10  
   16.11      def __init__( self, urlWriter ):
   16.12 @@ -76,8 +78,11 @@ class DomSXPTab( PreTab ):
   16.13              request.write( "<p>Please Select a Domain</p>" )
   16.14              return None
   16.15  
   16.16 -        domInfo = server.xend_domain( self.dom )
   16.17 -        
   16.18 +        try:
   16.19 +            domInfo = server.xend_domain( self.dom )
   16.20 +        except:
   16.21 +            domInfo = [["Error getting domain details."]]
   16.22 +            
   16.23          self.source = sxp2prettystring( domInfo )
   16.24          
   16.25          PreTab.write_BODY( self, request )
   16.26 @@ -88,32 +93,54 @@ class DomActionTab( ActionTab ):
   16.27      	actions = { "shutdown" : ( "Shutdown the Domain", "shutdown.png" ),
   16.28          	    "reboot" : ( "Reboot the Domain", "reboot.png" ),
   16.29                      "pause" : ( "Pause the Domain", "pause.png" ),
   16.30 -                    "unpause" : ( "Unpause the Domain", "unpause.png" ) }
   16.31 +                    "unpause" : ( "Unpause the Domain", "unpause.png" ),
   16.32 +                    "destroy" : ( "Destroy the Domain", "destroy.png" ) }
   16.33          ActionTab.__init__( self, actions )    
   16.34          
   16.35      def op_shutdown( self, request ):
   16.36     	dom = getVar( 'dom', request )
   16.37 -        if not dom is None:
   16.38 -    	   print ">DomShutDown %s" % dom
   16.39 -    	#server.xend_node_shutdown()
   16.40 +        if not dom is None and dom != '0':
   16.41 +    	   if DEBUG: print ">DomShutDown %s" % dom
   16.42 +           try:
   16.43 +    	   	server.xend_domain_shutdown( int( dom ), "halt" )
   16.44 +           except:
   16.45 +           	pass
   16.46      
   16.47      def op_reboot( self, request ):
   16.48         	dom = getVar( 'dom', request )
   16.49 -        if not dom is None:
   16.50 -    	    print ">DomReboot %s" % dom
   16.51 -        #server.xend_node_reboot()
   16.52 -        
   16.53 +        if not dom is None and dom != '0':
   16.54 +    	    if DEBUG: print ">DomReboot %s" % dom
   16.55 +            try:
   16.56 +            	server.xend_domain_shutdown( int( dom ), "reboot" )
   16.57 +            except:
   16.58 +            	pass
   16.59 +                
   16.60      def op_pause( self, request ):
   16.61         	dom = getVar( 'dom', request )
   16.62 -        if not dom is None:
   16.63 -    	    print ">DomPause %s" % dom
   16.64 -            server.xend_domain_pause( int( dom ) )
   16.65 -        
   16.66 +        if not dom is None and dom != '0':
   16.67 +    	    if DEBUG: print ">DomPause %s" % dom
   16.68 +            try:
   16.69 +                server.xend_domain_pause( int( dom ) )
   16.70 +            except:
   16.71 +            	pass
   16.72 +               
   16.73      def op_unpause( self, request ):
   16.74         	dom = getVar( 'dom', request )
   16.75 -        if not dom is None:
   16.76 -    	   print ">DomUnpause %s" % dom
   16.77 -           server.xend_domain_unpause( int( dom ) )
   16.78 +        if not dom is None and dom != '0':
   16.79 +    	   if DEBUG: print ">DomUnpause %s" % dom
   16.80 +           try:
   16.81 +               server.xend_domain_unpause( int( dom ) )
   16.82 +    	   except:
   16.83 +               pass
   16.84 +               
   16.85 +    def op_destroy( self, request ):
   16.86 +    	dom = getVar( 'dom', request )
   16.87 +        if not dom is None and dom != '0':
   16.88 +    	   if DEBUG: print ">DomDestroy %s" % dom
   16.89 +           try:
   16.90 +           	server.xend_domain_destroy( int( dom ), "halt" )
   16.91 +           except:
   16.92 +           	pass
   16.93          
   16.94      
   16.95      
    17.1 --- a/tools/python/xen/sv/DomList.py	Mon Aug 16 09:59:28 2004 +0000
    17.2 +++ b/tools/python/xen/sv/DomList.py	Tue Aug 17 16:09:56 2004 +0000
    17.3 @@ -17,9 +17,14 @@ class DomList( HTMLBase ):
    17.4  
    17.5      def write_BODY( self, request, head=True, long=True ):
    17.6          
    17.7 -        domains = map(int, server.xend_domains())
    17.8 -        domains.sort()
    17.9 +    	domains = None
   17.10      
   17.11 +    	try:
   17.12 +        	domains = server.xend_domains()
   17.13 +        	domains.sort()
   17.14 +  	except:
   17.15 +        	pass
   17.16 +                
   17.17          request.write( "\n<table style='border:0px solid white' cellspacing='0' cellpadding='0' border='0' width='100%'>\n" )
   17.18          
   17.19          if head:
   17.20 @@ -29,28 +34,42 @@ class DomList( HTMLBase ):
   17.21          
   17.22          odd = True
   17.23          
   17.24 -        for domain in domains:
   17.25 -            if odd:
   17.26 -                request.write( "<tr class='domainInfoOdd'>\n" )
   17.27 -                odd = False
   17.28 -            else:
   17.29 -                request.write( "<tr class='domainInfoEven'>\n" )
   17.30 -                odd = True
   17.31 -            self.write_DOMAIN( request, getDomInfoHash( domain ), long )
   17.32 -            request.write( "</tr>\n" )
   17.33 -        
   17.34 +        if not domains is None:
   17.35 +            for domain in domains:
   17.36 +                if odd:
   17.37 +                    request.write( "<tr class='domainInfoOdd'>\n" )
   17.38 +                    odd = False
   17.39 +                else:
   17.40 +                    request.write( "<tr class='domainInfoEven'>\n" )
   17.41 +                    odd = True
   17.42 +                self.write_DOMAIN( request, getDomInfoHash( domain ), long )
   17.43 +                request.write( "</tr>\n" )
   17.44 +        else:
   17.45 +        	request.write( "<tr colspan='10'><p class='small'>Error getting domain list<br/>Perhaps XenD not running?</p></tr>")
   17.46 +                
   17.47          request.write( "</table>\n" )
   17.48              
   17.49      def write_DOMAIN( self, request, domInfoHash, long=True ):   
   17.50 -        request.write( "<td class='domainInfo' align='center'>%(dom)-4d</td>\n" % domInfoHash )
   17.51 +        request.write( "<td class='domainInfo' align='center'>%(id)s</td>\n" % domInfoHash )
   17.52  
   17.53 -        url = self.urlWriter( "&mod=info&dom=%(dom)-4d" % domInfoHash )
   17.54 +        url = self.urlWriter( "&mod=info&dom=%(id)s" % domInfoHash )
   17.55  
   17.56          request.write( "<td class='domainInfo' align='center'><a href='%s'>%s</a></td>\n" % ( url, domInfoHash['name'] ) )
   17.57          if long: 
   17.58              request.write( "<td class='domainInfo' align='center'>%(memory)5s</td>\n" % domInfoHash )
   17.59              request.write( "<td class='domainInfo' align='center'>%(cpu)2s</td>\n" % domInfoHash )
   17.60          request.write( "<td class='domainInfo' align='center'>%(state)5s</td>\n" % domInfoHash )
   17.61 +        if domInfoHash[ 'id' ] != "0":
   17.62 +            request.write( "<td class='domainInfo' align='center'>" )
   17.63 +            
   17.64 +            if domInfoHash[ 'state' ][ 2 ] == "-":
   17.65 +                request.write( "<img src='images/small-pause.png' onclick='doOp2( \"pause\", \"%(dom)-4d\" )'>" % domInfoHash )
   17.66 +            else:
   17.67 +                request.write( "<img src='images/small-unpause.png' onclick='doOp2( \"unpause\", \"%(dom)-4d\" )'>" % domInfoHash )              
   17.68 +            
   17.69 +            request.write( "<img src='images/small-destroy.png' onclick='doOp2( \"destroy\", \"%(dom)-4d\" )'></td>" % domInfoHash)
   17.70 +        else:
   17.71 +            request.write( "<td>&nbsp;</td>" )
   17.72  
   17.73      def write_DOMAIN_HEAD( self, request, long=True ):
   17.74          request.write( "<td class='domainInfoHead' align='center'>Domain</td>\n" )      
   17.75 @@ -59,4 +78,4 @@ class DomList( HTMLBase ):
   17.76              request.write( "<td class='domainInfoHead' align='center'>Memory / Mb</td>\n" )      
   17.77              request.write( "<td class='domainInfoHead' align='center'>CPU</td>\n" )      
   17.78          request.write( "<td class='domainInfoHead' align='center'>State</td>\n" )      
   17.79 -            
   17.80 +        request.write( "<td class='domainInfoHead' align='center'></td>\n" )
    18.1 --- a/tools/python/xen/sv/HTMLBase.py	Mon Aug 16 09:59:28 2004 +0000
    18.2 +++ b/tools/python/xen/sv/HTMLBase.py	Tue Aug 17 16:09:56 2004 +0000
    18.3 @@ -1,4 +1,5 @@
    18.4  from twisted.web.resource import Resource
    18.5 +from xen.sv.util import *
    18.6  
    18.7  class HTMLBase( Resource ):
    18.8  
    18.9 @@ -28,6 +29,7 @@ class HTMLBase( Resource ):
   18.10  
   18.11      def write_BOTTOM( self, request ):
   18.12          request.write('<input type="hidden" name="op" value="">')
   18.13 +        request.write('<input type="hidden" name="args" value="">')
   18.14          request.write('</form>')
   18.15          request.write( "</body></html>" )
   18.16  
    19.1 --- a/tools/python/xen/sv/Main.py	Mon Aug 16 09:59:28 2004 +0000
    19.2 +++ b/tools/python/xen/sv/Main.py	Tue Aug 17 16:09:56 2004 +0000
    19.3 @@ -4,6 +4,8 @@ from xen.sv.NodeInfo import NodeInfo
    19.4  from xen.sv.DomInfo  import DomInfo
    19.5  from xen.sv.CreateDomain import CreateDomain
    19.6  
    19.7 +from xen.xend.XendClient import server
    19.8 +
    19.9  from xen.sv.util import getVar
   19.10  
   19.11  class Main( HTMLBase ):
   19.12 @@ -20,14 +22,18 @@ class Main( HTMLBase ):
   19.13      def render_POST( self, request ):
   19.14      
   19.15      	#decide what module post'd the action
   19.16 +                
   19.17 +    	args = getVar( 'args', request )
   19.18  
   19.19          mod = getVar( 'mod', request )
   19.20                  
   19.21 -        if not mod is None:
   19.22 +        if not mod is None and args is None:
   19.23              module = self.modules[ mod ]
   19.24              #check module exists
   19.25              if module:
   19.26 -               module( self.mainUrlWriter ).perform( request )     
   19.27 +               module( self.mainUrlWriter ).perform( request )
   19.28 +        else:
   19.29 +            self.perform( request )     
   19.30      
   19.31          return self.render_GET( request )
   19.32  
   19.33 @@ -80,3 +86,18 @@ class Main( HTMLBase ):
   19.34          
   19.35          request.write( "</table>\n" )
   19.36          
   19.37 +                
   19.38 +    def op_destroy( self, request ):
   19.39 +    	dom = getVar( 'args', request )
   19.40 +        if not dom is None and dom != "0":
   19.41 +            server.xend_domain_destroy( int( dom ), "halt" ) 
   19.42 +                 
   19.43 +    def op_pause( self, request ):
   19.44 +    	dom = getVar( 'args', request )
   19.45 +        if not dom is None and dom != "0":
   19.46 +            server.xend_domain_pause( int( dom ) )      
   19.47 +    
   19.48 +    def op_unpause( self, request ):
   19.49 +    	dom = getVar( 'args', request )
   19.50 +        if not dom is None and dom != "0":
   19.51 +            server.xend_domain_unpause( int( dom ) )      
   19.52 \ No newline at end of file
    20.1 --- a/tools/python/xen/sv/NodeInfo.py	Mon Aug 16 09:59:28 2004 +0000
    20.2 +++ b/tools/python/xen/sv/NodeInfo.py	Tue Aug 17 16:09:56 2004 +0000
    20.3 @@ -20,8 +20,12 @@ class NodeInfoTab( GeneralTab ):
    20.4                          
    20.5      def __init__( self ):
    20.6           
    20.7 -        nodeInfo = sxp2hash( server.xend_node() )
    20.8 -    
    20.9 +    	nodeInfo = {}
   20.10 +        try:
   20.11 +            nodeInfo = sxp2hash( server.xend_node() )
   20.12 +   	except:
   20.13 +            nodeInfo[ 'system' ] = 'Error getting node info'
   20.14 +             
   20.15          dictTitles = {}
   20.16          dictTitles[ 'System' ] = 'system'
   20.17          dictTitles[ 'Hostname' ] = 'host' 
   20.18 @@ -39,8 +43,11 @@ class NodeInfoTab( GeneralTab ):
   20.19  class NodeDmesgTab( PreTab ):
   20.20  
   20.21      def __init__( self ):
   20.22 -        dmesg = server.xend_node_dmesg()
   20.23 -        PreTab.__init__( self, dmesg[ 1 ] )
   20.24 +    	try:
   20.25 +            dmesg = server.xend_node_dmesg()
   20.26 +        except:
   20.27 +            dmesg = "Error getting node information: XenD not running?"
   20.28 +        PreTab.__init__( self, dmesg )
   20.29    
   20.30  class NodeActionTab( ActionTab ):
   20.31  
    21.1 --- a/tools/python/xen/sv/util.py	Mon Aug 16 09:59:28 2004 +0000
    21.2 +++ b/tools/python/xen/sv/util.py	Tue Aug 17 16:09:56 2004 +0000
    21.3 @@ -5,8 +5,12 @@ from xen.xend import PrettyPrint
    21.4  import types
    21.5  
    21.6  def getDomInfoHash( domain ):
    21.7 -    domInfoHash = sxp2hash( server.xend_domain( int( domain ) ) )
    21.8 -    domInfoHash['dom'] = int( domain )
    21.9 +    domInfoHash = {}
   21.10 +    try:
   21.11 +        domInfoHash = sxp2hash( server.xend_domain( domain ) )
   21.12 +        domInfoHash['dom'] = domain
   21.13 +    except:
   21.14 +    	domInfoHash['name'] = "Error getting domain details"
   21.15      return domInfoHash
   21.16  
   21.17  def sxp2hash( s ):
    22.1 --- a/tools/sv/Makefile	Mon Aug 16 09:59:28 2004 +0000
    22.2 +++ b/tools/sv/Makefile	Tue Aug 17 16:09:56 2004 +0000
    22.3 @@ -33,7 +33,12 @@ install:
    22.4  	install -m0644 images/reboot.png $(sv_insdir)/images
    22.5  	install -m0644 images/pause.png $(sv_insdir)/images
    22.6  	install -m0644 images/unpause.png $(sv_insdir)/images
    22.7 +	install -m0644 images/destroy.png $(sv_insdir)/images
    22.8          
    22.9 +	install -m0644 images/small-destroy.png $(sv_insdir)/images        
   22.10 +	install -m0644 images/small-pause.png $(sv_insdir)/images   
   22.11 +	install -m0644 images/small-unpause.png $(sv_insdir)/images
   22.12 +                        
   22.13  	install -m0644 images/next.png $(sv_insdir)/images
   22.14  	install -m0644 images/previous.png $(sv_insdir)/images        
   22.15  	install -m0644 images/finish.png $(sv_insdir)/images 
    23.1 Binary file tools/sv/images/destroy.png has changed
    24.1 Binary file tools/sv/images/small-destroy.png has changed
    25.1 Binary file tools/sv/images/small-pause.png has changed
    26.1 Binary file tools/sv/images/small-unpause.png has changed
    27.1 --- a/tools/sv/inc/script.js	Mon Aug 16 09:59:28 2004 +0000
    27.2 +++ b/tools/sv/inc/script.js	Tue Aug 17 16:09:56 2004 +0000
    27.3 @@ -13,3 +13,10 @@ function doOp( op )
    27.4      document.forms[0].op.value = op
    27.5      document.forms[0].submit()
    27.6  }
    27.7 +
    27.8 +function doOp2( op, args )
    27.9 +{
   27.10 +    document.forms[0].op.value = op
   27.11 +    document.forms[0].args.value = args
   27.12 +    document.forms[0].submit()
   27.13 +}
    28.1 --- a/xen/common/dom_mem_ops.c	Mon Aug 16 09:59:28 2004 +0000
    28.2 +++ b/xen/common/dom_mem_ops.c	Tue Aug 17 16:09:56 2004 +0000
    28.3 @@ -92,13 +92,32 @@ static long free_dom_mem(struct domain *
    28.4  long do_dom_mem_op(unsigned int   op, 
    28.5                     unsigned long *extent_list, 
    28.6                     unsigned long  nr_extents,
    28.7 -                   unsigned int   extent_order)
    28.8 +                   unsigned int   extent_order,
    28.9 +		   domid_t        domid)
   28.10  {
   28.11 -    if ( op == MEMOP_increase_reservation )
   28.12 -        return alloc_dom_mem(current, extent_list, nr_extents, extent_order);
   28.13 +    struct domain *d;
   28.14 +    long rc = -ENOSYS;
   28.15 +
   28.16 +    if (domid == DOMID_SELF)
   28.17 +	d = current;
   28.18 +    else
   28.19 +	d = find_domain_by_id(domid);
   28.20 +
   28.21 +    if (d==NULL)
   28.22 +	return -ESRCH;
   28.23  
   28.24 -    if ( op == MEMOP_decrease_reservation )
   28.25 -        return free_dom_mem(current, extent_list, nr_extents, extent_order);
   28.26 +    switch( op )
   28.27 +    {
   28.28 +    case MEMOP_increase_reservation:
   28.29 +        rc = alloc_dom_mem(d, extent_list, nr_extents, extent_order);
   28.30 +	break;
   28.31 +    case MEMOP_decrease_reservation:
   28.32 +        rc = free_dom_mem(d, extent_list, nr_extents, extent_order);
   28.33 +	break;
   28.34 +    }
   28.35  
   28.36 -    return -ENOSYS;
   28.37 +    if (domid!=DOMID_SELF)
   28.38 +	put_domain(d);
   28.39 +
   28.40 +    return rc;
   28.41  }
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/xen/include/hypervisor-ifs/grant_table.h	Tue Aug 17 16:09:56 2004 +0000
    29.3 @@ -0,0 +1,89 @@
    29.4 +/******************************************************************************
    29.5 + * grant_table.h
    29.6 + * 
    29.7 + * Interface for granting foreign access to page frames, and receiving
    29.8 + * page-ownership transfers.
    29.9 + * 
   29.10 + * Copyright (c) 2004, K A Fraser
   29.11 + * 
   29.12 + * Some rough guidelines on accessing and updating grant-table entries
   29.13 + * in a concurreny-safe manner. For more information, Linux contains a
   29.14 + * reference implementation for guest OSes (arch/xen/kernel/grant_table.c).
   29.15 + * 
   29.16 + * NB. WMB is a no-op on current-generation x86 processors.
   29.17 + * 
   29.18 + * Introducing a valid entry into the grant table:
   29.19 + *  1. Write ent->domid.
   29.20 + *  2. Write ent->frame (to zero if installing GTF_accept_transfer).
   29.21 + *  3. Write memory barrier (WMB).
   29.22 + *  4. Write ent->flags, inc. valid type.
   29.23 + * 
   29.24 + * Removing an unused GTF_permit_access entry:
   29.25 + *  1. flags = ent->flags.
   29.26 + *  2. Observe that !(flags & (GTF_reading|GTF_writing)).
   29.27 + *  3. Check result of SMP-safe CMPXCHG(&ent->flags, flags, 0).
   29.28 + *  4. WMB.
   29.29 + * 
   29.30 + * Removing an unused GTF_accept_transfer entry:
   29.31 + *  1. Clear ent->flags.
   29.32 + *  2. WMB.
   29.33 + * 
   29.34 + * Changing a GTF_permit_access from writable to read-only:
   29.35 + *  Use SMP-safe CMPXCHG to set GTF_readonly, while checking !GTF_writing.
   29.36 + * 
   29.37 + * Changing a GTF_permit_access from read-only to writable:
   29.38 + *  Use SMP-safe bit-setting instruction.
   29.39 + */
   29.40 +
   29.41 +#ifndef __HYPERVISOR_IFS_GRANT_TABLE_H__
   29.42 +#define __HYPERVISOR_IFS_GRANT_TABLE_H__
   29.43 +
   29.44 +/*
   29.45 + * A grant table comprises a packed array of grant entries in one or more
   29.46 + * page frames shared between Xen and a guest.
   29.47 + * [XEN]: This field is written by Xen and read by the sharing guest.
   29.48 + * [GST]: This field is written by the guest and read by Xen.
   29.49 + */
   29.50 +typedef struct {
   29.51 +    /* GTF_xxx: various type and flag information.  [XEN,GST] */
   29.52 +    u16     flags;      /* 0 */
   29.53 +    /* The domain being granted foreign privileges. [GST] */
   29.54 +    domid_t domid;      /* 2 */
   29.55 +    /*
   29.56 +     * GTF_permit_access: Frame that @domid is allowed to map and access. [GST]
   29.57 +     * GTF_accept_transfer: Frame whose ownership transferred by @domid. [XEN]
   29.58 +     */
   29.59 +    u32     frame;      /* 4 */
   29.60 +} PACKED grant_entry_t; /* 8 bytes */
   29.61 +
   29.62 +/*
   29.63 + * Reference to a grant entry in a specified domain's grant table.
   29.64 + */
   29.65 +typedef u16 grant_ref_t;
   29.66 +
   29.67 +/*
   29.68 + * Type of grant entry.
   29.69 + *  GTF_invalid: This grant entry grants no privileges.
   29.70 + *  GTF_permit_access: Allow @domid to map/access @frame.
   29.71 + *  GTF_accept_transfer: Allow @domid to transfer ownership of one page frame
   29.72 + *                       to this guest. Xen writes the page number to @frame.
   29.73 + */
   29.74 +#define GTF_invalid         (0<<0)
   29.75 +#define GTF_permit_access   (1<<0)
   29.76 +#define GTF_accept_transfer (2<<0)
   29.77 +#define GTF_type_mask       (3<<0)
   29.78 +
   29.79 +/*
   29.80 + * Subflags for GTF_permit_access.
   29.81 + *  GTF_readonly: Restrict @domid to read-only mappings and accesses. [GST]
   29.82 + *  GTF_reading: Grant entry is currently mapped for reading by @domid. [XEN]
   29.83 + *  GTF_writing: Grant entry is currently mapped for writing by @domid. [XEN]
   29.84 + */
   29.85 +#define _GTF_readonly       (2)
   29.86 +#define GTF_readonly        (1<<_GTF_readonly)
   29.87 +#define _GTF_reading        (3)
   29.88 +#define GTF_reading         (1<<_GTF_inuse)
   29.89 +#define _GTF_writing        (4)
   29.90 +#define GTF_writing         (1<<_GTF_inuse)
   29.91 +
   29.92 +#endif /* __HYPERVISOR_IFS_GRANT_TABLE_H__ */
    30.1 --- a/xen/include/hypervisor-ifs/hypervisor-if.h	Mon Aug 16 09:59:28 2004 +0000
    30.2 +++ b/xen/include/hypervisor-ifs/hypervisor-if.h	Tue Aug 17 16:09:56 2004 +0000
    30.3 @@ -2,6 +2,8 @@
    30.4   * hypervisor-if.h
    30.5   * 
    30.6   * Guest OS interface to Xen.
    30.7 + * 
    30.8 + * Copyright (c) 2004, K A Fraser
    30.9   */
   30.10  
   30.11  #ifndef __HYPERVISOR_IF_H__
   30.12 @@ -360,47 +362,35 @@ typedef struct shared_info_st
   30.13   *     extended by an extra 4MB to ensure this.
   30.14   */
   30.15  
   30.16 -/*
   30.17 - * This is the basic bootstrap information structure as passed by Xen to the
   30.18 - * initial controller domain. We want this structure to be easily extended by
   30.19 - * more sophisticated domain builders and controllers, so we make the basic
   30.20 - * fields of this structure available via a BASIC_START_INFO macro.
   30.21 - * 
   30.22 - * Extended version of start_info_t should be defined as:
   30.23 - *  typedef struct {
   30.24 - *      BASIC_START_INFO;
   30.25 - *      <...extra fields...>
   30.26 - *  } extended_start_info_t;
   30.27 - */
   30.28  #define MAX_CMDLINE 256
   30.29 -#define BASIC_START_INFO                                                      \
   30.30 -    /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME.     */ \
   30.31 -    memory_t nr_pages;       /*  0: Total pages allocated to this domain. */  \
   30.32 -    _MEMORY_PADDING(A);                                                       \
   30.33 -    memory_t shared_info;    /*  8: MACHINE address of shared info struct.*/  \
   30.34 -    _MEMORY_PADDING(B);                                                       \
   30.35 -    u32      flags;          /* 16: SIF_xxx flags.                        */  \
   30.36 -    u32      __pad;                                                           \
   30.37 -    /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME).      */ \
   30.38 -    memory_t pt_base;        /* 24: VIRTUAL address of page directory.    */  \
   30.39 -    _MEMORY_PADDING(C);                                                       \
   30.40 -    memory_t nr_pt_frames;   /* 32: Number of bootstrap p.t. frames.      */  \
   30.41 -    _MEMORY_PADDING(D);                                                       \
   30.42 -    memory_t mfn_list;       /* 40: VIRTUAL address of page-frame list.   */  \
   30.43 -    _MEMORY_PADDING(E);                                                       \
   30.44 -    memory_t mod_start;      /* 48: VIRTUAL address of pre-loaded module. */  \
   30.45 -    _MEMORY_PADDING(F);                                                       \
   30.46 -    memory_t mod_len;        /* 56: Size (bytes) of pre-loaded module.    */  \
   30.47 -    _MEMORY_PADDING(G);                                                       \
   30.48 -    u8 cmd_line[MAX_CMDLINE] /* 64 */
   30.49 -
   30.50  typedef struct {
   30.51 -    BASIC_START_INFO;
   30.52 +    /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME.     */
   30.53 +    memory_t nr_pages;        /*  0: Total pages allocated to this domain. */
   30.54 +    _MEMORY_PADDING(A);
   30.55 +    memory_t shared_info;     /*  8: MACHINE address of shared info struct.*/
   30.56 +    _MEMORY_PADDING(B);
   30.57 +    u32      flags;           /* 16: SIF_xxx flags.                        */
   30.58 +    u16      domain_controller_evtchn; /* 20 */
   30.59 +    u16      __pad;
   30.60 +    /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME).      */
   30.61 +    memory_t pt_base;         /* 24: VIRTUAL address of page directory.    */
   30.62 +    _MEMORY_PADDING(C);
   30.63 +    memory_t nr_pt_frames;    /* 32: Number of bootstrap p.t. frames.      */
   30.64 +    _MEMORY_PADDING(D);
   30.65 +    memory_t mfn_list;        /* 40: VIRTUAL address of page-frame list.   */
   30.66 +    _MEMORY_PADDING(E);
   30.67 +    memory_t mod_start;       /* 48: VIRTUAL address of pre-loaded module. */
   30.68 +    _MEMORY_PADDING(F);
   30.69 +    memory_t mod_len;         /* 56: Size (bytes) of pre-loaded module.    */
   30.70 +    _MEMORY_PADDING(G);
   30.71 +    u8 cmd_line[MAX_CMDLINE]; /* 64 */
   30.72  } PACKED start_info_t; /* 320 bytes */
   30.73  
   30.74  /* These flags are passed in the 'flags' field of start_info_t. */
   30.75  #define SIF_PRIVILEGED    (1<<0)  /* Is the domain privileged? */
   30.76  #define SIF_INITDOMAIN    (1<<1)  /* Is this the initial control domain? */
   30.77 +#define SIF_BLK_BE_DOMAIN (1<<4)  /* Is this a block backend domain? */
   30.78 +#define SIF_NET_BE_DOMAIN (1<<5)  /* Is this a net backend domain? */
   30.79  
   30.80  /* For use in guest OSes. */
   30.81  extern shared_info_t *HYPERVISOR_shared_info;
    31.1 --- a/xen/include/hypervisor-ifs/io/domain_controller.h	Mon Aug 16 09:59:28 2004 +0000
    31.2 +++ b/xen/include/hypervisor-ifs/io/domain_controller.h	Tue Aug 17 16:09:56 2004 +0000
    31.3 @@ -11,23 +11,6 @@
    31.4  #define __DOMAIN_CONTROLLER_H__
    31.5  
    31.6  
    31.7 -#ifndef BASIC_START_INFO
    31.8 -#error "Xen header file hypervisor-if.h must already be included here."
    31.9 -#endif
   31.10 -
   31.11 -
   31.12 -/*
   31.13 - * EXTENDED BOOTSTRAP STRUCTURE FOR NEW DOMAINS.
   31.14 - */
   31.15 -
   31.16 -typedef struct {
   31.17 -    BASIC_START_INFO;
   31.18 -    u16 domain_controller_evtchn; /* 320 */
   31.19 -} PACKED extended_start_info_t; /* 322 bytes */
   31.20 -#define SIF_BLK_BE_DOMAIN (1<<4)  /* Is this a block backend domain? */
   31.21 -#define SIF_NET_BE_DOMAIN (1<<5)  /* Is this a net backend domain? */
   31.22 -
   31.23 -
   31.24  /*
   31.25   * Reason codes for SCHEDOP_shutdown. These are opaque to Xen but may be
   31.26   * interpreted by control software to determine the appropriate action. These