All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qemu-xen: fix cpu hotplug
@ 2010-09-02 13:17 Stefano Stabellini
  2010-09-02 17:30 ` Ian Jackson
  0 siblings, 1 reply; 9+ messages in thread
From: Stefano Stabellini @ 2010-09-02 13:17 UTC (permalink / raw)
  To: xen-devel

qemu-xen: fix cpu hotplug

The current xenstore watch path for a vcpu-set event is wrong and is
also wrong the code to parse it.
This patch fixes both of them: a xenstore vcpu hotplug command is of the
following form:

path: /local/domain/DOMID/cpu/VCPU_NUMBER/availability
values: "online" or "offline"

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

diff --git a/xenstore.c b/xenstore.c
index 6d24613..2c325ad 100644
--- a/xenstore.c
+++ b/xenstore.c
@@ -680,9 +680,12 @@ void xenstore_parse_domain_config(int hvm_domid)
     }
 
     /* Set a watch for vcpu-set */
-    if (pasprintf(&buf, "/local/domain/%u/cpu", domid) != -1) {
-        xs_watch(xsh, buf, "vcpu-set");
-        fprintf(logfile, "Watching %s\n", buf);
+    for (i = 0; i < vcpus; i++) {
+        if (pasprintf(&buf, "/local/domain/%u/cpu/%u/availability",
+                    domid, i) != -1) {
+            xs_watch(xsh, buf, "vcpu-set");
+            fprintf(logfile, "Watching %s\n", buf);
+        }
     }
 
     /* no need for ifdef CONFIG_STUBDOM, since in the qemu case
@@ -970,15 +973,14 @@ void xenstore_record_dm_state(const char *state)
 static void xenstore_process_vcpu_set_event(char **vec)
 {
     char *act = NULL;
-    char *vcpustr, *node = vec[XS_WATCH_PATH];
-    unsigned int vcpu, len;
+    char *node = vec[XS_WATCH_PATH];
+    unsigned int vcpu, len, domid;
 
-    vcpustr = strstr(node, "cpu/");
-    if (!vcpustr) {
-        fprintf(stderr, "vcpu-set: watch node error.\n");
+    if (sscanf(node, "/local/domain/%u/cpu/%u/availability",
+                &domid, &vcpu) <= 0) {
+        fprintf(stderr, "vcpu-set: watch node error, path=%s\n", node);
         return;
     }
-    sscanf(vcpustr, "cpu/%u", &vcpu);
 
     act = xs_read(xsh, XBT_NULL, node, &len);
     if (!act) {

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-09-06 11:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-02 13:17 [PATCH] qemu-xen: fix cpu hotplug Stefano Stabellini
2010-09-02 17:30 ` Ian Jackson
2010-09-03  6:28   ` Liu, Jinsong
2010-09-03  7:34     ` Christoph Egger
2010-09-03  7:47       ` Liu, Jinsong
2010-09-03 10:10         ` Stefano Stabellini
2010-09-03 17:27     ` Ian Jackson
2010-09-03 18:52       ` Liu, Jinsong
2010-09-06 11:00         ` Stefano Stabellini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.