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

[Xen-changelog] Merged.



# HG changeset patch
# User emellor@xxxxxxxxxxxxxxxxxxxxxx
# Node ID 5019c8d034c42bc343000ff450ef90476846c2c3
# Parent  fa76c455af35d4129def2f846bfc7d6bdbb50b54
# Parent  9bf6f907b3ff0261902f06d261f76c1bd12af9f5
Merged.

diff -r fa76c455af35 -r 5019c8d034c4 
linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c     Wed Nov 16 10:31:57 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c     Wed Nov 16 10:32:14 2005
@@ -752,7 +752,7 @@
                irq_bindcount[dynirq_to_irq(i)] = 0;
 
                irq_desc[dynirq_to_irq(i)].status  = IRQ_DISABLED;
-               irq_desc[dynirq_to_irq(i)].action  = 0;
+               irq_desc[dynirq_to_irq(i)].action  = NULL;
                irq_desc[dynirq_to_irq(i)].depth   = 1;
                irq_desc[dynirq_to_irq(i)].handler = &dynirq_type;
        }
@@ -770,7 +770,7 @@
 #endif
 
                irq_desc[pirq_to_irq(i)].status  = IRQ_DISABLED;
-               irq_desc[pirq_to_irq(i)].action  = 0;
+               irq_desc[pirq_to_irq(i)].action  = NULL;
                irq_desc[pirq_to_irq(i)].depth   = 1;
                irq_desc[pirq_to_irq(i)].handler = &pirq_type;
        }
diff -r fa76c455af35 -r 5019c8d034c4 
linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c     Wed Nov 16 10:31:57 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c     Wed Nov 16 10:32:14 2005
@@ -188,7 +188,7 @@
        xenbus_resume();
 
 #ifdef CONFIG_SMP
-       for_each_present_cpu(i)
+       for_each_cpu(i)
                vcpu_prepare(i);
 
  out_reenable_cpus:
diff -r fa76c455af35 -r 5019c8d034c4 
linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c    Wed Nov 16 10:31:57 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/smpboot.c    Wed Nov 16 10:32:14 2005
@@ -277,6 +277,18 @@
 
 #ifdef CONFIG_HOTPLUG_CPU
 
+/*
+ * Initialize cpu_present_map late to skip SMP boot code in init/main.c.
+ * But do it early enough to catch critical for_each_present_cpu() loops
+ * in i386-specific code.
+ */
+static int __init initialize_cpu_present_map(void)
+{
+       cpu_present_map = cpu_possible_map;
+       return 0;
+}
+core_initcall(initialize_cpu_present_map);
+
 static void vcpu_hotplug(unsigned int cpu)
 {
        int err;
@@ -293,7 +305,6 @@
        }
 
        if (strcmp(state, "online") == 0) {
-               cpu_set(cpu, cpu_present_map);
                (void)cpu_up(cpu);
        } else if (strcmp(state, "offline") == 0) {
                (void)cpu_down(cpu);
diff -r fa76c455af35 -r 5019c8d034c4 
linux-2.6-xen-sparse/arch/xen/kernel/xen_proc.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/xen_proc.c   Wed Nov 16 10:31:57 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/xen_proc.c   Wed Nov 16 10:32:14 2005
@@ -1,6 +1,7 @@
 
 #include <linux/config.h>
 #include <linux/proc_fs.h>
+#include <asm-xen/xen_proc.h>
 
 static struct proc_dir_entry *xen_base;
 
diff -r fa76c455af35 -r 5019c8d034c4 linux-2.6-xen-sparse/drivers/acpi/tables.c
--- a/linux-2.6-xen-sparse/drivers/acpi/tables.c        Wed Nov 16 10:31:57 2005
+++ b/linux-2.6-xen-sparse/drivers/acpi/tables.c        Wed Nov 16 10:32:14 2005
@@ -565,7 +565,7 @@
  * 
  * result: sdt_entry[] is initialized
  */
-#ifdef CONFIG_XEN_X86
+#if defined(CONFIG_XEN_X86) || defined(CONFIG_XEN_X86_64)
 #define acpi_rsdp_phys_to_va(rsdp_phys) (__fix_to_virt(FIX_ACPI_RSDP_PAGE) + \
                                           (rsdp_phys & ~PAGE_MASK))
 #else
diff -r fa76c455af35 -r 5019c8d034c4 
linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c
--- a/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c   Wed Nov 16 10:31:57 2005
+++ b/linux-2.6-xen-sparse/drivers/char/tpm/tpm_xen.c   Wed Nov 16 10:32:14 2005
@@ -438,7 +438,7 @@
        &dev_attr_pcrs.attr,
        &dev_attr_caps.attr,
        &dev_attr_cancel.attr,
-       0,
+       NULL,
 };
 
 static struct attribute_group xen_attr_grp = { .attrs = xen_attrs };
diff -r fa76c455af35 -r 5019c8d034c4 
linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Wed Nov 16 
10:31:57 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c        Wed Nov 16 
10:32:14 2005
@@ -543,7 +543,7 @@
        spin_lock_init(&blkio_schedule_list_lock);
        INIT_LIST_HEAD(&blkio_schedule_list);
 
-       ret = kernel_thread(blkio_schedule, 0, CLONE_FS | CLONE_FILES);
+       ret = kernel_thread(blkio_schedule, NULL, CLONE_FS | CLONE_FILES);
        BUG_ON(ret < 0);
 
        blkif_xenbus_init();
diff -r fa76c455af35 -r 5019c8d034c4 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Wed Nov 16 
10:31:57 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c    Wed Nov 16 
10:32:14 2005
@@ -854,7 +854,7 @@
 {
        int ret = 0;
 
-        if(xenstored_ready > 0) 
+       if (xenstored_ready > 0) 
                ret = nb->notifier_call(nb, 0, NULL);
        else 
                notifier_chain_register(&xenstore_chain, nb);
@@ -884,7 +884,7 @@
        register_xenbus_watch(&be_watch);
 
        /* Notify others that xenstore is up */
-       notifier_call_chain(&xenstore_chain, 0, 0);
+       notifier_call_chain(&xenstore_chain, 0, NULL);
 }
 
 
diff -r fa76c455af35 -r 5019c8d034c4 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Wed Nov 16 10:31:57 2005
+++ b/tools/python/xen/xend/XendDomain.py       Wed Nov 16 10:32:14 2005
@@ -36,6 +36,7 @@
 from xen.xend.XendError import XendError
 from xen.xend.XendLogging import log
 from xen.xend.server import relocate
+from xen.xend.xenstore.xswatch import xswatch
 
 
 xc = xen.lowlevel.xc.new()
@@ -58,9 +59,11 @@
         # to import XendDomain from XendDomainInfo causes unbounded recursion.
         # So we stuff the XendDomain instance (self) into xroot's components.
         xroot.add_component("xen.xend.XendDomain", self)
+
         self.domains = {}
         self.domains_lock = threading.RLock()
-        self.watchReleaseDomain()
+
+        xswatch("@releaseDomain", self.onReleaseDomain)
 
         self.domains_lock.acquire()
         try:
@@ -112,11 +115,7 @@
             self.refresh()
         finally:
             self.domains_lock.release()
-            
-
-    def watchReleaseDomain(self):
-        from xen.xend.xenstore.xswatch import xswatch
-        self.releaseDomain = xswatch("@releaseDomain", self.onReleaseDomain)
+        return 1
 
 
     def xen_domains(self):
diff -r fa76c455af35 -r 5019c8d034c4 
tools/python/xen/xend/server/DevController.py
--- a/tools/python/xen/xend/server/DevController.py     Wed Nov 16 10:31:57 2005
+++ b/tools/python/xen/xend/server/DevController.py     Wed Nov 16 10:32:14 2005
@@ -29,6 +29,12 @@
 HOTPLUG_STATUS_NODE = "hotplug-status"
 HOTPLUG_STATUS_ERROR = "error"
 
+Connected = 1
+Died      = 2
+Error     = 3
+Missing   = 4
+Timeout   = 5
+
 xenbusState = {
     'Unknown'      : 0,
     'Initialising' : 1,
@@ -87,18 +93,28 @@
     def waitForDevice(self, devid):
         log.debug("Waiting for %s.", devid)
         
-        status, fn_ret = self.waitForBackend(devid)
-        if status:
+        status = self.waitForBackend(devid)
+
+        if status == Timeout:
             self.destroyDevice(devid)
-            raise VmError( ("Device %s (%s) could not be connected. "
-                            "Hotplug scripts not working") 
-                            % (devid, self.deviceClass))
-
-        elif fn_ret == HOTPLUG_STATUS_ERROR:
+            raise VmError("Device %s (%s) could not be connected. "
+                          "Hotplug scripts not working" %
+                          (devid, self.deviceClass))
+
+        elif status == Error:
             self.destroyDevice(devid)
-            raise VmError( ("Device %s (%s) could not be connected. "
-                            "Backend device not found!") 
-                            % (devid, self.deviceClass))
+            raise VmError("Device %s (%s) could not be connected. "
+                          "Backend device not found" %
+                          (devid, self.deviceClass))
+
+        elif status == Missing:
+            raise VmError("Device %s (%s) could not be connected. "
+                          "Device not found" % (devid, self.deviceClass))
+
+        elif status == Died:
+            self.destroyDevice(devid)
+            raise VmError("Device %s (%s) could not be connected. "
+                          "Device has died" % (devid, self.deviceClass))
 
 
     def reconfigureDevice(self, devid, config):
@@ -302,35 +318,22 @@
                 raise
 
 
-    def waitForBackend(self,devid):
-        ev = Event()
-
-        def hotplugStatus():
-            log.debug("hotplugStatus %d", devid)
-            
-            try:
-                status = self.readBackend(devid, HOTPLUG_STATUS_NODE)
-            except VmError:
-                status = "died"
-            if status is not None:
-                watch.xs.unwatch(backpath, watch)
-                hotplugStatus.value = status
-                ev.set()
-
-        hotplugStatus.value = None
+    def waitForBackend(self, devid):
+
         frontpath = self.frontendPath(devid)
         backpath = xstransact.Read(frontpath, "backend")
 
         if backpath:
-            watch = xswatch(backpath, hotplugStatus)
+            statusPath = backpath + '/' + HOTPLUG_STATUS_NODE
+            ev = Event()
+            result = { 'status': Timeout }
+            
+            xswatch(statusPath, hotplugStatusCallback, statusPath, ev, result)
 
             ev.wait(DEVICE_CREATE_TIMEOUT)
-            if ev.isSet():
-                return (0, hotplugStatus.value)
-            else:
-                return (-1, hotplugStatus.value)
-        else:
-            return (-1, "missing")
+            return result['status']
+        else:
+            return Missing
 
 
     def backendPath(self, backdom, devid):
@@ -352,3 +355,25 @@
     def frontendMiscPath(self):
         return "%s/device-misc/%s" % (self.vm.getDomainPath(),
                                       self.deviceClass)
+
+
+def hotplugStatusCallback(statusPath, ev, result):
+    log.debug("hotplugStatusCallback %s.", statusPath)
+
+    try:
+        status = xstransact.Read(statusPath)
+
+        if status is not None:
+            if status == HOTPLUG_STATUS_ERROR:
+                result['status'] = Error
+            else:
+                result['status'] = Connected
+        else:
+            return 1
+    except VmError:
+        result['status'] = Died
+
+    log.debug("hotplugStatusCallback %d.", result['status'])
+
+    ev.set()
+    return 0
diff -r fa76c455af35 -r 5019c8d034c4 
tools/python/xen/xend/xenstore/xstransact.py
--- a/tools/python/xen/xend/xenstore/xstransact.py      Wed Nov 16 10:31:57 2005
+++ b/tools/python/xen/xend/xenstore/xstransact.py      Wed Nov 16 10:32:14 2005
@@ -177,18 +177,15 @@
                 (key, fn, defval) = tup
 
             val = self._read(key)
-            # If fn is str, then this will successfully convert None to
-            # 'None'.  If it is int, then it will throw TypeError on None, or
-            # on any other non-integer value.  We have to, therefore, both
-            # check explicitly for None, and catch TypeError.  Either failure
-            # will result in defval being used instead.
+            # If fn is str, then this will successfully convert None to 'None'
+            # (which we don't want).  If it is int or float, then it will
+            # throw ValueError on any non-convertible value.  We check
+            # explicitly for None, using defval instead, but allow ValueError
+            # to propagate.
             if val is None:
                 val = defval
             else:
-                try:
-                    val = fn(val)
-                except TypeError:
-                    val = defval
+                val = fn(val)
             ret.append(val)
         if len(ret) == 1:
             return ret[0]
diff -r fa76c455af35 -r 5019c8d034c4 tools/python/xen/xend/xenstore/xswatch.py
--- a/tools/python/xen/xend/xenstore/xswatch.py Wed Nov 16 10:31:57 2005
+++ b/tools/python/xen/xend/xenstore/xswatch.py Wed Nov 16 10:32:14 2005
@@ -5,9 +5,7 @@
 # Public License.  See the file "COPYING" in the main directory of
 # this archive for more details.
 
-import select
 import threading
-from xen.lowlevel import xs
 from xen.xend.xenstore.xsutil import xshandle
 
 from xen.xend.XendLogging import log
@@ -15,42 +13,45 @@
 
 class xswatch:
 
-    watchThread = None
-    xs = None
-    xslock = threading.Lock()
-    
     def __init__(self, path, fn, *args, **kwargs):
+        self.path = path
         self.fn = fn
         self.args = args
         self.kwargs = kwargs
-        xswatch.watchStart()
-        xswatch.xs.watch(path, self)
-
-    def watchStart(cls):
-        cls.xslock.acquire()
-        if cls.watchThread:
-            cls.xslock.release()
-            return
-        cls.xs = xshandle()
-        cls.watchThread = threading.Thread(name="Watcher",
-                                           target=cls.watchMain)
-        cls.watchThread.setDaemon(True)
-        cls.watchThread.start()
-        cls.xslock.release()
-
-    watchStart = classmethod(watchStart)
-
-    def watchMain(cls):
-        while True:
-            try:
-                we = cls.xs.read_watch()
-                watch = we[1]
-                watch.fn(*watch.args, **watch.kwargs)
-            except:
-                log.exception("read_watch failed")
-                # Ignore this exception -- there's no point throwing it
-                # further on because that will just kill the watcher thread,
-                # which achieves nothing.
+        watchStart()
+        xs.watch(path, self)
 
 
-    watchMain = classmethod(watchMain)
+watchThread = None
+xs = None
+xslock = threading.Lock()
+
+def watchStart():
+    global watchThread
+    global xs
+    
+    xslock.acquire()
+    try:
+        if watchThread:
+            return
+        xs = xshandle()
+        watchThread = threading.Thread(name="Watcher", target=watchMain)
+        watchThread.setDaemon(True)
+        watchThread.start()
+    finally:
+        xslock.release()
+
+
+def watchMain():
+    while True:
+        try:
+            we = xs.read_watch()
+            watch = we[1]
+            res = watch.fn(*watch.args, **watch.kwargs)
+            if not res:
+                xs.unwatch(watch.path, watch)
+        except:
+            log.exception("read_watch failed")
+            # Ignore this exception -- there's no point throwing it
+            # further on because that will just kill the watcher thread,
+            # which achieves nothing.

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


 


Rackspace

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