# HG changeset patch
# User adsharma@xxxxxxxxxxxxxxxxxxxx
# Node ID 40b887fa79d00b7836248060d51f8d1cc04f5c28
# Parent 9413e453e83b0cd6b3a7593ee4c29ec5d645dfad
# Parent ba46bd7f5cdf766081edafda7b499129af177e88
Merge.
diff -r 9413e453e83b -r 40b887fa79d0
linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c Fri Aug 12
17:25:49 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/smpboot.c Fri Aug 12
17:35:15 2005
@@ -1353,83 +1353,82 @@
printk(KERN_ALERT "Error creating hotplug_cpu process!\n");
}
-static void handle_cpus_watch(struct xenbus_watch *, const char *);
-static struct notifier_block xsn_cpus;
+static void handle_vcpu_hotplug_event(struct xenbus_watch *, const char *);
+static struct notifier_block xsn_cpu;
/* xenbus watch struct */
-static struct xenbus_watch cpus_watch = {
- .node = "cpus",
- .callback = handle_cpus_watch,
+static struct xenbus_watch cpu_watch = {
+ .node = "cpu",
+ .callback = handle_vcpu_hotplug_event
};
-static int setup_cpus_watcher(struct notifier_block *notifier,
+/* NB: Assumes xenbus_lock is held! */
+static int setup_cpu_watcher(struct notifier_block *notifier,
unsigned long event, void *data)
{
int err = 0;
- down(&xenbus_lock);
- err = register_xenbus_watch(&cpus_watch);
- up(&xenbus_lock);
+ BUG_ON(down_trylock(&xenbus_lock) == 0);
+ err = register_xenbus_watch(&cpu_watch);
if (err) {
- printk("Failed to set cpus watcher\n");
- }
+ printk("Failed to register watch on /cpu\n");
+ }
+
return NOTIFY_DONE;
}
-static void handle_cpus_watch(struct xenbus_watch *watch, const char *node)
+static void handle_vcpu_hotplug_event(struct xenbus_watch *watch, const char
*node)
{
static DECLARE_WORK(vcpu_hotplug_work, __vcpu_hotplug_handler, NULL);
struct vcpu_hotplug_handler_t *handler = &vcpu_hotplug_handler;
ssize_t ret;
- int err, cpu, state;
+ int err, cpu;
+ char state[8];
char dir[32];
char *cpustr;
- /* get a pointer to start of cpus/cpu string */
- if ((cpustr = strstr(node, "cpus/cpu")) != NULL) {
+ /* get a pointer to start of cpu string */
+ if ((cpustr = strstr(node, "cpu/")) != NULL) {
/* find which cpu state changed, note vcpu for handler */
- sscanf(cpustr, "cpus/cpu%d", &cpu);
+ sscanf(cpustr, "cpu/%d", &cpu);
handler->vcpu = cpu;
/* calc the dir for xenbus read */
- sprintf(dir, "cpus/cpu%d", cpu);
-
- /* make sure watch that was triggered is changes to the online
key */
- if ((strcmp(node + strlen(dir), "/online")) != 0)
+ sprintf(dir, "cpu/%d", cpu);
+
+ /* make sure watch that was triggered is changes to the correct
key */
+ if ((strcmp(node + strlen(dir), "/availability")) != 0)
return;
/* get the state value */
- xenbus_transaction_start("cpus");
- err = xenbus_scanf(dir, "online", "%d", &state);
+ xenbus_transaction_start("cpu");
+ err = xenbus_scanf(dir, "availability", "%s", state);
xenbus_transaction_end(0);
if (err != 1) {
printk(KERN_ERR
- "XENBUS: Unable to read cpu online state\n");
+ "XENBUS: Unable to read cpu state\n");
return;
}
/* if we detect a state change, take action */
- switch (state) {
+ if (strcmp(state, "online") == 0) {
/* offline -> online */
- case 1:
if (!cpu_isset(cpu, cpu_online_map)) {
handler->fn = (void *)&cpu_up;
ret = schedule_work(&vcpu_hotplug_work);
- }
- break;
+ }
+ } else if (strcmp(state, "offline") == 0) {
/* online -> offline */
- case 0:
if (cpu_isset(cpu, cpu_online_map)) {
handler->fn = (void *)&cpu_down;
ret = schedule_work(&vcpu_hotplug_work);
- }
- break;
- default:
+ }
+ } else {
printk(KERN_ERR
- "XENBUS: unknown state(%d) on node(%s)\n", state,
+ "XENBUS: unknown state(%s) on node(%s)\n", state,
node);
}
}
@@ -1438,13 +1437,9 @@
static int __init setup_vcpu_hotplug_event(void)
{
- xsn_cpus.notifier_call = setup_cpus_watcher;
-
- if (xen_start_info.store_evtchn) {
- setup_cpus_watcher(&xsn_cpus, 0, NULL);
- } else {
- register_xenstore_notifier(&xsn_cpus);
- }
+ xsn_cpu.notifier_call = setup_cpu_watcher;
+
+ register_xenstore_notifier(&xsn_cpu);
return 0;
}
diff -r 9413e453e83b -r 40b887fa79d0
linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c Fri Aug 12 17:25:49 2005
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/time.c Fri Aug 12 17:35:15 2005
@@ -231,18 +231,32 @@
{
long wtm_nsec, xtime_nsec;
time_t wtm_sec, xtime_sec;
- u64 tmp, wc_nsec;
+ s64 tmp, wc_nsec;
/* Adjust wall-clock time base based on wall_jiffies ticks. */
wc_nsec = processed_system_time;
- wc_nsec += (u64)sec * 1000000000ULL;
- wc_nsec += (u64)nsec;
+ wc_nsec += (sec * 1000000000LL) + nsec;
wc_nsec -= (jiffies - wall_jiffies) * (u64)(NSEC_PER_SEC / HZ);
/* Split wallclock base into seconds and nanoseconds. */
- tmp = wc_nsec;
- xtime_nsec = do_div(tmp, 1000000000);
- xtime_sec = (time_t)tmp;
+ if ( (tmp = wc_nsec) < 0 )
+ {
+ /* -ve UTC offset => -ve seconds, +ve nanoseconds. */
+ tmp = -tmp;
+ xtime_nsec = do_div(tmp, 1000000000);
+ tmp = -tmp;
+ if ( xtime_nsec != 0 )
+ {
+ xtime_nsec = 1000000000 - xtime_nsec;
+ tmp--;
+ }
+ }
+ else
+ {
+ /* +ve UTC offset => +ve seconds, +ve nanoseconds. */
+ xtime_nsec = do_div(tmp, 1000000000);
+ }
+ xtime_sec = (time_t)tmp;
wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - xtime_sec);
wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - xtime_nsec);
diff -r 9413e453e83b -r 40b887fa79d0
linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c Fri Aug 12 17:25:49 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c Fri Aug 12 17:35:15 2005
@@ -6,6 +6,7 @@
#include <linux/module.h>
#include <linux/reboot.h>
#include <linux/sysrq.h>
+#include <linux/stringify.h>
#include <asm/irq.h>
#include <asm/mmu_context.h>
#include <asm-xen/evtchn.h>
@@ -254,7 +255,8 @@
char *str;
str = (char *)xenbus_read("control", "shutdown", NULL);
- if (IS_ERR(str))
+ /* Ignore read errors and recursive shutdown events. */
+ if (IS_ERR(str) || !strcmp(str, __stringify(SHUTDOWN_INVALID)))
return;
xenbus_printf("control", "shutdown", "%i", SHUTDOWN_INVALID);
diff -r 9413e453e83b -r 40b887fa79d0
linux-2.6-xen-sparse/arch/xen/x86_64/kernel/Makefile
--- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/Makefile Fri Aug 12
17:25:49 2005
+++ b/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/Makefile Fri Aug 12
17:35:15 2005
@@ -36,7 +36,7 @@
#obj-$(CONFIG_CPU_FREQ) += cpufreq/
#obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
#obj-$(CONFIG_GART_IOMMU) += pci-gart.o aperture.o
-c-obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o pci-dma.o
+obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o pci-dma.o
#obj-$(CONFIG_SWIOTLB) += swiotlb.o
obj-$(CONFIG_KPROBES) += kprobes.o
obj-$(CONFIG_X86_PM_TIMER) += pmtimer.o
diff -r 9413e453e83b -r 40b887fa79d0 tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c Fri Aug 12 17:25:49 2005
+++ b/tools/libxc/xc_core.c Fri Aug 12 17:35:15 2005
@@ -43,7 +43,7 @@
goto error_out;
}
- if ((dump_mem_start = malloc(DUMP_INCREMENT*PAGE_SIZE)) == 0) {
+ if ((dump_mem_start = malloc(DUMP_INCREMENT*PAGE_SIZE)) == NULL) {
PERROR("Could not allocate dump_mem");
goto error_out;
}
@@ -108,9 +108,8 @@
free(dump_mem_start);
return 0;
error_out:
- if (dump_fd)
+ if (dump_fd != -1)
close(dump_fd);
- if (dump_mem_start)
- free(dump_mem_start);
+ free(dump_mem_start);
return -1;
}
diff -r 9413e453e83b -r 40b887fa79d0 tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c Fri Aug 12 17:25:49 2005
+++ b/tools/libxc/xc_linux_build.c Fri Aug 12 17:35:15 2005
@@ -318,8 +318,7 @@
return 0;
error_out:
- if ( page_array != NULL )
- free(page_array);
+ free(page_array);
return -1;
}
#else /* x86 */
@@ -616,10 +615,8 @@
return 0;
error_out:
- if ( mmu != NULL )
- free(mmu);
- if ( page_array != NULL )
- free(page_array);
+ free(mmu);
+ free(page_array);
return -1;
}
#endif
@@ -719,8 +716,7 @@
close(initrd_fd);
if ( initrd_gfd )
gzclose(initrd_gfd);
- if ( image != NULL )
- free(image);
+ free(image);
#ifdef __ia64__
/* based on new_thread in xen/arch/ia64/domain.c */
@@ -806,8 +802,7 @@
gzclose(initrd_gfd);
else if ( initrd_fd >= 0 )
close(initrd_fd);
- if ( image != NULL )
- free(image);
+ free(image);
return -1;
}
diff -r 9413e453e83b -r 40b887fa79d0 tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c Fri Aug 12 17:25:49 2005
+++ b/tools/libxc/xc_linux_restore.c Fri Aug 12 17:35:15 2005
@@ -32,7 +32,7 @@
#define PPRINTF(_f, _a...)
#endif
-ssize_t
+static ssize_t
read_exact(int fd, void *buf, size_t count)
{
int r = 0, s;
@@ -607,12 +607,9 @@
out:
if ( (rc != 0) && (dom != 0) )
xc_domain_destroy(xc_handle, dom);
- if ( mmu != NULL )
- free(mmu);
- if ( pfn_to_mfn_table != NULL )
- free(pfn_to_mfn_table);
- if ( pfn_type != NULL )
- free(pfn_type);
+ free(mmu);
+ free(pfn_to_mfn_table);
+ free(pfn_type);
DPRINTF("Restore exit with rc=%d\n", rc);
return rc;
diff -r 9413e453e83b -r 40b887fa79d0 tools/libxc/xc_linux_save.c
--- a/tools/libxc/xc_linux_save.c Fri Aug 12 17:25:49 2005
+++ b/tools/libxc/xc_linux_save.c Fri Aug 12 17:35:15 2005
@@ -136,7 +136,7 @@
return (new->tv_sec * 1000000) + new->tv_usec;
}
-static long long llgettimeofday()
+static long long llgettimeofday( void )
{
struct timeval now;
gettimeofday(&now, NULL);
@@ -312,9 +312,9 @@
}
-int suspend_and_state(int xc_handle, int io_fd, int dom,
- xc_dominfo_t *info,
- vcpu_guest_context_t *ctxt)
+static int suspend_and_state(int xc_handle, int io_fd, int dom,
+ xc_dominfo_t *info,
+ vcpu_guest_context_t *ctxt)
{
int i=0;
char ans[30];
@@ -429,7 +429,7 @@
- that should be sent this iteration (unless later marked as skip);
- to skip this iteration because already dirty;
- to fixup by sending at the end if not already resent; */
- unsigned long *to_send, *to_skip, *to_fix;
+ unsigned long *to_send = NULL, *to_skip = NULL, *to_fix = NULL;
xc_shadow_control_stats_t stats;
@@ -1051,8 +1051,11 @@
if(live_mfn_to_pfn_table)
munmap(live_mfn_to_pfn_table, PAGE_SIZE*1024);
- if (pfn_type != NULL)
- free(pfn_type);
+ free(pfn_type);
+ free(pfn_batch);
+ free(to_send);
+ free(to_fix);
+ free(to_skip);
DPRINTF("Save exit rc=%d\n",rc);
return !!rc;
diff -r 9413e453e83b -r 40b887fa79d0 tools/libxc/xc_load_elf.c
--- a/tools/libxc/xc_load_elf.c Fri Aug 12 17:25:49 2005
+++ b/tools/libxc/xc_load_elf.c Fri Aug 12 17:35:15 2005
@@ -309,8 +309,7 @@
dsi->v_end = round_pgup(maxva);
out:
- if ( p != NULL )
- free(p);
+ free(p);
return 0;
}
diff -r 9413e453e83b -r 40b887fa79d0 tools/libxc/xc_ptrace.c
--- a/tools/libxc/xc_ptrace.c Fri Aug 12 17:25:49 2005
+++ b/tools/libxc/xc_ptrace.c Fri Aug 12 17:35:15 2005
@@ -221,7 +221,7 @@
return (void *)(((unsigned long)page_virt[cpu]) | (va & BSD_PAGE_MASK));
error_out:
- return 0;
+ return NULL;
}
int
diff -r 9413e453e83b -r 40b887fa79d0 tools/libxc/xc_vmx_build.c
--- a/tools/libxc/xc_vmx_build.c Fri Aug 12 17:25:49 2005
+++ b/tools/libxc/xc_vmx_build.c Fri Aug 12 17:35:15 2005
@@ -616,17 +616,15 @@
return 0;
error_out:
- if ( mmu != NULL )
- free(mmu);
- if ( page_array != NULL )
- free(page_array);
+ free(mmu);
+ free(page_array);
return -1;
}
#define VMX_FEATURE_FLAG 0x20
-int vmx_identify(void)
+static int vmx_identify(void)
{
int eax, ecx;
@@ -745,8 +743,7 @@
close(initrd_fd);
if ( initrd_gfd )
gzclose(initrd_gfd);
- if ( image != NULL )
- free(image);
+ free(image);
ctxt->flags = VGCF_VMX_GUEST;
/* FPU is set up to default initial state. */
@@ -801,8 +798,7 @@
gzclose(initrd_gfd);
else if ( initrd_fd >= 0 )
close(initrd_fd);
- if ( image != NULL )
- free(image);
+ free(image);
return -1;
}
diff -r 9413e453e83b -r 40b887fa79d0 tools/python/setup.py
--- a/tools/python/setup.py Fri Aug 12 17:25:49 2005
+++ b/tools/python/setup.py Fri Aug 12 17:35:15 2005
@@ -17,7 +17,7 @@
XEN_ROOT + "/tools/xenstore",
]
-libraries = [ "xc", "xenstore-pic" ]
+libraries = [ "xc", "xenstore" ]
xc = Extension("xc",
extra_compile_args = extra_compile_args,
diff -r 9413e453e83b -r 40b887fa79d0 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py Fri Aug 12 17:25:49 2005
+++ b/tools/python/xen/xend/XendDomainInfo.py Fri Aug 12 17:35:15 2005
@@ -561,12 +561,12 @@
def exportVCPUSToDB(self, vcpus):
for v in range(0,vcpus):
- path = "/cpus/cpu%d"%(v)
+ path = "/cpu/%d"%(v)
if not self.vcpusdb.has_key(path):
self.vcpusdb[path] = self.db.addChild(path)
db = self.vcpusdb[path]
- log.debug("writing key online=1 to path %s in store"%(path))
- db['online'] = "1"
+ log.debug("writing key availability=online to path %s in
store"%(path))
+ db['availability'] = "online"
db.saveDB(save=True)
def init_image(self):
@@ -915,7 +915,8 @@
"""
self.configure_fields()
self.create_devices()
- self.create_blkif()
+ if self.image.ostype != 'vmx':
+ self.create_blkif()
def create_blkif(self):
"""Create the block device interface (blkif) for the vm.
@@ -957,16 +958,16 @@
"""
db = ""
try:
- db = self.vcpusdb['/cpus/cpu%d'%(vcpu)]
+ db = self.vcpusdb['/cpu/%d'%(vcpu)]
except:
log.error("Invalid VCPU")
return
if self.store_channel:
if int(state) == 0:
- db['online'] = "0"
+ db['availability'] = "offline"
else:
- db['online'] = "1"
+ db['availability'] = "online"
db.saveDB(save=True)
diff -r 9413e453e83b -r 40b887fa79d0 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py Fri Aug 12 17:25:49 2005
+++ b/tools/python/xen/xm/main.py Fri Aug 12 17:35:15 2005
@@ -289,13 +289,12 @@
args.insert(0,"bogus")
destroy.main(args)
-# TODO: make reboot do the right thing, right now
-# reboot and shutdown are exactly the same
def xm_reboot(args):
arg_check(args,1,"reboot")
# ugly hack because the opt parser apparently wants
# the subcommand name just to throw it away!
args.insert(0,"bogus")
+ args.insert(2,"-R")
from xen.xm import shutdown
shutdown.main(args)
diff -r 9413e453e83b -r 40b887fa79d0 tools/security/secpol_tool.c
--- a/tools/security/secpol_tool.c Fri Aug 12 17:25:49 2005
+++ b/tools/security/secpol_tool.c Fri Aug 12 17:35:15 2005
@@ -612,7 +612,7 @@
int main(int argc, char **argv)
{
- int acm_cmd_fd, ret;
+ int acm_cmd_fd, ret = 0;
if (argc < 2)
usage(argv[0]);
diff -r 9413e453e83b -r 40b887fa79d0 tools/xenstore/Makefile
--- a/tools/xenstore/Makefile Fri Aug 12 17:25:49 2005
+++ b/tools/xenstore/Makefile Fri Aug 12 17:35:15 2005
@@ -24,7 +24,7 @@
TESTFLAGS= -DTESTING
TESTENV = XENSTORED_ROOTDIR=$(TESTDIR) XENSTORED_RUNDIR=$(TESTDIR)
-all: xen xenstored libxenstore.a libxenstore-pic.a
+all: xen xenstored libxenstore.so
testcode: xen xs_test xenstored_test xs_random xs_dom0_test
@@ -53,20 +53,14 @@
talloc_test.o: talloc.c
$(COMPILE.c) -o $@ $<
-LIB_OBJS := xs.o xs_lib.o
-
-LIB_OBJS_A := $(patsubst %.o,libxenstore.a(%.o),$(LIB_OBJS))
-LIB_OBJS_PIC := $(patsubst %.o,libxenstore-pic.a(%.opic),$(LIB_OBJS))
-
-libxenstore.a: $(LIB_OBJS_A)
-
-libxenstore-pic.a: $(LIB_OBJS_PIC)
+libxenstore.so: xs.opic xs_lib.opic
+ $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenstore.so -shared -o $@
$^
clean: testsuite-clean
- rm -f *.o *.opic *.a
+ rm -f *.o *.opic *.so
rm -f xen xenstored xs_random xs_stress xs_crashme
rm -f xs_test xenstored_test xs_dom0_test
- -$(RM) $(PROG_DEP)
+ $(RM) $(PROG_DEP)
print-dir:
@echo -n tools/xenstore:
@@ -117,15 +111,14 @@
tarball: clean
cd .. && tar -c -j -v -h -f xenstore.tar.bz2 xenstore/
-install: xenstored libxenstore.a libxenstore-pic.a
+install: xenstored libxenstore.so
$(INSTALL_DIR) -p $(DESTDIR)/var/run/xenstored
$(INSTALL_DIR) -p $(DESTDIR)/var/lib/xenstored
$(INSTALL_DIR) -p $(DESTDIR)/usr/sbin
$(INSTALL_DIR) -p $(DESTDIR)/usr/include
$(INSTALL_PROG) xenstored $(DESTDIR)/usr/sbin
$(INSTALL_DIR) -p $(DESTDIR)/usr/$(LIBDIR)
- $(INSTALL_DATA) libxenstore.a $(DESTDIR)/usr/$(LIBDIR)
- $(INSTALL_DATA) libxenstore-pic.a $(DESTDIR)/usr/$(LIBDIR)
+ $(INSTALL_DATA) libxenstore.so $(DESTDIR)/usr/$(LIBDIR)
$(INSTALL_DATA) xs.h $(DESTDIR)/usr/include
$(INSTALL_DATA) xs_lib.h $(DESTDIR)/usr/include
diff -r 9413e453e83b -r 40b887fa79d0 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c Fri Aug 12 17:25:49 2005
+++ b/tools/xenstore/xenstored_core.c Fri Aug 12 17:35:15 2005
@@ -1587,7 +1587,7 @@
int main(int argc, char *argv[])
{
- int opt, *sock, *ro_sock, event_fd, max, tmpout;
+ int opt, *sock, *ro_sock, event_fd, max;
struct sockaddr_un addr;
fd_set inset, outset;
bool dofork = true;
@@ -1673,9 +1673,8 @@
restore_existing_connections();
if (outputpid) {
- char buffer[20];
- sprintf(buffer, "%i\n", getpid());
- write(tmpout, buffer, strlen(buffer));
+ printf("%i\n", getpid());
+ fflush(stdout);
}
/* close stdin/stdout now we're ready to accept connections */
diff -r 9413e453e83b -r 40b887fa79d0 xen/arch/ia64/domain.c
--- a/xen/arch/ia64/domain.c Fri Aug 12 17:25:49 2005
+++ b/xen/arch/ia64/domain.c Fri Aug 12 17:35:15 2005
@@ -1398,3 +1398,12 @@
{
vcpu_pend_interrupt(dom0->vcpu[0],irq);
}
+
+void vcpu_migrate_cpu(struct vcpu *v, int newcpu)
+{
+ if ( v->processor == newcpu )
+ return;
+
+ set_bit(_VCPUF_cpu_migrated, &v->vcpu_flags);
+ v->processor = newcpu;
+}
diff -r 9413e453e83b -r 40b887fa79d0 xen/arch/ia64/xentime.c
--- a/xen/arch/ia64/xentime.c Fri Aug 12 17:25:49 2005
+++ b/xen/arch/ia64/xentime.c Fri Aug 12 17:35:15 2005
@@ -103,7 +103,7 @@
}
/* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
-void do_settime(unsigned long secs, unsigned long nsecs, u64 system_time_base)
+void do_settime(s64 secs, u32 nsecs, u64 system_time_base)
{
#ifdef CONFIG_VTI
u64 _nsecs;
diff -r 9413e453e83b -r 40b887fa79d0 xen/arch/x86/dom0_ops.c
--- a/xen/arch/x86/dom0_ops.c Fri Aug 12 17:25:49 2005
+++ b/xen/arch/x86/dom0_ops.c Fri Aug 12 17:35:15 2005
@@ -404,15 +404,17 @@
memcpy(c, &v->arch.guest_context, sizeof(*c));
- /* IOPL privileges are virtualised -- merge back into returned eflags. */
- BUG_ON(((c->user_regs.eflags & EF_IOPL) != 0) && !(VMX_DOMAIN(v)));
- c->user_regs.eflags |= v->arch.iopl << 12;
-
if ( VMX_DOMAIN(v) )
{
save_vmx_cpu_user_regs(&c->user_regs);
__vmread(CR0_READ_SHADOW, &c->ctrlreg[0]);
__vmread(CR4_READ_SHADOW, &c->ctrlreg[4]);
+ }
+ else
+ {
+ /* IOPL privileges are virtualised: merge back into returned eflags. */
+ BUG_ON((c->user_regs.eflags & EF_IOPL) != 0);
+ c->user_regs.eflags |= v->arch.iopl << 12;
}
c->flags = 0;
diff -r 9413e453e83b -r 40b887fa79d0 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c Fri Aug 12 17:25:49 2005
+++ b/xen/arch/x86/domain.c Fri Aug 12 17:35:15 2005
@@ -295,48 +295,23 @@
l1e_from_page(virt_to_page(gdt_table), PAGE_HYPERVISOR);
}
-void
-arch_migrate_cpu(struct vcpu *v, int newcpu)
-{
- if ( VMX_DOMAIN(v) && (v->processor != newcpu) ){
- u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
- __vmpclear(vmcs_phys_ptr);
+void vcpu_migrate_cpu(struct vcpu *v, int newcpu)
+{
+ if ( v->processor == newcpu )
+ return;
+
+ set_bit(_VCPUF_cpu_migrated, &v->vcpu_flags);
+ v->processor = newcpu;
+
+ if ( VMX_DOMAIN(v) )
+ {
+ __vmpclear(virt_to_phys(v->arch.arch_vmx.vmcs));
v->arch.schedule_tail = arch_vmx_do_relaunch;
}
}
#ifdef CONFIG_VMX
static int vmx_switch_on;
-
-void arch_vmx_do_resume(struct vcpu *v)
-{
- u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
-
- load_vmcs(&v->arch.arch_vmx, vmcs_phys_ptr);
- vmx_do_resume(v);
- reset_stack_and_jump(vmx_asm_do_resume);
-}
-
-void arch_vmx_do_launch(struct vcpu *v)
-{
- u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
-
- load_vmcs(&v->arch.arch_vmx, vmcs_phys_ptr);
- vmx_do_launch(v);
- reset_stack_and_jump(vmx_asm_do_launch);
-}
-
-void arch_vmx_do_relaunch(struct vcpu *v)
-{
- u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
-
- load_vmcs(&v->arch.arch_vmx, vmcs_phys_ptr);
- vmx_do_resume(v);
- vmx_set_host_env(v);
- v->arch.schedule_tail = arch_vmx_do_resume;
-
- reset_stack_and_jump(vmx_asm_do_relaunch);
-}
static int vmx_final_setup_guest(
struct vcpu *v, struct vcpu_guest_context *ctxt)
@@ -368,7 +343,7 @@
v->arch.schedule_tail = arch_vmx_do_launch;
-#if defined (__i386)
+#if defined (__i386__)
v->domain->arch.vmx_platform.real_mode_data =
(unsigned long *) regs->esi;
#endif
diff -r 9413e453e83b -r 40b887fa79d0 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c Fri Aug 12 17:25:49 2005
+++ b/xen/arch/x86/setup.c Fri Aug 12 17:35:15 2005
@@ -336,25 +336,24 @@
/* Find a large enough RAM extent to stash the DOM0 modules. */
for ( i = 0; ; i++ )
{
- if ( (e820.map[i].type == E820_RAM) &&
- (e820.map[i].size >= modules_length) &&
- ((e820.map[i].addr + e820.map[i].size) >=
- (xenheap_phys_end + modules_length)) )
- {
- /* Stash as near as possible to the beginning of the RAM extent. */
- initial_images_start = e820.map[i].addr;
- if ( initial_images_start < xenheap_phys_end )
- initial_images_start = xenheap_phys_end;
- initial_images_end = initial_images_start + modules_length;
- break;
- }
-
if ( i == e820.nr_map )
{
printk("Not enough memory to stash the DOM0 kernel image.\n");
for ( ; ; ) ;
}
- }
+
+ if ( (e820.map[i].type == E820_RAM) &&
+ (e820.map[i].size >= modules_length) &&
+ ((e820.map[i].addr + e820.map[i].size) >=
+ (xenheap_phys_end + modules_length)) )
+ break;
+ }
+
+ /* Stash as near as possible to the beginning of the RAM extent. */
+ initial_images_start = e820.map[i].addr;
+ if ( initial_images_start < xenheap_phys_end )
+ initial_images_start = xenheap_phys_end;
+ initial_images_end = initial_images_start + modules_length;
#if defined(CONFIG_X86_32)
memmove((void *)initial_images_start, /* use low mapping */
diff -r 9413e453e83b -r 40b887fa79d0 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c Fri Aug 12 17:25:49 2005
+++ b/xen/arch/x86/time.c Fri Aug 12 17:35:15 2005
@@ -43,7 +43,10 @@
spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
int timer_ack = 0;
unsigned long volatile jiffies;
-static u32 wc_sec, wc_nsec; /* UTC time at last 'time update'. */
+
+/* UTC time at system boot. */
+static s64 wc_sec;
+static u32 wc_nsec;
static spinlock_t wc_lock = SPIN_LOCK_UNLOCKED;
struct time_scale {
@@ -693,18 +696,33 @@
}
/* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
-void do_settime(unsigned long secs, unsigned long nsecs, u64 system_time_base)
-{
- u64 x;
- u32 y, _wc_sec, _wc_nsec;
+void do_settime(s64 secs, u32 nsecs, u64 system_time_base)
+{
+ s64 x;
+ u32 y;
struct domain *d;
shared_info_t *s;
- x = (secs * 1000000000ULL) + (u64)nsecs - system_time_base;
- y = do_div(x, 1000000000);
-
- wc_sec = _wc_sec = (u32)x;
- wc_nsec = _wc_nsec = (u32)y;
+ x = (secs * 1000000000LL) + (u64)nsecs - system_time_base;
+ if ( x < 0 )
+ {
+ /* -ve UTC offset => -ve seconds, +ve nanoseconds. */
+ x = -x;
+ y = do_div(x, 1000000000);
+ x = -x;
+ if ( y != 0 )
+ {
+ y = 1000000000 - y;
+ x--;
+ }
+ }
+ else
+ {
+ y = do_div(x, 1000000000);
+ }
+
+ wc_sec = x;
+ wc_nsec = y;
read_lock(&domlist_lock);
spin_lock(&wc_lock);
@@ -713,8 +731,8 @@
{
s = d->shared_info;
version_update_begin(&s->wc_version);
- s->wc_sec = _wc_sec;
- s->wc_nsec = _wc_nsec;
+ s->wc_sec = x;
+ s->wc_nsec = y;
version_update_end(&s->wc_version);
}
diff -r 9413e453e83b -r 40b887fa79d0 xen/arch/x86/vmx_vmcs.c
--- a/xen/arch/x86/vmx_vmcs.c Fri Aug 12 17:25:49 2005
+++ b/xen/arch/x86/vmx_vmcs.c Fri Aug 12 17:35:15 2005
@@ -543,6 +543,36 @@
__vmx_bug(guest_cpu_user_regs());
}
+void arch_vmx_do_resume(struct vcpu *v)
+{
+ u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
+
+ load_vmcs(&v->arch.arch_vmx, vmcs_phys_ptr);
+ vmx_do_resume(v);
+ reset_stack_and_jump(vmx_asm_do_resume);
+}
+
+void arch_vmx_do_launch(struct vcpu *v)
+{
+ u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
+
+ load_vmcs(&v->arch.arch_vmx, vmcs_phys_ptr);
+ vmx_do_launch(v);
+ reset_stack_and_jump(vmx_asm_do_launch);
+}
+
+void arch_vmx_do_relaunch(struct vcpu *v)
+{
+ u64 vmcs_phys_ptr = (u64) virt_to_phys(v->arch.arch_vmx.vmcs);
+
+ load_vmcs(&v->arch.arch_vmx, vmcs_phys_ptr);
+ vmx_do_resume(v);
+ vmx_set_host_env(v);
+ v->arch.schedule_tail = arch_vmx_do_resume;
+
+ reset_stack_and_jump(vmx_asm_do_relaunch);
+}
+
#endif /* CONFIG_VMX */
/*
diff -r 9413e453e83b -r 40b887fa79d0 xen/arch/x86/x86_32/entry.S
--- a/xen/arch/x86/x86_32/entry.S Fri Aug 12 17:25:49 2005
+++ b/xen/arch/x86/x86_32/entry.S Fri Aug 12 17:35:15 2005
@@ -183,6 +183,7 @@
#endif
+ ALIGN
restore_all_guest:
testl $X86_EFLAGS_VM,UREGS_eflags(%esp)
jnz restore_all_vm86
diff -r 9413e453e83b -r 40b887fa79d0 xen/arch/x86/x86_32/mm.c
--- a/xen/arch/x86/x86_32/mm.c Fri Aug 12 17:25:49 2005
+++ b/xen/arch/x86/x86_32/mm.c Fri Aug 12 17:35:15 2005
@@ -150,7 +150,7 @@
void subarch_init_memory(struct domain *dom_xen)
{
unsigned long m2p_start_mfn;
- int i;
+ unsigned int i, j;
/*
* We are rather picky about the layout of 'struct pfn_info'. The
@@ -174,12 +174,12 @@
{
m2p_start_mfn = l2e_get_pfn(
idle_pg_table_l2[l2_linear_offset(RDWR_MPT_VIRT_START) + i]);
- for ( i = 0; i < L2_PAGETABLE_ENTRIES; i++ )
+ for ( j = 0; j < L2_PAGETABLE_ENTRIES; j++ )
{
- frame_table[m2p_start_mfn+i].count_info = PGC_allocated | 1;
+ frame_table[m2p_start_mfn+j].count_info = PGC_allocated | 1;
/* Ensure it's only mapped read-only by domains. */
- frame_table[m2p_start_mfn+i].u.inuse.type_info = PGT_gdt_page | 1;
- page_set_owner(&frame_table[m2p_start_mfn+i], dom_xen);
+ frame_table[m2p_start_mfn+j].u.inuse.type_info = PGT_gdt_page | 1;
+ page_set_owner(&frame_table[m2p_start_mfn+j], dom_xen);
}
}
}
diff -r 9413e453e83b -r 40b887fa79d0 xen/common/dom0_ops.c
--- a/xen/common/dom0_ops.c Fri Aug 12 17:25:49 2005
+++ b/xen/common/dom0_ops.c Fri Aug 12 17:35:15 2005
@@ -293,19 +293,17 @@
v->cpumap = cpumap;
if ( cpumap == CPUMAP_RUNANYWHERE )
+ {
clear_bit(_VCPUF_cpu_pinned, &v->vcpu_flags);
+ }
else
{
/* pick a new cpu from the usable map */
int new_cpu = (int)find_first_set_bit(cpumap) % num_online_cpus();
vcpu_pause(v);
- if ( v->processor != new_cpu ){
- set_bit(_VCPUF_cpu_migrated, &v->vcpu_flags);
- arch_migrate_cpu(v, new_cpu);
- }
+ vcpu_migrate_cpu(v, new_cpu);
set_bit(_VCPUF_cpu_pinned, &v->vcpu_flags);
- v->processor = new_cpu;
vcpu_unpause(v);
}
diff -r 9413e453e83b -r 40b887fa79d0 xen/include/public/dom0_ops.h
--- a/xen/include/public/dom0_ops.h Fri Aug 12 17:25:49 2005
+++ b/xen/include/public/dom0_ops.h Fri Aug 12 17:35:15 2005
@@ -133,11 +133,12 @@
/*
* Set clock such that it would read <secs,nsecs> after 00:00:00 UTC,
* 1 January, 1970 if the current system time was <system_time>.
+ * NB. <secs> can be negative, but <nsecs> must always be non-negative.
*/
#define DOM0_SETTIME 17
typedef struct {
/* IN variables. */
- u32 secs;
+ s64 secs;
u32 nsecs;
u64 system_time;
} dom0_settime_t;
diff -r 9413e453e83b -r 40b887fa79d0 xen/include/public/xen.h
--- a/xen/include/public/xen.h Fri Aug 12 17:25:49 2005
+++ b/xen/include/public/xen.h Fri Aug 12 17:35:15 2005
@@ -399,11 +399,12 @@
/*
* Wallclock time: updated only by control software. Guests should base
- * their gettimeofday() syscall on this wallclock-base value.
+ * their gettimeofday() syscall on this wallclock-base value, which
+ * indicates UTC when system_time == 0 (i.e., at boot).
*/
u32 wc_version; /* Version counter: see vcpu_time_info_t. */
- u32 wc_sec; /* Secs 00:00:00 UTC, Jan 1, 1970. */
- u32 wc_nsec; /* Nsecs 00:00:00 UTC, Jan 1, 1970. */
+ u32 wc_nsec; /* Nsecs since 00:00:00 UTC, Jan 1, 1970. */
+ s64 wc_sec; /* Secs since 00:00:00 UTC, Jan 1, 1970. */
arch_shared_info_t arch;
diff -r 9413e453e83b -r 40b887fa79d0 xen/include/xen/domain.h
--- a/xen/include/xen/domain.h Fri Aug 12 17:25:49 2005
+++ b/xen/include/xen/domain.h Fri Aug 12 17:35:15 2005
@@ -14,10 +14,10 @@
extern void arch_do_boot_vcpu(struct vcpu *v);
-void arch_migrate_cpu(struct vcpu *v, int newcpu);
+extern int arch_set_info_guest(
+ struct vcpu *v, struct vcpu_guest_context *c);
-extern int arch_set_info_guest(
- struct vcpu *d, struct vcpu_guest_context *c);
+extern void vcpu_migrate_cpu(struct vcpu *v, int newcpu);
extern void free_perdomain_pt(struct domain *d);
diff -r 9413e453e83b -r 40b887fa79d0 xen/include/xen/time.h
--- a/xen/include/xen/time.h Fri Aug 12 17:25:49 2005
+++ b/xen/include/xen/time.h Fri Aug 12 17:35:15 2005
@@ -56,8 +56,7 @@
#define MICROSECS(_us) ((s_time_t)((_us) * 1000ULL))
extern void update_dom_time(struct vcpu *v);
-extern void do_settime(
- unsigned long secs, unsigned long nsecs, u64 system_time_base);
+extern void do_settime(s64 secs, u32 nsecs, u64 system_time_base);
#endif /* __XEN_TIME_H__ */
diff -r 9413e453e83b -r 40b887fa79d0
linux-2.6-xen-sparse/arch/xen/x86_64/kernel/init_task.c
--- a/linux-2.6-xen-sparse/arch/xen/x86_64/kernel/init_task.c Fri Aug 12
17:25:49 2005
+++ /dev/null Fri Aug 12 17:35:15 2005
@@ -1,49 +0,0 @@
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/init.h>
-#include <linux/init_task.h>
-#include <linux/fs.h>
-#include <linux/mqueue.h>
-
-#include <asm/uaccess.h>
-#include <asm/pgtable.h>
-#include <asm/desc.h>
-
-static struct fs_struct init_fs = INIT_FS;
-static struct files_struct init_files = INIT_FILES;
-static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
-static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
-/*
- * Initial task structure.
- *
- * We need to make sure that this is 8192-byte aligned due to the
- * way process stacks are handled. This is done by having a special
- * "init_task" linker map entry..
- */
-union thread_union init_thread_union
- __attribute__((__section__(".data.init_task"))) =
- { INIT_THREAD_INFO(init_task) };
-
-/*
- * Initial task structure.
- *
- * All other task structs will be allocated on slabs in fork.c
- */
-struct task_struct init_task = INIT_TASK(init_task);
-
-EXPORT_SYMBOL(init_task);
-/*
- * per-CPU TSS segments. Threads are completely 'soft' on Linux,
- * no more per-task TSS's. The TSS size is kept cacheline-aligned
- * so they are allowed to end up in the .data.cacheline_aligned
- * section. Since TSS's are completely CPU-local, we want them
- * on exact cacheline boundaries, to eliminate cacheline ping-pong.
- */
-DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp;
-
-#define ALIGN_TO_4K __attribute__((section(".data.init_task")))
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|