ia64/xen-unstable
changeset 11532:9061e1246906
Merge with xenppc-unstable-merge.hg
author | kfraser@localhost.localdomain |
---|---|
date | Tue Sep 19 09:40:26 2006 +0100 (2006-09-19) |
parents | 0bdd578c417f d8bceca5f07d |
children | 6374af16a8a3 |
files | xen/arch/powerpc/mm.c xen/include/asm-powerpc/mm.h |
line diff
1.1 --- a/extras/mini-os/events.c Mon Sep 18 14:28:16 2006 -0500 1.2 +++ b/extras/mini-os/events.c Tue Sep 19 09:40:26 2006 +0100 1.3 @@ -88,19 +88,18 @@ void unbind_evtchn(evtchn_port_t port ) 1.4 1.5 int bind_virq(uint32_t virq, evtchn_handler_t handler, void *data) 1.6 { 1.7 - evtchn_op_t op; 1.8 + evtchn_bind_virq_t op; 1.9 1.10 /* Try to bind the virq to a port */ 1.11 - op.cmd = EVTCHNOP_bind_virq; 1.12 - op.u.bind_virq.virq = virq; 1.13 - op.u.bind_virq.vcpu = smp_processor_id(); 1.14 + op.virq = virq; 1.15 + op.vcpu = smp_processor_id(); 1.16 1.17 - if ( HYPERVISOR_event_channel_op(&op) != 0 ) 1.18 + if ( HYPERVISOR_event_channel_op(EVTCHNOP_bind_virq, &op) != 0 ) 1.19 { 1.20 printk("Failed to bind virtual IRQ %d\n", virq); 1.21 return 1; 1.22 } 1.23 - bind_evtchn(op.u.bind_virq.port, handler, data); 1.24 + bind_evtchn(op.port, handler, data); 1.25 return 0; 1.26 } 1.27 1.28 @@ -151,14 +150,13 @@ void default_handler(evtchn_port_t port, 1.29 int evtchn_alloc_unbound(domid_t pal, evtchn_handler_t handler, 1.30 void *data, evtchn_port_t *port) 1.31 { 1.32 - evtchn_op_t op; 1.33 - op.cmd = EVTCHNOP_alloc_unbound; 1.34 - op.u.alloc_unbound.dom = DOMID_SELF; 1.35 - op.u.alloc_unbound.remote_dom = pal; 1.36 - int err = HYPERVISOR_event_channel_op(&op); 1.37 + evtchn_alloc_unbound_t op; 1.38 + op.dom = DOMID_SELF; 1.39 + op.remote_dom = pal; 1.40 + int err = HYPERVISOR_event_channel_op(EVTCHNOP_alloc_unbound, &op); 1.41 if (err) 1.42 return err; 1.43 - *port = bind_evtchn(op.u.alloc_unbound.port, handler, data); 1.44 + *port = bind_evtchn(op.port, handler, data); 1.45 return err; 1.46 } 1.47 1.48 @@ -169,14 +167,13 @@ int evtchn_bind_interdomain(domid_t pal, 1.49 evtchn_handler_t handler, void *data, 1.50 evtchn_port_t *local_port) 1.51 { 1.52 - evtchn_op_t op; 1.53 - op.cmd = EVTCHNOP_bind_interdomain; 1.54 - op.u.bind_interdomain.remote_dom = pal; 1.55 - op.u.bind_interdomain.remote_port = remote_port; 1.56 - int err = HYPERVISOR_event_channel_op(&op); 1.57 + evtchn_bind_interdomain_t op; 1.58 + op.remote_dom = pal; 1.59 + op.remote_port = remote_port; 1.60 + int err = HYPERVISOR_event_channel_op(EVTCHNOP_bind_interdomain, &op); 1.61 if (err) 1.62 return err; 1.63 - evtchn_port_t port = op.u.bind_interdomain.local_port; 1.64 + evtchn_port_t port = op.local_port; 1.65 clear_evtchn(port); /* Without, handler gets invoked now! */ 1.66 *local_port = bind_evtchn(port, handler, data); 1.67 return err;
2.1 --- a/extras/mini-os/include/events.h Mon Sep 18 14:28:16 2006 -0500 2.2 +++ b/extras/mini-os/include/events.h Tue Sep 19 09:40:26 2006 +0100 2.3 @@ -39,10 +39,9 @@ int evtchn_bind_interdomain(domid_t pal, 2.4 2.5 static inline int notify_remote_via_evtchn(evtchn_port_t port) 2.6 { 2.7 - evtchn_op_t op; 2.8 - op.cmd = EVTCHNOP_send; 2.9 - op.u.send.port = port; 2.10 - return HYPERVISOR_event_channel_op(&op); 2.11 + evtchn_send_t op; 2.12 + op.port = port; 2.13 + return HYPERVISOR_event_channel_op(EVTCHNOP_send, &op); 2.14 } 2.15 2.16
3.1 --- a/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h Mon Sep 18 14:28:16 2006 -0500 3.2 +++ b/extras/mini-os/include/x86/x86_32/hypercall-x86_32.h Tue Sep 19 09:40:26 2006 +0100 3.3 @@ -238,9 +238,9 @@ HYPERVISOR_update_va_mapping( 3.4 3.5 static inline int 3.6 HYPERVISOR_event_channel_op( 3.7 - void *op) 3.8 + int cmd, void *op) 3.9 { 3.10 - return _hypercall1(int, event_channel_op, op); 3.11 + return _hypercall2(int, event_channel_op, cmd, op); 3.12 } 3.13 3.14 static inline int
4.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Mon Sep 18 14:28:16 2006 -0500 4.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c Tue Sep 19 09:40:26 2006 +0100 4.3 @@ -65,6 +65,7 @@ 4.4 #include <xen/interface/physdev.h> 4.5 #include <xen/interface/memory.h> 4.6 #include <xen/features.h> 4.7 +#include <xen/xencons.h> 4.8 #include "setup_arch_pre.h" 4.9 #include <bios_ebda.h> 4.10 4.11 @@ -1665,33 +1666,15 @@ void __init setup_arch(char **cmdline_p) 4.12 screen_info.orig_video_cols = 80; 4.13 screen_info.orig_video_ega_bx = 3; 4.14 screen_info.orig_video_points = 16; 4.15 + screen_info.orig_y = screen_info.orig_video_lines - 1; 4.16 if (xen_start_info->console.dom0.info_size >= 4.17 sizeof(struct dom0_vga_console_info)) { 4.18 const struct dom0_vga_console_info *info = 4.19 (struct dom0_vga_console_info *)( 4.20 (char *)xen_start_info + 4.21 xen_start_info->console.dom0.info_off); 4.22 - screen_info.orig_video_mode = info->txt_mode; 4.23 - screen_info.orig_video_isVGA = info->video_type; 4.24 - screen_info.orig_video_lines = info->video_height; 4.25 - screen_info.orig_video_cols = info->video_width; 4.26 - screen_info.orig_video_points = info->txt_points; 4.27 - screen_info.lfb_width = info->video_width; 4.28 - screen_info.lfb_height = info->video_height; 4.29 - screen_info.lfb_depth = info->lfb_depth; 4.30 - screen_info.lfb_base = info->lfb_base; 4.31 - screen_info.lfb_size = info->lfb_size; 4.32 - screen_info.lfb_linelength = info->lfb_linelen; 4.33 - screen_info.red_size = info->red_size; 4.34 - screen_info.red_pos = info->red_pos; 4.35 - screen_info.green_size = info->green_size; 4.36 - screen_info.green_pos = info->green_pos; 4.37 - screen_info.blue_size = info->blue_size; 4.38 - screen_info.blue_pos = info->blue_pos; 4.39 - screen_info.rsvd_size = info->rsvd_size; 4.40 - screen_info.rsvd_pos = info->rsvd_pos; 4.41 + dom0_init_screen_info(info); 4.42 } 4.43 - screen_info.orig_y = screen_info.orig_video_lines - 1; 4.44 xen_start_info->console.domU.mfn = 0; 4.45 xen_start_info->console.domU.evtchn = 0; 4.46 } else
5.1 --- a/linux-2.6-xen-sparse/arch/ia64/dig/setup.c Mon Sep 18 14:28:16 2006 -0500 5.2 +++ b/linux-2.6-xen-sparse/arch/ia64/dig/setup.c Tue Sep 19 09:40:26 2006 +0100 5.3 @@ -25,6 +25,8 @@ 5.4 #include <asm/machvec.h> 5.5 #include <asm/system.h> 5.6 5.7 +#include <xen/xencons.h> 5.8 + 5.9 void __init 5.10 dig_setup (char **cmdline_p) 5.11 { 5.12 @@ -78,27 +80,8 @@ dig_setup (char **cmdline_p) 5.13 (struct dom0_vga_console_info *)( 5.14 (char *)xen_start_info + 5.15 xen_start_info->console.dom0.info_off); 5.16 - screen_info.orig_video_mode = info->txt_mode; 5.17 - screen_info.orig_video_isVGA = info->video_type; 5.18 - screen_info.orig_video_lines = info->video_height; 5.19 - screen_info.orig_video_cols = info->video_width; 5.20 - screen_info.orig_video_points = info->txt_points; 5.21 - screen_info.lfb_width = info->video_width; 5.22 - screen_info.lfb_height = info->video_height; 5.23 - screen_info.lfb_depth = info->lfb_depth; 5.24 - screen_info.lfb_base = info->lfb_base; 5.25 - screen_info.lfb_size = info->lfb_size; 5.26 - screen_info.lfb_linelength = info->lfb_linelen; 5.27 - screen_info.red_size = info->red_size; 5.28 - screen_info.red_pos = info->red_pos; 5.29 - screen_info.green_size = info->green_size; 5.30 - screen_info.green_pos = info->green_pos; 5.31 - screen_info.blue_size = info->blue_size; 5.32 - screen_info.blue_pos = info->blue_pos; 5.33 - screen_info.rsvd_size = info->rsvd_size; 5.34 - screen_info.rsvd_pos = info->rsvd_pos; 5.35 + dom0_init_screen_info(info); 5.36 } 5.37 - screen_info.orig_y = screen_info.orig_video_lines - 1; 5.38 xen_start_info->console.domU.mfn = 0; 5.39 xen_start_info->console.domU.evtchn = 0; 5.40 #endif
6.1 --- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c Mon Sep 18 14:28:16 2006 -0500 6.2 +++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c Tue Sep 19 09:40:26 2006 +0100 6.3 @@ -74,6 +74,7 @@ 6.4 #include <asm/hypervisor.h> 6.5 #include <xen/interface/nmi.h> 6.6 #include <xen/features.h> 6.7 +#include <xen/xencons.h> 6.8 #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) 6.9 #define PFN_PHYS(x) ((x) << PAGE_SHIFT) 6.10 #include <asm/mach-xen/setup_arch_post.h> 6.11 @@ -645,33 +646,15 @@ void __init setup_arch(char **cmdline_p) 6.12 screen_info.orig_video_cols = 80; 6.13 screen_info.orig_video_ega_bx = 3; 6.14 screen_info.orig_video_points = 16; 6.15 + screen_info.orig_y = screen_info.orig_video_lines - 1; 6.16 if (xen_start_info->console.dom0.info_size >= 6.17 sizeof(struct dom0_vga_console_info)) { 6.18 const struct dom0_vga_console_info *info = 6.19 (struct dom0_vga_console_info *)( 6.20 (char *)xen_start_info + 6.21 xen_start_info->console.dom0.info_off); 6.22 - screen_info.orig_video_mode = info->txt_mode; 6.23 - screen_info.orig_video_isVGA = info->video_type; 6.24 - screen_info.orig_video_lines = info->video_height; 6.25 - screen_info.orig_video_cols = info->video_width; 6.26 - screen_info.orig_video_points = info->txt_points; 6.27 - screen_info.lfb_width = info->video_width; 6.28 - screen_info.lfb_height = info->video_height; 6.29 - screen_info.lfb_depth = info->lfb_depth; 6.30 - screen_info.lfb_base = info->lfb_base; 6.31 - screen_info.lfb_size = info->lfb_size; 6.32 - screen_info.lfb_linelength = info->lfb_linelen; 6.33 - screen_info.red_size = info->red_size; 6.34 - screen_info.red_pos = info->red_pos; 6.35 - screen_info.green_size = info->green_size; 6.36 - screen_info.green_pos = info->green_pos; 6.37 - screen_info.blue_size = info->blue_size; 6.38 - screen_info.blue_pos = info->blue_pos; 6.39 - screen_info.rsvd_size = info->rsvd_size; 6.40 - screen_info.rsvd_pos = info->rsvd_pos; 6.41 + dom0_init_screen_info(info); 6.42 } 6.43 - screen_info.orig_y = screen_info.orig_video_lines - 1; 6.44 xen_start_info->console.domU.mfn = 0; 6.45 xen_start_info->console.domU.evtchn = 0; 6.46 } else
7.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c Mon Sep 18 14:28:16 2006 -0500 7.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c Tue Sep 19 09:40:26 2006 +0100 7.3 @@ -49,6 +49,7 @@ 7.4 #include <linux/console.h> 7.5 #include <linux/bootmem.h> 7.6 #include <linux/sysrq.h> 7.7 +#include <linux/screen_info.h> 7.8 #include <asm/io.h> 7.9 #include <asm/irq.h> 7.10 #include <asm/uaccess.h> 7.11 @@ -266,6 +267,41 @@ void xencons_force_flush(void) 7.12 } 7.13 7.14 7.15 +void dom0_init_screen_info(const struct dom0_vga_console_info *info) 7.16 +{ 7.17 + switch (info->video_type) { 7.18 + case XEN_VGATYPE_TEXT_MODE_3: 7.19 + screen_info.orig_video_mode = 3; 7.20 + screen_info.orig_video_ega_bx = 3; 7.21 + screen_info.orig_video_isVGA = 1; 7.22 + screen_info.orig_video_lines = info->u.text_mode_3.rows; 7.23 + screen_info.orig_video_cols = info->u.text_mode_3.columns; 7.24 + screen_info.orig_x = info->u.text_mode_3.cursor_x; 7.25 + screen_info.orig_y = info->u.text_mode_3.cursor_y; 7.26 + screen_info.orig_video_points = 7.27 + info->u.text_mode_3.font_height; 7.28 + break; 7.29 + case XEN_VGATYPE_VESA_LFB: 7.30 + screen_info.orig_video_isVGA = VIDEO_TYPE_VLFB; 7.31 + screen_info.lfb_width = info->u.vesa_lfb.width; 7.32 + screen_info.lfb_height = info->u.vesa_lfb.height; 7.33 + screen_info.lfb_depth = info->u.vesa_lfb.bits_per_pixel; 7.34 + screen_info.lfb_base = info->u.vesa_lfb.lfb_base; 7.35 + screen_info.lfb_size = info->u.vesa_lfb.lfb_size; 7.36 + screen_info.lfb_linelength = info->u.vesa_lfb.bytes_per_line; 7.37 + screen_info.red_size = info->u.vesa_lfb.red_size; 7.38 + screen_info.red_pos = info->u.vesa_lfb.red_pos; 7.39 + screen_info.green_size = info->u.vesa_lfb.green_size; 7.40 + screen_info.green_pos = info->u.vesa_lfb.green_pos; 7.41 + screen_info.blue_size = info->u.vesa_lfb.blue_size; 7.42 + screen_info.blue_pos = info->u.vesa_lfb.blue_pos; 7.43 + screen_info.rsvd_size = info->u.vesa_lfb.rsvd_size; 7.44 + screen_info.rsvd_pos = info->u.vesa_lfb.rsvd_pos; 7.45 + break; 7.46 + } 7.47 +} 7.48 + 7.49 + 7.50 /******************** User-space console driver (/dev/console) ************/ 7.51 7.52 #define DRV(_d) (_d)
8.1 --- a/linux-2.6-xen-sparse/include/xen/xencons.h Mon Sep 18 14:28:16 2006 -0500 8.2 +++ b/linux-2.6-xen-sparse/include/xen/xencons.h Tue Sep 19 09:40:26 2006 +0100 8.3 @@ -1,6 +1,9 @@ 8.4 #ifndef __ASM_XENCONS_H__ 8.5 #define __ASM_XENCONS_H__ 8.6 8.7 +struct dom0_vga_console_info; 8.8 +void dom0_init_screen_info(const struct dom0_vga_console_info *info); 8.9 + 8.10 void xencons_force_flush(void); 8.11 void xencons_resume(void); 8.12
9.1 --- a/tools/python/xen/xend/XendDomain.py Mon Sep 18 14:28:16 2006 -0500 9.2 +++ b/tools/python/xen/xend/XendDomain.py Tue Sep 19 09:40:26 2006 +0100 9.3 @@ -390,6 +390,22 @@ class XendDomain: 9.4 except Exception, ex: 9.5 raise XendError(str(ex)) 9.6 9.7 + def domain_dump(self, domid, filename, live, crash): 9.8 + """Dump domain core.""" 9.9 + 9.10 + dominfo = self.domain_lookup_by_name_or_id_nr(domid) 9.11 + if not dominfo: 9.12 + raise XendInvalidDomain(str(domid)) 9.13 + 9.14 + if dominfo.getDomid() == PRIV_DOMAIN: 9.15 + raise XendError("Cannot dump core for privileged domain %s" % domid) 9.16 + 9.17 + try: 9.18 + log.info("Domain core dump requested for domain %s (%d) live=%d crash=%d.", 9.19 + dominfo.getName(), dominfo.getDomid(), live, crash) 9.20 + return dominfo.dumpCore(filename) 9.21 + except Exception, ex: 9.22 + raise XendError(str(ex)) 9.23 9.24 def domain_destroy(self, domid): 9.25 """Terminate domain immediately."""
10.1 --- a/tools/python/xen/xend/XendDomainInfo.py Mon Sep 18 14:28:16 2006 -0500 10.2 +++ b/tools/python/xen/xend/XendDomainInfo.py Tue Sep 19 09:40:26 2006 +0100 10.3 @@ -86,6 +86,7 @@ STATE_DOM_OK = 1 10.4 STATE_DOM_SHUTDOWN = 2 10.5 10.6 SHUTDOWN_TIMEOUT = 30.0 10.7 +MIGRATE_TIMEOUT = 30.0 10.8 10.9 ZOMBIE_PREFIX = 'Zombie-' 10.10 10.11 @@ -977,15 +978,19 @@ class XendDomainInfo: 10.12 self.restart(True) 10.13 10.14 10.15 - def dumpCore(self): 10.16 + def dumpCore(self,corefile=None): 10.17 """Create a core dump for this domain. Nothrow guarantee.""" 10.18 10.19 try: 10.20 - corefile = "/var/xen/dump/%s.%s.core" % (self.info['name'], 10.21 - self.domid) 10.22 + if not corefile: 10.23 + this_time = time.strftime("%Y-%m%d-%H%M.%S", time.localtime()) 10.24 + corefile = "/var/xen/dump/%s-%s.%s.core" % (this_time, 10.25 + self.info['name'], self.domid) 10.26 xc.domain_dumpcore(self.domid, corefile) 10.27 10.28 except: 10.29 + corefile_incomp = corefile+'-incomplete' 10.30 + os.rename(corefile, corefile_incomp) 10.31 log.exception("XendDomainInfo.dumpCore failed: id = %s name = %s", 10.32 self.domid, self.info['name']) 10.33 10.34 @@ -1531,8 +1536,10 @@ class XendDomainInfo: 10.35 the device has shutdown correctly, i.e. all blocks are 10.36 flushed to disk 10.37 """ 10.38 + start = time.time() 10.39 while True: 10.40 test = 0 10.41 + diff = time.time() - start 10.42 for i in self.getDeviceController('vbd').deviceIDs(): 10.43 test = 1 10.44 log.info("Dev %s still active, looping...", i) 10.45 @@ -1540,6 +1547,9 @@ class XendDomainInfo: 10.46 10.47 if test == 0: 10.48 break 10.49 + if diff >= MIGRATE_TIMEOUT: 10.50 + log.info("Dev still active but hit max loop timeout") 10.51 + break 10.52 10.53 def migrateDevices(self, network, dst, step, domName=''): 10.54 """Notify the devices about migration
11.1 --- a/tools/python/xen/xend/image.py Mon Sep 18 14:28:16 2006 -0500 11.2 +++ b/tools/python/xen/xend/image.py Tue Sep 19 09:40:26 2006 +0100 11.3 @@ -340,10 +340,6 @@ class HVMImageHandler(ImageHandler): 11.4 (nics, mac, model)) 11.5 ret.append("-net") 11.6 ret.append("tap,vlan=%d,bridge=%s" % (nics, bridge)) 11.7 - if name == 'vtpm': 11.8 - instance = sxp.child_value(info, 'pref_instance') 11.9 - ret.append("-instance") 11.10 - ret.append("%s" % instance) 11.11 return ret 11.12 11.13 def configVNC(self, config):
12.1 --- a/tools/python/xen/xend/server/tpmif.py Mon Sep 18 14:28:16 2006 -0500 12.2 +++ b/tools/python/xen/xend/server/tpmif.py Tue Sep 19 09:40:26 2006 +0100 12.3 @@ -52,7 +52,7 @@ class TPMifController(DevController): 12.4 if inst == -1: 12.5 inst = int(sxp.child_value(config, 'instance' , '0')) 12.6 12.7 - log.info("The domain has a TPM with instance %d and devid %d.", 12.8 + log.info("The domain has a TPM with pref. instance %d and devid %d.", 12.9 inst, devid) 12.10 back = { 'pref_instance' : "%i" % inst, 12.11 'resume' : "%s" % (self.vm.getResume()) }
13.1 --- a/tools/python/xen/xm/main.py Mon Sep 18 14:28:16 2006 -0500 13.2 +++ b/tools/python/xen/xm/main.py Tue Sep 19 09:40:26 2006 +0100 13.3 @@ -57,6 +57,9 @@ console_help = "console <DomId> 13.4 create_help = """create [-c] <ConfigFile> 13.5 [Name=Value].. Create a domain based on Config File""" 13.6 destroy_help = "destroy <DomId> Terminate a domain immediately" 13.7 +dump_core_help = """dump-core [-L|--live][-C|--crash] 13.8 + <DomId> [FileName] Dump core of the specified domain""" 13.9 + 13.10 help_help = "help Display this message" 13.11 list_help = "list [--long] [DomId, ...] List information about domains" 13.12 list_label_help = "list [--label] [DomId, ...] List information about domains including their labels" 13.13 @@ -138,6 +141,7 @@ short_command_list = [ 13.14 "console", 13.15 "create", 13.16 "destroy", 13.17 + "dump-core", 13.18 "help", 13.19 "list", 13.20 "mem-set", 13.21 @@ -159,6 +163,7 @@ domain_commands = [ 13.22 "destroy", 13.23 "domid", 13.24 "domname", 13.25 + "dump-core", 13.26 "list", 13.27 "list_label", 13.28 "mem-max", 13.29 @@ -590,6 +595,43 @@ def xm_unpause(args): 13.30 13.31 server.xend.domain.unpause(dom) 13.32 13.33 +def xm_dump_core(args): 13.34 + arg_check(args, "dump-core",1,3) 13.35 + live = False 13.36 + crash = False 13.37 + import getopt 13.38 + (options, params) = getopt.gnu_getopt(args, 'LC', ['live','crash']) 13.39 + 13.40 + for (k, v) in options: 13.41 + if k in ['-L', '--live']: 13.42 + live = True 13.43 + if k in ['-C', '--crash']: 13.44 + crash = True 13.45 + 13.46 + if len(params) == 0 or len(params) > 2: 13.47 + err("invalid number of parameters") 13.48 + usage("dump-core") 13.49 + 13.50 + dom = params[0] 13.51 + if len(params) == 2: 13.52 + filename = os.path.abspath(params[1]) 13.53 + else: 13.54 + filename = None 13.55 + 13.56 + if not live: 13.57 + server.xend.domain.pause(dom) 13.58 + 13.59 + try: 13.60 + print "dumping core of domain:%s ..." % str(dom) 13.61 + server.xend.domain.dump(dom, filename, live, crash) 13.62 + finally: 13.63 + if not live: 13.64 + server.xend.domain.unpause(dom) 13.65 + 13.66 + if crash: 13.67 + print "destroying domain:%s ..." % str(dom) 13.68 + server.xend.domain.destroy(dom) 13.69 + 13.70 def xm_rename(args): 13.71 arg_check(args, "rename", 2) 13.72 13.73 @@ -1168,6 +1210,7 @@ commands = { 13.74 "destroy": xm_destroy, 13.75 "domid": xm_domid, 13.76 "domname": xm_domname, 13.77 + "dump-core": xm_dump_core, 13.78 "rename": xm_rename, 13.79 "restore": xm_restore, 13.80 "save": xm_save,
14.1 --- a/tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py Mon Sep 18 14:28:16 2006 -0500 14.2 +++ b/tools/xm-test/tests/vtpm/06_vtpm-susp_res_pcrs.py Tue Sep 19 09:40:26 2006 +0100 14.3 @@ -42,7 +42,7 @@ except ConsoleError, e: 14.4 FAIL("Error while creating /dev/tpm0") 14.5 14.6 try: 14.7 - 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") 14.8 + 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") 14.9 except ConsoleError, e: 14.10 saveLog(console.getHistory()) 14.11 vtpm_cleanup(domName)
15.1 --- a/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py Mon Sep 18 14:28:16 2006 -0500 15.2 +++ b/tools/xm-test/tests/vtpm/07_vtpm-mig_pcrs.py Tue Sep 19 09:40:26 2006 +0100 15.3 @@ -43,7 +43,7 @@ except ConsoleError, e: 15.4 FAIL("Error while creating /dev/tpm0") 15.5 15.6 try: 15.7 - 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") 15.8 + 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") 15.9 except ConsoleError, e: 15.10 saveLog(console.getHistory()) 15.11 vtpm_cleanup(domName)
16.1 --- a/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py Mon Sep 18 14:28:16 2006 -0500 16.2 +++ b/tools/xm-test/tests/vtpm/08_vtpm-mig_pcrs.py Tue Sep 19 09:40:26 2006 +0100 16.3 @@ -43,7 +43,7 @@ except ConsoleError, e: 16.4 FAIL("Error while creating /dev/tpm0") 16.5 16.6 try: 16.7 - 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") 16.8 + 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") 16.9 except ConsoleError, e: 16.10 saveLog(console.getHistory()) 16.11 vtpm_cleanup(domName)
17.1 --- a/xen/arch/ia64/xen/mm.c Mon Sep 18 14:28:16 2006 -0500 17.2 +++ b/xen/arch/ia64/xen/mm.c Tue Sep 19 09:40:26 2006 +0100 17.3 @@ -1627,13 +1627,6 @@ void put_page_type(struct page_info *pag 17.4 nx &= ~PGT_validated; 17.5 } 17.6 } 17.7 - else if ( unlikely(((nx & (PGT_pinned | PGT_count_mask)) == 17.8 - (PGT_pinned | 1)) && 17.9 - ((nx & PGT_type_mask) != PGT_writable_page)) ) 17.10 - { 17.11 - /* Page is now only pinned. Make the back pointer mutable again. */ 17.12 - nx |= PGT_va_mutable; 17.13 - } 17.14 } 17.15 while ( unlikely((y = cmpxchg_rel(&page->u.inuse.type_info, x, nx)) != x) ); 17.16 } 17.17 @@ -1643,6 +1636,8 @@ int get_page_type(struct page_info *page 17.18 { 17.19 u32 nx, x, y = page->u.inuse.type_info; 17.20 17.21 + ASSERT(!(type & ~PGT_type_mask)); 17.22 + 17.23 again: 17.24 do { 17.25 x = y; 17.26 @@ -1654,29 +1649,25 @@ int get_page_type(struct page_info *page 17.27 } 17.28 else if ( unlikely((x & PGT_count_mask) == 0) ) 17.29 { 17.30 - if ( (x & (PGT_type_mask|PGT_va_mask)) != type ) 17.31 + if ( (x & PGT_type_mask) != type ) 17.32 { 17.33 - if ( (x & PGT_type_mask) != (type & PGT_type_mask) ) 17.34 + /* 17.35 + * On type change we check to flush stale TLB entries. This 17.36 + * may be unnecessary (e.g., page was GDT/LDT) but those 17.37 + * circumstances should be very rare. 17.38 + */ 17.39 + cpumask_t mask = 17.40 + page_get_owner(page)->domain_dirty_cpumask; 17.41 + tlbflush_filter(mask, page->tlbflush_timestamp); 17.42 + 17.43 + if ( unlikely(!cpus_empty(mask)) ) 17.44 { 17.45 - /* 17.46 - * On type change we check to flush stale TLB 17.47 - * entries. This may be unnecessary (e.g., page 17.48 - * was GDT/LDT) but those circumstances should be 17.49 - * very rare. 17.50 - */ 17.51 - cpumask_t mask = 17.52 - page_get_owner(page)->domain_dirty_cpumask; 17.53 - tlbflush_filter(mask, page->tlbflush_timestamp); 17.54 - 17.55 - if ( unlikely(!cpus_empty(mask)) ) 17.56 - { 17.57 - perfc_incrc(need_flush_tlb_flush); 17.58 - flush_tlb_mask(mask); 17.59 - } 17.60 + perfc_incrc(need_flush_tlb_flush); 17.61 + flush_tlb_mask(mask); 17.62 } 17.63 17.64 /* We lose existing type, back pointer, and validity. */ 17.65 - nx &= ~(PGT_type_mask | PGT_va_mask | PGT_validated); 17.66 + nx &= ~(PGT_type_mask | PGT_validated); 17.67 nx |= type; 17.68 17.69 /* No special validation needed for writable pages. */ 17.70 @@ -1685,46 +1676,22 @@ int get_page_type(struct page_info *page 17.71 nx |= PGT_validated; 17.72 } 17.73 } 17.74 - else 17.75 + else if ( unlikely((x & PGT_type_mask) != type) ) 17.76 { 17.77 - if ( unlikely((x & (PGT_type_mask|PGT_va_mask)) != type) ) 17.78 - { 17.79 - if ( unlikely((x & PGT_type_mask) != (type & PGT_type_mask) ) ) 17.80 - { 17.81 - if ( ((x & PGT_type_mask) != PGT_l2_page_table) || 17.82 - ((type & PGT_type_mask) != PGT_l1_page_table) ) 17.83 - MEM_LOG("Bad type (saw %08x != exp %08x) " 17.84 - "for mfn %016lx (pfn %016lx)", 17.85 - x, type, page_to_mfn(page), 17.86 - get_gpfn_from_mfn(page_to_mfn(page))); 17.87 - return 0; 17.88 - } 17.89 - else if ( (x & PGT_va_mask) == PGT_va_mutable ) 17.90 - { 17.91 - /* The va backpointer is mutable, hence we update it. */ 17.92 - nx &= ~PGT_va_mask; 17.93 - nx |= type; /* we know the actual type is correct */ 17.94 - } 17.95 - else if ( ((type & PGT_va_mask) != PGT_va_mutable) && 17.96 - ((type & PGT_va_mask) != (x & PGT_va_mask)) ) 17.97 - { 17.98 -#ifdef CONFIG_X86_PAE 17.99 - /* We use backptr as extra typing. Cannot be unknown. */ 17.100 - if ( (type & PGT_type_mask) == PGT_l2_page_table ) 17.101 - return 0; 17.102 -#endif 17.103 - /* This table is possibly mapped at multiple locations. */ 17.104 - nx &= ~PGT_va_mask; 17.105 - nx |= PGT_va_unknown; 17.106 - } 17.107 - } 17.108 - if ( unlikely(!(x & PGT_validated)) ) 17.109 - { 17.110 - /* Someone else is updating validation of this page. Wait... */ 17.111 - while ( (y = page->u.inuse.type_info) == x ) 17.112 - cpu_relax(); 17.113 - goto again; 17.114 - } 17.115 + if ( ((x & PGT_type_mask) != PGT_l2_page_table) || 17.116 + (type != PGT_l1_page_table) ) 17.117 + MEM_LOG("Bad type (saw %08x != exp %08x) " 17.118 + "for mfn %016lx (pfn %016lx)", 17.119 + x, type, page_to_mfn(page), 17.120 + get_gpfn_from_mfn(page_to_mfn(page))); 17.121 + return 0; 17.122 + } 17.123 + else if ( unlikely(!(x & PGT_validated)) ) 17.124 + { 17.125 + /* Someone else is updating validation of this page. Wait... */ 17.126 + while ( (y = page->u.inuse.type_info) == x ) 17.127 + cpu_relax(); 17.128 + goto again; 17.129 } 17.130 } 17.131 while ( unlikely((y = cmpxchg_acq(&page->u.inuse.type_info, x, nx)) != x) );
18.1 --- a/xen/arch/powerpc/mm.c Mon Sep 18 14:28:16 2006 -0500 18.2 +++ b/xen/arch/powerpc/mm.c Tue Sep 19 09:40:26 2006 +0100 18.3 @@ -86,12 +86,6 @@ void put_page_type(struct page_info *pag 18.4 /* Record TLB information for flush later. */ 18.5 page->tlbflush_timestamp = tlbflush_current_time(); 18.6 } 18.7 - else if ( unlikely((nx & (PGT_pinned|PGT_type_mask|PGT_count_mask)) == 18.8 - (PGT_pinned | 1)) ) 18.9 - { 18.10 - /* Page is now only pinned. Make the back pointer mutable again. */ 18.11 - nx |= PGT_va_mutable; 18.12 - } 18.13 } 18.14 while ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) ); 18.15 } 18.16 @@ -101,6 +95,8 @@ int get_page_type(struct page_info *page 18.17 { 18.18 unsigned long nx, x, y = page->u.inuse.type_info; 18.19 18.20 + ASSERT(!(type & ~PGT_type_mask)); 18.21 + 18.22 again: 18.23 do { 18.24 x = y; 18.25 @@ -112,29 +108,25 @@ int get_page_type(struct page_info *page 18.26 } 18.27 else if ( unlikely((x & PGT_count_mask) == 0) ) 18.28 { 18.29 - if ( (x & (PGT_type_mask|PGT_va_mask)) != type ) 18.30 + if ( (x & PGT_type_mask) != type ) 18.31 { 18.32 - if ( (x & PGT_type_mask) != (type & PGT_type_mask) ) 18.33 + /* 18.34 + * On type change we check to flush stale TLB entries. This 18.35 + * may be unnecessary (e.g., page was GDT/LDT) but those 18.36 + * circumstances should be very rare. 18.37 + */ 18.38 + cpumask_t mask = 18.39 + page_get_owner(page)->domain_dirty_cpumask; 18.40 + tlbflush_filter(mask, page->tlbflush_timestamp); 18.41 + 18.42 + if ( unlikely(!cpus_empty(mask)) ) 18.43 { 18.44 - /* 18.45 - * On type change we check to flush stale TLB 18.46 - * entries. This may be unnecessary (e.g., page 18.47 - * was GDT/LDT) but those circumstances should be 18.48 - * very rare. 18.49 - */ 18.50 - cpumask_t mask = 18.51 - page_get_owner(page)->domain_dirty_cpumask; 18.52 - tlbflush_filter(mask, page->tlbflush_timestamp); 18.53 - 18.54 - if ( unlikely(!cpus_empty(mask)) ) 18.55 - { 18.56 - perfc_incrc(need_flush_tlb_flush); 18.57 - flush_tlb_mask(mask); 18.58 - } 18.59 + perfc_incrc(need_flush_tlb_flush); 18.60 + flush_tlb_mask(mask); 18.61 } 18.62 18.63 /* We lose existing type, back pointer, and validity. */ 18.64 - nx &= ~(PGT_type_mask | PGT_va_mask | PGT_validated); 18.65 + nx &= ~(PGT_type_mask | PGT_validated); 18.66 nx |= type; 18.67 18.68 /* No special validation needed for writable pages. */ 18.69 @@ -143,36 +135,16 @@ int get_page_type(struct page_info *page 18.70 nx |= PGT_validated; 18.71 } 18.72 } 18.73 - else 18.74 + else if ( unlikely((x & PGT_type_mask) != type) ) 18.75 { 18.76 - if ( unlikely((x & (PGT_type_mask|PGT_va_mask)) != type) ) 18.77 - { 18.78 - if ( unlikely((x & PGT_type_mask) != (type & PGT_type_mask) ) ) 18.79 - { 18.80 - return 0; 18.81 - } 18.82 - else if ( (x & PGT_va_mask) == PGT_va_mutable ) 18.83 - { 18.84 - /* The va backpointer is mutable, hence we update it. */ 18.85 - nx &= ~PGT_va_mask; 18.86 - nx |= type; /* we know the actual type is correct */ 18.87 - } 18.88 - else if ( (type & PGT_va_mask) != PGT_va_mutable ) 18.89 - { 18.90 - ASSERT((type & PGT_va_mask) != (x & PGT_va_mask)); 18.91 - 18.92 - /* This table is possibly mapped at multiple locations. */ 18.93 - nx &= ~PGT_va_mask; 18.94 - nx |= PGT_va_unknown; 18.95 - } 18.96 - } 18.97 - if ( unlikely(!(x & PGT_validated)) ) 18.98 - { 18.99 - /* Someone else is updating validation of this page. Wait... */ 18.100 - while ( (y = page->u.inuse.type_info) == x ) 18.101 - cpu_relax(); 18.102 - goto again; 18.103 - } 18.104 + return 0; 18.105 + } 18.106 + if ( unlikely(!(x & PGT_validated)) ) 18.107 + { 18.108 + /* Someone else is updating validation of this page. Wait... */ 18.109 + while ( (y = page->u.inuse.type_info) == x ) 18.110 + cpu_relax(); 18.111 + goto again; 18.112 } 18.113 } 18.114 while ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) );
19.1 --- a/xen/arch/x86/domain_build.c Mon Sep 18 14:28:16 2006 -0500 19.2 +++ b/xen/arch/x86/domain_build.c Tue Sep 19 09:40:26 2006 +0100 19.3 @@ -510,15 +510,13 @@ int construct_dom0(struct domain *d, 19.4 case 1 ... 4: 19.5 page->u.inuse.type_info &= ~PGT_type_mask; 19.6 page->u.inuse.type_info |= PGT_l2_page_table; 19.7 - page->u.inuse.type_info |= 19.8 - (count-1) << PGT_va_shift; 19.9 + if ( count == 4 ) 19.10 + page->u.inuse.type_info |= PGT_pae_xen_l2; 19.11 get_page(page, d); /* an extra ref because of readable mapping */ 19.12 break; 19.13 default: 19.14 page->u.inuse.type_info &= ~PGT_type_mask; 19.15 page->u.inuse.type_info |= PGT_l1_page_table; 19.16 - page->u.inuse.type_info |= 19.17 - ((dsi.v_start>>L2_PAGETABLE_SHIFT)+(count-5))<<PGT_va_shift; 19.18 get_page(page, d); /* an extra ref because of readable mapping */ 19.19 break; 19.20 } 19.21 @@ -544,8 +542,6 @@ int construct_dom0(struct domain *d, 19.22 { 19.23 page->u.inuse.type_info &= ~PGT_type_mask; 19.24 page->u.inuse.type_info |= PGT_l1_page_table; 19.25 - page->u.inuse.type_info |= 19.26 - ((dsi.v_start>>L2_PAGETABLE_SHIFT)+(count-1))<<PGT_va_shift; 19.27 19.28 /* 19.29 * No longer writable: decrement the type_count.
20.1 --- a/xen/arch/x86/hvm/hvm.c Mon Sep 18 14:28:16 2006 -0500 20.2 +++ b/xen/arch/x86/hvm/hvm.c Tue Sep 19 09:40:26 2006 +0100 20.3 @@ -337,7 +337,6 @@ int cpu_get_interrupt(struct vcpu *v, in 20.4 return -1; 20.5 } 20.6 20.7 -#include <asm/hvm/vmx/vmx.h> 20.8 void hvm_hlt(unsigned long rflags) 20.9 { 20.10 struct vcpu *v = current;
21.1 --- a/xen/arch/x86/mm.c Mon Sep 18 14:28:16 2006 -0500 21.2 +++ b/xen/arch/x86/mm.c Tue Sep 19 09:40:26 2006 +0100 21.3 @@ -625,8 +625,7 @@ get_page_from_l1e( 21.4 /* NB. Virtual address 'l2e' maps to a machine address within frame 'pfn'. */ 21.5 static int 21.6 get_page_from_l2e( 21.7 - l2_pgentry_t l2e, unsigned long pfn, 21.8 - struct domain *d, unsigned long vaddr) 21.9 + l2_pgentry_t l2e, unsigned long pfn, struct domain *d) 21.10 { 21.11 int rc; 21.12 21.13 @@ -639,10 +638,7 @@ get_page_from_l2e( 21.14 return 0; 21.15 } 21.16 21.17 - vaddr >>= L2_PAGETABLE_SHIFT; 21.18 - vaddr <<= PGT_va_shift; 21.19 - rc = get_page_and_type_from_pagenr( 21.20 - l2e_get_pfn(l2e), PGT_l1_page_table | vaddr, d); 21.21 + rc = get_page_and_type_from_pagenr(l2e_get_pfn(l2e), PGT_l1_page_table, d); 21.22 #if CONFIG_PAGING_LEVELS == 2 21.23 if ( unlikely(!rc) ) 21.24 rc = get_linear_pagetable(l2e, pfn, d); 21.25 @@ -654,8 +650,7 @@ get_page_from_l2e( 21.26 #if CONFIG_PAGING_LEVELS >= 3 21.27 static int 21.28 get_page_from_l3e( 21.29 - l3_pgentry_t l3e, unsigned long pfn, 21.30 - struct domain *d, unsigned long vaddr) 21.31 + l3_pgentry_t l3e, unsigned long pfn, struct domain *d) 21.32 { 21.33 int rc; 21.34 21.35 @@ -668,11 +663,7 @@ get_page_from_l3e( 21.36 return 0; 21.37 } 21.38 21.39 - vaddr >>= L3_PAGETABLE_SHIFT; 21.40 - vaddr <<= PGT_va_shift; 21.41 - rc = get_page_and_type_from_pagenr( 21.42 - l3e_get_pfn(l3e), 21.43 - PGT_l2_page_table | vaddr, d); 21.44 + rc = get_page_and_type_from_pagenr(l3e_get_pfn(l3e), PGT_l2_page_table, d); 21.45 return rc; 21.46 } 21.47 #endif /* 3 level */ 21.48 @@ -680,8 +671,7 @@ get_page_from_l3e( 21.49 #if CONFIG_PAGING_LEVELS >= 4 21.50 static int 21.51 get_page_from_l4e( 21.52 - l4_pgentry_t l4e, unsigned long pfn, 21.53 - struct domain *d, unsigned long vaddr) 21.54 + l4_pgentry_t l4e, unsigned long pfn, struct domain *d) 21.55 { 21.56 int rc; 21.57 21.58 @@ -694,11 +684,7 @@ get_page_from_l4e( 21.59 return 0; 21.60 } 21.61 21.62 - vaddr >>= L4_PAGETABLE_SHIFT; 21.63 - vaddr <<= PGT_va_shift; 21.64 - rc = get_page_and_type_from_pagenr( 21.65 - l4e_get_pfn(l4e), 21.66 - PGT_l3_page_table | vaddr, d); 21.67 + rc = get_page_and_type_from_pagenr(l4e_get_pfn(l4e), PGT_l3_page_table, d); 21.68 21.69 if ( unlikely(!rc) ) 21.70 rc = get_linear_pagetable(l4e, pfn, d); 21.71 @@ -877,8 +863,8 @@ static int create_pae_xen_mappings(l3_pg 21.72 /* 21.73 * The Xen-private mappings include linear mappings. The L2 thus cannot 21.74 * be shared by multiple L3 tables. The test here is adequate because: 21.75 - * 1. Cannot appear in slots != 3 because the page would then then have 21.76 - * unknown va backpointer, which get_page_type() explicitly disallows. 21.77 + * 1. Cannot appear in slots != 3 because get_page_type() checks the 21.78 + * PGT_pae_xen_l2 flag, which is asserted iff the L2 appears in slot 3 21.79 * 2. Cannot appear in another page table's L3: 21.80 * a. alloc_l3_table() calls this function and this check will fail 21.81 * b. mod_l3_entry() disallows updates to slot 3 in an existing table 21.82 @@ -888,6 +874,7 @@ static int create_pae_xen_mappings(l3_pg 21.83 page = l3e_get_page(l3e3); 21.84 BUG_ON(page->u.inuse.type_info & PGT_pinned); 21.85 BUG_ON((page->u.inuse.type_info & PGT_count_mask) == 0); 21.86 + BUG_ON(!(page->u.inuse.type_info & PGT_pae_xen_l2)); 21.87 if ( (page->u.inuse.type_info & PGT_count_mask) != 1 ) 21.88 { 21.89 MEM_LOG("PAE L3 3rd slot is shared"); 21.90 @@ -949,61 +936,17 @@ static void pae_flush_pgd( 21.91 flush_tlb_mask(d->domain_dirty_cpumask); 21.92 } 21.93 21.94 -static inline int l1_backptr( 21.95 - unsigned long *backptr, unsigned long offset_in_l2, unsigned long l2_type) 21.96 -{ 21.97 - unsigned long l2_backptr = l2_type & PGT_va_mask; 21.98 - ASSERT(l2_backptr != PGT_va_unknown); 21.99 - ASSERT(l2_backptr != PGT_va_mutable); 21.100 - *backptr = 21.101 - ((l2_backptr >> PGT_va_shift) << L3_PAGETABLE_SHIFT) | 21.102 - (offset_in_l2 << L2_PAGETABLE_SHIFT); 21.103 - return 1; 21.104 -} 21.105 - 21.106 #elif CONFIG_X86_64 21.107 # define create_pae_xen_mappings(pl3e) (1) 21.108 # define pae_flush_pgd(mfn, idx, nl3e) ((void)0) 21.109 - 21.110 -static inline int l1_backptr( 21.111 - unsigned long *backptr, unsigned long offset_in_l2, unsigned long l2_type) 21.112 -{ 21.113 - unsigned long l2_backptr = l2_type & PGT_va_mask; 21.114 - ASSERT(l2_backptr != PGT_va_unknown); 21.115 - ASSERT(l2_backptr != PGT_va_mutable); 21.116 - *backptr = ((l2_backptr >> PGT_va_shift) << L3_PAGETABLE_SHIFT) | 21.117 - (offset_in_l2 << L2_PAGETABLE_SHIFT); 21.118 - return 1; 21.119 -} 21.120 - 21.121 -static inline int l2_backptr( 21.122 - unsigned long *backptr, unsigned long offset_in_l3, unsigned long l3_type) 21.123 -{ 21.124 - unsigned long l3_backptr = l3_type & PGT_va_mask; 21.125 - ASSERT(l3_backptr != PGT_va_unknown); 21.126 - ASSERT(l3_backptr != PGT_va_mutable); 21.127 - *backptr = ((l3_backptr >> PGT_va_shift) << L4_PAGETABLE_SHIFT) | 21.128 - (offset_in_l3 << L3_PAGETABLE_SHIFT); 21.129 - return 1; 21.130 -} 21.131 - 21.132 -static inline int l3_backptr( 21.133 - unsigned long *backptr, unsigned long offset_in_l4, unsigned long l4_type) 21.134 -{ 21.135 - *backptr = (offset_in_l4 << L4_PAGETABLE_SHIFT); 21.136 - return 1; 21.137 -} 21.138 #else 21.139 # define create_pae_xen_mappings(pl3e) (1) 21.140 -# define l1_backptr(bp,l2o,l2t) \ 21.141 - ({ *(bp) = (unsigned long)(l2o) << L2_PAGETABLE_SHIFT; 1; }) 21.142 #endif 21.143 21.144 static int alloc_l2_table(struct page_info *page, unsigned long type) 21.145 { 21.146 struct domain *d = page_get_owner(page); 21.147 unsigned long pfn = page_to_mfn(page); 21.148 - unsigned long vaddr; 21.149 l2_pgentry_t *pl2e; 21.150 int i; 21.151 21.152 @@ -1013,10 +956,8 @@ static int alloc_l2_table(struct page_in 21.153 21.154 for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ ) 21.155 { 21.156 - if ( !l1_backptr(&vaddr, i, type) ) 21.157 - goto fail; 21.158 if ( is_guest_l2_slot(type, i) && 21.159 - unlikely(!get_page_from_l2e(pl2e[i], pfn, d, vaddr)) ) 21.160 + unlikely(!get_page_from_l2e(pl2e[i], pfn, d)) ) 21.161 goto fail; 21.162 21.163 adjust_guest_l2e(pl2e[i]); 21.164 @@ -1051,11 +992,10 @@ static int alloc_l2_table(struct page_in 21.165 21.166 21.167 #if CONFIG_PAGING_LEVELS >= 3 21.168 -static int alloc_l3_table(struct page_info *page, unsigned long type) 21.169 +static int alloc_l3_table(struct page_info *page) 21.170 { 21.171 struct domain *d = page_get_owner(page); 21.172 unsigned long pfn = page_to_mfn(page); 21.173 - unsigned long vaddr; 21.174 l3_pgentry_t *pl3e; 21.175 int i; 21.176 21.177 @@ -1079,14 +1019,21 @@ static int alloc_l3_table(struct page_in 21.178 pl3e = map_domain_page(pfn); 21.179 for ( i = 0; i < L3_PAGETABLE_ENTRIES; i++ ) 21.180 { 21.181 -#if CONFIG_PAGING_LEVELS >= 4 21.182 - if ( !l2_backptr(&vaddr, i, type) ) 21.183 - goto fail; 21.184 -#else 21.185 - vaddr = (unsigned long)i << L3_PAGETABLE_SHIFT; 21.186 +#ifdef CONFIG_X86_PAE 21.187 + if ( i == 3 ) 21.188 + { 21.189 + if ( !(l3e_get_flags(pl3e[i]) & _PAGE_PRESENT) || 21.190 + (l3e_get_flags(pl3e[i]) & L3_DISALLOW_MASK) || 21.191 + !get_page_and_type_from_pagenr(l3e_get_pfn(pl3e[i]), 21.192 + PGT_l2_page_table | 21.193 + PGT_pae_xen_l2, 21.194 + d) ) 21.195 + goto fail; 21.196 + } 21.197 + else 21.198 #endif 21.199 if ( is_guest_l3_slot(i) && 21.200 - unlikely(!get_page_from_l3e(pl3e[i], pfn, d, vaddr)) ) 21.201 + unlikely(!get_page_from_l3e(pl3e[i], pfn, d)) ) 21.202 goto fail; 21.203 21.204 adjust_guest_l3e(pl3e[i]); 21.205 @@ -1108,27 +1055,23 @@ static int alloc_l3_table(struct page_in 21.206 return 0; 21.207 } 21.208 #else 21.209 -#define alloc_l3_table(page, type) (0) 21.210 +#define alloc_l3_table(page) (0) 21.211 #endif 21.212 21.213 #if CONFIG_PAGING_LEVELS >= 4 21.214 -static int alloc_l4_table(struct page_info *page, unsigned long type) 21.215 +static int alloc_l4_table(struct page_info *page) 21.216 { 21.217 struct domain *d = page_get_owner(page); 21.218 unsigned long pfn = page_to_mfn(page); 21.219 l4_pgentry_t *pl4e = page_to_virt(page); 21.220 - unsigned long vaddr; 21.221 int i; 21.222 21.223 ASSERT(!shadow_mode_refcounts(d)); 21.224 21.225 for ( i = 0; i < L4_PAGETABLE_ENTRIES; i++ ) 21.226 { 21.227 - if ( !l3_backptr(&vaddr, i, type) ) 21.228 - goto fail; 21.229 - 21.230 if ( is_guest_l4_slot(i) && 21.231 - unlikely(!get_page_from_l4e(pl4e[i], pfn, d, vaddr)) ) 21.232 + unlikely(!get_page_from_l4e(pl4e[i], pfn, d)) ) 21.233 goto fail; 21.234 21.235 adjust_guest_l4e(pl4e[i]); 21.236 @@ -1156,7 +1099,7 @@ static int alloc_l4_table(struct page_in 21.237 return 0; 21.238 } 21.239 #else 21.240 -#define alloc_l4_table(page, type) (0) 21.241 +#define alloc_l4_table(page) (0) 21.242 #endif 21.243 21.244 21.245 @@ -1190,6 +1133,8 @@ static void free_l2_table(struct page_in 21.246 put_page_from_l2e(pl2e[i], pfn); 21.247 21.248 unmap_domain_page(pl2e); 21.249 + 21.250 + page->u.inuse.type_info &= ~PGT_pae_xen_l2; 21.251 } 21.252 21.253 21.254 @@ -1357,7 +1302,6 @@ static int mod_l2_entry(l2_pgentry_t *pl 21.255 unsigned long type) 21.256 { 21.257 l2_pgentry_t ol2e; 21.258 - unsigned long vaddr = 0; 21.259 21.260 if ( unlikely(!is_guest_l2_slot(type,pgentry_ptr_to_slot(pl2e))) ) 21.261 { 21.262 @@ -1383,8 +1327,7 @@ static int mod_l2_entry(l2_pgentry_t *pl 21.263 if ( !l2e_has_changed(ol2e, nl2e, _PAGE_PRESENT)) 21.264 return UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn); 21.265 21.266 - if ( unlikely(!l1_backptr(&vaddr, pgentry_ptr_to_slot(pl2e), type)) || 21.267 - unlikely(!get_page_from_l2e(nl2e, pfn, current->domain, vaddr)) ) 21.268 + if ( unlikely(!get_page_from_l2e(nl2e, pfn, current->domain)) ) 21.269 return 0; 21.270 21.271 if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn)) ) 21.272 @@ -1407,11 +1350,9 @@ static int mod_l2_entry(l2_pgentry_t *pl 21.273 /* Update the L3 entry at pl3e to new value nl3e. pl3e is within frame pfn. */ 21.274 static int mod_l3_entry(l3_pgentry_t *pl3e, 21.275 l3_pgentry_t nl3e, 21.276 - unsigned long pfn, 21.277 - unsigned long type) 21.278 + unsigned long pfn) 21.279 { 21.280 l3_pgentry_t ol3e; 21.281 - unsigned long vaddr; 21.282 int okay; 21.283 21.284 if ( unlikely(!is_guest_l3_slot(pgentry_ptr_to_slot(pl3e))) ) 21.285 @@ -1447,16 +1388,8 @@ static int mod_l3_entry(l3_pgentry_t *pl 21.286 if (!l3e_has_changed(ol3e, nl3e, _PAGE_PRESENT)) 21.287 return UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn); 21.288 21.289 -#if CONFIG_PAGING_LEVELS >= 4 21.290 - if ( unlikely(!l2_backptr(&vaddr, pgentry_ptr_to_slot(pl3e), type)) || 21.291 - unlikely(!get_page_from_l3e(nl3e, pfn, current->domain, vaddr)) ) 21.292 + if ( unlikely(!get_page_from_l3e(nl3e, pfn, current->domain)) ) 21.293 return 0; 21.294 -#else 21.295 - vaddr = (((unsigned long)pl3e & ~PAGE_MASK) / sizeof(l3_pgentry_t)) 21.296 - << L3_PAGETABLE_SHIFT; 21.297 - if ( unlikely(!get_page_from_l3e(nl3e, pfn, current->domain, vaddr)) ) 21.298 - return 0; 21.299 -#endif 21.300 21.301 if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn)) ) 21.302 { 21.303 @@ -1485,11 +1418,9 @@ static int mod_l3_entry(l3_pgentry_t *pl 21.304 /* Update the L4 entry at pl4e to new value nl4e. pl4e is within frame pfn. */ 21.305 static int mod_l4_entry(l4_pgentry_t *pl4e, 21.306 l4_pgentry_t nl4e, 21.307 - unsigned long pfn, 21.308 - unsigned long type) 21.309 + unsigned long pfn) 21.310 { 21.311 l4_pgentry_t ol4e; 21.312 - unsigned long vaddr; 21.313 21.314 if ( unlikely(!is_guest_l4_slot(pgentry_ptr_to_slot(pl4e))) ) 21.315 { 21.316 @@ -1515,8 +1446,7 @@ static int mod_l4_entry(l4_pgentry_t *pl 21.317 if (!l4e_has_changed(ol4e, nl4e, _PAGE_PRESENT)) 21.318 return UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn); 21.319 21.320 - if ( unlikely(!l3_backptr(&vaddr, pgentry_ptr_to_slot(pl4e), type)) || 21.321 - unlikely(!get_page_from_l4e(nl4e, pfn, current->domain, vaddr)) ) 21.322 + if ( unlikely(!get_page_from_l4e(nl4e, pfn, current->domain)) ) 21.323 return 0; 21.324 21.325 if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn)) ) 21.326 @@ -1550,9 +1480,9 @@ int alloc_page_type(struct page_info *pa 21.327 case PGT_l2_page_table: 21.328 return alloc_l2_table(page, type); 21.329 case PGT_l3_page_table: 21.330 - return alloc_l3_table(page, type); 21.331 + return alloc_l3_table(page); 21.332 case PGT_l4_page_table: 21.333 - return alloc_l4_table(page, type); 21.334 + return alloc_l4_table(page); 21.335 case PGT_gdt_page: 21.336 case PGT_ldt_page: 21.337 return alloc_segdesc_page(page); 21.338 @@ -1640,15 +1570,6 @@ void put_page_type(struct page_info *pag 21.339 21.340 ASSERT((x & PGT_count_mask) != 0); 21.341 21.342 - /* 21.343 - * The page should always be validated while a reference is held. The 21.344 - * exception is during domain destruction, when we forcibly invalidate 21.345 - * page-table pages if we detect a referential loop. 21.346 - * See domain.c:relinquish_list(). 21.347 - */ 21.348 - ASSERT((x & PGT_validated) || 21.349 - test_bit(_DOMF_dying, &page_get_owner(page)->domain_flags)); 21.350 - 21.351 if ( unlikely((nx & PGT_count_mask) == 0) ) 21.352 { 21.353 if ( unlikely((nx & PGT_type_mask) <= PGT_l4_page_table) && 21.354 @@ -1672,12 +1593,6 @@ void put_page_type(struct page_info *pag 21.355 /* Record TLB information for flush later. */ 21.356 page->tlbflush_timestamp = tlbflush_current_time(); 21.357 } 21.358 - else if ( unlikely((nx & (PGT_pinned|PGT_type_mask|PGT_count_mask)) == 21.359 - (PGT_pinned|PGT_l1_page_table|1)) ) 21.360 - { 21.361 - /* Page is now only pinned. Make the back pointer mutable again. */ 21.362 - nx |= PGT_va_mutable; 21.363 - } 21.364 } 21.365 while ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) ); 21.366 } 21.367 @@ -1687,6 +1602,8 @@ int get_page_type(struct page_info *page 21.368 { 21.369 unsigned long nx, x, y = page->u.inuse.type_info; 21.370 21.371 + ASSERT(!(type & ~(PGT_type_mask | PGT_pae_xen_l2))); 21.372 + 21.373 again: 21.374 do { 21.375 x = y; 21.376 @@ -1698,29 +1615,26 @@ int get_page_type(struct page_info *page 21.377 } 21.378 else if ( unlikely((x & PGT_count_mask) == 0) ) 21.379 { 21.380 - if ( (x & (PGT_type_mask|PGT_va_mask)) != type ) 21.381 + ASSERT(!(x & PGT_pae_xen_l2)); 21.382 + if ( (x & PGT_type_mask) != type ) 21.383 { 21.384 - if ( (x & PGT_type_mask) != (type & PGT_type_mask) ) 21.385 + /* 21.386 + * On type change we check to flush stale TLB entries. This 21.387 + * may be unnecessary (e.g., page was GDT/LDT) but those 21.388 + * circumstances should be very rare. 21.389 + */ 21.390 + cpumask_t mask = 21.391 + page_get_owner(page)->domain_dirty_cpumask; 21.392 + tlbflush_filter(mask, page->tlbflush_timestamp); 21.393 + 21.394 + if ( unlikely(!cpus_empty(mask)) ) 21.395 { 21.396 - /* 21.397 - * On type change we check to flush stale TLB 21.398 - * entries. This may be unnecessary (e.g., page 21.399 - * was GDT/LDT) but those circumstances should be 21.400 - * very rare. 21.401 - */ 21.402 - cpumask_t mask = 21.403 - page_get_owner(page)->domain_dirty_cpumask; 21.404 - tlbflush_filter(mask, page->tlbflush_timestamp); 21.405 - 21.406 - if ( unlikely(!cpus_empty(mask)) ) 21.407 - { 21.408 - perfc_incrc(need_flush_tlb_flush); 21.409 - flush_tlb_mask(mask); 21.410 - } 21.411 + perfc_incrc(need_flush_tlb_flush); 21.412 + flush_tlb_mask(mask); 21.413 } 21.414 21.415 /* We lose existing type, back pointer, and validity. */ 21.416 - nx &= ~(PGT_type_mask | PGT_va_mask | PGT_validated); 21.417 + nx &= ~(PGT_type_mask | PGT_validated); 21.418 nx |= type; 21.419 21.420 /* No special validation needed for writable pages. */ 21.421 @@ -1729,51 +1643,23 @@ int get_page_type(struct page_info *page 21.422 nx |= PGT_validated; 21.423 } 21.424 } 21.425 - else 21.426 + else if ( unlikely((x & (PGT_type_mask|PGT_pae_xen_l2)) != type) ) 21.427 { 21.428 - if ( unlikely((x & (PGT_type_mask|PGT_va_mask)) != type) ) 21.429 - { 21.430 - if ( unlikely((x & PGT_type_mask) != (type & PGT_type_mask) ) ) 21.431 - { 21.432 - if ( ((x & PGT_type_mask) != PGT_l2_page_table) || 21.433 - ((type & PGT_type_mask) != PGT_l1_page_table) ) 21.434 - MEM_LOG("Bad type (saw %" PRtype_info 21.435 - " != exp %" PRtype_info ") " 21.436 - "for mfn %lx (pfn %lx)", 21.437 - x, type, page_to_mfn(page), 21.438 - get_gpfn_from_mfn(page_to_mfn(page))); 21.439 - return 0; 21.440 - } 21.441 - else if ( (x & PGT_va_mask) == PGT_va_mutable ) 21.442 - { 21.443 - /* The va backpointer is mutable, hence we update it. */ 21.444 - nx &= ~PGT_va_mask; 21.445 - nx |= type; /* we know the actual type is correct */ 21.446 - } 21.447 - else if ( (type & PGT_va_mask) != PGT_va_mutable ) 21.448 - { 21.449 - ASSERT((type & PGT_va_mask) != (x & PGT_va_mask)); 21.450 -#ifdef CONFIG_X86_PAE 21.451 - /* We use backptr as extra typing. Cannot be unknown. */ 21.452 - if ( (type & PGT_type_mask) == PGT_l2_page_table ) 21.453 - return 0; 21.454 -#endif 21.455 - /* Fixme: add code to propagate va_unknown to subtables. */ 21.456 - if ( ((type & PGT_type_mask) >= PGT_l2_page_table) && 21.457 - !shadow_mode_refcounts(page_get_owner(page)) ) 21.458 - return 0; 21.459 - /* This table is possibly mapped at multiple locations. */ 21.460 - nx &= ~PGT_va_mask; 21.461 - nx |= PGT_va_unknown; 21.462 - } 21.463 - } 21.464 - if ( unlikely(!(x & PGT_validated)) ) 21.465 - { 21.466 - /* Someone else is updating validation of this page. Wait... */ 21.467 - while ( (y = page->u.inuse.type_info) == x ) 21.468 - cpu_relax(); 21.469 - goto again; 21.470 - } 21.471 + if ( ((x & PGT_type_mask) != PGT_l2_page_table) || 21.472 + (type != PGT_l1_page_table) ) 21.473 + MEM_LOG("Bad type (saw %" PRtype_info 21.474 + " != exp %" PRtype_info ") " 21.475 + "for mfn %lx (pfn %lx)", 21.476 + x, type, page_to_mfn(page), 21.477 + get_gpfn_from_mfn(page_to_mfn(page))); 21.478 + return 0; 21.479 + } 21.480 + else if ( unlikely(!(x & PGT_validated)) ) 21.481 + { 21.482 + /* Someone else is updating validation of this page. Wait... */ 21.483 + while ( (y = page->u.inuse.type_info) == x ) 21.484 + cpu_relax(); 21.485 + goto again; 21.486 } 21.487 } 21.488 while ( unlikely((y = cmpxchg(&page->u.inuse.type_info, x, nx)) != x) ); 21.489 @@ -2030,19 +1916,25 @@ int do_mmuext_op( 21.490 switch ( op.cmd ) 21.491 { 21.492 case MMUEXT_PIN_L1_TABLE: 21.493 - type = PGT_l1_page_table | PGT_va_mutable; 21.494 + type = PGT_l1_page_table; 21.495 goto pin_page; 21.496 21.497 case MMUEXT_PIN_L2_TABLE: 21.498 + type = PGT_l2_page_table; 21.499 + goto pin_page; 21.500 + 21.501 case MMUEXT_PIN_L3_TABLE: 21.502 + type = PGT_l3_page_table; 21.503 + goto pin_page; 21.504 + 21.505 case MMUEXT_PIN_L4_TABLE: 21.506 - /* Ignore pinning of subdirectories. */ 21.507 - if ( (op.cmd - MMUEXT_PIN_L1_TABLE) != (CONFIG_PAGING_LEVELS - 1) ) 21.508 - break; 21.509 - 21.510 - type = PGT_root_page_table; 21.511 + type = PGT_l4_page_table; 21.512 21.513 pin_page: 21.514 + /* Ignore pinning of invalid paging levels. */ 21.515 + if ( (op.cmd - MMUEXT_PIN_L1_TABLE) > (CONFIG_PAGING_LEVELS - 1) ) 21.516 + break; 21.517 + 21.518 if ( shadow_mode_refcounts(FOREIGNDOM) ) 21.519 break; 21.520 21.521 @@ -2326,7 +2218,7 @@ int do_mmu_update( 21.522 } 21.523 21.524 if ( unlikely(!get_page_type( 21.525 - page, type_info & (PGT_type_mask|PGT_va_mask))) ) 21.526 + page, type_info & (PGT_type_mask|PGT_pae_xen_l2))) ) 21.527 goto not_a_pt; 21.528 21.529 switch ( type_info & PGT_type_mask ) 21.530 @@ -2348,7 +2240,7 @@ int do_mmu_update( 21.531 case PGT_l3_page_table: 21.532 { 21.533 l3_pgentry_t l3e = l3e_from_intpte(req.val); 21.534 - okay = mod_l3_entry(va, l3e, mfn, type_info); 21.535 + okay = mod_l3_entry(va, l3e, mfn); 21.536 } 21.537 break; 21.538 #endif 21.539 @@ -2356,7 +2248,7 @@ int do_mmu_update( 21.540 case PGT_l4_page_table: 21.541 { 21.542 l4_pgentry_t l4e = l4e_from_intpte(req.val); 21.543 - okay = mod_l4_entry(va, l4e, mfn, type_info); 21.544 + okay = mod_l4_entry(va, l4e, mfn); 21.545 } 21.546 break; 21.547 #endif 21.548 @@ -2454,7 +2346,7 @@ static int create_grant_pte_mapping( 21.549 void *va; 21.550 unsigned long gmfn, mfn; 21.551 struct page_info *page; 21.552 - u32 type_info; 21.553 + u32 type; 21.554 l1_pgentry_t ol1e; 21.555 struct domain *d = v->domain; 21.556 21.557 @@ -2475,9 +2367,8 @@ static int create_grant_pte_mapping( 21.558 va = (void *)((unsigned long)va + (pte_addr & ~PAGE_MASK)); 21.559 page = mfn_to_page(mfn); 21.560 21.561 - type_info = page->u.inuse.type_info; 21.562 - if ( ((type_info & PGT_type_mask) != PGT_l1_page_table) || 21.563 - !get_page_type(page, type_info & (PGT_type_mask|PGT_va_mask)) ) 21.564 + type = page->u.inuse.type_info & PGT_type_mask; 21.565 + if ( (type != PGT_l1_page_table) || !get_page_type(page, type) ) 21.566 { 21.567 MEM_LOG("Grant map attempted to update a non-L1 page"); 21.568 rc = GNTST_general_error; 21.569 @@ -2511,7 +2402,7 @@ static int destroy_grant_pte_mapping( 21.570 void *va; 21.571 unsigned long gmfn, mfn; 21.572 struct page_info *page; 21.573 - u32 type_info; 21.574 + u32 type; 21.575 l1_pgentry_t ol1e; 21.576 21.577 gmfn = addr >> PAGE_SHIFT; 21.578 @@ -2527,9 +2418,8 @@ static int destroy_grant_pte_mapping( 21.579 va = (void *)((unsigned long)va + (addr & ~PAGE_MASK)); 21.580 page = mfn_to_page(mfn); 21.581 21.582 - type_info = page->u.inuse.type_info; 21.583 - if ( ((type_info & PGT_type_mask) != PGT_l1_page_table) || 21.584 - !get_page_type(page, type_info & (PGT_type_mask|PGT_va_mask)) ) 21.585 + type = page->u.inuse.type_info & PGT_type_mask; 21.586 + if ( (type != PGT_l1_page_table) || !get_page_type(page, type) ) 21.587 { 21.588 MEM_LOG("Grant map attempted to update a non-L1 page"); 21.589 rc = GNTST_general_error;
22.1 --- a/xen/arch/x86/mm/shadow/common.c Mon Sep 18 14:28:16 2006 -0500 22.2 +++ b/xen/arch/x86/mm/shadow/common.c Tue Sep 19 09:40:26 2006 +0100 22.3 @@ -21,8 +21,6 @@ 22.4 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22.5 */ 22.6 22.7 -#define SHADOW 1 22.8 - 22.9 #include <xen/config.h> 22.10 #include <xen/types.h> 22.11 #include <xen/mm.h> 22.12 @@ -225,7 +223,6 @@ struct x86_emulate_ops shadow_emulator_o 22.13 .cmpxchg8b_emulated = sh_x86_emulate_cmpxchg8b_emulated, 22.14 }; 22.15 22.16 - 22.17 /**************************************************************************/ 22.18 /* Code for "promoting" a guest page to the point where the shadow code is 22.19 * willing to let it be treated as a guest page table. This generally 22.20 @@ -252,8 +249,8 @@ void shadow_promote(struct vcpu *v, mfn_ 22.21 // count to be > 0. 22.22 // 22.23 do { 22.24 - type_info = 22.25 - page->u.inuse.type_info & (PGT_type_mask | PGT_va_mask); 22.26 + type_info = page->u.inuse.type_info & 22.27 + (PGT_type_mask | PGT_pae_xen_l2); 22.28 } while ( !get_page_type(page, type_info) ); 22.29 22.30 // Now that the type ref is non-zero, we can safely use the
23.1 --- a/xen/arch/x86/mm/shadow/multi.c Mon Sep 18 14:28:16 2006 -0500 23.2 +++ b/xen/arch/x86/mm/shadow/multi.c Tue Sep 19 09:40:26 2006 +0100 23.3 @@ -35,8 +35,6 @@ 23.4 // space for both PV and HVM guests. 23.5 // 23.6 23.7 -#define SHADOW 1 23.8 - 23.9 #include <xen/config.h> 23.10 #include <xen/types.h> 23.11 #include <xen/mm.h>
24.1 --- a/xen/arch/x86/oprofile/nmi_int.c Mon Sep 18 14:28:16 2006 -0500 24.2 +++ b/xen/arch/x86/oprofile/nmi_int.c Tue Sep 19 09:40:26 2006 +0100 24.3 @@ -269,8 +269,12 @@ static int __init p4_init(char * cpu_typ 24.4 { 24.5 __u8 cpu_model = current_cpu_data.x86_model; 24.6 24.7 - if ((cpu_model > 6) || (cpu_model == 5)) 24.8 + if ((cpu_model > 6) || (cpu_model == 5)) { 24.9 + printk("xenoprof: Initialization failed. " 24.10 + "Intel processor model %d for pentium 4 family is not " 24.11 + "supported\n", cpu_model); 24.12 return 0; 24.13 + } 24.14 24.15 #ifndef CONFIG_SMP 24.16 strncpy (cpu_type, "i386/p4", XENOPROF_CPU_TYPE_SIZE - 1); 24.17 @@ -301,8 +305,12 @@ static int __init ppro_init(char *cpu_ty 24.18 { 24.19 __u8 cpu_model = current_cpu_data.x86_model; 24.20 24.21 - if (cpu_model > 0xd) 24.22 + if (cpu_model > 0xd) { 24.23 + printk("xenoprof: Initialization failed. " 24.24 + "Intel processor model %d for P6 class family is not " 24.25 + "supported\n", cpu_model); 24.26 return 0; 24.27 + } 24.28 24.29 if (cpu_model == 9) { 24.30 strncpy (cpu_type, "i386/p6_mobile", XENOPROF_CPU_TYPE_SIZE - 1); 24.31 @@ -324,8 +332,10 @@ int nmi_init(int *num_events, int *is_pr 24.32 __u8 family = current_cpu_data.x86; 24.33 int prim = 0; 24.34 24.35 - if (!cpu_has_apic) 24.36 + if (!cpu_has_apic) { 24.37 + printk("xenoprof: Initialization failed. No apic.\n"); 24.38 return -ENODEV; 24.39 + } 24.40 24.41 if (primary_profiler == NULL) { 24.42 /* For now, only dom0 can be the primary profiler */ 24.43 @@ -344,6 +354,9 @@ int nmi_init(int *num_events, int *is_pr 24.44 24.45 switch (family) { 24.46 default: 24.47 + printk("xenoprof: Initialization failed. " 24.48 + "AMD processor family %d is not " 24.49 + "supported\n", family); 24.50 return -ENODEV; 24.51 case 6: 24.52 model = &op_athlon_spec; 24.53 @@ -375,11 +388,17 @@ int nmi_init(int *num_events, int *is_pr 24.54 break; 24.55 24.56 default: 24.57 + printk("xenoprof: Initialization failed. " 24.58 + "Intel processor family %d is not " 24.59 + "supported\n", family); 24.60 return -ENODEV; 24.61 } 24.62 break; 24.63 24.64 default: 24.65 + printk("xenoprof: Initialization failed. " 24.66 + "Unsupported processor. Unknown vendor %d\n", 24.67 + vendor); 24.68 return -ENODEV; 24.69 } 24.70
25.1 --- a/xen/arch/x86/oprofile/xenoprof.c Mon Sep 18 14:28:16 2006 -0500 25.2 +++ b/xen/arch/x86/oprofile/xenoprof.c Tue Sep 19 09:40:26 2006 +0100 25.3 @@ -492,19 +492,23 @@ int xenoprof_op_get_buffer(XEN_GUEST_HAN 25.4 return 0; 25.5 } 25.6 25.7 -#define PRIV_OP(op) ( (op == XENOPROF_set_active) \ 25.8 - || (op == XENOPROF_reserve_counters) \ 25.9 - || (op == XENOPROF_setup_events) \ 25.10 - || (op == XENOPROF_start) \ 25.11 - || (op == XENOPROF_stop) \ 25.12 - || (op == XENOPROF_release_counters) \ 25.13 - || (op == XENOPROF_shutdown)) 25.14 - 25.15 +#define NONPRIV_OP(op) ( (op == XENOPROF_init) \ 25.16 + || (op == XENOPROF_enable_virq) \ 25.17 + || (op == XENOPROF_disable_virq) \ 25.18 + || (op == XENOPROF_get_buffer)) 25.19 + 25.20 int do_xenoprof_op(int op, XEN_GUEST_HANDLE(void) arg) 25.21 { 25.22 int ret = 0; 25.23 + 25.24 + if ( (op < 0) || (op>XENOPROF_last_op) ) 25.25 + { 25.26 + printk("xenoprof: invalid operation %d for domain %d\n", 25.27 + op, current->domain->domain_id); 25.28 + return -EINVAL; 25.29 + } 25.30 25.31 - if ( PRIV_OP(op) && (current->domain != primary_profiler) ) 25.32 + if ( !NONPRIV_OP(op) && (current->domain != primary_profiler) ) 25.33 { 25.34 printk("xenoprof: dom %d denied privileged operation %d\n", 25.35 current->domain->domain_id, op);
26.1 --- a/xen/common/sched_credit.c Mon Sep 18 14:28:16 2006 -0500 26.2 +++ b/xen/common/sched_credit.c Tue Sep 19 09:40:26 2006 +0100 26.3 @@ -290,6 +290,7 @@ static inline void 26.4 { 26.5 CSCHED_STAT_CRANK(tickle_idlers_some); 26.6 cpus_or(mask, mask, csched_priv.idlers); 26.7 + cpus_and(mask, mask, new->vcpu->cpu_affinity); 26.8 } 26.9 } 26.10 26.11 @@ -987,36 +988,39 @@ csched_load_balance(int cpu, struct csch 26.12 * cause a deadlock if the peer CPU is also load balancing and trying 26.13 * to lock this CPU. 26.14 */ 26.15 - if ( spin_trylock(&per_cpu(schedule_data, peer_cpu).schedule_lock) ) 26.16 + if ( !spin_trylock(&per_cpu(schedule_data, peer_cpu).schedule_lock) ) 26.17 { 26.18 + CSCHED_STAT_CRANK(steal_trylock_failed); 26.19 + continue; 26.20 + } 26.21 26.22 - spc = CSCHED_PCPU(peer_cpu); 26.23 - if ( unlikely(spc == NULL) ) 26.24 - { 26.25 - CSCHED_STAT_CRANK(steal_peer_down); 26.26 - speer = NULL; 26.27 - } 26.28 - else 26.29 - { 26.30 - speer = csched_runq_steal(spc, cpu, snext->pri); 26.31 - } 26.32 - 26.33 - spin_unlock(&per_cpu(schedule_data, peer_cpu).schedule_lock); 26.34 - 26.35 - /* Got one! */ 26.36 - if ( speer ) 26.37 - { 26.38 - CSCHED_STAT_CRANK(vcpu_migrate); 26.39 - return speer; 26.40 - } 26.41 + spc = CSCHED_PCPU(peer_cpu); 26.42 + if ( unlikely(spc == NULL) ) 26.43 + { 26.44 + CSCHED_STAT_CRANK(steal_peer_down); 26.45 + speer = NULL; 26.46 + } 26.47 + else if ( is_idle_vcpu(per_cpu(schedule_data, peer_cpu).curr) ) 26.48 + { 26.49 + CSCHED_STAT_CRANK(steal_peer_idle); 26.50 + speer = NULL; 26.51 } 26.52 else 26.53 { 26.54 - CSCHED_STAT_CRANK(steal_trylock_failed); 26.55 + /* Try to steal work from an online non-idle CPU. */ 26.56 + speer = csched_runq_steal(spc, cpu, snext->pri); 26.57 + } 26.58 + 26.59 + spin_unlock(&per_cpu(schedule_data, peer_cpu).schedule_lock); 26.60 + 26.61 + /* Got one? */ 26.62 + if ( speer ) 26.63 + { 26.64 + CSCHED_STAT_CRANK(vcpu_migrate); 26.65 + return speer; 26.66 } 26.67 } 26.68 26.69 - 26.70 /* Failed to find more important work */ 26.71 __runq_remove(snext); 26.72 return snext;
27.1 --- a/xen/drivers/video/vga.c Mon Sep 18 14:28:16 2006 -0500 27.2 +++ b/xen/drivers/video/vga.c Tue Sep 19 09:40:26 2006 +0100 27.3 @@ -680,11 +680,12 @@ int fill_console_start_info(struct dom0_ 27.4 if ( !vgacon_enabled ) 27.5 return 0; 27.6 27.7 - ci->video_type = 1; 27.8 - ci->video_width = COLUMNS; 27.9 - ci->video_height = LINES; 27.10 - ci->txt_mode = 3; 27.11 - ci->txt_points = font ? font->height : 16; 27.12 + ci->video_type = XEN_VGATYPE_TEXT_MODE_3; 27.13 + ci->u.text_mode_3.rows = LINES; 27.14 + ci->u.text_mode_3.columns = COLUMNS; 27.15 + ci->u.text_mode_3.cursor_x = 0; 27.16 + ci->u.text_mode_3.cursor_y = LINES - 1; 27.17 + ci->u.text_mode_3.font_height = font ? font->height : 16; 27.18 27.19 return 1; 27.20 }
28.1 --- a/xen/include/asm-ia64/mm.h Mon Sep 18 14:28:16 2006 -0500 28.2 +++ b/xen/include/asm-ia64/mm.h Tue Sep 19 09:40:26 2006 +0100 28.3 @@ -103,14 +103,6 @@ struct page_info 28.4 #define _PGT_pinned 27 28.5 #define PGT_pinned (1U<<_PGT_pinned) 28.6 28.7 - /* The 27 most significant bits of virt address if this is a page table. */ 28.8 -#define PGT_va_shift 32 28.9 -#define PGT_va_mask ((unsigned long)((1U<<28)-1)<<PGT_va_shift) 28.10 - /* Is the back pointer still mutable (i.e. not fixed yet)? */ 28.11 -#define PGT_va_mutable ((unsigned long)((1U<<28)-1)<<PGT_va_shift) 28.12 - /* Is the back pointer unknown (e.g., p.t. is mapped at multiple VAs)? */ 28.13 -#define PGT_va_unknown ((unsigned long)((1U<<28)-2)<<PGT_va_shift) 28.14 - 28.15 /* 16-bit count of uses of this frame as its current type. */ 28.16 #define PGT_count_mask ((1U<<16)-1) 28.17
29.1 --- a/xen/include/asm-powerpc/mm.h Mon Sep 18 14:28:16 2006 -0500 29.2 +++ b/xen/include/asm-powerpc/mm.h Tue Sep 19 09:40:26 2006 +0100 29.3 @@ -102,14 +102,6 @@ struct page_extents { 29.4 #define _PGT_validated 27 29.5 #define PGT_validated (1U<<_PGT_validated) 29.6 29.7 - /* The 27 most significant bits of virt address if this is a page table. */ 29.8 -#define PGT_va_shift 32 29.9 -#define PGT_va_mask ((unsigned long)((1U<<28)-1)<<PGT_va_shift) 29.10 - /* Is the back pointer still mutable (i.e. not fixed yet)? */ 29.11 -#define PGT_va_mutable ((unsigned long)((1U<<28)-1)<<PGT_va_shift) 29.12 - /* Is the back pointer unknown (e.g., p.t. is mapped at multiple VAs)? */ 29.13 -#define PGT_va_unknown ((unsigned long)((1U<<28)-2)<<PGT_va_shift) 29.14 - 29.15 /* 16-bit count of uses of this frame as its current type. */ 29.16 #define PGT_count_mask ((1U<<16)-1) 29.17
30.1 --- a/xen/include/asm-x86/mm.h Mon Sep 18 14:28:16 2006 -0500 30.2 +++ b/xen/include/asm-x86/mm.h Tue Sep 19 09:40:26 2006 +0100 30.3 @@ -75,19 +75,6 @@ struct page_info 30.4 #define PGT_gdt_page (5U<<29) /* using this page in a GDT? */ 30.5 #define PGT_ldt_page (6U<<29) /* using this page in an LDT? */ 30.6 #define PGT_writable_page (7U<<29) /* has writable mappings of this page? */ 30.7 - 30.8 -#ifndef SHADOW 30.9 -#define PGT_l1_shadow PGT_l1_page_table 30.10 -#define PGT_l2_shadow PGT_l2_page_table 30.11 -#define PGT_l3_shadow PGT_l3_page_table 30.12 -#define PGT_l4_shadow PGT_l4_page_table 30.13 -#define PGT_hl2_shadow (5U<<29) 30.14 -#define PGT_snapshot (6U<<29) 30.15 -#define PGT_writable_pred (7U<<29) /* predicted gpfn with writable ref */ 30.16 - 30.17 -#define PGT_fl1_shadow (5U<<29) 30.18 -#endif 30.19 - 30.20 #define PGT_type_mask (7U<<29) /* Bits 29-31. */ 30.21 30.22 /* Owning guest has pinned this page to its current type? */ 30.23 @@ -96,44 +83,13 @@ struct page_info 30.24 /* Has this page been validated for use as its current type? */ 30.25 #define _PGT_validated 27 30.26 #define PGT_validated (1U<<_PGT_validated) 30.27 -#if defined(__i386__) 30.28 - /* The 11 most significant bits of virt address if this is a page table. */ 30.29 -#define PGT_va_shift 16 30.30 -#define PGT_va_mask (((1U<<11)-1)<<PGT_va_shift) 30.31 - /* Is the back pointer still mutable (i.e. not fixed yet)? */ 30.32 -#define PGT_va_mutable (((1U<<11)-1)<<PGT_va_shift) 30.33 - /* Is the back pointer unknown (e.g., p.t. is mapped at multiple VAs)? */ 30.34 -#define PGT_va_unknown (((1U<<11)-2)<<PGT_va_shift) 30.35 -#elif defined(__x86_64__) 30.36 - /* The 27 most significant bits of virt address if this is a page table. */ 30.37 -#define PGT_va_shift 32 30.38 -#define PGT_va_mask ((unsigned long)((1U<<28)-1)<<PGT_va_shift) 30.39 - /* Is the back pointer still mutable (i.e. not fixed yet)? */ 30.40 -#define PGT_va_mutable ((unsigned long)((1U<<28)-1)<<PGT_va_shift) 30.41 - /* Is the back pointer unknown (e.g., p.t. is mapped at multiple VAs)? */ 30.42 -#define PGT_va_unknown ((unsigned long)((1U<<28)-2)<<PGT_va_shift) 30.43 -#endif 30.44 + /* PAE only: is this an L2 page directory containing Xen-private mappings? */ 30.45 +#define _PGT_pae_xen_l2 26 30.46 +#define PGT_pae_xen_l2 (1U<<_PGT_pae_xen_l2) 30.47 30.48 /* 16-bit count of uses of this frame as its current type. */ 30.49 #define PGT_count_mask ((1U<<16)-1) 30.50 30.51 -#ifndef SHADOW 30.52 -#ifdef __x86_64__ 30.53 -#define PGT_high_mfn_shift 52 30.54 -#define PGT_high_mfn_mask (0xfffUL << PGT_high_mfn_shift) 30.55 -#define PGT_mfn_mask (((1U<<27)-1) | PGT_high_mfn_mask) 30.56 -#define PGT_high_mfn_nx (0x800UL << PGT_high_mfn_shift) 30.57 -#else 30.58 - /* 23-bit mfn mask for shadow types: good for up to 32GB RAM. */ 30.59 -#define PGT_mfn_mask ((1U<<23)-1) 30.60 - /* NX for PAE xen is not supported yet */ 30.61 -#define PGT_high_mfn_nx (1ULL << 63) 30.62 - 30.63 -#define PGT_score_shift 23 30.64 -#define PGT_score_mask (((1U<<4)-1)<<PGT_score_shift) 30.65 -#endif 30.66 -#endif /* SHADOW */ 30.67 - 30.68 /* Cleared when the owning guest 'frees' this page. */ 30.69 #define _PGC_allocated 31 30.70 #define PGC_allocated (1U<<_PGC_allocated)
31.1 --- a/xen/include/asm-x86/x86_32/page-3level.h Mon Sep 18 14:28:16 2006 -0500 31.2 +++ b/xen/include/asm-x86/x86_32/page-3level.h Tue Sep 19 09:40:26 2006 +0100 31.3 @@ -49,7 +49,7 @@ typedef l3_pgentry_t root_pgentry_t; 31.4 /* misc */ 31.5 #define is_guest_l1_slot(s) (1) 31.6 #define is_guest_l2_slot(t,s) \ 31.7 - ( ((((t) & PGT_va_mask) >> PGT_va_shift) != 3) || \ 31.8 + ( !((t) & PGT_pae_xen_l2) || \ 31.9 ((s) < (L2_PAGETABLE_FIRST_XEN_SLOT & (L2_PAGETABLE_ENTRIES - 1))) ) 31.10 #define is_guest_l3_slot(s) (1) 31.11
32.1 --- a/xen/include/public/xen.h Mon Sep 18 14:28:16 2006 -0500 32.2 +++ b/xen/include/public/xen.h Tue Sep 19 09:40:26 2006 +0100 32.3 @@ -517,25 +517,37 @@ typedef struct start_info start_info_t; 32.4 #define SIF_INITDOMAIN (1<<1) /* Is this the initial control domain? */ 32.5 32.6 typedef struct dom0_vga_console_info { 32.7 - uint8_t video_type; 32.8 - uint8_t txt_points; 32.9 - uint16_t txt_mode; 32.10 - uint16_t txt_x; 32.11 - uint16_t txt_y; 32.12 - uint16_t video_width; 32.13 - uint16_t video_height; 32.14 - uint16_t lfb_linelen; 32.15 - uint16_t lfb_depth; 32.16 - unsigned long lfb_base; 32.17 - unsigned long lfb_size; 32.18 - uint8_t red_pos; 32.19 - uint8_t red_size; 32.20 - uint8_t green_pos; 32.21 - uint8_t green_size; 32.22 - uint8_t blue_pos; 32.23 - uint8_t blue_size; 32.24 - uint8_t rsvd_pos; 32.25 - uint8_t rsvd_size; 32.26 + uint8_t video_type; /* DOM0_VGA_CONSOLE_??? */ 32.27 +#define XEN_VGATYPE_TEXT_MODE_3 0x03 32.28 +#define XEN_VGATYPE_VESA_LFB 0x23 32.29 + 32.30 + union { 32.31 + struct { 32.32 + /* Font height, in pixels. */ 32.33 + uint16_t font_height; 32.34 + /* Cursor location (column, row). */ 32.35 + uint16_t cursor_x, cursor_y; 32.36 + /* Number of rows and columns (dimensions in characters). */ 32.37 + uint16_t rows, columns; 32.38 + } text_mode_3; 32.39 + 32.40 + struct { 32.41 + /* Width and height, in pixels. */ 32.42 + uint16_t width, height; 32.43 + /* Bytes per scan line. */ 32.44 + uint16_t bytes_per_line; 32.45 + /* Bits per pixel. */ 32.46 + uint16_t bits_per_pixel; 32.47 + /* LFB physical address, and size (in units of 64kB). */ 32.48 + uint32_t lfb_base; 32.49 + uint32_t lfb_size; 32.50 + /* RGB mask offsets and sizes, as defined by VBE 1.2+ */ 32.51 + uint8_t red_pos, red_size; 32.52 + uint8_t green_pos, green_size; 32.53 + uint8_t blue_pos, blue_size; 32.54 + uint8_t rsvd_pos, rsvd_size; 32.55 + } vesa_lfb; 32.56 + } u; 32.57 } dom0_vga_console_info_t; 32.58 32.59 typedef uint8_t xen_domain_handle_t[16];
33.1 --- a/xen/tools/figlet/figlet.c Mon Sep 18 14:28:16 2006 -0500 33.2 +++ b/xen/tools/figlet/figlet.c Tue Sep 19 09:40:26 2006 +0100 33.3 @@ -1448,8 +1448,9 @@ inchr c; 33.4 } 33.5 else { 33.6 for (k=0;k<smushamount;k++) { 33.7 - outputline[row][outlinelen-smushamount+k] = 33.8 - smushem(outputline[row][outlinelen-smushamount+k],currchar[row][k]); 33.9 + if (outlinelen-smushamount+k >= 0) 33.10 + outputline[row][outlinelen-smushamount+k] = 33.11 + smushem(outputline[row][outlinelen-smushamount+k],currchar[row][k]); 33.12 } 33.13 strcat(outputline[row],currchar[row]+smushamount); 33.14 }