Skip to contentSkip to conversation

Remove vcpu_avail from the S-Expression that's passed on the wire

PATCH In review Anthony Liguori 2 participants 3 messages Mar 28, 2006 – Mar 29, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove vcpu_avail from the S-Expression that's passed on the wire

Third time's a charm right :-)

vcpu_avail is the configuration parameter that's tripping us up on large SMP systems. Instead of modifying the XML-RPC layer, a much less invasive solution is just to remove vcpu_avail from the S-Expression that's passed over the wire. The vcpu_avail parameter is not used by xm so this seems like a pretty reasonable thing to do. It certainly feels less hacky.

Regards,

Anthony Liguori

# HG changeset patch
# User [email protected]
# Node ID 96c1e3c2d336a0f9cdb9e074c737e7026cede171
# Parent 4109c4e7804abeabe3b222673f2ba4dd1375be53
Remove vcpu_avail from the public S-Expression that's passed over the wire. This trips up the XML-RPC layer on large SMP systems and isn't actually used by xm.

tools/python/xen/xend/server/XMLRPCServer.py +17 -4
diff -r 4109c4e7804a -r 96c1e3c2d336 tools/python/xen/xend/server/XMLRPCServer.py
@@ -24,6 +24,7 @@
 
 from xen.xend.XendClient import XML_RPC_SOCKET, ERROR_INVALID_DOMAIN
 from xen.xend.XendError import *
+from types import ListType
 
 def lookup(domid):
     info = XendDomain.instance().domain_lookup_by_name_or_id(domid)
@@ -35,24 +36,36 @@
     info = lookup(domid)
     return getattr(info, fn)(*args)
 
+# vcpu_avail is a long and is not needed by the clients.  It's far easier
+# to just remove it then to try and marshal the long.
+def fixup_sxpr(sexpr):
+    ret = []
+    for k in sexpr:
+        if type(k) is ListType:
+            if len(k) != 2 or k[0] != 'vcpu_avail':
+                ret.append(fixup_sxpr(k))
+        else:
+            ret.append(k)
+    return ret
+
 def domain(domid):
     info = lookup(domid)
-    return info.sxpr()
+    return fixup_sxpr(info.sxpr())
 
 def domains(detail=1):
     if detail < 1:
         return XendDomain.instance().list_names()
     else:
         domains = XendDomain.instance().list_sorted()
-        return map(lambda dom: dom.sxpr(), domains)
+        return map(lambda dom: fixup_sxpr(dom.sxpr()), domains)
 
 def domain_create(config):
     info = XendDomain.instance().domain_create(config)
-    return info.sxpr()
+    return fixup_sxpr(info.sxpr())
 
 def domain_restore(src):
     info = XendDomain.instance().domain_restore(src)
-    return info.sxpr()    
+    return fixup_sxpr(info.sxpr())
 
 def get_log():
     f = open(XendLogging.getLogFilename(), 'r')

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

While looking into this bug, I realized that the vcpu_avail stuff in Xend is broken in general. If the guest uses sysfs for hotplugging, the vcpu_avail bitmap will be inconsistent. I've opened a bug in bugzilla about it that explains in more detail with my plan on how to clean this up for 3.0.3.

If the user uses sysfs to hotplug VCPUs, later calls to xm vcpu-set will result in the wrong thing happening. I don't think this is a show-stopper for 3.0.2 but we should at least document it.

http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=590

Regards,

Anthony Liguori

Quoted 79 lines · Anthony Liguori

Third time's a charm right :-)

vcpu_avail is the configuration parameter that's tripping us up on large SMP systems. Instead of modifying the XML-RPC layer, a much less invasive solution is just to remove vcpu_avail from the S-Expression that's passed over the wire. The vcpu_avail parameter is not used by xm so this seems like a pretty reasonable thing to do. It certainly feels less hacky.

Regards,

Anthony Liguori
------------------------------------------------------------------------

# HG changeset patch
# User [email protected]
# Node ID 96c1e3c2d336a0f9cdb9e074c737e7026cede171
# Parent 4109c4e7804abeabe3b222673f2ba4dd1375be53
Remove vcpu_avail from the public S-Expression that's passed over the wire. This trips up the XML-RPC layer on large SMP systems and isn't actually used by xm.

diff -r 4109c4e7804a -r 96c1e3c2d336 tools/python/xen/xend/server/XMLRPCServer.py

tools/python/xen/xend/server/XMLRPCServer.py +17 -5
@@ -24,6 +24,7 @@
 
 from xen.xend.XendClient import XML_RPC_SOCKET, ERROR_INVALID_DOMAIN
 from xen.xend.XendError import *
+from types import ListType
 
 def lookup(domid):
     info = XendDomain.instance().domain_lookup_by_name_or_id(domid)
@@ -35,24 +36,36 @@
     info = lookup(domid)
     return getattr(info, fn)(*args)
 
+# vcpu_avail is a long and is not needed by the clients.  It's far easier
+# to just remove it then to try and marshal the long.
+def fixup_sxpr(sexpr):
+    ret = []
+    for k in sexpr:
+        if type(k) is ListType:
+            if len(k) != 2 or k[0] != 'vcpu_avail':
+                ret.append(fixup_sxpr(k))
+        else:
+            ret.append(k)
+    return ret
+
 def domain(domid):
     info = lookup(domid)
-    return info.sxpr()
+    return fixup_sxpr(info.sxpr())
 
 def domains(detail=1):
     if detail < 1:
         return XendDomain.instance().list_names()
     else:
         domains = XendDomain.instance().list_sorted()
-        return map(lambda dom: dom.sxpr(), domains)
+        return map(lambda dom: fixup_sxpr(dom.sxpr()), domains)
 
 def domain_create(config):
     info = XendDomain.instance().domain_create(config)
-    return info.sxpr()
+    return fixup_sxpr(info.sxpr())
 
 def domain_restore(src):
     info = XendDomain.instance().domain_restore(src)
-    return info.sxpr()    
+    return fixup_sxpr(info.sxpr())
 
 def get_log():
     f = open(XendLogging.getLogFilename(), 'r')
 
------------------------------------------------------------------------

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 3 lines · Anthony Liguori

While looking into this bug, I realized that the vcpu_avail stuff in Xend is broken in general. If the guest uses sysfs for hotplugging, the vcpu_avail bitmap will be inconsistent. I've opened a bug in bugzilla about it that explains in more detail with my plan on how to clean this up for 3.0.3.

If the user uses sysfs to hotplug VCPUs, later calls to xm vcpu-set will result in the wrong thing happening. I don't think this is a show-stopper for 3.0.2 but we should at least document it.

If you think of the xenstore 'availability' keys as denoting which VCPUs are available for the guest to use if it wishes, but it doesn't necessarily need to have all online at the same time, then we do not need the guest kernel to update those fields in the xenstore. The current naming of those xenstore keys makes sense to me given the current semantics.

-- Keir