xen-vtx-unstable
changeset 6504:dc61689b4781
Merge.
line diff
2.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32 Tue Aug 09 14:57:45 2005 -0800 2.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_32 Wed Aug 10 10:44:42 2005 -0800 2.3 @@ -415,7 +415,7 @@ CONFIG_RAMFS=y 2.4 # CONFIG_BEFS_FS is not set 2.5 # CONFIG_BFS_FS is not set 2.6 # CONFIG_EFS_FS is not set 2.7 -# CONFIG_CRAMFS is not set 2.8 +CONFIG_CRAMFS=y 2.9 # CONFIG_VXFS_FS is not set 2.10 # CONFIG_HPFS_FS is not set 2.11 # CONFIG_QNX4FS_FS is not set
3.1 --- a/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64 Tue Aug 09 14:57:45 2005 -0800 3.2 +++ b/linux-2.6-xen-sparse/arch/xen/configs/xenU_defconfig_x86_64 Wed Aug 10 10:44:42 2005 -0800 3.3 @@ -748,7 +748,7 @@ CONFIG_BEFS_FS=m 3.4 # CONFIG_BEFS_DEBUG is not set 3.5 CONFIG_BFS_FS=m 3.6 CONFIG_EFS_FS=m 3.7 -CONFIG_CRAMFS=m 3.8 +CONFIG_CRAMFS=y 3.9 CONFIG_VXFS_FS=m 3.10 # CONFIG_HPFS_FS is not set 3.11 CONFIG_QNX4FS_FS=m
4.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c Tue Aug 09 14:57:45 2005 -0800 4.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/pci-dma.c Wed Aug 10 10:44:42 2005 -0800 4.3 @@ -182,8 +182,8 @@ dma_map_single(struct device *dev, void 4.4 if ((((unsigned int)ptr & ~PAGE_MASK) + size) <= PAGE_SIZE) { 4.5 dma = virt_to_bus(ptr); 4.6 } else { 4.7 - BUG_ON((bnc = dma_alloc_coherent(dev, size, &dma, 0)) == NULL); 4.8 - BUG_ON((ent = kmalloc(sizeof(*ent), GFP_KERNEL)) == NULL); 4.9 + BUG_ON((bnc = dma_alloc_coherent(dev, size, &dma, GFP_ATOMIC)) == NULL); 4.10 + BUG_ON((ent = kmalloc(sizeof(*ent), GFP_ATOMIC)) == NULL); 4.11 if (direction != DMA_FROM_DEVICE) 4.12 memcpy(bnc, ptr, size); 4.13 ent->dma = dma;
5.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c Tue Aug 09 14:57:45 2005 -0800 5.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c Wed Aug 10 10:44:42 2005 -0800 5.3 @@ -144,8 +144,6 @@ static int __init __independent_wallcloc 5.4 return 1; 5.5 } 5.6 __setup("independent_wallclock", __independent_wallclock); 5.7 -#define INDEPENDENT_WALLCLOCK() \ 5.8 - (independent_wallclock || (xen_start_info.flags & SIF_INITDOMAIN)) 5.9 5.10 int tsc_disable __initdata = 0; 5.11 5.12 @@ -173,13 +171,16 @@ struct timer_opts timer_tsc = { 5.13 static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift) 5.14 { 5.15 u64 product; 5.16 +#ifdef __i386__ 5.17 u32 tmp1, tmp2; 5.18 +#endif 5.19 5.20 if ( shift < 0 ) 5.21 delta >>= -shift; 5.22 else 5.23 delta <<= shift; 5.24 5.25 +#ifdef __i386__ 5.26 __asm__ ( 5.27 "mul %5 ; " 5.28 "mov %4,%%eax ; " 5.29 @@ -190,6 +191,11 @@ static inline u64 scale_delta(u64 delta, 5.30 "adc %5,%%edx ; " 5.31 : "=A" (product), "=r" (tmp1), "=r" (tmp2) 5.32 : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) ); 5.33 +#else 5.34 + __asm__ ( 5.35 + "mul %%rdx ; shrd $32,%%rdx,%%rax" 5.36 + : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) ); 5.37 +#endif 5.38 5.39 return product; 5.40 } 5.41 @@ -203,8 +209,6 @@ void init_cpu_khz(void) 5.42 cpu_khz = __cpu_khz >> -info->tsc_shift; 5.43 else 5.44 cpu_khz = __cpu_khz << info->tsc_shift; 5.45 - printk(KERN_INFO "Xen reported: %lu.%03lu MHz processor.\n", 5.46 - cpu_khz / 1000, cpu_khz % 1000); 5.47 } 5.48 5.49 static u64 get_nsec_offset(struct shadow_time_info *shadow) 5.50 @@ -239,10 +243,7 @@ static void update_wallclock(void) 5.51 } 5.52 while ((s->wc_version & 1) | (shadow_tv_version ^ s->wc_version)); 5.53 5.54 - if (INDEPENDENT_WALLCLOCK()) 5.55 - return; 5.56 - 5.57 - if ((time_status & STA_UNSYNC) != 0) 5.58 + if (independent_wallclock) 5.59 return; 5.60 5.61 /* Adjust wall-clock time base based on wall_jiffies ticks. */ 5.62 @@ -417,7 +418,7 @@ int do_settimeofday(struct timespec *tv) 5.63 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC) 5.64 return -EINVAL; 5.65 5.66 - if (!INDEPENDENT_WALLCLOCK()) 5.67 + if (!independent_wallclock && !(xen_start_info.flags & SIF_INITDOMAIN)) 5.68 return 0; /* Silent failure? */ 5.69 5.70 cpu = get_cpu(); 5.71 @@ -463,7 +464,8 @@ int do_settimeofday(struct timespec *tv) 5.72 time_esterror = NTP_PHASE_LIMIT; 5.73 5.74 #ifdef CONFIG_XEN_PRIVILEGED_GUEST 5.75 - if (xen_start_info.flags & SIF_INITDOMAIN) { 5.76 + if ((xen_start_info.flags & SIF_INITDOMAIN) && 5.77 + !independent_wallclock) { 5.78 dom0_op_t op; 5.79 op.cmd = DOM0_SETTIME; 5.80 op.u.settime.secs = xentime.tv_sec; 5.81 @@ -790,13 +792,15 @@ void __init time_init(void) 5.82 } 5.83 #endif 5.84 get_time_values_from_xen(); 5.85 - update_wallclock(); 5.86 - set_normalized_timespec(&wall_to_monotonic, 5.87 - -xtime.tv_sec, -xtime.tv_nsec); 5.88 + 5.89 processed_system_time = per_cpu(shadow_time, 0).system_timestamp; 5.90 per_cpu(processed_system_time, 0) = processed_system_time; 5.91 5.92 + update_wallclock(); 5.93 + 5.94 init_cpu_khz(); 5.95 + printk(KERN_INFO "Xen reported: %lu.%03lu MHz processor.\n", 5.96 + cpu_khz / 1000, cpu_khz % 1000); 5.97 5.98 #if defined(__x86_64__) 5.99 vxtime.mode = VXTIME_TSC; 5.100 @@ -871,15 +875,13 @@ void time_resume(void) 5.101 { 5.102 init_cpu_khz(); 5.103 5.104 - /* Get timebases for new environment. */ 5.105 get_time_values_from_xen(); 5.106 - update_wallclock(); 5.107 5.108 - /* Reset our own concept of passage of system time. */ 5.109 - processed_system_time = 5.110 - per_cpu(shadow_time, smp_processor_id()).system_timestamp; 5.111 + processed_system_time = per_cpu(shadow_time, 0).system_timestamp; 5.112 per_cpu(processed_system_time, 0) = processed_system_time; 5.113 5.114 + update_wallclock(); 5.115 + 5.116 per_cpu(timer_irq, 0) = bind_virq_to_irq(VIRQ_TIMER); 5.117 (void)setup_irq(per_cpu(timer_irq, 0), &irq_timer); 5.118 }
6.1 --- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/pci-dma.c Tue Aug 09 14:57:45 2005 -0800 6.2 +++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/pci-dma.c Wed Aug 10 10:44:42 2005 -0800 6.3 @@ -234,8 +234,8 @@ dma_map_single(struct device *dev, void 6.4 if (((((unsigned long)ptr) & ~PAGE_MASK) + size) <= PAGE_SIZE) { 6.5 dma = virt_to_bus(ptr); 6.6 } else { 6.7 - BUG_ON((bnc = dma_alloc_coherent(dev, size, &dma, 0)) == NULL); 6.8 - BUG_ON((ent = kmalloc(sizeof(*ent), GFP_KERNEL)) == NULL); 6.9 + BUG_ON((bnc = dma_alloc_coherent(dev, size, &dma, GFP_ATOMIC)) == NULL); 6.10 + BUG_ON((ent = kmalloc(sizeof(*ent), GFP_ATOMIC)) == NULL); 6.11 if (direction != DMA_FROM_DEVICE) 6.12 memcpy(bnc, ptr, size); 6.13 ent->dma = dma;
10.1 --- a/tools/console/daemon/io.c Tue Aug 09 14:57:45 2005 -0800 10.2 +++ b/tools/console/daemon/io.c Wed Aug 10 10:44:42 2005 -0800 10.3 @@ -231,6 +231,7 @@ static void handle_tty_read(struct domai 10.4 10.5 if (!write_sync(xcs_data_fd, &msg, sizeof(msg))) { 10.6 dolog(LOG_ERR, "Write to xcs failed: %m"); 10.7 + exit(1); 10.8 } 10.9 } else { 10.10 close(dom->tty_fd); 10.11 @@ -262,6 +263,7 @@ static void handle_xcs_msg(int fd) 10.12 10.13 if (!read_sync(fd, &msg, sizeof(msg))) { 10.14 dolog(LOG_ERR, "read from xcs failed! %m"); 10.15 + exit(1); 10.16 } else if (msg.type == XCS_REQUEST) { 10.17 struct domain *dom; 10.18
11.1 --- a/tools/console/daemon/utils.c Tue Aug 09 14:57:45 2005 -0800 11.2 +++ b/tools/console/daemon/utils.c Wed Aug 10 10:44:42 2005 -0800 11.3 @@ -59,6 +59,8 @@ bool _read_write_sync(int fd, void *data 11.4 11.5 if (len < 1) { 11.6 if (len == -1 && (errno == EAGAIN || errno == EINTR)) { 11.7 + continue; 11.8 + } else { 11.9 return false; 11.10 } 11.11 } else {
18.1 --- a/tools/misc/xend Tue Aug 09 14:57:45 2005 -0800 18.2 +++ b/tools/misc/xend Wed Aug 10 10:44:42 2005 -0800 18.3 @@ -24,6 +24,7 @@ import sys 18.4 import socket 18.5 import signal 18.6 import time 18.7 +import commands 18.8 18.9 XCS_PATH = "/var/lib/xen/xcs_socket" 18.10 XCS_EXEC = "/usr/sbin/xcs" 18.11 @@ -116,8 +117,7 @@ def stop_xcs(): 18.12 return 18.13 18.14 def start_xenstored(): 18.15 - if os.fork() == 0: 18.16 - os.execvp('/usr/sbin/xenstored', ['/usr/sbin/xenstored']); 18.17 + s,o = commands.getstatusoutput("/usr/sbin/xenstored --pid-file=/var/run/xenstore.pid"); 18.18 18.19 def start_consoled(): 18.20 if os.fork() == 0:
25.1 --- a/tools/python/xen/xm/main.py Tue Aug 09 14:57:45 2005 -0800 25.2 +++ b/tools/python/xen/xm/main.py Wed Aug 10 10:44:42 2005 -0800 25.3 @@ -651,7 +651,7 @@ def main(argv=sys.argv): 25.4 sys.exit(1) 25.5 except XendError, ex: 25.6 if len(args) > 0: 25.7 - handle_xend_error(argv[1], args[0], ex) 25.8 + handle_xend_error(argv[1], args[1], ex) 25.9 else: 25.10 print "Unexpected error:", sys.exc_info()[0] 25.11 print
26.1 --- a/tools/xenstore/Makefile Tue Aug 09 14:57:45 2005 -0800 26.2 +++ b/tools/xenstore/Makefile Wed Aug 10 10:44:42 2005 -0800 26.3 @@ -1,6 +1,5 @@ 26.4 XEN_ROOT=../.. 26.5 include $(XEN_ROOT)/tools/Rules.mk 26.6 -LIBDIR = lib 26.7 XEN_LIBXC = $(XEN_ROOT)/tools/libxc 26.8 26.9 INSTALL = install
27.1 --- a/tools/xenstore/utils.c Tue Aug 09 14:57:45 2005 -0800 27.2 +++ b/tools/xenstore/utils.c Wed Aug 10 10:44:42 2005 -0800 27.3 @@ -80,30 +80,6 @@ void *malloc_nofail(size_t size) 27.4 barf("malloc of %zu failed", size); 27.5 } 27.6 27.7 -/* Stevens. */ 27.8 -void daemonize(void) 27.9 -{ 27.10 - pid_t pid; 27.11 - 27.12 - /* Separate from our parent via fork, so init inherits us. */ 27.13 - if ((pid = fork()) < 0) 27.14 - barf_perror("Failed to fork daemon"); 27.15 - if (pid != 0) 27.16 - exit(0); 27.17 - 27.18 - close(STDIN_FILENO); 27.19 - close(STDOUT_FILENO); 27.20 - close(STDERR_FILENO); 27.21 - 27.22 - /* Session leader so ^C doesn't whack us. */ 27.23 - setsid(); 27.24 - /* Move off any mount points we might be in. */ 27.25 - chdir("/"); 27.26 - /* Discard our parent's old-fashioned umask prejudices. */ 27.27 - umask(0); 27.28 -} 27.29 - 27.30 - 27.31 /* This version adds one byte (for nul term) */ 27.32 void *grab_file(const char *filename, unsigned long *size) 27.33 {
28.1 --- a/tools/xenstore/utils.h Tue Aug 09 14:57:45 2005 -0800 28.2 +++ b/tools/xenstore/utils.h Wed Aug 10 10:44:42 2005 -0800 28.3 @@ -40,9 +40,6 @@ void barf_perror(const char *fmt, ...) _ 28.4 void *grab_file(const char *filename, unsigned long *size); 28.5 void release_file(void *data, unsigned long size); 28.6 28.7 -/* For writing daemons, based on Stevens. */ 28.8 -void daemonize(void); 28.9 - 28.10 /* Signal handling: returns fd to listen on. */ 28.11 int signal_to_fd(int signal); 28.12 void close_signal(int fd);
29.1 --- a/tools/xenstore/xenstored_core.c Tue Aug 09 14:57:45 2005 -0800 29.2 +++ b/tools/xenstore/xenstored_core.c Wed Aug 10 10:44:42 2005 -0800 29.3 @@ -931,8 +931,7 @@ static void do_write(struct connection * 29.4 } 29.5 29.6 node = canonicalize(conn, vec[0]); 29.7 - if (/*suppress error on write outside transaction*/ 0 && 29.8 - !within_transaction(conn->transaction, node)) { 29.9 + if (!within_transaction(conn->transaction, node)) { 29.10 send_error(conn, EROFS); 29.11 return; 29.12 } 29.13 @@ -1541,10 +1540,49 @@ static void setup_structure(void) 29.14 xs_daemon_transactions()); 29.15 } 29.16 29.17 +static void write_pidfile(const char *pidfile) 29.18 +{ 29.19 + char buf[100]; 29.20 + int len; 29.21 + int fd; 29.22 + 29.23 + fd = open(pidfile, O_RDWR | O_CREAT, 0600); 29.24 + if (fd == -1) 29.25 + barf_perror("Opening pid file %s", pidfile); 29.26 + 29.27 + /* We exit silently if daemon already running. */ 29.28 + if (lockf(fd, F_TLOCK, 0) == -1) 29.29 + exit(0); 29.30 + 29.31 + len = sprintf(buf, "%d\n", getpid()); 29.32 + write(fd, buf, len); 29.33 +} 29.34 + 29.35 +/* Stevens. */ 29.36 +static void daemonize(void) 29.37 +{ 29.38 + pid_t pid; 29.39 + 29.40 + /* Separate from our parent via fork, so init inherits us. */ 29.41 + if ((pid = fork()) < 0) 29.42 + barf_perror("Failed to fork daemon"); 29.43 + if (pid != 0) 29.44 + exit(0); 29.45 + 29.46 + /* Session leader so ^C doesn't whack us. */ 29.47 + setsid(); 29.48 + /* Move off any mount points we might be in. */ 29.49 + chdir("/"); 29.50 + /* Discard our parent's old-fashioned umask prejudices. */ 29.51 + umask(0); 29.52 +} 29.53 + 29.54 + 29.55 static struct option options[] = { { "no-fork", 0, NULL, 'N' }, 29.56 { "verbose", 0, NULL, 'V' }, 29.57 { "output-pid", 0, NULL, 'P' }, 29.58 { "trace-file", 1, NULL, 'T' }, 29.59 + { "pid-file", 1, NULL, 'F' }, 29.60 { NULL, 0, NULL, 0 } }; 29.61 29.62 int main(int argc, char *argv[]) 29.63 @@ -1554,6 +1592,7 @@ int main(int argc, char *argv[]) 29.64 fd_set inset, outset; 29.65 bool dofork = true; 29.66 bool outputpid = false; 29.67 + const char *pidfile = NULL; 29.68 29.69 while ((opt = getopt_long(argc, argv, "DVT:", options, NULL)) != -1) { 29.70 switch (opt) { 29.71 @@ -1573,11 +1612,20 @@ int main(int argc, char *argv[]) 29.72 optarg); 29.73 write(tracefd, "\n***\n", strlen("\n***\n")); 29.74 break; 29.75 + case 'F': 29.76 + pidfile = optarg; 29.77 } 29.78 } 29.79 if (optind != argc) 29.80 barf("%s: No arguments desired", argv[0]); 29.81 29.82 + if (dofork) { 29.83 + openlog("xenstored", 0, LOG_DAEMON); 29.84 + daemonize(); 29.85 + } 29.86 + if (pidfile) 29.87 + write_pidfile(pidfile); 29.88 + 29.89 talloc_enable_leak_report_full(); 29.90 29.91 /* Create sockets for them to listen to. */ 29.92 @@ -1624,19 +1672,18 @@ int main(int argc, char *argv[]) 29.93 /* Restore existing connections. */ 29.94 restore_existing_connections(); 29.95 29.96 - /* Debugging: daemonize() closes standard fds, so dup here. */ 29.97 - tmpout = dup(STDOUT_FILENO); 29.98 - if (dofork) { 29.99 - openlog("xenstored", 0, LOG_DAEMON); 29.100 - daemonize(); 29.101 - } 29.102 - 29.103 if (outputpid) { 29.104 char buffer[20]; 29.105 sprintf(buffer, "%i\n", getpid()); 29.106 write(tmpout, buffer, strlen(buffer)); 29.107 } 29.108 - close(tmpout); 29.109 + 29.110 + /* close stdin/stdout now we're ready to accept connections */ 29.111 + if (dofork) { 29.112 + close(STDIN_FILENO); 29.113 + close(STDOUT_FILENO); 29.114 + close(STDERR_FILENO); 29.115 + } 29.116 29.117 #ifdef TESTING 29.118 signal(SIGUSR1, stop_failtest);
33.1 --- a/xen/arch/x86/domain_build.c Tue Aug 09 14:57:45 2005 -0800 33.2 +++ b/xen/arch/x86/domain_build.c Wed Aug 10 10:44:42 2005 -0800 33.3 @@ -78,8 +78,8 @@ int construct_dom0(struct domain *d, 33.4 unsigned long pfn, mfn; 33.5 unsigned long nr_pages; 33.6 unsigned long nr_pt_pages; 33.7 - unsigned long alloc_start; 33.8 - unsigned long alloc_end; 33.9 + unsigned long alloc_spfn; 33.10 + unsigned long alloc_epfn; 33.11 unsigned long count; 33.12 struct pfn_info *page = NULL; 33.13 start_info_t *si; 33.14 @@ -145,8 +145,8 @@ int construct_dom0(struct domain *d, 33.15 ((image_len + PAGE_SIZE - 1) >> PAGE_SHIFT); 33.16 if ( (page = alloc_largest(d, nr_pages)) == NULL ) 33.17 panic("Not enough RAM for DOM0 reservation.\n"); 33.18 - alloc_start = page_to_phys(page); 33.19 - alloc_end = alloc_start + (d->tot_pages << PAGE_SHIFT); 33.20 + alloc_spfn = page_to_pfn(page); 33.21 + alloc_epfn = alloc_spfn + d->tot_pages; 33.22 33.23 if ( (rc = parseelfimage(&dsi)) != 0 ) 33.24 return rc; 33.25 @@ -166,7 +166,7 @@ int construct_dom0(struct domain *d, 33.26 return -EINVAL; 33.27 } 33.28 if (strstr(dsi.xen_section_string, "SHADOW=translate")) 33.29 - opt_dom0_translate = 1; 33.30 + opt_dom0_translate = 1; 33.31 33.32 /* Align load address to 4MB boundary. */ 33.33 dsi.v_start &= ~((1UL<<22)-1); 33.34 @@ -215,12 +215,12 @@ int construct_dom0(struct domain *d, 33.35 #endif 33.36 } 33.37 33.38 - if ( (v_end - dsi.v_start) > (alloc_end - alloc_start) ) 33.39 + if ( ((v_end - dsi.v_start) >> PAGE_SHIFT) > (alloc_epfn - alloc_spfn) ) 33.40 panic("Insufficient contiguous RAM to build kernel image.\n"); 33.41 33.42 printk("PHYSICAL MEMORY ARRANGEMENT:\n" 33.43 - " Dom0 alloc.: %p->%p", 33.44 - _p(alloc_start), _p(alloc_end)); 33.45 + " Dom0 alloc.: %"PRIphysaddr"->%"PRIphysaddr, 33.46 + pfn_to_phys(alloc_spfn), pfn_to_phys(alloc_epfn)); 33.47 if ( d->tot_pages < nr_pages ) 33.48 printk(" (%lu pages to be allocated)", 33.49 nr_pages - d->tot_pages); 33.50 @@ -249,7 +249,8 @@ int construct_dom0(struct domain *d, 33.51 return -ENOMEM; 33.52 } 33.53 33.54 - mpt_alloc = (vpt_start - dsi.v_start) + alloc_start; 33.55 + mpt_alloc = (vpt_start - dsi.v_start) + 33.56 + (unsigned long)pfn_to_phys(alloc_spfn); 33.57 33.58 /* 33.59 * We're basically forcing default RPLs to 1, so that our "what privilege 33.60 @@ -306,7 +307,7 @@ int construct_dom0(struct domain *d, 33.61 #endif 33.62 33.63 l2tab += l2_linear_offset(dsi.v_start); 33.64 - mfn = alloc_start >> PAGE_SHIFT; 33.65 + mfn = alloc_spfn; 33.66 for ( count = 0; count < ((v_end-dsi.v_start)>>PAGE_SHIFT); count++ ) 33.67 { 33.68 if ( !((unsigned long)l1tab & (PAGE_SIZE-1)) ) 33.69 @@ -428,7 +429,7 @@ int construct_dom0(struct domain *d, 33.70 v->arch.guest_table = mk_pagetable(__pa(l4start)); 33.71 33.72 l4tab += l4_table_offset(dsi.v_start); 33.73 - mfn = alloc_start >> PAGE_SHIFT; 33.74 + mfn = alloc_spfn; 33.75 for ( count = 0; count < ((v_end-dsi.v_start)>>PAGE_SHIFT); count++ ) 33.76 { 33.77 if ( !((unsigned long)l1tab & (PAGE_SIZE-1)) ) 33.78 @@ -563,11 +564,11 @@ int construct_dom0(struct domain *d, 33.79 /* Write the phys->machine and machine->phys table entries. */ 33.80 for ( pfn = 0; pfn < d->tot_pages; pfn++ ) 33.81 { 33.82 - mfn = pfn + (alloc_start>>PAGE_SHIFT); 33.83 + mfn = pfn + alloc_spfn; 33.84 #ifndef NDEBUG 33.85 #define REVERSE_START ((v_end - dsi.v_start) >> PAGE_SHIFT) 33.86 if ( !opt_dom0_translate && (pfn > REVERSE_START) ) 33.87 - mfn = (alloc_end>>PAGE_SHIFT) - (pfn - REVERSE_START); 33.88 + mfn = alloc_epfn - (pfn - REVERSE_START); 33.89 #endif 33.90 ((u32 *)vphysmap_start)[pfn] = mfn; 33.91 machine_to_phys_mapping[mfn] = pfn; 33.92 @@ -580,7 +581,7 @@ int construct_dom0(struct domain *d, 33.93 { 33.94 mfn = page_to_pfn(page); 33.95 #ifndef NDEBUG 33.96 -#define pfn (nr_pages - 1 - (pfn - ((alloc_end - alloc_start) >> PAGE_SHIFT))) 33.97 +#define pfn (nr_pages - 1 - (pfn - (alloc_epfn - alloc_spfn))) 33.98 #endif 33.99 ((u32 *)vphysmap_start)[pfn] = mfn; 33.100 machine_to_phys_mapping[mfn] = pfn; 33.101 @@ -620,13 +621,13 @@ int construct_dom0(struct domain *d, 33.102 33.103 if ( opt_dom0_shadow || opt_dom0_translate ) 33.104 { 33.105 - printk("dom0: shadow enable\n"); 33.106 + printk("dom0: shadow enable\n"); 33.107 shadow_mode_enable(d, (opt_dom0_translate 33.108 ? SHM_enable | SHM_refcounts | SHM_translate 33.109 : SHM_enable)); 33.110 if ( opt_dom0_translate ) 33.111 { 33.112 - printk("dom0: shadow translate\n"); 33.113 + printk("dom0: shadow translate\n"); 33.114 #if defined(__i386__) && defined(CONFIG_X86_PAE) 33.115 printk("FIXME: PAE code needed here: %s:%d (%s)\n", 33.116 __FILE__, __LINE__, __FUNCTION__); 33.117 @@ -659,7 +660,7 @@ int construct_dom0(struct domain *d, 33.118 } 33.119 33.120 update_pagetables(v); /* XXX SMP */ 33.121 - printk("dom0: shadow setup done\n"); 33.122 + printk("dom0: shadow setup done\n"); 33.123 } 33.124 33.125 return 0;
34.1 --- a/xen/arch/x86/time.c Tue Aug 09 14:57:45 2005 -0800 34.2 +++ b/xen/arch/x86/time.c Wed Aug 10 10:44:42 2005 -0800 34.3 @@ -103,13 +103,16 @@ static inline u32 mul_frac(u32 multiplic 34.4 static inline u64 scale_delta(u64 delta, struct time_scale *scale) 34.5 { 34.6 u64 product; 34.7 +#ifdef CONFIG_X86_32 34.8 u32 tmp1, tmp2; 34.9 +#endif 34.10 34.11 if ( scale->shift < 0 ) 34.12 delta >>= -scale->shift; 34.13 else 34.14 delta <<= scale->shift; 34.15 34.16 +#ifdef CONFIG_X86_32 34.17 __asm__ ( 34.18 "mul %5 ; " 34.19 "mov %4,%%eax ; " 34.20 @@ -120,6 +123,11 @@ static inline u64 scale_delta(u64 delta, 34.21 "adc %5,%%edx ; " 34.22 : "=A" (product), "=r" (tmp1), "=r" (tmp2) 34.23 : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (scale->mul_frac) ); 34.24 +#else 34.25 + __asm__ ( 34.26 + "mul %%rdx ; shrd $32,%%rdx,%%rax" 34.27 + : "=a" (product) : "0" (delta), "d" ((u64)scale->mul_frac) ); 34.28 +#endif 34.29 34.30 return product; 34.31 }
40.1 --- a/xen/common/page_alloc.c Tue Aug 09 14:57:45 2005 -0800 40.2 +++ b/xen/common/page_alloc.c Wed Aug 10 10:44:42 2005 -0800 40.3 @@ -52,7 +52,6 @@ LIST_HEAD(page_scrub_list); 40.4 * One bit per page of memory. Bit set => page is allocated. 40.5 */ 40.6 40.7 -static unsigned long bitmap_size; /* in bytes */ 40.8 static unsigned long *alloc_bitmap; 40.9 #define PAGES_PER_MAPWORD (sizeof(unsigned long) * 8) 40.10 40.11 @@ -135,10 +134,16 @@ static void map_free(unsigned long first 40.12 /* Initialise allocator to handle up to @max_page pages. */ 40.13 physaddr_t init_boot_allocator(physaddr_t bitmap_start) 40.14 { 40.15 + unsigned long bitmap_size; 40.16 + 40.17 bitmap_start = round_pgup(bitmap_start); 40.18 40.19 - /* Allocate space for the allocation bitmap. */ 40.20 + /* 40.21 + * Allocate space for the allocation bitmap. Include an extra longword 40.22 + * of padding for possible overrun in map_alloc and map_free. 40.23 + */ 40.24 bitmap_size = max_page / 8; 40.25 + bitmap_size += sizeof(unsigned long); 40.26 bitmap_size = round_pgup(bitmap_size); 40.27 alloc_bitmap = (unsigned long *)phys_to_virt(bitmap_start); 40.28 40.29 @@ -171,7 +176,7 @@ void init_boot_pages(physaddr_t ps, phys 40.30 else if ( *p != '\0' ) 40.31 break; 40.32 40.33 - if ( (bad_pfn < (bitmap_size*8)) && !allocated_in_map(bad_pfn) ) 40.34 + if ( (bad_pfn < max_page) && !allocated_in_map(bad_pfn) ) 40.35 { 40.36 printk("Marking page %lx as bad\n", bad_pfn); 40.37 map_alloc(bad_pfn, 1); 40.38 @@ -183,7 +188,7 @@ unsigned long alloc_boot_pages(unsigned 40.39 { 40.40 unsigned long pg, i; 40.41 40.42 - for ( pg = 0; (pg + nr_pfns) < (bitmap_size*8); pg += pfn_align ) 40.43 + for ( pg = 0; (pg + nr_pfns) < max_page; pg += pfn_align ) 40.44 { 40.45 for ( i = 0; i < nr_pfns; i++ ) 40.46 if ( allocated_in_map(pg + i) ) 40.47 @@ -362,7 +367,7 @@ void scrub_heap_pages(void) 40.48 40.49 printk("Scrubbing Free RAM: "); 40.50 40.51 - for ( pfn = 0; pfn < (bitmap_size * 8); pfn++ ) 40.52 + for ( pfn = 0; pfn < max_page; pfn++ ) 40.53 { 40.54 /* Every 100MB, print a progress dot. */ 40.55 if ( (pfn % ((100*1024*1024)/PAGE_SIZE)) == 0 )
41.1 --- a/xen/include/asm-x86/page.h Tue Aug 09 14:57:45 2005 -0800 41.2 +++ b/xen/include/asm-x86/page.h Wed Aug 10 10:44:42 2005 -0800 41.3 @@ -189,6 +189,9 @@ typedef struct { u64 pfn; } pagetable_t; 41.4 #define virt_to_page(kaddr) (frame_table + (__pa(kaddr) >> PAGE_SHIFT)) 41.5 #define pfn_valid(_pfn) ((_pfn) < max_page) 41.6 41.7 +#define pfn_to_phys(pfn) ((physaddr_t)(pfn) << PAGE_SHIFT) 41.8 +#define phys_to_pfn(pa) ((unsigned long)((pa) >> PAGE_SHIFT)) 41.9 + 41.10 /* High table entries are reserved by the hypervisor. */ 41.11 #if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE) 41.12 #define DOMAIN_ENTRIES_PER_L2_PAGETABLE \
42.1 --- a/xen/include/asm-x86/types.h Tue Aug 09 14:57:45 2005 -0800 42.2 +++ b/xen/include/asm-x86/types.h Wed Aug 10 10:44:42 2005 -0800 42.3 @@ -38,13 +38,16 @@ typedef signed long long s64; 42.4 typedef unsigned long long u64; 42.5 #if defined(CONFIG_X86_PAE) 42.6 typedef u64 physaddr_t; 42.7 +#define PRIphysaddr "016llx" 42.8 #else 42.9 -typedef u32 physaddr_t; 42.10 +typedef unsigned long physaddr_t; 42.11 +#define PRIphysaddr "08lx" 42.12 #endif 42.13 #elif defined(__x86_64__) 42.14 typedef signed long s64; 42.15 typedef unsigned long u64; 42.16 -typedef u64 physaddr_t; 42.17 +typedef unsigned long physaddr_t; 42.18 +#define PRIphysaddr "016lx" 42.19 #endif 42.20 42.21 typedef unsigned long size_t;
45.1 --- a/xen/include/asm-x86/x86_32/uaccess.h Tue Aug 09 14:57:45 2005 -0800 45.2 +++ b/xen/include/asm-x86/x86_32/uaccess.h Wed Aug 10 10:44:42 2005 -0800 45.3 @@ -67,7 +67,7 @@ do { \ 45.4 " .long 1b,4b\n" \ 45.5 " .long 2b,4b\n" \ 45.6 ".previous" \ 45.7 - : "=r" (retval), "=A" (x) \ 45.8 + : "=r" (retval), "=&A" (x) \ 45.9 : "r" (addr), "i"(errret), "0"(retval)) 45.10 45.11 #define __get_user_size(x,ptr,size,retval,errret) \