diff --git a/.rootkeys b/.rootkeys
index 6c0a76071c..4bfb84abd1 100644
--- a/.rootkeys
+++ b/.rootkeys
@@ -218,6 +218,7 @@
41062ab7HMSSuaUv3_Z4agLpjSO88A linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/pci-functions.h
40f5623aDMCsWOFO0jktZ4e8sjwvEg linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_post.h
40f5623arsFXkGdPvIqvFi3yFXGR0Q linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mach-xen/setup_arch_pre.h
+4120f807GCO0uqsLqdZj9csxR1Wthw linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mmu_context.h
40f5623aFTyFTR-vdiA-KaGxk5JOKQ linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/msr.h
40f5623adgjZq9nAgCt0IXdWl7udSA linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/page.h
40f5623a54NuG-7qHihGYmw4wWQnMA linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/param.h
@@ -442,6 +443,7 @@
40cf2937Z8WCNOnO2FcWdubvEAF9QQ tools/python/xen/xm/shutdown.py
40fcefb2K1xqVVT4D-p7nL2GzS4scg tools/sv/Main.rpy
40ffbcb66Dj5F-1kCK9BcgSqCWkt1w tools/sv/Makefile
+4120b0e5L_nW-u0MWRfIdXg4ng4OjA tools/sv/images/destroy.png
4107c921_OR9NTSv2dKFiLCXxrXoxA tools/sv/images/finish.png
40fcefb3wXQMsl9WkgQAVtdrupm4sw tools/sv/images/left-end-highlight.jpg
40fcefb3K6ESt5sQhD9aCQRscQIlXQ tools/sv/images/left-end-no-highlight.jpg
@@ -459,6 +461,9 @@
40fcefb3dgsa24WLk_BJeYQHrDLuOg tools/sv/images/seperator-right-highlight.jpg
40fcefb3FtiX4Pd2kT8wDlp8u8xRhQ tools/sv/images/seperator.jpg
41013a82sUdUqBv8EoAUJii3gsZ-4g tools/sv/images/shutdown.png
+4120b0e5RyNoIQNMjUs4A2kshovjaQ tools/sv/images/small-destroy.png
+4120b0e6vW66wW6WvjQyFD0AZH2tng tools/sv/images/small-pause.png
+4120b0e6USof7ieyGxEvtCdTMpxaQw tools/sv/images/small-unpause.png
4104ffca-jPHLVOrW0n0VghEXXtKxg tools/sv/images/unpause.png
40fcefb3yMSrZvApO9ToIi-iQwnchA tools/sv/images/xen.png
41013a83z27rKvWIxAfUBMVZ1eDCDg tools/sv/inc/script.js
@@ -682,6 +687,7 @@
404f1bc7IwU-qnH8mJeVu0YsNGMrcw xen/include/hypervisor-ifs/arch-x86_64.h
3ddb79c2PMeWTK86y4C3F4MzHw4A1g xen/include/hypervisor-ifs/dom0_ops.h
403cd194j2pyLqXD8FJ-ukvZzkPenw xen/include/hypervisor-ifs/event_channel.h
+4121d149udGfSUGhn3k1ECz0bM31nQ xen/include/hypervisor-ifs/grant_table.h
3ddb79c25UE59iu4JJcbRalx95mvcg xen/include/hypervisor-ifs/hypervisor-if.h
40f5623bqoi4GEoBiiUc6TZk1HjsMg xen/include/hypervisor-ifs/io/blkif.h
40dc4076pVeE1kEEWzcUaNZin65kCA xen/include/hypervisor-ifs/io/domain_controller.h
diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c
index da60123dfd..f519ba1c5e 100644
--- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c
+++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/process.c
@@ -502,10 +502,10 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
*next = &next_p->thread;
int cpu = smp_processor_id();
struct tss_struct *tss = init_tss + cpu;
- unsigned long flags;
dom0_op_t op;
- local_irq_save(flags);
+ /* NB. No need to disable interrupts as already done in sched.c */
+ /* __cli(); */
/*
* Save away %fs and %gs. No need to save %es and %ds, as
@@ -569,8 +569,7 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
/* EXECUTE ALL TASK SWITCH XEN SYSCALLS AT THIS POINT. */
execute_multicall_list();
-
- local_irq_restore(flags);
+ /* __sti(); */
/*
* Restore %fs and %gs if needed.
diff --git a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/mmap.c b/linux-2.6.7-xen-sparse/arch/xen/i386/mm/mmap.c
index d3ffc00d9c..b55742967e 100644
--- a/linux-2.6.7-xen-sparse/arch/xen/i386/mm/mmap.c
+++ b/linux-2.6.7-xen-sparse/arch/xen/i386/mm/mmap.c
@@ -27,7 +27,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
start_addr = addr = mm->free_area_cache;
#else
- addr = PAGE_ALIGN(TASK_UNMAPPED_BASE);
+ start_addr = addr = PAGE_ALIGN(TASK_UNMAPPED_BASE);
#endif
full_search:
@@ -61,7 +61,10 @@ unsigned long
arch_check_fixed_mapping(struct file *filp, unsigned long addr,
unsigned long len, unsigned long pgoff, unsigned long flags)
{
- if ( addr < (FIRST_USER_PGD_NR<comm, addr, len);
return -EINVAL;
+ }
return 0;
}
diff --git a/linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c b/linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c
index 0a0046c86a..1a92d7d8b7 100644
--- a/linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c
+++ b/linux-2.6.7-xen-sparse/drivers/xen/blkfront/blkfront.c
@@ -49,15 +49,6 @@ static int recovery = 0; /* "Recovery in progress" flag. Protected
#define BLKIF_RING_FULL (((req_prod - resp_cons) == BLKIF_RING_SIZE) || \
(blkif_state != BLKIF_STATE_CONNECTED))
-/*
- * Request queues with outstanding work, but ring is currently full.
- * We need no special lock here, as we always access this with the
- * blkif_io_lock held. We only need a small maximum list.
- */
-#define MAX_PENDING 8
-static request_queue_t *pending_queues[MAX_PENDING];
-static int nr_pending;
-
static inline void translate_req_to_mfn(blkif_request_t *xreq,
blkif_request_t *req);
@@ -99,6 +90,23 @@ static inline void ADD_ID_TO_FREELIST( unsigned long id )
__initcall(xlblk_init);
+
+static void kick_pending_request_queues(void)
+{
+
+ if ( (xlbd_blk_queue != NULL) &&
+ test_bit(QUEUE_FLAG_STOPPED, &xlbd_blk_queue->queue_flags) )
+ {
+ blk_start_queue(xlbd_blk_queue);
+ /* XXXcl call to request_fn should not be needed but
+ * we get stuck without... needs investigating
+ */
+ xlbd_blk_queue->request_fn(xlbd_blk_queue);
+ }
+
+}
+
+
int blkif_open(struct inode *inode, struct file *filep)
{
struct gendisk *gd = inode->i_bdev->bd_disk;
@@ -244,7 +252,7 @@ static int blkif_queue_request(struct request *req)
id = GET_ID_FROM_FREELIST();
rec_ring[id].id = (unsigned long) req;
-//printk("r: %d req %p (%ld)\n",req_prod,req,id);
+//printk(KERN_ALERT"r: %d req %p (%ld)\n",req_prod,req,id);
ring_req->id = id;
ring_req->operation = rq_data_dir(req) ? BLKIF_OP_WRITE :
@@ -291,6 +299,8 @@ void do_blkif_request(request_queue_t *rq)
DPRINTK("Entered do_blkif_request\n");
+//printk(KERN_ALERT"r: %d req\n",req_prod);
+
queued = 0;
while ((req = elv_next_request(rq)) != NULL) {
@@ -347,7 +357,7 @@ static irqreturn_t blkif_int(int irq, void *dev_id, struct pt_regs *ptregs)
id = bret->id;
req = (struct request *)rec_ring[id].id;
-//printk("i: %d req %p (%ld)\n",i,req,id);
+//printk(KERN_ALERT"i: %d req %p (%ld)\n",i,req,id);
ADD_ID_TO_FREELIST(id); // overwrites req
@@ -378,15 +388,7 @@ static irqreturn_t blkif_int(int irq, void *dev_id, struct pt_regs *ptregs)
resp_cons = i;
- if ( (xlbd_blk_queue != NULL) &&
- test_bit(QUEUE_FLAG_STOPPED, &xlbd_blk_queue->queue_flags) )
- {
- blk_start_queue(xlbd_blk_queue);
- /* XXXcl call to request_fn should not be needed but
- * we get stuck without... needs investigating
- */
- xlbd_blk_queue->request_fn(xlbd_blk_queue);
- }
+ kick_pending_request_queues();
spin_unlock_irqrestore(&blkif_io_lock, flags);
@@ -400,6 +402,16 @@ static kdev_t sg_dev;
static int sg_operation = -1;
static unsigned long sg_next_sect;
+/*
+ * Request queues with outstanding work, but ring is currently full.
+ * We need no special lock here, as we always access this with the
+ * blkif_io_lock held. We only need a small maximum list.
+ */
+#define MAX_PENDING 8
+static request_queue_t *pending_queues[MAX_PENDING];
+static int nr_pending;
+
+
#define DISABLE_SCATTERGATHER() (sg_operation = -1)
#define blkif_io_lock io_request_lock
@@ -418,6 +430,18 @@ static void update_vbds_task(void *unused)
}
#endif
+static void kick_pending_request_queues(void)
+{
+ /* We kick pending request queues if the ring is reasonably empty. */
+ if ( (nr_pending != 0) &&
+ ((req_prod - resp_cons) < (BLKIF_RING_SIZE >> 1)) )
+ {
+ /* Attempt to drain the queue, but bail if the ring becomes full. */
+ while ( (nr_pending != 0) && !BLKIF_RING_FULL )
+ do_blkif_request(pending_queues[--nr_pending]);
+ }
+}
+
int blkif_open(struct inode *inode, struct file *filep)
{
short xldev = inode->i_rdev;
@@ -949,24 +973,13 @@ static inline void translate_req_to_mfn(blkif_request_t *xreq,
static inline void flush_requests(void)
{
DISABLE_SCATTERGATHER();
+//printk(KERN_ALERT"flush %d\n",req_prod);
wmb(); /* Ensure that the frontend can see the requests. */
blk_ring->req_prod = req_prod;
notify_via_evtchn(blkif_evtchn);
}
-static void kick_pending_request_queues(void)
-{
- /* We kick pending request queues if the ring is reasonably empty. */
- if ( (nr_pending != 0) &&
- ((req_prod - resp_cons) < (BLKIF_RING_SIZE >> 1)) )
- {
- /* Attempt to drain the queue, but bail if the ring becomes full. */
- while ( (nr_pending != 0) && !BLKIF_RING_FULL )
- do_blkif_request(pending_queues[--nr_pending]);
- }
-}
-
void blkif_control_send(blkif_request_t *req, blkif_response_t *rsp)
{
unsigned long flags, id;
@@ -1016,6 +1029,7 @@ static void blkif_status_change(blkif_fe_interface_status_changed_t *status)
{
ctrl_msg_t cmsg;
blkif_fe_interface_connect_t up;
+ long rc;
if ( status->handle != 0 )
{
@@ -1075,11 +1089,13 @@ static void blkif_status_change(blkif_fe_interface_status_changed_t *status)
" in state %d\n", blkif_state);
break;
}
-
blkif_evtchn = status->evtchn;
blkif_irq = bind_evtchn_to_irq(blkif_evtchn);
- (void)request_irq(blkif_irq, blkif_int,
- SA_SAMPLE_RANDOM, "blkif", NULL);
+ if ( (rc=request_irq(blkif_irq, blkif_int,
+ SA_SAMPLE_RANDOM, "blkif", NULL)) )
+ {
+ printk(KERN_ALERT"blkfront request_irq failed (%ld)\n",rc);
+ }
if ( recovery )
{
diff --git a/linux-2.6.7-xen-sparse/drivers/xen/netfront/netfront.c b/linux-2.6.7-xen-sparse/drivers/xen/netfront/netfront.c
index 7a9cfed29e..118577ef3e 100644
--- a/linux-2.6.7-xen-sparse/drivers/xen/netfront/netfront.c
+++ b/linux-2.6.7-xen-sparse/drivers/xen/netfront/netfront.c
@@ -17,6 +17,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -427,9 +428,7 @@ static int netif_poll(struct net_device *dev, int *pbudget)
*/
if ( unlikely(rx->status <= 0) )
{
- /* Gate this error. We get a (valid) slew of them on suspend. */
- if ( np->user_state == UST_OPEN )
- printk(KERN_ALERT "bad buffer on RX ring!(%d)\n", rx->status);
+ printk(KERN_ALERT "bad buffer on RX ring!(%d)\n", rx->status);
np->rx->ring[MASK_NETIF_RX_IDX(np->rx->req_prod)].req.id = rx->id;
wmb();
np->rx->req_prod++;
@@ -470,6 +469,15 @@ static int netif_poll(struct net_device *dev, int *pbudget)
mcl->args[2] = 0;
mcl++;
(void)HYPERVISOR_multicall(rx_mcl, mcl - rx_mcl);
+
+#if 0
+ if (unlikely(rx_mcl[0].args[5] != 0))
+ printk(KERN_ALERT"Hypercall0 failed %u\n",np->rx->resp_prod);
+
+ if (unlikely(rx_mcl[1].args[5] != 0))
+ printk(KERN_ALERT"Hypercall1 failed %u\n",np->rx->resp_prod);
+#endif
+
}
while ( (skb = __skb_dequeue(&rxq)) != NULL )
@@ -595,6 +603,7 @@ static void network_connect(struct net_device *dev,
printk(KERN_ALERT"Netfront recovered tx=%d rxfree=%d\n",
np->tx->req_prod,np->rx->req_prod);
+
/* Step 3: All public and private state should now be sane. Get
* ready to start sending and receiving packets and give the driver
* domain a kick because we've probably just requeued some
@@ -712,7 +721,6 @@ static void netif_status_change(netif_fe_interface_status_changed_t *status)
np->irq = bind_evtchn_to_irq(np->evtchn);
(void)request_irq(np->irq, netif_int, SA_SAMPLE_RANDOM,
dev->name, dev);
-
netctrl_connected_count();
break;
@@ -897,10 +905,9 @@ void netif_suspend(void)
sprintf(name,"eth%d",i);
dev = __dev_get_by_name(name);
- if ( dev && (dev->flags & IFF_UP) )
+ if ( dev )
{
np = dev->priv;
-
free_irq(np->irq, dev);
unbind_evtchn_from_irq(np->evtchn);
}
@@ -932,6 +939,9 @@ void netif_resume(void)
// stop bad things from happening until we're back up
np->backend_state = BEST_DISCONNECTED;
+
+ memset(np->tx,0,PAGE_SIZE);
+ memset(np->rx,0,PAGE_SIZE);
cmsg.type = CMSG_NETIF_FE;
cmsg.subtype = CMSG_NETIF_FE_INTERFACE_CONNECT;
diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mmu_context.h b/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mmu_context.h
new file mode 100644
index 0000000000..cea0fd614c
--- /dev/null
+++ b/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/mmu_context.h
@@ -0,0 +1,75 @@
+#ifndef __I386_SCHED_H
+#define __I386_SCHED_H
+
+#include
+#include
+#include
+#include
+#include
+
+/*
+ * Used for LDT copy/destruction.
+ */
+int init_new_context(struct task_struct *tsk, struct mm_struct *mm);
+void destroy_context(struct mm_struct *mm);
+
+
+static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
+{
+#ifdef CONFIG_SMP
+ unsigned cpu = smp_processor_id();
+ if (cpu_tlbstate[cpu].state == TLBSTATE_OK)
+ cpu_tlbstate[cpu].state = TLBSTATE_LAZY;
+#endif
+}
+
+static inline void switch_mm(struct mm_struct *prev,
+ struct mm_struct *next,
+ struct task_struct *tsk)
+{
+ int cpu = smp_processor_id();
+
+ if (likely(prev != next)) {
+ /* stop flush ipis for the previous mm */
+ cpu_clear(cpu, prev->cpu_vm_mask);
+#ifdef CONFIG_SMP
+ cpu_tlbstate[cpu].state = TLBSTATE_OK;
+ cpu_tlbstate[cpu].active_mm = next;
+#endif
+ cpu_set(cpu, next->cpu_vm_mask);
+
+ /* Re-load page tables */
+ load_cr3_noflush(next->pgd);
+
+ /*
+ * load the LDT, if the LDT is different:
+ */
+ if (unlikely(prev->context.ldt != next->context.ldt))
+ load_LDT_nolock(&next->context, cpu);
+ }
+#ifdef CONFIG_SMP
+ else {
+ cpu_tlbstate[cpu].state = TLBSTATE_OK;
+ BUG_ON(cpu_tlbstate[cpu].active_mm != next);
+
+ if (!cpu_test_and_set(cpu, next->cpu_vm_mask)) {
+ /* We were in lazy tlb mode and leave_mm disabled
+ * tlb flush IPI delivery. We must reload %cr3.
+ */
+ load_cr3_noflush(next->pgd);
+ load_LDT_nolock(&next->context, cpu);
+ }
+ }
+#endif
+}
+
+#define deactivate_mm(tsk, mm) \
+ asm("movl %0,%%fs ; movl %0,%%gs": :"r" (0))
+
+#define activate_mm(prev, next) \
+do { \
+ switch_mm((prev),(next),NULL); \
+ flush_page_update_queue(); \
+} while ( 0 )
+
+#endif
diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/processor.h b/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/processor.h
index a57533dd8a..b4eafd19f7 100644
--- a/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/processor.h
+++ b/linux-2.6.7-xen-sparse/include/asm-xen/asm-i386/processor.h
@@ -186,6 +186,11 @@ static inline unsigned int cpuid_edx(unsigned int op)
cur_pgd = pgdir; /* XXXsmp */ \
} while (/* CONSTCOND */0)
+#define load_cr3_noflush(pgdir) do { \
+ queue_pt_switch(__pa(pgdir)); \
+ cur_pgd = pgdir; /* XXXsmp */ \
+} while (/* CONSTCOND */0)
+
/*
* Intel CPU features in CR4
diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/hypervisor.h b/linux-2.6.7-xen-sparse/include/asm-xen/hypervisor.h
index 5b89913a81..a3b180ecb8 100644
--- a/linux-2.6.7-xen-sparse/include/asm-xen/hypervisor.h
+++ b/linux-2.6.7-xen-sparse/include/asm-xen/hypervisor.h
@@ -21,7 +21,7 @@
/* arch/xen/i386/kernel/setup.c */
union start_info_union
{
- extended_start_info_t start_info;
+ start_info_t start_info;
char padding[512];
};
extern union start_info_union start_info_union;
@@ -374,7 +374,8 @@ static inline int HYPERVISOR_dom_mem_op(unsigned int op,
__asm__ __volatile__ (
TRAP_INSTR
: "=a" (ret) : "0" (__HYPERVISOR_dom_mem_op),
- "b" (op), "c" (extent_list), "d" (nr_extents), "S" (extent_order)
+ "b" (op), "c" (extent_list), "d" (nr_extents), "S" (extent_order),
+ "D" (DOMID_SELF)
: "memory" );
return ret;
diff --git a/linux-2.6.7-xen-sparse/include/asm-xen/suspend.h b/linux-2.6.7-xen-sparse/include/asm-xen/suspend.h
index 0a9c8e74a9..937137f005 100644
--- a/linux-2.6.7-xen-sparse/include/asm-xen/suspend.h
+++ b/linux-2.6.7-xen-sparse/include/asm-xen/suspend.h
@@ -12,7 +12,7 @@
typedef struct suspend_record_st {
/* To be filled in before resume. */
- extended_start_info_t resume_info;
+ start_info_t resume_info;
/*
* The number of a machine frame containing, in sequence, the number of
* each machine frame that contains PFN -> MFN translation table data.
diff --git a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c
index 39dd6c3d08..c272ecb2c2 100644
--- a/tools/libxc/xc_linux_build.c
+++ b/tools/libxc/xc_linux_build.c
@@ -85,7 +85,7 @@ static int setup_guestos(int xc_handle,
unsigned long l2tab;
unsigned long l1tab;
unsigned long count, i;
- extended_start_info_t *start_info;
+ start_info_t *start_info;
shared_info_t *shared_info;
mmu_t *mmu = NULL;
void *pm_handle=NULL;
diff --git a/tools/libxc/xc_linux_restore.c b/tools/libxc/xc_linux_restore.c
index 31c9924bfd..6d4f0906aa 100644
--- a/tools/libxc/xc_linux_restore.c
+++ b/tools/libxc/xc_linux_restore.c
@@ -504,6 +504,54 @@ printf("XXXXXXXXXXXXXXX pin L2\n");
xcio_info(ioctxt, "\b\b\b\b100%%\nMemory reloaded.\n");
+ /* Get the list of PFNs that are not in the psuedo-phys map */
+ {
+ unsigned int count, *pfntab;
+ int rc;
+ if ( xcio_read(ioctxt, &count, sizeof(count)) )
+ {
+ xcio_error(ioctxt, "Error when reading from state file");
+ goto out;
+ }
+
+ pfntab = malloc( sizeof(unsigned int) * count );
+ if ( !pfntab )
+ {
+ xcio_error(ioctxt, "Out of memory");
+ goto out;
+ }
+
+ if ( xcio_read(ioctxt, pfntab, sizeof(unsigned int)*count) )
+ {
+ xcio_error(ioctxt, "Error when reading pfntab from state file");
+ goto out;
+ }
+
+ for(i=0;i0 )
+ {
+ if ( (rc = do_dom_mem_op( xc_handle,
+ MEMOP_decrease_reservation,
+ pfntab, count, 0, dom )) <0 )
+ {
+ xcio_error(ioctxt, "Could not decrease reservation : %d",rc);
+ goto out;
+ }
+ else
+ {
+ printf("Decreased reservation by %d pages\n", count);
+ }
+ }
+
+ }
+
+
if ( xcio_read(ioctxt, &ctxt, sizeof(ctxt)) ||
xcio_read(ioctxt, shared_info, PAGE_SIZE) )
diff --git a/tools/libxc/xc_linux_save.c b/tools/libxc/xc_linux_save.c
index c3089955c9..5a47b30f56 100644
--- a/tools/libxc/xc_linux_save.c
+++ b/tools/libxc/xc_linux_save.c
@@ -463,10 +463,6 @@ int xc_linux_save(int xc_handle, XcIOContext *ioctxt)
goto out;
}
- printf("SUSPPPPPPPP flags %08lx shinfo %08lx eip %08lx esi %08lx\n",
- op.u.getdomaininfo.flags, op.u.getdomaininfo.shared_info_frame,
- ctxt.cpu_ctxt.eip, ctxt.cpu_ctxt.esi );
-
}
/* calculate the power of 2 order of nr_pfns, e.g.
@@ -866,9 +862,41 @@ printf("type fail: page %i mfn %08lx\n",j,pfn_type[j]);
goto out;
}
-printf("SUSPPPPPPPP flags %08lx shinfo %08lx eip %08lx esi %08lx\n",
- op.u.getdomaininfo.flags, op.u.getdomaininfo.shared_info_frame,
- ctxt.cpu_ctxt.eip, ctxt.cpu_ctxt.esi );
+ /* Send through a list of all the PFNs that were not in map at the close */
+ {
+ unsigned int i,j;
+ unsigned int pfntab[1024];
+
+ for ( i = 0, j = 0; i < nr_pfns; i++ )
+ {
+ if ( live_pfn_to_mfn_table[i] >= 0x80000000UL )
+ j++;
+ }
+
+ if ( xcio_write(ioctxt, &j, sizeof(unsigned int)) )
+ {
+ xcio_error(ioctxt, "Error when writing to state file (6a)");
+ goto out;
+ }
+
+ for ( i = 0, j = 0; i < nr_pfns; )
+ {
+ if ( live_pfn_to_mfn_table[i] >= 0x80000000UL )
+ {
+ pfntab[j++] = i;
+ }
+ i++;
+ if ( j == 1024 || i == nr_pfns )
+ {
+ if ( xcio_write(ioctxt, &pfntab, sizeof(unsigned long)*j) )
+ {
+ xcio_error(ioctxt, "Error when writing to state file (6b)");
+ goto out;
+ }
+ j = 0;
+ }
+ }
+ }
/* Map the suspend-record MFN to pin it. The page must be owned by
domid for this to succeed. */
diff --git a/tools/libxc/xc_netbsd_build.c b/tools/libxc/xc_netbsd_build.c
index 41adfa935a..e113726551 100644
--- a/tools/libxc/xc_netbsd_build.c
+++ b/tools/libxc/xc_netbsd_build.c
@@ -73,7 +73,7 @@ static int setup_guestos(int xc_handle,
unsigned long l1tab;
unsigned long count, pt_start;
unsigned long symtab_addr = 0, symtab_len = 0;
- extended_start_info_t *start_info;
+ start_info_t *start_info;
shared_info_t *shared_info;
unsigned long ksize;
mmu_t *mmu = NULL;
diff --git a/tools/libxc/xc_private.h b/tools/libxc/xc_private.h
index 3d0572501b..d70f7df58a 100644
--- a/tools/libxc/xc_private.h
+++ b/tools/libxc/xc_private.h
@@ -127,6 +127,42 @@ static inline int do_multicall_op(int xc_handle,
out1: return ret;
}
+
+static inline int do_dom_mem_op(int xc_handle,
+ unsigned int memop,
+ unsigned int *extent_list,
+ unsigned int nr_extents,
+ unsigned int extent_order,
+ domid_t domid)
+{
+ privcmd_hypercall_t hypercall;
+ long ret = -EINVAL;
+
+ hypercall.op = __HYPERVISOR_dom_mem_op;
+ hypercall.arg[0] = (unsigned long)memop;
+ hypercall.arg[1] = (unsigned long)extent_list;
+ hypercall.arg[2] = (unsigned long)nr_extents;
+ hypercall.arg[3] = (unsigned long)extent_order;
+ hypercall.arg[4] = (unsigned long)domid;
+
+ if ( mlock(extent_list, nr_extents*sizeof(unsigned long)) != 0 )
+ {
+ PERROR("Could not lock memory for Xen hypercall");
+ goto out1;
+ }
+
+ if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
+ {
+ fprintf(stderr, "Dom_mem operation failed (rc=%ld errno=%d)-- need to"
+ " rebuild the user-space tool set?\n",ret,errno);
+ goto out2;
+ }
+
+ out2: (void)munlock(extent_list, nr_extents*sizeof(unsigned long));
+ out1: return ret;
+}
+
+
/*
* PFN mapping.
*/
diff --git a/tools/python/xen/sv/CreateDomain.py b/tools/python/xen/sv/CreateDomain.py
index b4fd52f0e8..77237a3a47 100644
--- a/tools/python/xen/sv/CreateDomain.py
+++ b/tools/python/xen/sv/CreateDomain.py
@@ -25,6 +25,7 @@ class CreatePage0( Sheet ):
self.addControl( InputControl( 'name', 'VM Name', 'VM Name:', "[\\w|\\S]+", "You must enter a name in this field" ) )
self.addControl( InputControl( 'memory', '64', 'Memory (Mb):', "[\\d]+", "You must enter a number in this field" ) )
self.addControl( InputControl( 'cpu', '0', 'CPU:', "[\\d]+", "You must enter a number in this feild" ) )
+ self.addControl( InputControl( 'cpu_weight', '1', 'CPU Weight:', "[\\d]+", "You must enter a number in this feild" ) )
class CreatePage1( Sheet ):
@@ -83,9 +84,16 @@ class CreateFinish( Sheet ):
xend_sxp = self.translate_sxp( string2sxp( self.passback ) )
- dom_sxp = server.xend_domain_create( xend_sxp )
+ try:
+ dom_sxp = server.xend_domain_create( xend_sxp )
+ success = "Your domain was successfully created.\n"
+ except:
+ success = "There was an error creating your domain.\nThe configuration used is as follows:\n"
+ dom_sxp = xend_sxp
+
+
- pt = PreTab( sxp2prettystring( dom_sxp ) )
+ pt = PreTab( success + sxp2prettystring( dom_sxp ) )
pt.write_BODY( request )
request.write( "
" % self.passback )
@@ -106,6 +114,7 @@ class CreateFinish( Sheet ):
vals.name = get( 'name' )
vals.memory = get( 'memory' )
vals.cpu = get( 'cpu' )
+ vals.cpu_weight = get( 'cpu_weight' )
vals.builder = get( 'builder' )
vals.kernel = get( 'kernel' )
@@ -121,7 +130,7 @@ class CreateFinish( Sheet ):
vals.disk = vbds
- #misc crap
+ #misc
vals.pci = []
@@ -145,4 +154,8 @@ class CreateFinish( Sheet ):
vals.cmdline_ip = "%s:%s:%s:%s:%s:eth0:%s" % (ip, nfs, gate, mask, host, dhcp)
- return make_config( vals )
+ try:
+ return make_config( vals )
+ except:
+ return [["Error creating domain config."]]
+
diff --git a/tools/python/xen/sv/DomInfo.py b/tools/python/xen/sv/DomInfo.py
index 6f8ac1ab5b..3e4fb70b13 100755
--- a/tools/python/xen/sv/DomInfo.py
+++ b/tools/python/xen/sv/DomInfo.py
@@ -5,6 +5,8 @@ from xen.sv.HTMLBase import HTMLBase
from xen.sv.util import *
from xen.sv.GenTabbed import *
+DEBUG=1
+
class DomInfo( GenTabbed ):
def __init__( self, urlWriter ):
@@ -76,8 +78,11 @@ class DomSXPTab( PreTab ):
request.write( "Please Select a Domain
" )
return None
- domInfo = server.xend_domain( self.dom )
-
+ try:
+ domInfo = server.xend_domain( self.dom )
+ except:
+ domInfo = [["Error getting domain details."]]
+
self.source = sxp2prettystring( domInfo )
PreTab.write_BODY( self, request )
@@ -88,32 +93,54 @@ class DomActionTab( ActionTab ):
actions = { "shutdown" : ( "Shutdown the Domain", "shutdown.png" ),
"reboot" : ( "Reboot the Domain", "reboot.png" ),
"pause" : ( "Pause the Domain", "pause.png" ),
- "unpause" : ( "Unpause the Domain", "unpause.png" ) }
+ "unpause" : ( "Unpause the Domain", "unpause.png" ),
+ "destroy" : ( "Destroy the Domain", "destroy.png" ) }
ActionTab.__init__( self, actions )
def op_shutdown( self, request ):
dom = getVar( 'dom', request )
- if not dom is None:
- print ">DomShutDown %s" % dom
- #server.xend_node_shutdown()
+ if not dom is None and dom != '0':
+ if DEBUG: print ">DomShutDown %s" % dom
+ try:
+ server.xend_domain_shutdown( int( dom ), "halt" )
+ except:
+ pass
def op_reboot( self, request ):
dom = getVar( 'dom', request )
- if not dom is None:
- print ">DomReboot %s" % dom
- #server.xend_node_reboot()
-
+ if not dom is None and dom != '0':
+ if DEBUG: print ">DomReboot %s" % dom
+ try:
+ server.xend_domain_shutdown( int( dom ), "reboot" )
+ except:
+ pass
+
def op_pause( self, request ):
dom = getVar( 'dom', request )
- if not dom is None:
- print ">DomPause %s" % dom
- server.xend_domain_pause( int( dom ) )
-
+ if not dom is None and dom != '0':
+ if DEBUG: print ">DomPause %s" % dom
+ try:
+ server.xend_domain_pause( int( dom ) )
+ except:
+ pass
+
def op_unpause( self, request ):
dom = getVar( 'dom', request )
- if not dom is None:
- print ">DomUnpause %s" % dom
- server.xend_domain_unpause( int( dom ) )
+ if not dom is None and dom != '0':
+ if DEBUG: print ">DomUnpause %s" % dom
+ try:
+ server.xend_domain_unpause( int( dom ) )
+ except:
+ pass
+
+ def op_destroy( self, request ):
+ dom = getVar( 'dom', request )
+ if not dom is None and dom != '0':
+ if DEBUG: print ">DomDestroy %s" % dom
+ try:
+ server.xend_domain_destroy( int( dom ), "halt" )
+ except:
+ pass
diff --git a/tools/python/xen/sv/DomList.py b/tools/python/xen/sv/DomList.py
index faed020b05..d6e123143e 100755
--- a/tools/python/xen/sv/DomList.py
+++ b/tools/python/xen/sv/DomList.py
@@ -17,9 +17,14 @@ class DomList( HTMLBase ):
def write_BODY( self, request, head=True, long=True ):
- domains = map(int, server.xend_domains())
- domains.sort()
+ domains = None
+ try:
+ domains = server.xend_domains()
+ domains.sort()
+ except:
+ pass
+
request.write( "\n\n" )
if head:
@@ -29,28 +34,42 @@ class DomList( HTMLBase ):
odd = True
- for domain in domains:
- if odd:
- request.write( "\n" )
- odd = False
- else:
- request.write( "
\n" )
- odd = True
- self.write_DOMAIN( request, getDomInfoHash( domain ), long )
- request.write( "
\n" )
-
+ if not domains is None:
+ for domain in domains:
+ if odd:
+ request.write( "\n" )
+ odd = False
+ else:
+ request.write( "
\n" )
+ odd = True
+ self.write_DOMAIN( request, getDomInfoHash( domain ), long )
+ request.write( "
\n" )
+ else:
+ request.write( "Error getting domain list
Perhaps XenD not running?
")
+
request.write( "
\n" )
def write_DOMAIN( self, request, domInfoHash, long=True ):
- request.write( "%(dom)-4d | \n" % domInfoHash )
+ request.write( "%(id)s | \n" % domInfoHash )
- url = self.urlWriter( "&mod=info&dom=%(dom)-4d" % domInfoHash )
+ url = self.urlWriter( "&mod=info&dom=%(id)s" % domInfoHash )
request.write( "%s | \n" % ( url, domInfoHash['name'] ) )
if long:
request.write( "%(memory)5s | \n" % domInfoHash )
request.write( "%(cpu)2s | \n" % domInfoHash )
request.write( "%(state)5s | \n" % domInfoHash )
+ if domInfoHash[ 'id' ] != "0":
+ request.write( "" )
+
+ if domInfoHash[ 'state' ][ 2 ] == "-":
+ request.write( " " % domInfoHash )
+ else:
+ request.write( " " % domInfoHash )
+
+ request.write( " | " % domInfoHash)
+ else:
+ request.write( " | " )
def write_DOMAIN_HEAD( self, request, long=True ):
request.write( "Domain | \n" )
@@ -59,4 +78,4 @@ class DomList( HTMLBase ):
request.write( "Memory / Mb | \n" )
request.write( "CPU | \n" )
request.write( "State | \n" )
-
+ request.write( " | \n" )
diff --git a/tools/python/xen/sv/HTMLBase.py b/tools/python/xen/sv/HTMLBase.py
index 10d860e0c4..e67784d558 100755
--- a/tools/python/xen/sv/HTMLBase.py
+++ b/tools/python/xen/sv/HTMLBase.py
@@ -1,4 +1,5 @@
from twisted.web.resource import Resource
+from xen.sv.util import *
class HTMLBase( Resource ):
@@ -28,6 +29,7 @@ class HTMLBase( Resource ):
def write_BOTTOM( self, request ):
request.write('')
+ request.write('')
request.write('')
request.write( "