Skip to contentSkip to conversation

libxl: Fix vcpu-set for PV guest.

PATCH In review Anthony PERARD 3 participants 4 messages Jan 31, 2014 – Feb 6, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl: Fix vcpu-set for PV guest.

vcpu-set will try to use the HVM path (through QEMU) instead of the PV path (through xenstore) for a PV guest, if there is a QEMU running for this domain. This patch check which kind of guest is running before before doing any call.

---

Yun, is this patch fix the issue with your PV guest ?

 tools/libxl/libxl.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
tools/libxl/libxl.c +14 -5
index 2845ca4..c4fe6af 100644
@@ -4692,12 +4692,21 @@ int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap *cpumap)
 {
     GC_INIT(ctx);
     int rc;
-    switch (libxl__device_model_version_running(gc, domid)) {
-    case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-        rc = libxl__set_vcpuonline_xenstore(gc, domid, cpumap);
+    switch (libxl__domain_type(gc, domid)) {
+    case LIBXL_DOMAIN_TYPE_HVM:
+        switch (libxl__device_model_version_running(gc, domid)) {
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
+            rc = libxl__set_vcpuonline_xenstore(gc, domid, cpumap);
+            break;
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
+            rc = libxl__set_vcpuonline_qmp(gc, domid, cpumap);
+            break;
+        default:
+            rc = ERROR_INVAL;
+        }
         break;
-    case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-        rc = libxl__set_vcpuonline_qmp(gc, domid, cpumap);
+    case LIBXL_DOMAIN_TYPE_PV:
+        rc = libxl__set_vcpuonline_xenstore(gc, domid, cpumap);
         break;
     default:
         rc = ERROR_INVAL;
Signature · 1 line
Anthony PERARD
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Anthony PERARD

vcpu-set will try to use the HVM path (through QEMU) instead of the PV path (through xenstore) for a PV guest, if there is a QEMU running for this domain. This patch check which kind of guest is running before before doing any call.

Quoted 3 lines

---

Yun, is this patch fix the issue with your PV guest ?

Yun, any feedback on this patch?

George -- I think vcpu-set not working for PV guests is a bug worth fixing in 4.4 so I intend to apply.

Quoted 36 lines

 tools/libxl/libxl.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
tools/libxl/libxl.c +14 -5
index 2845ca4..c4fe6af 100644
@@ -4692,12 +4692,21 @@ int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap *cpumap)
 {
     GC_INIT(ctx);
     int rc;
-    switch (libxl__device_model_version_running(gc, domid)) {
-    case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-        rc = libxl__set_vcpuonline_xenstore(gc, domid, cpumap);
+    switch (libxl__domain_type(gc, domid)) {
+    case LIBXL_DOMAIN_TYPE_HVM:
+        switch (libxl__device_model_version_running(gc, domid)) {
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
+            rc = libxl__set_vcpuonline_xenstore(gc, domid, cpumap);
+            break;
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
+            rc = libxl__set_vcpuonline_qmp(gc, domid, cpumap);
+            break;
+        default:
+            rc = ERROR_INVAL;
+        }
         break;
-    case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-        rc = libxl__set_vcpuonline_qmp(gc, domid, cpumap);
+    case LIBXL_DOMAIN_TYPE_PV:
+        rc = libxl__set_vcpuonline_xenstore(gc, domid, cpumap);
         break;
     default:
         rc = ERROR_INVAL;
#2 lore raw
Quoted 9 lines · Ian Campbell
Quoted 6 lines · Anthony PERARD

vcpu-set will try to use the HVM path (through QEMU) instead of the PV path (through xenstore) for a PV guest, if there is a QEMU running for this domain. This patch check which kind of guest is running before before doing any call.

Quoted 7 lines
Quoted 3 lines

---

Yun, is this patch fix the issue with your PV guest ?

Yun, any feedback on this patch?

George -- I think vcpu-set not working for PV guests is a bug worth fixing in 4.4 so I intend to apply.

Yes, please do.

-George

Quoted 37 lines
Quoted 36 lines

  tools/libxl/libxl.c | 19 ++++++++++++++-----
  1 file changed, 14 insertions(+), 5 deletions(-)
tools/libxl/libxl.c +14 -5
index 2845ca4..c4fe6af 100644
@@ -4692,12 +4692,21 @@ int libxl_set_vcpuonline(libxl_ctx *ctx, uint32_t domid, libxl_bitmap *cpumap)
  {
      GC_INIT(ctx);
      int rc;
-    switch (libxl__device_model_version_running(gc, domid)) {
-    case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-        rc = libxl__set_vcpuonline_xenstore(gc, domid, cpumap);
+    switch (libxl__domain_type(gc, domid)) {
+    case LIBXL_DOMAIN_TYPE_HVM:
+        switch (libxl__device_model_version_running(gc, domid)) {
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
+            rc = libxl__set_vcpuonline_xenstore(gc, domid, cpumap);
+            break;
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
+            rc = libxl__set_vcpuonline_qmp(gc, domid, cpumap);
+            break;
+        default:
+            rc = ERROR_INVAL;
+        }
          break;
-    case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
-        rc = libxl__set_vcpuonline_qmp(gc, domid, cpumap);
+    case LIBXL_DOMAIN_TYPE_PV:
+        rc = libxl__set_vcpuonline_xenstore(gc, domid, cpumap);
          break;
      default:
          rc = ERROR_INVAL;
#3 lore raw
Quoted 12 lines · George Dunlap
Quoted 11 lines · Ian Campbell
Quoted 6 lines · Anthony PERARD

vcpu-set will try to use the HVM path (through QEMU) instead of the PV path (through xenstore) for a PV guest, if there is a QEMU running for this domain. This patch check which kind of guest is running before before doing any call.

Quoted 2 lines

---

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Yun, is this patch fix the issue with your PV guest ?

Yun, any feedback on this patch?

George -- I think vcpu-set not working for PV guests is a bug worth fixing in 4.4 so I intend to apply.

Yes, please do.

Done. Thanks.