[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Merge with xenppc-unstable-merge.hg



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 9061e1246906e8d1b7f6519c5252e6182f73214d
# Parent  0bdd578c417f0a3b50da35b3d6d1a196bb9abd7f
# Parent  d8bceca5f07d4510a8c4a7d9c13cae2af571aa30
Merge with xenppc-unstable-merge.hg
---
 extras/mini-os/events.c                              |   33 --
 extras/mini-os/include/events.h                      |    7 
 extras/mini-os/include/x86/x86_32/hypercall-x86_32.h |    6 
 linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c    |   25 -
 linux-2.6-xen-sparse/arch/ia64/dig/setup.c           |   23 -
 linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c  |   25 -
 linux-2.6-xen-sparse/drivers/xen/console/console.c   |   36 ++
 linux-2.6-xen-sparse/include/xen/xencons.h           |    3 
 tools/python/xen/xend/XendDomain.py                  |   16 +
 tools/python/xen/xend/XendDomainInfo.py              |   16 -
 tools/python/xen/xend/image.py                       |    4 
 tools/python/xen/xend/server/tpmif.py                |    2 
 tools/python/xen/xm/main.py                          |   43 ++
 tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py    |    2 
 tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py         |    2 
 tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py         |    2 
 xen/arch/ia64/xen/mm.c                               |   95 ++----
 xen/arch/powerpc/mm.c                                |   80 +----
 xen/arch/x86/domain_build.c                          |    8 
 xen/arch/x86/hvm/hvm.c                               |    1 
 xen/arch/x86/mm.c                                    |  294 +++++--------------
 xen/arch/x86/mm/shadow/common.c                      |    7 
 xen/arch/x86/mm/shadow/multi.c                       |    2 
 xen/arch/x86/oprofile/nmi_int.c                      |   25 +
 xen/arch/x86/oprofile/xenoprof.c                     |   24 -
 xen/common/sched_credit.c                            |   56 +--
 xen/drivers/video/vga.c                              |   11 
 xen/include/asm-ia64/mm.h                            |    8 
 xen/include/asm-powerpc/mm.h                         |    8 
 xen/include/asm-x86/mm.h                             |   50 ---
 xen/include/asm-x86/x86_32/page-3level.h             |    2 
 xen/include/public/xen.h                             |   50 ++-
 xen/tools/figlet/figlet.c                            |    5 
 33 files changed, 410 insertions(+), 561 deletions(-)

diff -r 0bdd578c417f -r 9061e1246906 extras/mini-os/events.c
--- a/extras/mini-os/events.c   Mon Sep 18 14:28:16 2006 -0500
+++ b/extras/mini-os/events.c   Tue Sep 19 09:40:26 2006 +0100
@@ -88,19 +88,18 @@ void unbind_evtchn(evtchn_port_t port )
 
 int bind_virq(uint32_t virq, evtchn_handler_t handler, void *data)
 {
-       evtchn_op_t op;
+       evtchn_bind_virq_t op;
 
        /* Try to bind the virq to a port */
-       op.cmd = EVTCHNOP_bind_virq;
-       op.u.bind_virq.virq = virq;
-       op.u.bind_virq.vcpu = smp_processor_id();
+       op.virq = virq;
+       op.vcpu = smp_processor_id();
 
-       if ( HYPERVISOR_event_channel_op(&op) != 0 )
+       if ( HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, &op) != 0 )
        {
                printk("Failed to bind virtual IRQ %d\n", virq);
                return 1;
     }
-    bind_evtchn(op.u.bind_virq.port, handler, data);
+    bind_evtchn(op.port, handler, data);
        return 0;
 }
 
@@ -151,14 +150,13 @@ int evtchn_alloc_unbound(domid_t pal, ev
 int evtchn_alloc_unbound(domid_t pal, evtchn_handler_t handler,
                                                 void *data, evtchn_port_t 
*port)
 {
-    evtchn_op_t op;
-    op.cmd = EVTCHNOP_alloc_unbound;
-    op.u.alloc_unbound.dom = DOMID_SELF;
-    op.u.alloc_unbound.remote_dom = pal;
-    int err = HYPERVISOR_event_channel_op(&op);
+    evtchn_alloc_unbound_t op;
+    op.dom = DOMID_SELF;
+    op.remote_dom = pal;
+    int err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, &op);
     if (err)
                return err;
-    *port = bind_evtchn(op.u.alloc_unbound.port, handler, data);
+    *port = bind_evtchn(op.port, handler, data);
     return err;
 }
 
@@ -169,14 +167,13 @@ int evtchn_bind_interdomain(domid_t pal,
                            evtchn_handler_t handler, void *data,
                            evtchn_port_t *local_port)
 {
-    evtchn_op_t op;
-    op.cmd = EVTCHNOP_bind_interdomain;
-    op.u.bind_interdomain.remote_dom = pal;
-    op.u.bind_interdomain.remote_port = remote_port;
-    int err = HYPERVISOR_event_channel_op(&op);
+    evtchn_bind_interdomain_t op;
+    op.remote_dom = pal;
+    op.remote_port = remote_port;
+    int err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain, &op);
     if (err)
                return err;
-       evtchn_port_t port = op.u.bind_interdomain.local_port;
+       evtchn_port_t port = op.local_port;
     clear_evtchn(port);              /* Without, handler gets invoked now! */
     *local_port = bind_evtchn(port, handler, data);
     return err;
diff -r 0bdd578c417f -r 9061e1246906 extras/mini-os/include/events.h
--- a/extras/mini-os/include/events.h   Mon Sep 18 14:28:16 2006 -0500
+++ b/extras/mini-os/include/events.h   Tue Sep 19 09:40:26 2006 +0100
@@ -39,10 +39,9 @@ int evtchn_bind_interdomain(domid_t pal,
 
 static inline int notify_remote_via_evtchn(evtchn_port_t port)
 {
-    evtchn_op_t op;
-    op.cmd = EVTCHNOP_send;
-    op.u.send.port = port;
-    return HYPERVISOR_event_channel_op(&op);
+    evtchn_send_t op;
+    op.port = port;
+    return HYPERVISOR_event_channel_op(EVTCHNOP_send, &op);
 }
 
 
diff -r 0bdd578c417f -r 9061e1246906 
extras/mini-os/include/x86/x86_32/hypercall-x86_32.h
--- a/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h      Mon Sep 18 
14:28:16 2006 -0500
+++ b/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h      Tue Sep 19 
09:40:26 2006 +0100
@@ -238,9 +238,9 @@ HYPERVISOR_update_va_mapping(
 
 static inline int
 HYPERVISOR_event_channel_op(
-       void *op)
-{
-       return _hypercall1(int, event_channel_op, op);
+       int cmd, void *op)
+{
+       return _hypercall2(int, event_channel_op, cmd, op);
 }
 
 static inline int
diff -r 0bdd578c417f -r 9061e1246906 
linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Mon Sep 18 14:28:16 
2006 -0500
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Tue Sep 19 09:40:26 
2006 +0100
@@ -65,6 +65,7 @@
 #include <xen/interface/physdev.h>
 #include <xen/interface/memory.h>
 #include <xen/features.h>
+#include <xen/xencons.h>
 #include "setup_arch_pre.h"
 #include <bios_ebda.h>
 
@@ -1665,33 +1666,15 @@ void __init setup_arch(char **cmdline_p)
                screen_info.orig_video_cols = 80;
                screen_info.orig_video_ega_bx = 3;
                screen_info.orig_video_points = 16;
+               screen_info.orig_y = screen_info.orig_video_lines - 1;
                if (xen_start_info->console.dom0.info_size >=
                    sizeof(struct dom0_vga_console_info)) {
                        const struct dom0_vga_console_info *info =
                                (struct dom0_vga_console_info *)(
                                        (char *)xen_start_info +
                                        xen_start_info->console.dom0.info_off);
-                       screen_info.orig_video_mode = info->txt_mode;
-                       screen_info.orig_video_isVGA = info->video_type;
-                       screen_info.orig_video_lines = info->video_height;
-                       screen_info.orig_video_cols = info->video_width;
-                       screen_info.orig_video_points = info->txt_points;
-                       screen_info.lfb_width = info->video_width;
-                       screen_info.lfb_height = info->video_height;
-                       screen_info.lfb_depth = info->lfb_depth;
-                       screen_info.lfb_base = info->lfb_base;
-                       screen_info.lfb_size = info->lfb_size;
-                       screen_info.lfb_linelength = info->lfb_linelen;
-                       screen_info.red_size = info->red_size;
-                       screen_info.red_pos = info->red_pos;
-                       screen_info.green_size = info->green_size;
-                       screen_info.green_pos = info->green_pos;
-                       screen_info.blue_size = info->blue_size;
-                       screen_info.blue_pos = info->blue_pos;
-                       screen_info.rsvd_size = info->rsvd_size;
-                       screen_info.rsvd_pos = info->rsvd_pos;
-               }
-               screen_info.orig_y = screen_info.orig_video_lines - 1;
+                       dom0_init_screen_info(info);
+               }
                xen_start_info->console.domU.mfn = 0;
                xen_start_info->console.domU.evtchn = 0;
        } else
diff -r 0bdd578c417f -r 9061e1246906 linux-2.6-xen-sparse/arch/ia64/dig/setup.c
--- a/linux-2.6-xen-sparse/arch/ia64/dig/setup.c        Mon Sep 18 14:28:16 
2006 -0500
+++ b/linux-2.6-xen-sparse/arch/ia64/dig/setup.c        Tue Sep 19 09:40:26 
2006 +0100
@@ -24,6 +24,8 @@
 #include <asm/io.h>
 #include <asm/machvec.h>
 #include <asm/system.h>
+
+#include <xen/xencons.h>
 
 void __init
 dig_setup (char **cmdline_p)
@@ -78,27 +80,8 @@ dig_setup (char **cmdline_p)
                        (struct dom0_vga_console_info *)(
                                (char *)xen_start_info +
                                xen_start_info->console.dom0.info_off);
-               screen_info.orig_video_mode = info->txt_mode;
-               screen_info.orig_video_isVGA = info->video_type;
-               screen_info.orig_video_lines = info->video_height;
-               screen_info.orig_video_cols = info->video_width;
-               screen_info.orig_video_points = info->txt_points;
-               screen_info.lfb_width = info->video_width;
-               screen_info.lfb_height = info->video_height;
-               screen_info.lfb_depth = info->lfb_depth;
-               screen_info.lfb_base = info->lfb_base;
-               screen_info.lfb_size = info->lfb_size;
-               screen_info.lfb_linelength = info->lfb_linelen;
-               screen_info.red_size = info->red_size;
-               screen_info.red_pos = info->red_pos;
-               screen_info.green_size = info->green_size;
-               screen_info.green_pos = info->green_pos;
-               screen_info.blue_size = info->blue_size;
-               screen_info.blue_pos = info->blue_pos;
-               screen_info.rsvd_size = info->rsvd_size;
-               screen_info.rsvd_pos = info->rsvd_pos;
+               dom0_init_screen_info(info);
        }
-       screen_info.orig_y = screen_info.orig_video_lines - 1;
        xen_start_info->console.domU.mfn = 0;
        xen_start_info->console.domU.evtchn = 0;
 #endif
diff -r 0bdd578c417f -r 9061e1246906 
linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c       Mon Sep 18 
14:28:16 2006 -0500
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c       Tue Sep 19 
09:40:26 2006 +0100
@@ -74,6 +74,7 @@
 #include <asm/hypervisor.h>
 #include <xen/interface/nmi.h>
 #include <xen/features.h>
+#include <xen/xencons.h>
 #define PFN_UP(x)       (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
 #define PFN_PHYS(x)     ((x) << PAGE_SHIFT)
 #include <asm/mach-xen/setup_arch_post.h>
@@ -645,33 +646,15 @@ void __init setup_arch(char **cmdline_p)
                screen_info.orig_video_cols = 80;
                screen_info.orig_video_ega_bx = 3;
                screen_info.orig_video_points = 16;
+               screen_info.orig_y = screen_info.orig_video_lines - 1;
                if (xen_start_info->console.dom0.info_size >=
                    sizeof(struct dom0_vga_console_info)) {
                        const struct dom0_vga_console_info *info =
                                (struct dom0_vga_console_info *)(
                                        (char *)xen_start_info +
                                        xen_start_info->console.dom0.info_off);
-                       screen_info.orig_video_mode = info->txt_mode;
-                       screen_info.orig_video_isVGA = info->video_type;
-                       screen_info.orig_video_lines = info->video_height;
-                       screen_info.orig_video_cols = info->video_width;
-                       screen_info.orig_video_points = info->txt_points;
-                       screen_info.lfb_width = info->video_width;
-                       screen_info.lfb_height = info->video_height;
-                       screen_info.lfb_depth = info->lfb_depth;
-                       screen_info.lfb_base = info->lfb_base;
-                       screen_info.lfb_size = info->lfb_size;
-                       screen_info.lfb_linelength = info->lfb_linelen;
-                       screen_info.red_size = info->red_size;
-                       screen_info.red_pos = info->red_pos;
-                       screen_info.green_size = info->green_size;
-                       screen_info.green_pos = info->green_pos;
-                       screen_info.blue_size = info->blue_size;
-                       screen_info.blue_pos = info->blue_pos;
-                       screen_info.rsvd_size = info->rsvd_size;
-                       screen_info.rsvd_pos = info->rsvd_pos;
-               }
-               screen_info.orig_y = screen_info.orig_video_lines - 1;
+                       dom0_init_screen_info(info);
+               }
                xen_start_info->console.domU.mfn = 0;
                xen_start_info->console.domU.evtchn = 0;
        } else
diff -r 0bdd578c417f -r 9061e1246906 
linux-2.6-xen-sparse/drivers/xen/console/console.c
--- a/linux-2.6-xen-sparse/drivers/xen/console/console.c        Mon Sep 18 
14:28:16 2006 -0500
+++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c        Tue Sep 19 
09:40:26 2006 +0100
@@ -49,6 +49,7 @@
 #include <linux/console.h>
 #include <linux/bootmem.h>
 #include <linux/sysrq.h>
+#include <linux/screen_info.h>
 #include <asm/io.h>
 #include <asm/irq.h>
 #include <asm/uaccess.h>
@@ -262,6 +263,41 @@ void xencons_force_flush(void)
                sent = xencons_ring_send(&wbuf[WBUF_MASK(wc)], sz);
                if (sent > 0)
                        wc += sent;
+       }
+}
+
+
+void dom0_init_screen_info(const struct dom0_vga_console_info *info)
+{
+       switch (info->video_type) {
+       case XEN_VGATYPE_TEXT_MODE_3:
+               screen_info.orig_video_mode = 3;
+               screen_info.orig_video_ega_bx = 3;
+               screen_info.orig_video_isVGA = 1;
+               screen_info.orig_video_lines = info->u.text_mode_3.rows;
+               screen_info.orig_video_cols = info->u.text_mode_3.columns;
+               screen_info.orig_x = info->u.text_mode_3.cursor_x;
+               screen_info.orig_y = info->u.text_mode_3.cursor_y;
+               screen_info.orig_video_points =
+                       info->u.text_mode_3.font_height;
+               break;
+       case XEN_VGATYPE_VESA_LFB:
+               screen_info.orig_video_isVGA = VIDEO_TYPE_VLFB;
+               screen_info.lfb_width = info->u.vesa_lfb.width;
+               screen_info.lfb_height = info->u.vesa_lfb.height;
+               screen_info.lfb_depth = info->u.vesa_lfb.bits_per_pixel;
+               screen_info.lfb_base = info->u.vesa_lfb.lfb_base;
+               screen_info.lfb_size = info->u.vesa_lfb.lfb_size;
+               screen_info.lfb_linelength = info->u.vesa_lfb.bytes_per_line;
+               screen_info.red_size = info->u.vesa_lfb.red_size;
+               screen_info.red_pos = info->u.vesa_lfb.red_pos;
+               screen_info.green_size = info->u.vesa_lfb.green_size;
+               screen_info.green_pos = info->u.vesa_lfb.green_pos;
+               screen_info.blue_size = info->u.vesa_lfb.blue_size;
+               screen_info.blue_pos = info->u.vesa_lfb.blue_pos;
+               screen_info.rsvd_size = info->u.vesa_lfb.rsvd_size;
+               screen_info.rsvd_pos = info->u.vesa_lfb.rsvd_pos;
+               break;
        }
 }
 
diff -r 0bdd578c417f -r 9061e1246906 linux-2.6-xen-sparse/include/xen/xencons.h
--- a/linux-2.6-xen-sparse/include/xen/xencons.h        Mon Sep 18 14:28:16 
2006 -0500
+++ b/linux-2.6-xen-sparse/include/xen/xencons.h        Tue Sep 19 09:40:26 
2006 +0100
@@ -1,5 +1,8 @@
 #ifndef __ASM_XENCONS_H__
 #define __ASM_XENCONS_H__
+
+struct dom0_vga_console_info;
+void dom0_init_screen_info(const struct dom0_vga_console_info *info);
 
 void xencons_force_flush(void);
 void xencons_resume(void);
diff -r 0bdd578c417f -r 9061e1246906 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Mon Sep 18 14:28:16 2006 -0500
+++ b/tools/python/xen/xend/XendDomain.py       Tue Sep 19 09:40:26 2006 +0100
@@ -390,6 +390,22 @@ class XendDomain:
         except Exception, ex:
             raise XendError(str(ex))
 
+    def domain_dump(self, domid, filename, live, crash):
+        """Dump domain core."""
+
+        dominfo = self.domain_lookup_by_name_or_id_nr(domid)
+        if not dominfo:
+            raise XendInvalidDomain(str(domid))
+
+        if dominfo.getDomid() == PRIV_DOMAIN:
+            raise XendError("Cannot dump core for privileged domain %s" % 
domid)
+
+        try:
+            log.info("Domain core dump requested for domain %s (%d) live=%d 
crash=%d.",
+                     dominfo.getName(), dominfo.getDomid(), live, crash)
+            return dominfo.dumpCore(filename)
+        except Exception, ex:
+            raise XendError(str(ex))
 
     def domain_destroy(self, domid):
         """Terminate domain immediately."""
diff -r 0bdd578c417f -r 9061e1246906 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Mon Sep 18 14:28:16 2006 -0500
+++ b/tools/python/xen/xend/XendDomainInfo.py   Tue Sep 19 09:40:26 2006 +0100
@@ -86,6 +86,7 @@ STATE_DOM_SHUTDOWN = 2
 STATE_DOM_SHUTDOWN = 2
 
 SHUTDOWN_TIMEOUT = 30.0
+MIGRATE_TIMEOUT = 30.0
 
 ZOMBIE_PREFIX = 'Zombie-'
 
@@ -977,15 +978,19 @@ class XendDomainInfo:
         self.restart(True)
 
 
-    def dumpCore(self):
+    def dumpCore(self,corefile=None):
         """Create a core dump for this domain.  Nothrow guarantee."""
         
         try:
-            corefile = "/var/xen/dump/%s.%s.core" % (self.info['name'],
-                                                     self.domid)
+            if not corefile:
+                this_time = time.strftime("%Y-%m%d-%H%M.%S", time.localtime())
+                corefile = "/var/xen/dump/%s-%s.%s.core" % (this_time,
+                                  self.info['name'], self.domid)
             xc.domain_dumpcore(self.domid, corefile)
 
         except:
+            corefile_incomp = corefile+'-incomplete'
+            os.rename(corefile, corefile_incomp)
             log.exception("XendDomainInfo.dumpCore failed: id = %s name = %s",
                           self.domid, self.info['name'])
 
@@ -1531,14 +1536,19 @@ class XendDomainInfo:
         the device has shutdown correctly, i.e. all blocks are
         flushed to disk
         """
+        start = time.time()
         while True:
             test = 0
+            diff = time.time() - start
             for i in self.getDeviceController('vbd').deviceIDs():
                 test = 1
                 log.info("Dev %s still active, looping...", i)
                 time.sleep(0.1)
                 
             if test == 0:
+                break
+            if diff >= MIGRATE_TIMEOUT:
+                log.info("Dev still active but hit max loop timeout")
                 break
 
     def migrateDevices(self, network, dst, step, domName=''):
diff -r 0bdd578c417f -r 9061e1246906 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Mon Sep 18 14:28:16 2006 -0500
+++ b/tools/python/xen/xend/image.py    Tue Sep 19 09:40:26 2006 +0100
@@ -340,10 +340,6 @@ class HVMImageHandler(ImageHandler):
                            (nics, mac, model))
                 ret.append("-net")
                 ret.append("tap,vlan=%d,bridge=%s" % (nics, bridge))
-            if name == 'vtpm':
-                instance = sxp.child_value(info, 'pref_instance')
-                ret.append("-instance")
-                ret.append("%s" % instance)
         return ret
 
     def configVNC(self, config):
diff -r 0bdd578c417f -r 9061e1246906 tools/python/xen/xend/server/tpmif.py
--- a/tools/python/xen/xend/server/tpmif.py     Mon Sep 18 14:28:16 2006 -0500
+++ b/tools/python/xen/xend/server/tpmif.py     Tue Sep 19 09:40:26 2006 +0100
@@ -52,7 +52,7 @@ class TPMifController(DevController):
         if inst == -1:
             inst = int(sxp.child_value(config, 'instance' , '0'))
 
-        log.info("The domain has a TPM with instance %d and devid %d.",
+        log.info("The domain has a TPM with pref. instance %d and devid %d.",
                  inst, devid)
         back  = { 'pref_instance' : "%i" % inst,
                   'resume'        : "%s" % (self.vm.getResume()) }
diff -r 0bdd578c417f -r 9061e1246906 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Mon Sep 18 14:28:16 2006 -0500
+++ b/tools/python/xen/xm/main.py       Tue Sep 19 09:40:26 2006 +0100
@@ -57,6 +57,9 @@ create_help =  """create [-c] <ConfigFil
 create_help =  """create [-c] <ConfigFile>
                [Name=Value]..       Create a domain based on Config File"""
 destroy_help = "destroy <DomId>                  Terminate a domain 
immediately"
+dump_core_help =   """dump-core [-L|--live][-C|--crash]
+            <DomId> [FileName]      Dump core of the specified domain"""
+
 help_help =    "help                             Display this message"
 list_help =    "list [--long] [DomId, ...]       List information about 
domains"
 list_label_help = "list [--label] [DomId, ...]      List information about 
domains including their labels"
@@ -138,6 +141,7 @@ short_command_list = [
     "console",
     "create",
     "destroy",
+    "dump-core",
     "help",
     "list",
     "mem-set",
@@ -159,6 +163,7 @@ domain_commands = [
     "destroy",
     "domid",
     "domname",
+    "dump-core",
     "list",
     "list_label",
     "mem-max",
@@ -590,6 +595,43 @@ def xm_unpause(args):
 
     server.xend.domain.unpause(dom)
 
+def xm_dump_core(args):
+    arg_check(args, "dump-core",1,3)
+    live = False
+    crash = False
+    import getopt
+    (options, params) = getopt.gnu_getopt(args, 'LC', ['live','crash'])
+
+    for (k, v) in options:
+        if k in ['-L', '--live']:
+            live = True
+        if k in ['-C', '--crash']:
+            crash = True
+
+    if len(params) == 0 or len(params) > 2:
+        err("invalid number of parameters")
+        usage("dump-core")
+
+    dom = params[0]
+    if len(params) == 2:
+        filename = os.path.abspath(params[1])
+    else:
+        filename = None
+
+    if not live:
+        server.xend.domain.pause(dom)
+
+    try:
+        print "dumping core of domain:%s ..." % str(dom)
+        server.xend.domain.dump(dom, filename, live, crash)
+    finally:
+        if not live:
+            server.xend.domain.unpause(dom)
+
+    if crash:
+        print "destroying domain:%s ..." % str(dom)
+        server.xend.domain.destroy(dom)
+
 def xm_rename(args):
     arg_check(args, "rename", 2)
 
@@ -1168,6 +1210,7 @@ commands = {
     "destroy": xm_destroy,
     "domid": xm_domid,
     "domname": xm_domname,
+    "dump-core": xm_dump_core,
     "rename": xm_rename,
     "restore": xm_restore,
     "save": xm_save,
diff -r 0bdd578c417f -r 9061e1246906 
tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py
--- a/tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py Mon Sep 18 14:28:16 
2006 -0500
+++ b/tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py Tue Sep 19 09:40:26 
2006 +0100
@@ -42,7 +42,7 @@ except ConsoleError, e:
     FAIL("Error while creating /dev/tpm0")
 
 try:
-    run = console.runCmd("echo -ne 
\"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\"
 > /dev/tpm0")
+    run = console.runCmd("echo -ne 
\"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\"
 > seq; cat seq > /dev/tpm0")
 except ConsoleError, e:
     saveLog(console.getHistory())
     vtpm_cleanup(domName)
diff -r 0bdd578c417f -r 9061e1246906 
tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py
--- a/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py      Mon Sep 18 14:28:16 
2006 -0500
+++ b/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py      Tue Sep 19 09:40:26 
2006 +0100
@@ -43,7 +43,7 @@ except ConsoleError, e:
     FAIL("Error while creating /dev/tpm0")
 
 try:
-    run = console.runCmd("echo -ne 
\"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\"
 > /dev/tpm0")
+    run = console.runCmd("echo -ne 
\"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\"
 > seq; cat seq > /dev/tpm0")
 except ConsoleError, e:
     saveLog(console.getHistory())
     vtpm_cleanup(domName)
diff -r 0bdd578c417f -r 9061e1246906 
tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py
--- a/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py      Mon Sep 18 14:28:16 
2006 -0500
+++ b/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py      Tue Sep 19 09:40:26 
2006 +0100
@@ -43,7 +43,7 @@ except ConsoleError, e:
     FAIL("Error while creating /dev/tpm0")
 
 try:
-    run = console.runCmd("echo -ne 
\"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\"
 > /dev/tpm0")
+    run = console.runCmd("echo -ne 
\"\\x00\\xc1\\x00\\x00\\x00\\x22\\x00\\x00\\x00\\x14\\x00\\x00\\x00\\x00\\x01\\x02\\x03\\x04\\x05\\x06\\x07\\x08\\x09\\x0a\\x0b\\x0c\\x0d\\x0e\\0xf\\x10\\x11\\x12\\x13\\x14\"
 > seq; cat seq > /dev/tpm0")
 except ConsoleError, e:
     saveLog(console.getHistory())
     vtpm_cleanup(domName)
diff -r 0bdd578c417f -r 9061e1246906 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/arch/ia64/xen/mm.c    Tue Sep 19 09:40:26 2006 +0100
@@ -1627,13 +1627,6 @@ void put_page_type(struct page_info *pag
                 nx &= ~PGT_validated;
             }
         }
-        else if ( unlikely(((nx & (PGT_pinned | PGT_count_mask)) ==
-                            (PGT_pinned | 1)) &&
-                           ((nx & PGT_type_mask) != PGT_writable_page)) )
-        {
-            /* Page is now only pinned. Make the back pointer mutable again. */
-            nx |= PGT_va_mutable;
-        }
     }
     while ( unlikely((y = cmpxchg_rel(&page->u.inuse.type_info, x, nx)) != x) 
);
 }
@@ -1642,6 +1635,8 @@ int get_page_type(struct page_info *page
 int get_page_type(struct page_info *page, u32 type)
 {
     u32 nx, x, y = page->u.inuse.type_info;
+
+    ASSERT(!(type & ~PGT_type_mask));
 
  again:
     do {
@@ -1654,29 +1649,25 @@ int get_page_type(struct page_info *page
         }
         else if ( unlikely((x & PGT_count_mask) == 0) )
         {
-            if ( (x & (PGT_type_mask|PGT_va_mask)) != type )
+            if ( (x & PGT_type_mask) != type )
             {
-                if ( (x & PGT_type_mask) != (type & PGT_type_mask) )
+                /*
+                 * On type change we check to flush stale TLB entries. This 
+                 * may be unnecessary (e.g., page was GDT/LDT) but those 
+                 * circumstances should be very rare.
+                 */
+                cpumask_t mask =
+                    page_get_owner(page)->domain_dirty_cpumask;
+                tlbflush_filter(mask, page->tlbflush_timestamp);
+
+                if ( unlikely(!cpus_empty(mask)) )
                 {
-                    /*
-                     * On type change we check to flush stale TLB
-                     * entries. This may be unnecessary (e.g., page
-                     * was GDT/LDT) but those circumstances should be
-                     * very rare.
-                     */
-                    cpumask_t mask =
-                        page_get_owner(page)->domain_dirty_cpumask;
-                    tlbflush_filter(mask, page->tlbflush_timestamp);
-
-                    if ( unlikely(!cpus_empty(mask)) )
-                    {
-                        perfc_incrc(need_flush_tlb_flush);
-                        flush_tlb_mask(mask);
-                    }
+                    perfc_incrc(need_flush_tlb_flush);
+                    flush_tlb_mask(mask);
                 }
 
                 /* We lose existing type, back pointer, and validity. */
-                nx &= ~(PGT_type_mask | PGT_va_mask | PGT_validated);
+                nx &= ~(PGT_type_mask | PGT_validated);
                 nx |= type;
 
                 /* No special validation needed for writable pages. */
@@ -1685,46 +1676,22 @@ int get_page_type(struct page_info *page
                     nx |= PGT_validated;
             }
         }
-        else
+        else if ( unlikely((x & PGT_type_mask) != type) )
         {
-            if ( unlikely((x & (PGT_type_mask|PGT_va_mask)) != type) )
-            {
-                if ( unlikely((x & PGT_type_mask) != (type & PGT_type_mask) ) )
-                {
-                    if ( ((x & PGT_type_mask) != PGT_l2_page_table) ||
-                         ((type & PGT_type_mask) != PGT_l1_page_table) )
-                        MEM_LOG("Bad type (saw %08x != exp %08x) "
-                                "for mfn %016lx (pfn %016lx)",
-                                x, type, page_to_mfn(page),
-                                get_gpfn_from_mfn(page_to_mfn(page)));
-                    return 0;
-                }
-                else if ( (x & PGT_va_mask) == PGT_va_mutable )
-                {
-                    /* The va backpointer is mutable, hence we update it. */
-                    nx &= ~PGT_va_mask;
-                    nx |= type; /* we know the actual type is correct */
-                }
-                else if ( ((type & PGT_va_mask) != PGT_va_mutable) &&
-                          ((type & PGT_va_mask) != (x & PGT_va_mask)) )
-                {
-#ifdef CONFIG_X86_PAE
-                    /* We use backptr as extra typing. Cannot be unknown. */
-                    if ( (type & PGT_type_mask) == PGT_l2_page_table )
-                        return 0;
-#endif
-                    /* This table is possibly mapped at multiple locations. */
-                    nx &= ~PGT_va_mask;
-                    nx |= PGT_va_unknown;
-                }
-            }
-            if ( unlikely(!(x & PGT_validated)) )
-            {
-                /* Someone else is updating validation of this page. Wait... */
-                while ( (y = page->u.inuse.type_info) == x )
-                    cpu_relax();
-                goto again;
-            }
+            if ( ((x & PGT_type_mask) != PGT_l2_page_table) ||
+                 (type != PGT_l1_page_table) )
+                MEM_LOG("Bad type (saw %08x != exp %08x) "
+                        "for mfn %016lx (pfn %016lx)",
+                        x, type, page_to_mfn(page),
+                        get_gpfn_from_mfn(page_to_mfn(page)));
+            return 0;
+        }
+        else if ( unlikely(!(x & PGT_validated)) )
+        {
+            /* Someone else is updating validation of this page. Wait... */
+            while ( (y = page->u.inuse.type_info) == x )
+                cpu_relax();
+            goto again;
         }
     }
     while ( unlikely((y = cmpxchg_acq(&page->u.inuse.type_info, x, nx)) != x) 
);
diff -r 0bdd578c417f -r 9061e1246906 xen/arch/powerpc/mm.c
--- a/xen/arch/powerpc/mm.c     Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/arch/powerpc/mm.c     Tue Sep 19 09:40:26 2006 +0100
@@ -86,12 +86,6 @@ void put_page_type(struct page_info *pag
             /* Record TLB information for flush later. */
             page->tlbflush_timestamp = tlbflush_current_time();
         }
-        else if ( unlikely((nx & (PGT_pinned|PGT_type_mask|PGT_count_mask)) == 
-                           (PGT_pinned | 1)) )
-        {
-            /* Page is now only pinned. Make the back pointer mutable again. */
-            nx |= PGT_va_mutable;
-        }
     }
     while ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) );
 }
@@ -100,6 +94,8 @@ int get_page_type(struct page_info *page
 int get_page_type(struct page_info *page, unsigned long type)
 {
     unsigned long nx, x, y = page->u.inuse.type_info;
+
+    ASSERT(!(type & ~PGT_type_mask));
 
  again:
     do {
@@ -112,29 +108,25 @@ int get_page_type(struct page_info *page
         }
         else if ( unlikely((x & PGT_count_mask) == 0) )
         {
-            if ( (x & (PGT_type_mask|PGT_va_mask)) != type )
+            if ( (x & PGT_type_mask) != type )
             {
-                if ( (x & PGT_type_mask) != (type & PGT_type_mask) )
+                /*
+                 * On type change we check to flush stale TLB entries. This 
+                 * may be unnecessary (e.g., page was GDT/LDT) but those 
+                 * circumstances should be very rare.
+                 */
+                cpumask_t mask =
+                    page_get_owner(page)->domain_dirty_cpumask;
+                tlbflush_filter(mask, page->tlbflush_timestamp);
+
+                if ( unlikely(!cpus_empty(mask)) )
                 {
-                    /*
-                     * On type change we check to flush stale TLB
-                     * entries. This may be unnecessary (e.g., page
-                     * was GDT/LDT) but those circumstances should be
-                     * very rare.
-                     */
-                    cpumask_t mask =
-                        page_get_owner(page)->domain_dirty_cpumask;
-                    tlbflush_filter(mask, page->tlbflush_timestamp);
-
-                    if ( unlikely(!cpus_empty(mask)) )
-                    {
-                        perfc_incrc(need_flush_tlb_flush);
-                        flush_tlb_mask(mask);
-                    }
+                    perfc_incrc(need_flush_tlb_flush);
+                    flush_tlb_mask(mask);
                 }
 
                 /* We lose existing type, back pointer, and validity. */
-                nx &= ~(PGT_type_mask | PGT_va_mask | PGT_validated);
+                nx &= ~(PGT_type_mask | PGT_validated);
                 nx |= type;
 
                 /* No special validation needed for writable pages. */
@@ -143,36 +135,16 @@ int get_page_type(struct page_info *page
                     nx |= PGT_validated;
             }
         }
-        else
-        {
-            if ( unlikely((x & (PGT_type_mask|PGT_va_mask)) != type) )
-            {
-                if ( unlikely((x & PGT_type_mask) != (type & PGT_type_mask) ) )
-                {
-                    return 0;
-                }
-                else if ( (x & PGT_va_mask) == PGT_va_mutable )
-                {
-                    /* The va backpointer is mutable, hence we update it. */
-                    nx &= ~PGT_va_mask;
-                    nx |= type; /* we know the actual type is correct */
-                }
-                else if ( (type & PGT_va_mask) != PGT_va_mutable )
-                {
-                    ASSERT((type & PGT_va_mask) != (x & PGT_va_mask));
-
-                    /* This table is possibly mapped at multiple locations. */
-                    nx &= ~PGT_va_mask;
-                    nx |= PGT_va_unknown;
-                }
-            }
-            if ( unlikely(!(x & PGT_validated)) )
-            {
-                /* Someone else is updating validation of this page. Wait... */
-                while ( (y = page->u.inuse.type_info) == x )
-                    cpu_relax();
-                goto again;
-            }
+        else if ( unlikely((x & PGT_type_mask) != type) )
+        {
+            return 0;
+        }
+        if ( unlikely(!(x & PGT_validated)) )
+        {
+            /* Someone else is updating validation of this page. Wait... */
+            while ( (y = page->u.inuse.type_info) == x )
+                cpu_relax();
+            goto again;
         }
     }
     while ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) );
diff -r 0bdd578c417f -r 9061e1246906 xen/arch/x86/domain_build.c
--- a/xen/arch/x86/domain_build.c       Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/arch/x86/domain_build.c       Tue Sep 19 09:40:26 2006 +0100
@@ -510,15 +510,13 @@ int construct_dom0(struct domain *d,
         case 1 ... 4:
             page->u.inuse.type_info &= ~PGT_type_mask;
             page->u.inuse.type_info |= PGT_l2_page_table;
-            page->u.inuse.type_info |=
-                (count-1) << PGT_va_shift;
+            if ( count == 4 )
+                page->u.inuse.type_info |= PGT_pae_xen_l2;
             get_page(page, d); /* an extra ref because of readable mapping */
             break;
         default:
             page->u.inuse.type_info &= ~PGT_type_mask;
             page->u.inuse.type_info |= PGT_l1_page_table;
-            page->u.inuse.type_info |= 
-                ((dsi.v_start>>L2_PAGETABLE_SHIFT)+(count-5))<<PGT_va_shift;
             get_page(page, d); /* an extra ref because of readable mapping */
             break;
         }
@@ -544,8 +542,6 @@ int construct_dom0(struct domain *d,
         {
             page->u.inuse.type_info &= ~PGT_type_mask;
             page->u.inuse.type_info |= PGT_l1_page_table;
-            page->u.inuse.type_info |= 
-                ((dsi.v_start>>L2_PAGETABLE_SHIFT)+(count-1))<<PGT_va_shift;
 
             /*
              * No longer writable: decrement the type_count.
diff -r 0bdd578c417f -r 9061e1246906 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c    Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/arch/x86/hvm/hvm.c    Tue Sep 19 09:40:26 2006 +0100
@@ -337,7 +337,6 @@ int cpu_get_interrupt(struct vcpu *v, in
     return -1;
 }
 
-#include <asm/hvm/vmx/vmx.h>
 void hvm_hlt(unsigned long rflags)
 {
     struct vcpu *v = current;
diff -r 0bdd578c417f -r 9061e1246906 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/arch/x86/mm.c Tue Sep 19 09:40:26 2006 +0100
@@ -625,8 +625,7 @@ get_page_from_l1e(
 /* NB. Virtual address 'l2e' maps to a machine address within frame 'pfn'. */
 static int 
 get_page_from_l2e(
-    l2_pgentry_t l2e, unsigned long pfn,
-    struct domain *d, unsigned long vaddr)
+    l2_pgentry_t l2e, unsigned long pfn, struct domain *d)
 {
     int rc;
 
@@ -639,10 +638,7 @@ get_page_from_l2e(
         return 0;
     }
 
-    vaddr >>= L2_PAGETABLE_SHIFT;
-    vaddr <<= PGT_va_shift;
-    rc = get_page_and_type_from_pagenr(
-        l2e_get_pfn(l2e), PGT_l1_page_table | vaddr, d);
+    rc = get_page_and_type_from_pagenr(l2e_get_pfn(l2e), PGT_l1_page_table, d);
 #if CONFIG_PAGING_LEVELS == 2
     if ( unlikely(!rc) )
         rc = get_linear_pagetable(l2e, pfn, d);
@@ -654,8 +650,7 @@ get_page_from_l2e(
 #if CONFIG_PAGING_LEVELS >= 3
 static int 
 get_page_from_l3e(
-    l3_pgentry_t l3e, unsigned long pfn,
-    struct domain *d, unsigned long vaddr)
+    l3_pgentry_t l3e, unsigned long pfn, struct domain *d)
 {
     int rc;
 
@@ -668,11 +663,7 @@ get_page_from_l3e(
         return 0;
     }
 
-    vaddr >>= L3_PAGETABLE_SHIFT;
-    vaddr <<= PGT_va_shift;
-    rc = get_page_and_type_from_pagenr(
-        l3e_get_pfn(l3e),
-        PGT_l2_page_table | vaddr, d);
+    rc = get_page_and_type_from_pagenr(l3e_get_pfn(l3e), PGT_l2_page_table, d);
     return rc;
 }
 #endif /* 3 level */
@@ -680,8 +671,7 @@ get_page_from_l3e(
 #if CONFIG_PAGING_LEVELS >= 4
 static int 
 get_page_from_l4e(
-    l4_pgentry_t l4e, unsigned long pfn, 
-    struct domain *d, unsigned long vaddr)
+    l4_pgentry_t l4e, unsigned long pfn, struct domain *d)
 {
     int rc;
 
@@ -694,11 +684,7 @@ get_page_from_l4e(
         return 0;
     }
 
-    vaddr >>= L4_PAGETABLE_SHIFT;
-    vaddr <<= PGT_va_shift;
-    rc = get_page_and_type_from_pagenr(
-        l4e_get_pfn(l4e), 
-        PGT_l3_page_table | vaddr, d);
+    rc = get_page_and_type_from_pagenr(l4e_get_pfn(l4e), PGT_l3_page_table, d);
 
     if ( unlikely(!rc) )
         rc = get_linear_pagetable(l4e, pfn, d);
@@ -877,8 +863,8 @@ static int create_pae_xen_mappings(l3_pg
     /*
      * The Xen-private mappings include linear mappings. The L2 thus cannot
      * be shared by multiple L3 tables. The test here is adequate because:
-     *  1. Cannot appear in slots != 3 because the page would then then have
-     *     unknown va backpointer, which get_page_type() explicitly disallows.
+     *  1. Cannot appear in slots != 3 because get_page_type() checks the
+     *     PGT_pae_xen_l2 flag, which is asserted iff the L2 appears in slot 3
      *  2. Cannot appear in another page table's L3:
      *     a. alloc_l3_table() calls this function and this check will fail
      *     b. mod_l3_entry() disallows updates to slot 3 in an existing table
@@ -888,6 +874,7 @@ static int create_pae_xen_mappings(l3_pg
     page = l3e_get_page(l3e3);
     BUG_ON(page->u.inuse.type_info & PGT_pinned);
     BUG_ON((page->u.inuse.type_info & PGT_count_mask) == 0);
+    BUG_ON(!(page->u.inuse.type_info & PGT_pae_xen_l2));
     if ( (page->u.inuse.type_info & PGT_count_mask) != 1 )
     {
         MEM_LOG("PAE L3 3rd slot is shared");
@@ -949,61 +936,17 @@ static void pae_flush_pgd(
     flush_tlb_mask(d->domain_dirty_cpumask);
 }
 
-static inline int l1_backptr(
-    unsigned long *backptr, unsigned long offset_in_l2, unsigned long l2_type)
-{
-    unsigned long l2_backptr = l2_type & PGT_va_mask;
-    ASSERT(l2_backptr != PGT_va_unknown);
-    ASSERT(l2_backptr != PGT_va_mutable);
-    *backptr = 
-        ((l2_backptr >> PGT_va_shift) << L3_PAGETABLE_SHIFT) | 
-        (offset_in_l2 << L2_PAGETABLE_SHIFT);
-    return 1;
-}
-
 #elif CONFIG_X86_64
 # define create_pae_xen_mappings(pl3e) (1)
 # define pae_flush_pgd(mfn, idx, nl3e) ((void)0)
-
-static inline int l1_backptr(
-    unsigned long *backptr, unsigned long offset_in_l2, unsigned long l2_type)
-{
-    unsigned long l2_backptr = l2_type & PGT_va_mask;
-    ASSERT(l2_backptr != PGT_va_unknown);
-    ASSERT(l2_backptr != PGT_va_mutable);
-    *backptr = ((l2_backptr >> PGT_va_shift) << L3_PAGETABLE_SHIFT) | 
-        (offset_in_l2 << L2_PAGETABLE_SHIFT);
-    return 1;
-}
-
-static inline int l2_backptr(
-    unsigned long *backptr, unsigned long offset_in_l3, unsigned long l3_type)
-{
-    unsigned long l3_backptr = l3_type & PGT_va_mask;
-    ASSERT(l3_backptr != PGT_va_unknown);
-    ASSERT(l3_backptr != PGT_va_mutable);
-    *backptr = ((l3_backptr >> PGT_va_shift) << L4_PAGETABLE_SHIFT) | 
-        (offset_in_l3 << L3_PAGETABLE_SHIFT);
-    return 1;
-}
-
-static inline int l3_backptr(
-    unsigned long *backptr, unsigned long offset_in_l4, unsigned long l4_type)
-{
-    *backptr = (offset_in_l4 << L4_PAGETABLE_SHIFT);
-    return 1;
-}
 #else
 # define create_pae_xen_mappings(pl3e) (1)
-# define l1_backptr(bp,l2o,l2t) \
-    ({ *(bp) = (unsigned long)(l2o) << L2_PAGETABLE_SHIFT; 1; })
 #endif
 
 static int alloc_l2_table(struct page_info *page, unsigned long type)
 {
     struct domain *d = page_get_owner(page);
     unsigned long  pfn = page_to_mfn(page);
-    unsigned long  vaddr;
     l2_pgentry_t  *pl2e;
     int            i;
 
@@ -1013,10 +956,8 @@ static int alloc_l2_table(struct page_in
 
     for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
     {
-        if ( !l1_backptr(&vaddr, i, type) )
-            goto fail;
         if ( is_guest_l2_slot(type, i) &&
-             unlikely(!get_page_from_l2e(pl2e[i], pfn, d, vaddr)) )
+             unlikely(!get_page_from_l2e(pl2e[i], pfn, d)) )
             goto fail;
         
         adjust_guest_l2e(pl2e[i]);
@@ -1051,11 +992,10 @@ static int alloc_l2_table(struct page_in
 
 
 #if CONFIG_PAGING_LEVELS >= 3
-static int alloc_l3_table(struct page_info *page, unsigned long type)
+static int alloc_l3_table(struct page_info *page)
 {
     struct domain *d = page_get_owner(page);
     unsigned long  pfn = page_to_mfn(page);
-    unsigned long  vaddr;
     l3_pgentry_t  *pl3e;
     int            i;
 
@@ -1079,14 +1019,21 @@ static int alloc_l3_table(struct page_in
     pl3e = map_domain_page(pfn);
     for ( i = 0; i < L3_PAGETABLE_ENTRIES; i++ )
     {
-#if CONFIG_PAGING_LEVELS >= 4
-        if ( !l2_backptr(&vaddr, i, type) )
-            goto fail;
-#else
-        vaddr = (unsigned long)i << L3_PAGETABLE_SHIFT;
+#ifdef CONFIG_X86_PAE
+        if ( i == 3 )
+        {
+            if ( !(l3e_get_flags(pl3e[i]) & _PAGE_PRESENT) ||
+                 (l3e_get_flags(pl3e[i]) & L3_DISALLOW_MASK) ||
+                 !get_page_and_type_from_pagenr(l3e_get_pfn(pl3e[i]),
+                                                PGT_l2_page_table |
+                                                PGT_pae_xen_l2,
+                                                d) )
+                goto fail;
+        }
+        else
 #endif
         if ( is_guest_l3_slot(i) &&
-             unlikely(!get_page_from_l3e(pl3e[i], pfn, d, vaddr)) )
+             unlikely(!get_page_from_l3e(pl3e[i], pfn, d)) )
             goto fail;
         
         adjust_guest_l3e(pl3e[i]);
@@ -1108,27 +1055,23 @@ static int alloc_l3_table(struct page_in
     return 0;
 }
 #else
-#define alloc_l3_table(page, type) (0)
+#define alloc_l3_table(page) (0)
 #endif
 
 #if CONFIG_PAGING_LEVELS >= 4
-static int alloc_l4_table(struct page_info *page, unsigned long type)
+static int alloc_l4_table(struct page_info *page)
 {
     struct domain *d = page_get_owner(page);
     unsigned long  pfn = page_to_mfn(page);
     l4_pgentry_t  *pl4e = page_to_virt(page);
-    unsigned long vaddr;
     int            i;
 
     ASSERT(!shadow_mode_refcounts(d));
 
     for ( i = 0; i < L4_PAGETABLE_ENTRIES; i++ )
     {
-        if ( !l3_backptr(&vaddr, i, type) )
-            goto fail;
-
         if ( is_guest_l4_slot(i) &&
-             unlikely(!get_page_from_l4e(pl4e[i], pfn, d, vaddr)) )
+             unlikely(!get_page_from_l4e(pl4e[i], pfn, d)) )
             goto fail;
 
         adjust_guest_l4e(pl4e[i]);
@@ -1156,7 +1099,7 @@ static int alloc_l4_table(struct page_in
     return 0;
 }
 #else
-#define alloc_l4_table(page, type) (0)
+#define alloc_l4_table(page) (0)
 #endif
 
 
@@ -1190,6 +1133,8 @@ static void free_l2_table(struct page_in
             put_page_from_l2e(pl2e[i], pfn);
 
     unmap_domain_page(pl2e);
+
+    page->u.inuse.type_info &= ~PGT_pae_xen_l2;
 }
 
 
@@ -1357,7 +1302,6 @@ static int mod_l2_entry(l2_pgentry_t *pl
                         unsigned long type)
 {
     l2_pgentry_t ol2e;
-    unsigned long vaddr = 0;
 
     if ( unlikely(!is_guest_l2_slot(type,pgentry_ptr_to_slot(pl2e))) )
     {
@@ -1383,8 +1327,7 @@ static int mod_l2_entry(l2_pgentry_t *pl
         if ( !l2e_has_changed(ol2e, nl2e, _PAGE_PRESENT))
             return UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn);
 
-        if ( unlikely(!l1_backptr(&vaddr, pgentry_ptr_to_slot(pl2e), type)) ||
-             unlikely(!get_page_from_l2e(nl2e, pfn, current->domain, vaddr)) )
+        if ( unlikely(!get_page_from_l2e(nl2e, pfn, current->domain)) )
             return 0;
 
         if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn)) )
@@ -1407,11 +1350,9 @@ static int mod_l2_entry(l2_pgentry_t *pl
 /* Update the L3 entry at pl3e to new value nl3e. pl3e is within frame pfn. */
 static int mod_l3_entry(l3_pgentry_t *pl3e, 
                         l3_pgentry_t nl3e, 
-                        unsigned long pfn,
-                        unsigned long type)
+                        unsigned long pfn)
 {
     l3_pgentry_t ol3e;
-    unsigned long vaddr;
     int okay;
 
     if ( unlikely(!is_guest_l3_slot(pgentry_ptr_to_slot(pl3e))) )
@@ -1447,16 +1388,8 @@ static int mod_l3_entry(l3_pgentry_t *pl
         if (!l3e_has_changed(ol3e, nl3e, _PAGE_PRESENT))
             return UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn);
 
-#if CONFIG_PAGING_LEVELS >= 4
-        if ( unlikely(!l2_backptr(&vaddr, pgentry_ptr_to_slot(pl3e), type)) ||
-             unlikely(!get_page_from_l3e(nl3e, pfn, current->domain, vaddr)) )
+        if ( unlikely(!get_page_from_l3e(nl3e, pfn, current->domain)) )
             return 0;
-#else
-        vaddr = (((unsigned long)pl3e & ~PAGE_MASK) / sizeof(l3_pgentry_t))
-            << L3_PAGETABLE_SHIFT;
-        if ( unlikely(!get_page_from_l3e(nl3e, pfn, current->domain, vaddr)) )
-            return 0;
-#endif 
 
         if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn)) )
         {
@@ -1485,11 +1418,9 @@ static int mod_l3_entry(l3_pgentry_t *pl
 /* Update the L4 entry at pl4e to new value nl4e. pl4e is within frame pfn. */
 static int mod_l4_entry(l4_pgentry_t *pl4e, 
                         l4_pgentry_t nl4e, 
-                        unsigned long pfn,
-                        unsigned long type)
+                        unsigned long pfn)
 {
     l4_pgentry_t ol4e;
-    unsigned long vaddr;
 
     if ( unlikely(!is_guest_l4_slot(pgentry_ptr_to_slot(pl4e))) )
     {
@@ -1515,8 +1446,7 @@ static int mod_l4_entry(l4_pgentry_t *pl
         if (!l4e_has_changed(ol4e, nl4e, _PAGE_PRESENT))
             return UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn);
 
-        if ( unlikely(!l3_backptr(&vaddr, pgentry_ptr_to_slot(pl4e), type)) ||
-             unlikely(!get_page_from_l4e(nl4e, pfn, current->domain, vaddr)) )
+        if ( unlikely(!get_page_from_l4e(nl4e, pfn, current->domain)) )
             return 0;
 
         if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn)) )
@@ -1550,9 +1480,9 @@ int alloc_page_type(struct page_info *pa
     case PGT_l2_page_table:
         return alloc_l2_table(page, type);
     case PGT_l3_page_table:
-        return alloc_l3_table(page, type);
+        return alloc_l3_table(page);
     case PGT_l4_page_table:
-        return alloc_l4_table(page, type);
+        return alloc_l4_table(page);
     case PGT_gdt_page:
     case PGT_ldt_page:
         return alloc_segdesc_page(page);
@@ -1639,15 +1569,6 @@ void put_page_type(struct page_info *pag
         nx = x - 1;
 
         ASSERT((x & PGT_count_mask) != 0);
-
-        /*
-         * The page should always be validated while a reference is held. The 
-         * exception is during domain destruction, when we forcibly invalidate 
-         * page-table pages if we detect a referential loop.
-         * See domain.c:relinquish_list().
-         */
-        ASSERT((x & PGT_validated) || 
-               test_bit(_DOMF_dying, &page_get_owner(page)->domain_flags));
 
         if ( unlikely((nx & PGT_count_mask) == 0) )
         {
@@ -1672,12 +1593,6 @@ void put_page_type(struct page_info *pag
             /* Record TLB information for flush later. */
             page->tlbflush_timestamp = tlbflush_current_time();
         }
-        else if ( unlikely((nx & (PGT_pinned|PGT_type_mask|PGT_count_mask)) == 
-                           (PGT_pinned|PGT_l1_page_table|1)) )
-        {
-            /* Page is now only pinned. Make the back pointer mutable again. */
-            nx |= PGT_va_mutable;
-        }
     }
     while ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) );
 }
@@ -1686,6 +1601,8 @@ int get_page_type(struct page_info *page
 int get_page_type(struct page_info *page, unsigned long type)
 {
     unsigned long nx, x, y = page->u.inuse.type_info;
+
+    ASSERT(!(type & ~(PGT_type_mask | PGT_pae_xen_l2)));
 
  again:
     do {
@@ -1698,29 +1615,26 @@ int get_page_type(struct page_info *page
         }
         else if ( unlikely((x & PGT_count_mask) == 0) )
         {
-            if ( (x & (PGT_type_mask|PGT_va_mask)) != type )
+            ASSERT(!(x & PGT_pae_xen_l2));
+            if ( (x & PGT_type_mask) != type )
             {
-                if ( (x & PGT_type_mask) != (type & PGT_type_mask) )
+                /*
+                 * On type change we check to flush stale TLB entries. This 
+                 * may be unnecessary (e.g., page was GDT/LDT) but those 
+                 * circumstances should be very rare.
+                 */
+                cpumask_t mask =
+                    page_get_owner(page)->domain_dirty_cpumask;
+                tlbflush_filter(mask, page->tlbflush_timestamp);
+
+                if ( unlikely(!cpus_empty(mask)) )
                 {
-                    /*
-                     * On type change we check to flush stale TLB
-                     * entries. This may be unnecessary (e.g., page
-                     * was GDT/LDT) but those circumstances should be
-                     * very rare.
-                     */
-                    cpumask_t mask =
-                        page_get_owner(page)->domain_dirty_cpumask;
-                    tlbflush_filter(mask, page->tlbflush_timestamp);
-
-                    if ( unlikely(!cpus_empty(mask)) )
-                    {
-                        perfc_incrc(need_flush_tlb_flush);
-                        flush_tlb_mask(mask);
-                    }
+                    perfc_incrc(need_flush_tlb_flush);
+                    flush_tlb_mask(mask);
                 }
 
                 /* We lose existing type, back pointer, and validity. */
-                nx &= ~(PGT_type_mask | PGT_va_mask | PGT_validated);
+                nx &= ~(PGT_type_mask | PGT_validated);
                 nx |= type;
 
                 /* No special validation needed for writable pages. */
@@ -1729,51 +1643,23 @@ int get_page_type(struct page_info *page
                     nx |= PGT_validated;
             }
         }
-        else
-        {
-            if ( unlikely((x & (PGT_type_mask|PGT_va_mask)) != type) )
-            {
-                if ( unlikely((x & PGT_type_mask) != (type & PGT_type_mask) ) )
-                {
-                    if ( ((x & PGT_type_mask) != PGT_l2_page_table) ||
-                         ((type & PGT_type_mask) != PGT_l1_page_table) )
-                        MEM_LOG("Bad type (saw %" PRtype_info
-                                " != exp %" PRtype_info ") "
-                                "for mfn %lx (pfn %lx)",
-                                x, type, page_to_mfn(page),
-                                get_gpfn_from_mfn(page_to_mfn(page)));
-                    return 0;
-                }
-                else if ( (x & PGT_va_mask) == PGT_va_mutable )
-                {
-                    /* The va backpointer is mutable, hence we update it. */
-                    nx &= ~PGT_va_mask;
-                    nx |= type; /* we know the actual type is correct */
-                }
-                else if ( (type & PGT_va_mask) != PGT_va_mutable )
-                {
-                    ASSERT((type & PGT_va_mask) != (x & PGT_va_mask));
-#ifdef CONFIG_X86_PAE
-                    /* We use backptr as extra typing. Cannot be unknown. */
-                    if ( (type & PGT_type_mask) == PGT_l2_page_table )
-                        return 0;
-#endif
-                    /* Fixme: add code to propagate va_unknown to subtables. */
-                    if ( ((type & PGT_type_mask) >= PGT_l2_page_table) &&
-                         !shadow_mode_refcounts(page_get_owner(page)) )
-                        return 0;
-                    /* This table is possibly mapped at multiple locations. */
-                    nx &= ~PGT_va_mask;
-                    nx |= PGT_va_unknown;
-                }
-            }
-            if ( unlikely(!(x & PGT_validated)) )
-            {
-                /* Someone else is updating validation of this page. Wait... */
-                while ( (y = page->u.inuse.type_info) == x )
-                    cpu_relax();
-                goto again;
-            }
+        else if ( unlikely((x & (PGT_type_mask|PGT_pae_xen_l2)) != type) )
+        {
+            if ( ((x & PGT_type_mask) != PGT_l2_page_table) ||
+                 (type != PGT_l1_page_table) )
+                MEM_LOG("Bad type (saw %" PRtype_info
+                        " != exp %" PRtype_info ") "
+                        "for mfn %lx (pfn %lx)",
+                        x, type, page_to_mfn(page),
+                        get_gpfn_from_mfn(page_to_mfn(page)));
+            return 0;
+        }
+        else if ( unlikely(!(x & PGT_validated)) )
+        {
+            /* Someone else is updating validation of this page. Wait... */
+            while ( (y = page->u.inuse.type_info) == x )
+                cpu_relax();
+            goto again;
         }
     }
     while ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) );
@@ -2030,19 +1916,25 @@ int do_mmuext_op(
         switch ( op.cmd )
         {
         case MMUEXT_PIN_L1_TABLE:
-            type = PGT_l1_page_table | PGT_va_mutable;
+            type = PGT_l1_page_table;
             goto pin_page;
 
         case MMUEXT_PIN_L2_TABLE:
+            type = PGT_l2_page_table;
+            goto pin_page;
+
         case MMUEXT_PIN_L3_TABLE:
+            type = PGT_l3_page_table;
+            goto pin_page;
+
         case MMUEXT_PIN_L4_TABLE:
-            /* Ignore pinning of subdirectories. */
-            if ( (op.cmd - MMUEXT_PIN_L1_TABLE) != (CONFIG_PAGING_LEVELS - 1) )
+            type = PGT_l4_page_table;
+
+        pin_page:
+            /* Ignore pinning of invalid paging levels. */
+            if ( (op.cmd - MMUEXT_PIN_L1_TABLE) > (CONFIG_PAGING_LEVELS - 1) )
                 break;
 
-            type = PGT_root_page_table;
-
-        pin_page:
             if ( shadow_mode_refcounts(FOREIGNDOM) )
                 break;
 
@@ -2326,7 +2218,7 @@ int do_mmu_update(
                 }
 
                 if ( unlikely(!get_page_type(
-                    page, type_info & (PGT_type_mask|PGT_va_mask))) )
+                    page, type_info & (PGT_type_mask|PGT_pae_xen_l2))) )
                     goto not_a_pt;
 
                 switch ( type_info & PGT_type_mask )
@@ -2348,7 +2240,7 @@ int do_mmu_update(
                 case PGT_l3_page_table:
                 {
                     l3_pgentry_t l3e = l3e_from_intpte(req.val);
-                    okay = mod_l3_entry(va, l3e, mfn, type_info);
+                    okay = mod_l3_entry(va, l3e, mfn);
                 }
                 break;
 #endif
@@ -2356,7 +2248,7 @@ int do_mmu_update(
                 case PGT_l4_page_table:
                 {
                     l4_pgentry_t l4e = l4e_from_intpte(req.val);
-                    okay = mod_l4_entry(va, l4e, mfn, type_info);
+                    okay = mod_l4_entry(va, l4e, mfn);
                 }
                 break;
 #endif
@@ -2454,7 +2346,7 @@ static int create_grant_pte_mapping(
     void *va;
     unsigned long gmfn, mfn;
     struct page_info *page;
-    u32 type_info;
+    u32 type;
     l1_pgentry_t ol1e;
     struct domain *d = v->domain;
 
@@ -2475,9 +2367,8 @@ static int create_grant_pte_mapping(
     va = (void *)((unsigned long)va + (pte_addr & ~PAGE_MASK));
     page = mfn_to_page(mfn);
 
-    type_info = page->u.inuse.type_info;
-    if ( ((type_info & PGT_type_mask) != PGT_l1_page_table) ||         
-         !get_page_type(page, type_info & (PGT_type_mask|PGT_va_mask)) )
+    type = page->u.inuse.type_info & PGT_type_mask;
+    if ( (type != PGT_l1_page_table) || !get_page_type(page, type) )
     {
         MEM_LOG("Grant map attempted to update a non-L1 page");
         rc = GNTST_general_error;
@@ -2511,7 +2402,7 @@ static int destroy_grant_pte_mapping(
     void *va;
     unsigned long gmfn, mfn;
     struct page_info *page;
-    u32 type_info;
+    u32 type;
     l1_pgentry_t ol1e;
 
     gmfn = addr >> PAGE_SHIFT;
@@ -2527,9 +2418,8 @@ static int destroy_grant_pte_mapping(
     va = (void *)((unsigned long)va + (addr & ~PAGE_MASK));
     page = mfn_to_page(mfn);
 
-    type_info = page->u.inuse.type_info;
-    if ( ((type_info & PGT_type_mask) != PGT_l1_page_table) ||
-         !get_page_type(page, type_info & (PGT_type_mask|PGT_va_mask)) )
+    type = page->u.inuse.type_info & PGT_type_mask;
+    if ( (type != PGT_l1_page_table) || !get_page_type(page, type) )
     {
         MEM_LOG("Grant map attempted to update a non-L1 page");
         rc = GNTST_general_error;
diff -r 0bdd578c417f -r 9061e1246906 xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c   Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/arch/x86/mm/shadow/common.c   Tue Sep 19 09:40:26 2006 +0100
@@ -21,8 +21,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#define SHADOW 1
-
 #include <xen/config.h>
 #include <xen/types.h>
 #include <xen/mm.h>
@@ -225,7 +223,6 @@ struct x86_emulate_ops shadow_emulator_o
     .cmpxchg8b_emulated = sh_x86_emulate_cmpxchg8b_emulated,
 };
 
-
 /**************************************************************************/
 /* Code for "promoting" a guest page to the point where the shadow code is
  * willing to let it be treated as a guest page table.  This generally
@@ -252,8 +249,8 @@ void shadow_promote(struct vcpu *v, mfn_
         // count to be > 0.
         //
         do {
-            type_info =
-                page->u.inuse.type_info & (PGT_type_mask | PGT_va_mask);
+            type_info = page->u.inuse.type_info &
+                (PGT_type_mask | PGT_pae_xen_l2);
         } while ( !get_page_type(page, type_info) );
 
         // Now that the type ref is non-zero, we can safely use the
diff -r 0bdd578c417f -r 9061e1246906 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c    Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/arch/x86/mm/shadow/multi.c    Tue Sep 19 09:40:26 2006 +0100
@@ -34,8 +34,6 @@
 // - Want to map the P2M table into the 16MB RO_MPT hole in Xen's address
 //   space for both PV and HVM guests.
 //
-
-#define SHADOW 1
 
 #include <xen/config.h>
 #include <xen/types.h>
diff -r 0bdd578c417f -r 9061e1246906 xen/arch/x86/oprofile/nmi_int.c
--- a/xen/arch/x86/oprofile/nmi_int.c   Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/arch/x86/oprofile/nmi_int.c   Tue Sep 19 09:40:26 2006 +0100
@@ -269,8 +269,12 @@ static int __init p4_init(char * cpu_typ
 { 
        __u8 cpu_model = current_cpu_data.x86_model;
 
-       if ((cpu_model > 6) || (cpu_model == 5))
+       if ((cpu_model > 6) || (cpu_model == 5)) {
+               printk("xenoprof: Initialization failed. "
+                      "Intel processor model %d for pentium 4 family is not "
+                      "supported\n", cpu_model);
                return 0;
+       }
 
 #ifndef CONFIG_SMP
        strncpy (cpu_type, "i386/p4", XENOPROF_CPU_TYPE_SIZE - 1);
@@ -301,8 +305,12 @@ static int __init ppro_init(char *cpu_ty
 {
        __u8 cpu_model = current_cpu_data.x86_model;
 
-       if (cpu_model > 0xd)
+       if (cpu_model > 0xd) {
+               printk("xenoprof: Initialization failed. "
+                      "Intel processor model %d for P6 class family is not "
+                      "supported\n", cpu_model);
                return 0;
+       }
 
        if (cpu_model == 9) {
                strncpy (cpu_type, "i386/p6_mobile", XENOPROF_CPU_TYPE_SIZE - 
1);
@@ -324,8 +332,10 @@ int nmi_init(int *num_events, int *is_pr
        __u8 family = current_cpu_data.x86;
        int prim = 0;
  
-       if (!cpu_has_apic)
+       if (!cpu_has_apic) {
+               printk("xenoprof: Initialization failed. No apic.\n");
                return -ENODEV;
+       }
 
        if (primary_profiler == NULL) {
                /* For now, only dom0 can be the primary profiler */
@@ -344,6 +354,9 @@ int nmi_init(int *num_events, int *is_pr
 
                        switch (family) {
                        default:
+                               printk("xenoprof: Initialization failed. "
+                                      "AMD processor family %d is not "
+                                      "supported\n", family);
                                return -ENODEV;
                        case 6:
                                model = &op_athlon_spec;
@@ -375,11 +388,17 @@ int nmi_init(int *num_events, int *is_pr
                                        break;
 
                                default:
+                               printk("xenoprof: Initialization failed. "
+                                      "Intel processor family %d is not "
+                                      "supported\n", family);
                                        return -ENODEV;
                        }
                        break;
 
                default:
+                       printk("xenoprof: Initialization failed. "
+                              "Unsupported processor. Unknown vendor %d\n",
+                               vendor);
                        return -ENODEV;
        }
 
diff -r 0bdd578c417f -r 9061e1246906 xen/arch/x86/oprofile/xenoprof.c
--- a/xen/arch/x86/oprofile/xenoprof.c  Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/arch/x86/oprofile/xenoprof.c  Tue Sep 19 09:40:26 2006 +0100
@@ -492,19 +492,23 @@ int xenoprof_op_get_buffer(XEN_GUEST_HAN
     return 0;
 }
 
-#define PRIV_OP(op) ( (op == XENOPROF_set_active)       \
-                   || (op == XENOPROF_reserve_counters) \
-                   || (op == XENOPROF_setup_events)     \
-                   || (op == XENOPROF_start)            \
-                   || (op == XENOPROF_stop)             \
-                   || (op == XENOPROF_release_counters) \
-                   || (op == XENOPROF_shutdown))
-
+#define NONPRIV_OP(op) ( (op == XENOPROF_init)          \
+                      || (op == XENOPROF_enable_virq)   \
+                      || (op == XENOPROF_disable_virq)  \
+                      || (op == XENOPROF_get_buffer))
+ 
 int do_xenoprof_op(int op, XEN_GUEST_HANDLE(void) arg)
 {
     int ret = 0;
-
-    if ( PRIV_OP(op) && (current->domain != primary_profiler) )
+    
+    if ( (op < 0) || (op>XENOPROF_last_op) )
+    {
+        printk("xenoprof: invalid operation %d for domain %d\n",
+               op, current->domain->domain_id);
+        return -EINVAL;
+    }
+
+    if ( !NONPRIV_OP(op) && (current->domain != primary_profiler) )
     {
         printk("xenoprof: dom %d denied privileged operation %d\n",
                current->domain->domain_id, op);
diff -r 0bdd578c417f -r 9061e1246906 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/common/sched_credit.c Tue Sep 19 09:40:26 2006 +0100
@@ -290,6 +290,7 @@ __runq_tickle(unsigned int cpu, struct c
         {
             CSCHED_STAT_CRANK(tickle_idlers_some);
             cpus_or(mask, mask, csched_priv.idlers);
+            cpus_and(mask, mask, new->vcpu->cpu_affinity);
         }
     }
 
@@ -987,35 +988,38 @@ csched_load_balance(int cpu, struct csch
          * cause a deadlock if the peer CPU is also load balancing and trying
          * to lock this CPU.
          */
-        if ( spin_trylock(&per_cpu(schedule_data, peer_cpu).schedule_lock) )
-        {
-
-            spc = CSCHED_PCPU(peer_cpu);
-            if ( unlikely(spc == NULL) )
-            {
-                CSCHED_STAT_CRANK(steal_peer_down);
-                speer = NULL;
-            }
-            else
-            {
-                speer = csched_runq_steal(spc, cpu, snext->pri);
-            }
-
-            spin_unlock(&per_cpu(schedule_data, peer_cpu).schedule_lock);
-
-            /* Got one! */
-            if ( speer )
-            {
-                CSCHED_STAT_CRANK(vcpu_migrate);
-                return speer;
-            }
+        if ( !spin_trylock(&per_cpu(schedule_data, peer_cpu).schedule_lock) )
+        {
+            CSCHED_STAT_CRANK(steal_trylock_failed);
+            continue;
+        }
+
+        spc = CSCHED_PCPU(peer_cpu);
+        if ( unlikely(spc == NULL) )
+        {
+            CSCHED_STAT_CRANK(steal_peer_down);
+            speer = NULL;
+        }
+        else if ( is_idle_vcpu(per_cpu(schedule_data, peer_cpu).curr) )
+        {
+            CSCHED_STAT_CRANK(steal_peer_idle);
+            speer = NULL;
         }
         else
         {
-            CSCHED_STAT_CRANK(steal_trylock_failed);
-        }
-    }
-
+            /* Try to steal work from an online non-idle CPU. */
+            speer = csched_runq_steal(spc, cpu, snext->pri);
+        }
+
+        spin_unlock(&per_cpu(schedule_data, peer_cpu).schedule_lock);
+
+        /* Got one? */
+        if ( speer )
+        {
+            CSCHED_STAT_CRANK(vcpu_migrate);
+            return speer;
+        }
+    }
 
     /* Failed to find more important work */
     __runq_remove(snext);
diff -r 0bdd578c417f -r 9061e1246906 xen/drivers/video/vga.c
--- a/xen/drivers/video/vga.c   Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/drivers/video/vga.c   Tue Sep 19 09:40:26 2006 +0100
@@ -680,11 +680,12 @@ int fill_console_start_info(struct dom0_
     if ( !vgacon_enabled )
         return 0;
 
-    ci->video_type   = 1;
-    ci->video_width  = COLUMNS;
-    ci->video_height = LINES;
-    ci->txt_mode     = 3;
-    ci->txt_points   = font ? font->height : 16;
+    ci->video_type = XEN_VGATYPE_TEXT_MODE_3;
+    ci->u.text_mode_3.rows     = LINES;
+    ci->u.text_mode_3.columns  = COLUMNS;
+    ci->u.text_mode_3.cursor_x = 0;
+    ci->u.text_mode_3.cursor_y = LINES - 1;
+    ci->u.text_mode_3.font_height = font ? font->height : 16;
 
     return 1;
 }
diff -r 0bdd578c417f -r 9061e1246906 xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/include/asm-ia64/mm.h Tue Sep 19 09:40:26 2006 +0100
@@ -102,14 +102,6 @@ struct page_info
  /* Owning guest has pinned this page to its current type? */
 #define _PGT_pinned         27
 #define PGT_pinned          (1U<<_PGT_pinned)
-
- /* The 27 most significant bits of virt address if this is a page table. */
-#define PGT_va_shift        32
-#define PGT_va_mask         ((unsigned long)((1U<<28)-1)<<PGT_va_shift)
- /* Is the back pointer still mutable (i.e. not fixed yet)? */
-#define PGT_va_mutable      ((unsigned long)((1U<<28)-1)<<PGT_va_shift)
- /* Is the back pointer unknown (e.g., p.t. is mapped at multiple VAs)? */
-#define PGT_va_unknown      ((unsigned long)((1U<<28)-2)<<PGT_va_shift)
 
  /* 16-bit count of uses of this frame as its current type. */
 #define PGT_count_mask      ((1U<<16)-1)
diff -r 0bdd578c417f -r 9061e1246906 xen/include/asm-powerpc/mm.h
--- a/xen/include/asm-powerpc/mm.h      Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/include/asm-powerpc/mm.h      Tue Sep 19 09:40:26 2006 +0100
@@ -101,14 +101,6 @@ struct page_extents {
  /* Has this page been validated for use as its current type? */
 #define _PGT_validated      27
 #define PGT_validated       (1U<<_PGT_validated)
-
- /* The 27 most significant bits of virt address if this is a page table. */
-#define PGT_va_shift        32
-#define PGT_va_mask         ((unsigned long)((1U<<28)-1)<<PGT_va_shift)
- /* Is the back pointer still mutable (i.e. not fixed yet)? */
-#define PGT_va_mutable      ((unsigned long)((1U<<28)-1)<<PGT_va_shift)
- /* Is the back pointer unknown (e.g., p.t. is mapped at multiple VAs)? */
-#define PGT_va_unknown      ((unsigned long)((1U<<28)-2)<<PGT_va_shift)
 
  /* 16-bit count of uses of this frame as its current type. */
 #define PGT_count_mask      ((1U<<16)-1)
diff -r 0bdd578c417f -r 9061e1246906 xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h  Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/include/asm-x86/mm.h  Tue Sep 19 09:40:26 2006 +0100
@@ -75,19 +75,6 @@ struct page_info
 #define PGT_gdt_page        (5U<<29) /* using this page in a GDT? */
 #define PGT_ldt_page        (6U<<29) /* using this page in an LDT? */
 #define PGT_writable_page   (7U<<29) /* has writable mappings of this page? */
-
-#ifndef SHADOW
-#define PGT_l1_shadow       PGT_l1_page_table
-#define PGT_l2_shadow       PGT_l2_page_table
-#define PGT_l3_shadow       PGT_l3_page_table
-#define PGT_l4_shadow       PGT_l4_page_table
-#define PGT_hl2_shadow      (5U<<29)
-#define PGT_snapshot        (6U<<29)
-#define PGT_writable_pred   (7U<<29) /* predicted gpfn with writable ref */
-
-#define PGT_fl1_shadow      (5U<<29)
-#endif
-
 #define PGT_type_mask       (7U<<29) /* Bits 29-31. */
 
  /* Owning guest has pinned this page to its current type? */
@@ -96,43 +83,12 @@ struct page_info
  /* Has this page been validated for use as its current type? */
 #define _PGT_validated      27
 #define PGT_validated       (1U<<_PGT_validated)
-#if defined(__i386__)
- /* The 11 most significant bits of virt address if this is a page table. */
-#define PGT_va_shift        16
-#define PGT_va_mask         (((1U<<11)-1)<<PGT_va_shift)
- /* Is the back pointer still mutable (i.e. not fixed yet)? */
-#define PGT_va_mutable      (((1U<<11)-1)<<PGT_va_shift)
- /* Is the back pointer unknown (e.g., p.t. is mapped at multiple VAs)? */
-#define PGT_va_unknown      (((1U<<11)-2)<<PGT_va_shift)
-#elif defined(__x86_64__)
- /* The 27 most significant bits of virt address if this is a page table. */
-#define PGT_va_shift        32
-#define PGT_va_mask         ((unsigned long)((1U<<28)-1)<<PGT_va_shift)
- /* Is the back pointer still mutable (i.e. not fixed yet)? */
-#define PGT_va_mutable      ((unsigned long)((1U<<28)-1)<<PGT_va_shift)
- /* Is the back pointer unknown (e.g., p.t. is mapped at multiple VAs)? */
-#define PGT_va_unknown      ((unsigned long)((1U<<28)-2)<<PGT_va_shift)
-#endif
+ /* PAE only: is this an L2 page directory containing Xen-private mappings? */
+#define _PGT_pae_xen_l2     26
+#define PGT_pae_xen_l2      (1U<<_PGT_pae_xen_l2)
 
  /* 16-bit count of uses of this frame as its current type. */
 #define PGT_count_mask      ((1U<<16)-1)
-
-#ifndef SHADOW
-#ifdef __x86_64__
-#define PGT_high_mfn_shift  52
-#define PGT_high_mfn_mask   (0xfffUL << PGT_high_mfn_shift)
-#define PGT_mfn_mask        (((1U<<27)-1) | PGT_high_mfn_mask)
-#define PGT_high_mfn_nx     (0x800UL << PGT_high_mfn_shift)
-#else
- /* 23-bit mfn mask for shadow types: good for up to 32GB RAM. */
-#define PGT_mfn_mask        ((1U<<23)-1)
- /* NX for PAE xen is not supported yet */
-#define PGT_high_mfn_nx     (1ULL << 63)
-
-#define PGT_score_shift     23
-#define PGT_score_mask      (((1U<<4)-1)<<PGT_score_shift)
-#endif
-#endif /* SHADOW */
 
  /* Cleared when the owning guest 'frees' this page. */
 #define _PGC_allocated      31
diff -r 0bdd578c417f -r 9061e1246906 xen/include/asm-x86/x86_32/page-3level.h
--- a/xen/include/asm-x86/x86_32/page-3level.h  Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/include/asm-x86/x86_32/page-3level.h  Tue Sep 19 09:40:26 2006 +0100
@@ -49,7 +49,7 @@ typedef l3_pgentry_t root_pgentry_t;
 /* misc */
 #define is_guest_l1_slot(s)    (1)
 #define is_guest_l2_slot(t,s)                                              \
-    ( ((((t) & PGT_va_mask) >> PGT_va_shift) != 3) ||                      \
+    ( !((t) & PGT_pae_xen_l2) ||                                           \
       ((s) < (L2_PAGETABLE_FIRST_XEN_SLOT & (L2_PAGETABLE_ENTRIES - 1))) )
 #define is_guest_l3_slot(s)    (1)
 
diff -r 0bdd578c417f -r 9061e1246906 xen/include/public/xen.h
--- a/xen/include/public/xen.h  Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/include/public/xen.h  Tue Sep 19 09:40:26 2006 +0100
@@ -517,25 +517,37 @@ typedef struct start_info start_info_t;
 #define SIF_INITDOMAIN    (1<<1)  /* Is this the initial control domain? */
 
 typedef struct dom0_vga_console_info {
-    uint8_t video_type;
-    uint8_t txt_points;
-    uint16_t txt_mode;
-    uint16_t txt_x;
-    uint16_t txt_y;
-    uint16_t video_width;
-    uint16_t video_height;
-    uint16_t lfb_linelen;
-    uint16_t lfb_depth;
-    unsigned long lfb_base;
-    unsigned long lfb_size;
-    uint8_t red_pos;
-    uint8_t red_size;
-    uint8_t green_pos;
-    uint8_t green_size;
-    uint8_t blue_pos;
-    uint8_t blue_size;
-    uint8_t rsvd_pos;
-    uint8_t rsvd_size;
+    uint8_t video_type; /* DOM0_VGA_CONSOLE_??? */
+#define XEN_VGATYPE_TEXT_MODE_3 0x03
+#define XEN_VGATYPE_VESA_LFB    0x23
+
+    union {
+        struct {
+            /* Font height, in pixels. */
+            uint16_t font_height;
+            /* Cursor location (column, row). */
+            uint16_t cursor_x, cursor_y;
+            /* Number of rows and columns (dimensions in characters). */
+            uint16_t rows, columns;
+        } text_mode_3;
+
+        struct {
+            /* Width and height, in pixels. */
+            uint16_t width, height;
+            /* Bytes per scan line. */
+            uint16_t bytes_per_line;
+            /* Bits per pixel. */
+            uint16_t bits_per_pixel;
+            /* LFB physical address, and size (in units of 64kB). */
+            uint32_t lfb_base;
+            uint32_t lfb_size;
+            /* RGB mask offsets and sizes, as defined by VBE 1.2+ */
+            uint8_t  red_pos, red_size;
+            uint8_t  green_pos, green_size;
+            uint8_t  blue_pos, blue_size;
+            uint8_t  rsvd_pos, rsvd_size;
+        } vesa_lfb;
+    } u;
 } dom0_vga_console_info_t;
 
 typedef uint8_t xen_domain_handle_t[16];
diff -r 0bdd578c417f -r 9061e1246906 xen/tools/figlet/figlet.c
--- a/xen/tools/figlet/figlet.c Mon Sep 18 14:28:16 2006 -0500
+++ b/xen/tools/figlet/figlet.c Tue Sep 19 09:40:26 2006 +0100
@@ -1448,8 +1448,9 @@ inchr c;
       }
     else {
       for (k=0;k<smushamount;k++) {
-        outputline[row][outlinelen-smushamount+k] =
-          smushem(outputline[row][outlinelen-smushamount+k],currchar[row][k]);
+        if (outlinelen-smushamount+k >= 0)
+          outputline[row][outlinelen-smushamount+k] =
+            
smushem(outputline[row][outlinelen-smushamount+k],currchar[row][k]);
         }
       strcat(outputline[row],currchar[row]+smushamount);
       }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.