Skip to contentSkip to conversation

qemu-trad: xenstore: use relative path for device-model node

PATCH Superseded Wei Liu 3 participants 7 messages Mar 30, 2015 – Apr 9, 2015

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 qemu-trad: xenstore: use relative path for device-model node

For QEMU traditional stubdom, this is incompatible startup protocol change. This change needs to work with corresponding libxl changeset. QEMU traditional is shipped with Xen so we are allowed to do such change.

For QEMU traditional running in Dom0, there is no functional change because it will still write to the same /local/domain/0 path.

---
 xenstore.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
xenstore.c +12 -12
index b0d6f77..09319c7 100644
@@ -711,7 +711,7 @@ void xenstore_parse_domain_config(int hvm_domid)
 
 
     /* Set a watch for log-dirty commands from the migration tools */
-    if (pasprintf(&buf, "/local/domain/0/device-model/%u/logdirty/cmd",
+    if (pasprintf(&buf, "device-model/%u/logdirty/cmd",
                   domid) != -1) {
         xs_watch(xsh, buf, "logdirty");
         fprintf(logfile, "Watching %s\n", buf);
@@ -719,7 +719,7 @@ void xenstore_parse_domain_config(int hvm_domid)
 
     /* Set a watch for suspend requests from the migration tools */
     if (pasprintf(&buf, 
-                  "/local/domain/0/device-model/%u/command", domid) != -1) {
+                  "device-model/%u/command", domid) != -1) {
         xs_watch(xsh, buf, "dm-command");
         fprintf(logfile, "Watching %s\n", buf);
     }
@@ -777,7 +777,7 @@ int xenstore_parse_disable_pf_config ()
     int disable_pf = 0;
     unsigned int len;
 
-    if (pasprintf(&buf, "/local/domain/0/device-model/%u/disable_pf",domid) == -1)
+    if (pasprintf(&buf, "device-model/%u/disable_pf",domid) == -1)
         goto out;
 
     params = xs_read(xsh, XBT_NULL, buf, &len);
@@ -808,13 +808,13 @@ static void xenstore_process_logdirty_event(void)
 
     /* Remember the paths for the command and response entries */
     if (pasprintf(&ret_path,
-                "/local/domain/0/device-model/%u/logdirty/ret",
+                "device-model/%u/logdirty/ret",
                 domid) == -1) {
         fprintf(logfile, "Log-dirty: out of memory\n");
         exit(1);
     }
     if (pasprintf(&cmd_path,
-                "/local/domain/0/device-model/%u/logdirty/cmd",
+                "device-model/%u/logdirty/cmd",
                 domid) == -1) {
         fprintf(logfile, "Log-dirty: out of memory\n");
         exit(1);
@@ -855,7 +855,7 @@ static void xenstore_process_dm_command_event(void)
     unsigned int len;
 
     if (pasprintf(&path, 
-                  "/local/domain/0/device-model/%u/command", domid) == -1) {
+                  "device-model/%u/command", domid) == -1) {
         fprintf(logfile, "out of memory reading dm command\n");
         goto out;
     }
@@ -875,7 +875,7 @@ static void xenstore_process_dm_command_event(void)
     } else if (!strncmp(command, "usb-add", len)) {
         fprintf(logfile, "dm-command: usb-add a usb device\n");
         if (pasprintf(&path,
-                "/local/domain/0/device-model/%u/parameter", domid) == -1) {
+                "device-model/%u/parameter", domid) == -1) {
             fprintf(logfile, "out of memory reading dm command parameter\n");
             goto out;
         }
@@ -889,7 +889,7 @@ static void xenstore_process_dm_command_event(void)
     } else if (!strncmp(command, "usb-del", len)) {
         fprintf(logfile, "dm-command: usb-del a usb device\n");
         if (pasprintf(&path,
-                "/local/domain/0/device-model/%u/parameter", domid) == -1) {
+                "device-model/%u/parameter", domid) == -1) {
             fprintf(logfile, "out of memory reading dm command parameter\n");
             goto out;
         }
@@ -905,7 +905,7 @@ static void xenstore_process_dm_command_event(void)
         fprintf(logfile, "dm-command: hot remove pass-through pci dev \n");
 
         if (pasprintf(&path, 
-                      "/local/domain/0/device-model/%u/parameter", domid) == -1) {
+                      "device-model/%u/parameter", domid) == -1) {
             fprintf(logfile, "out of memory reading dm command parameter\n");
             goto out;
         }
@@ -919,7 +919,7 @@ static void xenstore_process_dm_command_event(void)
         fprintf(logfile, "dm-command: hot insert pass-through pci dev \n");
 
         if (pasprintf(&path, 
-                      "/local/domain/0/device-model/%u/parameter", domid) == -1) {
+                      "device-model/%u/parameter", domid) == -1) {
             fprintf(logfile, "out of memory reading dm command parameter\n");
             goto out;
         }
@@ -944,7 +944,7 @@ void xenstore_record_dm(const char *subpath, const char *state)
     char *path = NULL;
 
     if (pasprintf(&path, 
-                  "/local/domain/0/device-model/%u/%s", domid, subpath) == -1) {
+                  "device-model/%u/%s", domid, subpath) == -1) {
         fprintf(logfile, "out of memory recording dm \n");
         goto out;
     }
@@ -1521,7 +1521,7 @@ char *xenstore_device_model_read(int domid, const char *key, unsigned int *len)
 {
     char *path = NULL, *value = NULL;
 
-    if (pasprintf(&path, "/local/domain/0/device-model/%d/%s", domid, key) == -1)
+    if (pasprintf(&path, "device-model/%d/%s", domid, key) == -1)
         return NULL;
 
     value = xs_read(xsh, XBT_NULL, path, len);
Signature · 1 line
1.9.1
#1 lore raw
Quoted 10 lines · Wei Liu

For QEMU traditional stubdom, this is incompatible startup protocol change. This change needs to work with corresponding libxl changeset. QEMU traditional is shipped with Xen so we are allowed to do such change.

For QEMU traditional running in Dom0, there is no functional change because it will still write to the same /local/domain/0 path.

For the change, Reviewed-by: Andrew Cooper <[email protected]>

However, it would be nice if you also unsplit the pasprintf() calls. It looks as if all of them should fit on a single line now.

~Andrew

Quoted 114 lines
---
 xenstore.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
xenstore.c +12 -12
index b0d6f77..09319c7 100644
@@ -711,7 +711,7 @@ void xenstore_parse_domain_config(int hvm_domid)
 
 
     /* Set a watch for log-dirty commands from the migration tools */
-    if (pasprintf(&buf, "/local/domain/0/device-model/%u/logdirty/cmd",
+    if (pasprintf(&buf, "device-model/%u/logdirty/cmd",
                   domid) != -1) {
         xs_watch(xsh, buf, "logdirty");
         fprintf(logfile, "Watching %s\n", buf);
@@ -719,7 +719,7 @@ void xenstore_parse_domain_config(int hvm_domid)
 
     /* Set a watch for suspend requests from the migration tools */
     if (pasprintf(&buf, 
-                  "/local/domain/0/device-model/%u/command", domid) != -1) {
+                  "device-model/%u/command", domid) != -1) {
         xs_watch(xsh, buf, "dm-command");
         fprintf(logfile, "Watching %s\n", buf);
     }
@@ -777,7 +777,7 @@ int xenstore_parse_disable_pf_config ()
     int disable_pf = 0;
     unsigned int len;
 
-    if (pasprintf(&buf, "/local/domain/0/device-model/%u/disable_pf",domid) == -1)
+    if (pasprintf(&buf, "device-model/%u/disable_pf",domid) == -1)
         goto out;
 
     params = xs_read(xsh, XBT_NULL, buf, &len);
@@ -808,13 +808,13 @@ static void xenstore_process_logdirty_event(void)
 
     /* Remember the paths for the command and response entries */
     if (pasprintf(&ret_path,
-                "/local/domain/0/device-model/%u/logdirty/ret",
+                "device-model/%u/logdirty/ret",
                 domid) == -1) {
         fprintf(logfile, "Log-dirty: out of memory\n");
         exit(1);
     }
     if (pasprintf(&cmd_path,
-                "/local/domain/0/device-model/%u/logdirty/cmd",
+                "device-model/%u/logdirty/cmd",
                 domid) == -1) {
         fprintf(logfile, "Log-dirty: out of memory\n");
         exit(1);
@@ -855,7 +855,7 @@ static void xenstore_process_dm_command_event(void)
     unsigned int len;
 
     if (pasprintf(&path, 
-                  "/local/domain/0/device-model/%u/command", domid) == -1) {
+                  "device-model/%u/command", domid) == -1) {
         fprintf(logfile, "out of memory reading dm command\n");
         goto out;
     }
@@ -875,7 +875,7 @@ static void xenstore_process_dm_command_event(void)
     } else if (!strncmp(command, "usb-add", len)) {
         fprintf(logfile, "dm-command: usb-add a usb device\n");
         if (pasprintf(&path,
-                "/local/domain/0/device-model/%u/parameter", domid) == -1) {
+                "device-model/%u/parameter", domid) == -1) {
             fprintf(logfile, "out of memory reading dm command parameter\n");
             goto out;
         }
@@ -889,7 +889,7 @@ static void xenstore_process_dm_command_event(void)
     } else if (!strncmp(command, "usb-del", len)) {
         fprintf(logfile, "dm-command: usb-del a usb device\n");
         if (pasprintf(&path,
-                "/local/domain/0/device-model/%u/parameter", domid) == -1) {
+                "device-model/%u/parameter", domid) == -1) {
             fprintf(logfile, "out of memory reading dm command parameter\n");
             goto out;
         }
@@ -905,7 +905,7 @@ static void xenstore_process_dm_command_event(void)
         fprintf(logfile, "dm-command: hot remove pass-through pci dev \n");
 
         if (pasprintf(&path, 
-                      "/local/domain/0/device-model/%u/parameter", domid) == -1) {
+                      "device-model/%u/parameter", domid) == -1) {
             fprintf(logfile, "out of memory reading dm command parameter\n");
             goto out;
         }
@@ -919,7 +919,7 @@ static void xenstore_process_dm_command_event(void)
         fprintf(logfile, "dm-command: hot insert pass-through pci dev \n");
 
         if (pasprintf(&path, 
-                      "/local/domain/0/device-model/%u/parameter", domid) == -1) {
+                      "device-model/%u/parameter", domid) == -1) {
             fprintf(logfile, "out of memory reading dm command parameter\n");
             goto out;
         }
@@ -944,7 +944,7 @@ void xenstore_record_dm(const char *subpath, const char *state)
     char *path = NULL;
 
     if (pasprintf(&path, 
-                  "/local/domain/0/device-model/%u/%s", domid, subpath) == -1) {
+                  "device-model/%u/%s", domid, subpath) == -1) {
         fprintf(logfile, "out of memory recording dm \n");
         goto out;
     }
@@ -1521,7 +1521,7 @@ char *xenstore_device_model_read(int domid, const char *key, unsigned int *len)
 {
     char *path = NULL, *value = NULL;
 
-    if (pasprintf(&path, "/local/domain/0/device-model/%d/%s", domid, key) == -1)
+    if (pasprintf(&path, "device-model/%d/%s", domid, key) == -1)
         return NULL;
 
     value = xs_read(xsh, XBT_NULL, path, len);
#2 lore raw

PATCH 1/1 qemu-trad: xenstore: use relative path for device-model node

In reply to Wei Liu

Wei Liu writes ("[PATCH] qemu-trad: xenstore: use relative path for device-model node"):

Quoted 7 lines

For QEMU traditional stubdom, this is incompatible startup protocol change. This change needs to work with corresponding libxl changeset. QEMU traditional is shipped with Xen so we are allowed to do such change.

For QEMU traditional running in Dom0, there is no functional change because it will still write to the same /local/domain/0 path.

I think you mean:

For QEMU traditional running in Dom0, there is no functional change because it will still write to the same /local/domain/0 path.

For QEMU traditional stubdom, this is an incompatible startup protocol change. There is a corresponding libxl changeset "libxl:
use new QEMU xenstore protocol", which has not yet been committed (54c2e621 was reverted in 84066dd4).

QEMU traditional stubdom was broken by #### and is still broken in -unstable, so this incompatible change is not a regression.

where #### is some commit I haven't been able to easily identify.

Is that right ?

Thanks,
Ian.

author
#3 lore raw
Quoted 11 lines · Ian Jackson

Wei Liu writes ("[PATCH] qemu-trad: xenstore: use relative path for device-model node"):

Quoted 7 lines

For QEMU traditional stubdom, this is incompatible startup protocol change. This change needs to work with corresponding libxl changeset. QEMU traditional is shipped with Xen so we are allowed to do such change.

For QEMU traditional running in Dom0, there is no functional change because it will still write to the same /local/domain/0 path.

I think you mean:

Quoted 8 lines

For QEMU traditional running in Dom0, there is no functional change because it will still write to the same /local/domain/0 path.

For QEMU traditional stubdom, this is an incompatible startup protocol change. There is a corresponding libxl changeset "libxl:
use new QEMU xenstore protocol", which has not yet been committed (54c2e621 was reverted in 84066dd4).

So far so good.

Quoted 3 lines

QEMU traditional stubdom was broken by #### and is still broken in -unstable, so this incompatible change is not a regression.

It's complicated.

QEMU traditional stubdom was broken by a0731cca "ioreq-server: on-demand creation of ioreq server" in 4.5. Currently there is a workaround in -unstable dd748d12 "x86/hvm: wait for at least one ioreq server to be enabled" (which should be backported to 4.5). QEMU traditional stubdom works with that workaround in -unstable but it's not ideal situation.

This incompatible change is not a regression because we don't change the protocol 4.5 uses. We will only use the new protocol for -unstable.

Wei.

Quoted 6 lines

where #### is some commit I haven't been able to easily identify.

Is that right ?

Thanks,
Ian.

#4 lore raw

Wei Liu writes ("Re: [PATCH] qemu-trad: xenstore: use relative path for device-model node"):

Quoted 11 lines · Ian Jackson
Quoted 3 lines

I think you mean:
...

So far so good.

Quoted 3 lines

QEMU traditional stubdom was broken by #### and is still broken in -unstable, so this incompatible change is not a regression.

Quoted 7 lines

It's complicated.

QEMU traditional stubdom was broken by a0731cca "ioreq-server: on-demand creation of ioreq server" in 4.5. Currently there is a workaround in -unstable dd748d12 "x86/hvm: wait for at least one ioreq server to be enabled" (which should be backported to 4.5). QEMU traditional stubdom works with that workaround in -unstable but it's not ideal situation.

Right. So that means that this patch needs to go in at the same time as the corresponding libxl change.

Quoted 2 lines

This incompatible change is not a regression because we don't change the protocol 4.5 uses. We will only use the new protocol for -unstable.

I meant, is it a regression in -unstable from earlier -unstable ?

And the answer is that unless both libxl and qemu change at the same time, it would be a regression in -unstable ?

Ian.

author
#5 lore raw
Quoted 14 lines · Ian Jackson

Wei Liu writes ("Re: [PATCH] qemu-trad: xenstore: use relative path for device-model node"):

Quoted 13 lines · Ian Jackson
Quoted 3 lines

I think you mean:
...

So far so good.

Quoted 3 lines

QEMU traditional stubdom was broken by #### and is still broken in -unstable, so this incompatible change is not a regression.

It's complicated.

Quoted 9 lines
Quoted 5 lines

QEMU traditional stubdom was broken by a0731cca "ioreq-server: on-demand creation of ioreq server" in 4.5. Currently there is a workaround in -unstable dd748d12 "x86/hvm: wait for at least one ioreq server to be enabled" (which should be backported to 4.5). QEMU traditional stubdom works with that workaround in -unstable but it's not ideal situation.

Right. So that means that this patch needs to go in at the same time as the corresponding libxl change.

I don't follow "go in at the same time". They are in two different trees, don't they?

Quoted 8 lines
Quoted 2 lines

This incompatible change is not a regression because we don't change the protocol 4.5 uses. We will only use the new protocol for -unstable.

I meant, is it a regression in -unstable from earlier -unstable ?

And the answer is that unless both libxl and qemu change at the same time, it would be a regression in -unstable ?

It would be a regression because stubdom in -unstable is working now with Paul's workaround. So yes, both changes need to go in at the same time -- though I don't know how you would do that.

Wei.

Quoted 1 line

Ian.

#6 lore raw

Wei Liu writes ("Re: [PATCH] qemu-trad: xenstore: use relative path for device-model node"):

Quoted 6 lines · Ian Jackson
Quoted 2 lines

Right. So that means that this patch needs to go in at the same time as the corresponding libxl change.

I don't follow "go in at the same time". They are in two different trees, don't they?

The commit id of the qemu-trad tree is in Config.mk in xen.git. So it is possible to update them "simultaneously". (Of course not every way of building and deploying Xen will honour this, but if you don't honour it you deserve what you get.)

Quoted 6 lines
Quoted 2 lines

And the answer is that unless both libxl and qemu change at the same time, it would be a regression in -unstable ?

It would be a regression because stubdom in -unstable is working now with Paul's workaround. So yes, both changes need to go in at the same time -- though I don't know how you would do that.

Right. That's what the Config.mk update is for.

So if the libxl patch is otherwise ready, we can commit both at once. I will commit and push to qemu-trad, update the libxl patch to contain the Config.mk update as well, and push the result to xen.git.

We normally explain the need to do this in the commit message for the patches, and cross reference the two commits.

Ian.