Skip to contentSkip to conversation

tools/libxl: Switch Arm guest type to PVH

PATCH Superseded Julien Grall 3 participants 19 messages Aug 22, 2018 – Oct 1, 2018

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover tools/libxl: Switch Arm guest type to PVH

Hi all,

This small patch series adds switch Arm guest type to PVH in libxl. See patch #2 for the rationale.

Cheers,

Julien Grall (2):
tools/libxl: Rename libxl__arch_domain_build_info_acpi_setdefault

    to...

tools/libxl: Switch Arm guest type to PVH

 docs/man/xl.cfg.pod.5.in   |  3 ++-
 tools/libxl/libxl_arch.h   |  4 ++--
 tools/libxl/libxl_arm.c    | 41 ++++++++++++++++++++++++++++++++++++++---
 tools/libxl/libxl_create.c |  2 +-
 tools/libxl/libxl_x86.c    |  4 ++--
 tools/xl/xl_parse.c        |  4 ++++
 6 files changed, 49 insertions(+), 9 deletions(-)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH 1/2 tools/libxl: Rename libxl__arch_domain_build_info_acpi_setdefault to...

libxl__arch_domain_build_info_setdefault

A follow-up will require to modify default of multiple fields of build_info. So rename the function accordingly.

---
 tools/libxl/libxl_arch.h   | 3 +--
 tools/libxl/libxl_arm.c    | 4 ++--
 tools/libxl/libxl_create.c | 2 +-
 tools/libxl/libxl_x86.c    | 3 +--
 4 files changed, 5 insertions(+), 7 deletions(-)
tools/libxl/libxl_arch.h +1 -2
index c8ccaaf14c..5ab0c95974 100644
@@ -65,8 +65,7 @@ _hidden
 int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq);
 
 _hidden
-void libxl__arch_domain_build_info_acpi_setdefault(
-                                        libxl_domain_build_info *b_info);
+void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info);
 
 _hidden
 int libxl__arch_extra_memory(libxl__gc *gc,
tools/libxl/libxl_arm.c +2 -2
index 3ee37d2d12..18c41f4ee9 100644
@@ -1135,9 +1135,9 @@ int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq)
     return xc_domain_bind_pt_spi_irq(CTX->xch, domid, irq, irq);
 }
 
-void libxl__arch_domain_build_info_acpi_setdefault(
-                                        libxl_domain_build_info *b_info)
+void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info)
 {
+    /* ACPI is disabled by default */
     libxl_defbool_setdefault(&b_info->acpi, false);
 }
 
tools/libxl/libxl_create.c +1 -1
index b7b44e280b..d4fa06daea 100644
@@ -215,7 +215,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
     if (!b_info->event_channels)
         b_info->event_channels = 1023;
 
-    libxl__arch_domain_build_info_acpi_setdefault(b_info);
+    libxl__arch_domain_build_info_setdefault(b_info);
     libxl_defbool_setdefault(&b_info->dm_restrict, false);
 
     switch (b_info->type) {
tools/libxl/libxl_x86.c +1 -2
index 6f670b03b5..81523a568f 100644
@@ -613,8 +613,7 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
     return rc;
 }
 
-void libxl__arch_domain_build_info_acpi_setdefault(
-                                        libxl_domain_build_info *b_info)
+void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info)
 {
     libxl_defbool_setdefault(&b_info->acpi, true);
 }
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] tools/libxl: Rename libxl__arch_domain_build_info_acpi_setdefault to...

Quoted 4 lines · Julien Grall

libxl__arch_domain_build_info_setdefault

A follow-up will require to modify default of multiple fields of build_info. So rename the function accordingly.

No functional change.

Quoted 2 lines

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by
#3 lore raw

Re: [PATCH 1/2] tools/libxl: Rename libxl__arch_domain_build_info_acpi_setdefault to...

Quoted 6 lines · Roger Pau Monné
Quoted 4 lines · Julien Grall

libxl__arch_domain_build_info_setdefault

A follow-up will require to modify default of multiple fields of build_info. So rename the function accordingly.

Quoted 6 lines

No functional change.

Quoted 2 lines

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw

PATCH 2/2 tools/libxl: Switch Arm guest type to PVH

In reply to Julien Grall

Currently, the toolstack is considering Arm guest always PV. However, they are very similar to PVH because HW virtualization extension are used and QEMU is not started. So switch Arm guest type to PVH.

To keep compatibility with toolstack creating Arm guest with PV type (e.g libvirt), libxl will now convert those guests to PVH.

Furthermore, the default type for Arm in xl will now be PVH to allow smooth transition for user.

---

This was discussed at Xen Summit and also in various thread on xen-devel. The latest one was when Andrew sent a patch to deny guest creation on Arm with XEN_DOMCTL_CDF_hap unset.

I suspect we first implemented Arm guest as PV in libxl because PVH was non-existent and the type was easier to avoid spawning QEMU. Note that Linux and Xen are already considering Arm guest as PVH.

Changes in v2:
- Rather than denying PV guest, convert them to PVH.

---
 docs/man/xl.cfg.pod.5.in   |  3 ++-
 tools/libxl/libxl_arch.h   |  3 ++-
 tools/libxl/libxl_arm.c    | 39 +++++++++++++++++++++++++++++++++++++--
 tools/libxl/libxl_create.c |  2 +-
 tools/libxl/libxl_x86.c    |  3 ++-
 tools/xl/xl_parse.c        |  4 ++++
 6 files changed, 48 insertions(+), 6 deletions(-)
docs/man/xl.cfg.pod.5.in +2 -1
index b72718151b..a0568e397d 100644
@@ -86,7 +86,8 @@ guest operating systems. This is the default.
 
 Specifies that this is to be an PVH domain. That is a lightweight HVM-like
 guest without a device model and without many of the emulated devices
-available to HVM guests. Note that this mode requires a PVH aware kernel.
+available to HVM guests. Note that this mode requires a PVH aware kernel on
+x86.
 
 =item B<type="hvm">
 
tools/libxl/libxl_arch.h +2 -1
index 5ab0c95974..930570ef1e 100644
@@ -65,7 +65,8 @@ _hidden
 int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq);
 
 _hidden
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info);
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info);
 
 _hidden
 int libxl__arch_extra_memory(libxl__gc *gc,
tools/libxl/libxl_arm.c +37 -2
index 18c41f4ee9..0cf92d7af4 100644
@@ -978,7 +978,11 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,
     int rc;
     uint64_t val;
 
-    assert(info->type == LIBXL_DOMAIN_TYPE_PV);
+    if (info->type != LIBXL_DOMAIN_TYPE_PVH) {
+        LOG(ERROR, "Unsupported Arm guest type %s",
+            libxl_domain_type_to_string(info->type));
+        return ERROR_FAIL;
+    }
 
     /* Set the value of domain param HVM_PARAM_CALLBACK_IRQ. */
     val = MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI,
@@ -1135,10 +1139,41 @@ int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq)
     return xc_domain_bind_pt_spi_irq(CTX->xch, domid, irq, irq);
 }
 
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info)
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info)
 {
     /* ACPI is disabled by default */
     libxl_defbool_setdefault(&b_info->acpi, false);
+
+    /*
+     * Arm guest are now considered as PVH by the toolstack. To allow
+     * compatibility with previous toolstack, PV guest are automatically
+     * converted to PVH.
+     */
+    if (b_info->type != LIBXL_DOMAIN_TYPE_PV)
+        return;
+
+    LOG(WARN, "Converting PV guest to PVH");
+    LOG(WARN, "ARM guest are now PVH. Please update your toolstack.");
+
+    b_info->type = LIBXL_DOMAIN_TYPE_PVH;
+
+    /*
+     * They only field in u.pv that matters on Arm are: kernel, cmdline,
+     * ramdisk.
+     */
+
+    if (!b_info->kernel && b_info->u.pv.kernel)
+            b_info->kernel = b_info->u.pv.kernel;
+
+    if (!b_info->ramdisk && b_info->u.pv.ramdisk)
+        b_info->ramdisk = b_info->u.pv.ramdisk;
+
+    if (!b_info->cmdline && b_info->u.pv.cmdline)
+        b_info->cmdline = b_info->u.pv.cmdline;
+
+    /* Reset b_info->u.pvh to default values */
+    memset(&b_info->u.pvh, 0, sizeof(b_info->u.pvh));
 }
 
 /*
tools/libxl/libxl_create.c +1 -1
index d4fa06daea..a6431c5d3f 100644
@@ -215,7 +215,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
     if (!b_info->event_channels)
         b_info->event_channels = 1023;
 
-    libxl__arch_domain_build_info_setdefault(b_info);
+    libxl__arch_domain_build_info_setdefault(gc, b_info);
     libxl_defbool_setdefault(&b_info->dm_restrict, false);
 
     switch (b_info->type) {
tools/libxl/libxl_x86.c +2 -1
index 81523a568f..8b6759c089 100644
@@ -613,7 +613,8 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
     return rc;
 }
 
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info)
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info)
 {
     libxl_defbool_setdefault(&b_info->acpi, true);
 }
tools/xl/xl_parse.c +4 -0
index 971ec1bc56..0bda28152b 100644
@@ -1286,7 +1286,11 @@ void parse_config_data(const char *config_source,
     }
 
     if (c_info->type == LIBXL_DOMAIN_TYPE_INVALID)
+#if defined(__arm__) || defined(__aarch64__)
+        c_info->type = LIBXL_DOMAIN_TYPE_PVH;
+#else
         c_info->type = LIBXL_DOMAIN_TYPE_PV;
+#endif
 
     xlu_cfg_get_defbool(config, "hap", &c_info->hap, 0);
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#5 lore raw
Quoted 38 lines · Julien Grall

Currently, the toolstack is considering Arm guest always PV. However, they are very similar to PVH because HW virtualization extension are used and QEMU is not started. So switch Arm guest type to PVH.

To keep compatibility with toolstack creating Arm guest with PV type (e.g libvirt), libxl will now convert those guests to PVH.

Furthermore, the default type for Arm in xl will now be PVH to allow smooth transition for user.

---

This was discussed at Xen Summit and also in various thread on xen-devel. The latest one was when Andrew sent a patch to deny guest creation on Arm with XEN_DOMCTL_CDF_hap unset.

I suspect we first implemented Arm guest as PV in libxl because PVH was non-existent and the type was easier to avoid spawning QEMU. Note that Linux and Xen are already considering Arm guest as PVH.

Changes in v2:
- Rather than denying PV guest, convert them to PVH.

---
 docs/man/xl.cfg.pod.5.in   |  3 ++-
 tools/libxl/libxl_arch.h   |  3 ++-
 tools/libxl/libxl_arm.c    | 39 +++++++++++++++++++++++++++++++++++++--
 tools/libxl/libxl_create.c |  2 +-
 tools/libxl/libxl_x86.c    |  3 ++-
 tools/xl/xl_parse.c        |  4 ++++
 6 files changed, 48 insertions(+), 6 deletions(-)
docs/man/xl.cfg.pod.5.in +0 -0
index b72718151b..a0568e397d 100644

docs/man/xl.cfg.pod.5.in guest operating systems. This is the default. · line 90

Quoted 6 lines
docs/man/xl.cfg.pod.5.in +2 -1
@@ -86,7 +86,8 @@ guest operating systems. This is the default.
 
 Specifies that this is to be an PVH domain. That is a lightweight HVM-like
 guest without a device model and without many of the emulated devices
-available to HVM guests. Note that this mode requires a PVH aware kernel.
+available to HVM guests. Note that this mode requires a PVH aware kernel on
+x86.

Should you add "This is the default on ARM". And likewise modify 'type="pv"' so it's last sentence is "This is the default on x86"?

Quoted 22 lines
docs/man/xl.cfg.pod.5.in +0 -0
 =item B<type="hvm">
 
tools/libxl/libxl_arch.h +2 -1
index 5ab0c95974..930570ef1e 100644
@@ -65,7 +65,8 @@ _hidden
 int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq);
 
 _hidden
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info);
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info);
 
 _hidden
 int libxl__arch_extra_memory(libxl__gc *gc,
tools/libxl/libxl_arm.c +0 -0
index 18c41f4ee9..0cf92d7af4 100644

tools/libxl/libxl_arm.c int libxl__arch_domain_init_hw_description(libxl__gc *gc, · line 984

Quoted 8 lines
tools/libxl/libxl_arm.c +4 -1
@@ -978,7 +978,11 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,
     int rc;
     uint64_t val;
 
-    assert(info->type == LIBXL_DOMAIN_TYPE_PV);
+    if (info->type != LIBXL_DOMAIN_TYPE_PVH) {
+        LOG(ERROR, "Unsupported Arm guest type %s",
+            libxl_domain_type_to_string(info->type));
+        return ERROR_FAIL;

Nit: ERROR_INVAL might be better here.

Quoted 15 lines
tools/libxl/libxl_arm.c +4 -1
+    }
 
     /* Set the value of domain param HVM_PARAM_CALLBACK_IRQ. */
     val = MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI,
@@ -1135,10 +1139,41 @@ int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq)
     return xc_domain_bind_pt_spi_irq(CTX->xch, domid, irq, irq);
 }
 
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info)
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info)
 {
     /* ACPI is disabled by default */
     libxl_defbool_setdefault(&b_info->acpi, false);
+

tools/libxl/libxl_arm.c int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq) · line 1157

Quoted 10 lines
tools/libxl/libxl_arm.c +10 -0
+    /*
+     * Arm guest are now considered as PVH by the toolstack. To allow
+     * compatibility with previous toolstack, PV guest are automatically
+     * converted to PVH.
+     */
+    if (b_info->type != LIBXL_DOMAIN_TYPE_PV)
+        return;
+
+    LOG(WARN, "Converting PV guest to PVH");
+    LOG(WARN, "ARM guest are now PVH. Please update your toolstack.");

"Please update your configuration file.". Updating the toolstack won't make this message go away AFAICT :).

Quoted 9 lines
tools/libxl/libxl_arm.c +9 -0
+
+    b_info->type = LIBXL_DOMAIN_TYPE_PVH;
+
+    /*
+     * They only field in u.pv that matters on Arm are: kernel, cmdline,
+     * ramdisk.
+     */
+
+    if (!b_info->kernel && b_info->u.pv.kernel)

tools/libxl/libxl_arm.c int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq) · line 1176

Quoted 10 lines
tools/libxl/libxl_arm.c +10 -0
+            b_info->kernel = b_info->u.pv.kernel;
+
+    if (!b_info->ramdisk && b_info->u.pv.ramdisk)
+        b_info->ramdisk = b_info->u.pv.ramdisk;
+
+    if (!b_info->cmdline && b_info->u.pv.cmdline)
+        b_info->cmdline = b_info->u.pv.cmdline;
+
+    /* Reset b_info->u.pvh to default values */
+    memset(&b_info->u.pvh, 0, sizeof(b_info->u.pvh));

I'm afraid that's not correct. The default values for u.pvh are set by libxl__domain_build_info_setdefault.

Quoted 35 lines
tools/libxl/libxl_arm.c +0 -0
 }
 
 /*
tools/libxl/libxl_create.c +1 -1
index d4fa06daea..a6431c5d3f 100644
@@ -215,7 +215,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
     if (!b_info->event_channels)
         b_info->event_channels = 1023;
 
-    libxl__arch_domain_build_info_setdefault(b_info);
+    libxl__arch_domain_build_info_setdefault(gc, b_info);
     libxl_defbool_setdefault(&b_info->dm_restrict, false);
 
     switch (b_info->type) {
tools/libxl/libxl_x86.c +2 -1
index 81523a568f..8b6759c089 100644
@@ -613,7 +613,8 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
     return rc;
 }
 
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info)
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info)
 {
     libxl_defbool_setdefault(&b_info->acpi, true);
 }
tools/xl/xl_parse.c +0 -0
index 971ec1bc56..0bda28152b 100644

tools/xl/xl_parse.c void parse_config_data(const char *config_source, · line 1289

Quoted 4 lines
tools/xl/xl_parse.c +1 -0
@@ -1286,7 +1286,11 @@ void parse_config_data(const char *config_source,
     }
 
     if (c_info->type == LIBXL_DOMAIN_TYPE_INVALID)
+#if defined(__arm__) || defined(__aarch64__)

I think #ifdef CONFIG_ARM should DTRT and it's cleaner IMO.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw

Hi Roger,

Quoted 40 lines · Roger Pau Monné
Quoted 39 lines · Julien Grall

Currently, the toolstack is considering Arm guest always PV. However, they are very similar to PVH because HW virtualization extension are used and QEMU is not started. So switch Arm guest type to PVH.

To keep compatibility with toolstack creating Arm guest with PV type (e.g libvirt), libxl will now convert those guests to PVH.

Furthermore, the default type for Arm in xl will now be PVH to allow smooth transition for user.

---

This was discussed at Xen Summit and also in various thread on xen-devel. The latest one was when Andrew sent a patch to deny guest creation on Arm with XEN_DOMCTL_CDF_hap unset.

I suspect we first implemented Arm guest as PV in libxl because PVH was non-existent and the type was easier to avoid spawning QEMU. Note that Linux and Xen are already considering Arm guest as PVH.

Changes in v2:
- Rather than denying PV guest, convert them to PVH.

---
  docs/man/xl.cfg.pod.5.in   |  3 ++-
  tools/libxl/libxl_arch.h   |  3 ++-
  tools/libxl/libxl_arm.c    | 39 +++++++++++++++++++++++++++++++++++++--
  tools/libxl/libxl_create.c |  2 +-
  tools/libxl/libxl_x86.c    |  3 ++-
  tools/xl/xl_parse.c        |  4 ++++
  6 files changed, 48 insertions(+), 6 deletions(-)
docs/man/xl.cfg.pod.5.in +0 -0
index b72718151b..a0568e397d 100644
@@ -86,7 +86,8 @@ guest operating systems. This is the default.
 
Quoted 8 lines

docs/man/xl.cfg.pod.5.in guest operating systems. This is the default. · line 90

Quoted 5 lines
docs/man/xl.cfg.pod.5.in +2 -1
  Specifies that this is to be an PVH domain. That is a lightweight HVM-like
  guest without a device model and without many of the emulated devices
-available to HVM guests. Note that this mode requires a PVH aware kernel.
+available to HVM guests. Note that this mode requires a PVH aware kernel on
+x86.

Should you add "This is the default on ARM". And likewise modify 'type="pv"' so it's last sentence is "This is the default on x86"?

Good idea. I will update the doc.

Quoted 54 lines
Quoted 23 lines
docs/man/xl.cfg.pod.5.in +0 -0
  =item B<type="hvm">
 
tools/libxl/libxl_arch.h +2 -1
index 5ab0c95974..930570ef1e 100644
@@ -65,7 +65,8 @@ _hidden
  int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq);
 
  _hidden
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info);
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info);
 
  _hidden
  int libxl__arch_extra_memory(libxl__gc *gc,
tools/libxl/libxl_arm.c +0 -0
index 18c41f4ee9..0cf92d7af4 100644

tools/libxl/libxl_arm.c int libxl__arch_domain_init_hw_description(libxl__gc *gc, · line 984

Quoted 8 lines
tools/libxl/libxl_arm.c +4 -1
@@ -978,7 +978,11 @@ int libxl__arch_domain_init_hw_description(libxl__gc *gc,
      int rc;
      uint64_t val;
 
-    assert(info->type == LIBXL_DOMAIN_TYPE_PV);
+    if (info->type != LIBXL_DOMAIN_TYPE_PVH) {
+        LOG(ERROR, "Unsupported Arm guest type %s",
+            libxl_domain_type_to_string(info->type));
+        return ERROR_FAIL;

Nit: ERROR_INVAL might be better here.

Quoted 20 lines
tools/libxl/libxl_arm.c +9 -1
+    }
 
      /* Set the value of domain param HVM_PARAM_CALLBACK_IRQ. */
      val = MASK_INSR(HVM_PARAM_CALLBACK_TYPE_PPI,
@@ -1135,10 +1139,41 @@ int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq)
      return xc_domain_bind_pt_spi_irq(CTX->xch, domid, irq, irq);
  }
 
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info)
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info)
  {
      /* ACPI is disabled by default */
      libxl_defbool_setdefault(&b_info->acpi, false);
+
+    /*
+     * Arm guest are now considered as PVH by the toolstack. To allow
+     * compatibility with previous toolstack, PV guest are automatically
+     * converted to PVH.
+     */
Quoted 8 lines

tools/libxl/libxl_arm.c int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq) · line 1157

Quoted 5 lines
tools/libxl/libxl_arm.c +5 -0
+    if (b_info->type != LIBXL_DOMAIN_TYPE_PV)
+        return;
+
+    LOG(WARN, "Converting PV guest to PVH");
+    LOG(WARN, "ARM guest are now PVH. Please update your toolstack.");

"Please update your configuration file.". Updating the toolstack won't make this message go away AFAICT :).

In the case of libvirt, you don't have PVH support. So you would need to update your toolstack here.

How about "Please fix your configuration file/toolstack"?

Quoted 15 lines
Quoted 15 lines
tools/libxl/libxl_arm.c +14 -0
+
+    b_info->type = LIBXL_DOMAIN_TYPE_PVH;
+
+    /*
+     * They only field in u.pv that matters on Arm are: kernel, cmdline,
+     * ramdisk.
+     */
+
+    if (!b_info->kernel && b_info->u.pv.kernel)
+            b_info->kernel = b_info->u.pv.kernel;
+
+    if (!b_info->ramdisk && b_info->u.pv.ramdisk)
+        b_info->ramdisk = b_info->u.pv.ramdisk;
+
Quoted 8 lines

tools/libxl/libxl_arm.c int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq) · line 1176

Quoted 5 lines
tools/libxl/libxl_arm.c +5 -0
+    if (!b_info->cmdline && b_info->u.pv.cmdline)
+        b_info->cmdline = b_info->u.pv.cmdline;
+
+    /* Reset b_info->u.pvh to default values */
+    memset(&b_info->u.pvh, 0, sizeof(b_info->u.pvh));

I'm afraid that's not correct. The default values for u.pvh are set by libxl__domain_build_info_setdefault.

I thought that this should be covered by the switch right after the call of libxl__arch_domain_build_info_setdefault. Did I miss anything?

What I wanted to do here is resetting the union to 0 so you don't get data mangled by the pv fields.

Quoted 38 lines
Quoted 38 lines
tools/libxl/libxl_arm.c +0 -0
  }
 
  /*
tools/libxl/libxl_create.c +1 -1
index d4fa06daea..a6431c5d3f 100644
@@ -215,7 +215,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
      if (!b_info->event_channels)
          b_info->event_channels = 1023;
 
-    libxl__arch_domain_build_info_setdefault(b_info);
+    libxl__arch_domain_build_info_setdefault(gc, b_info);
      libxl_defbool_setdefault(&b_info->dm_restrict, false);
 
      switch (b_info->type) {
tools/libxl/libxl_x86.c +2 -1
index 81523a568f..8b6759c089 100644
@@ -613,7 +613,8 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
      return rc;
  }
 
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info)
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info)
  {
      libxl_defbool_setdefault(&b_info->acpi, true);
  }
tools/xl/xl_parse.c +0 -0
index 971ec1bc56..0bda28152b 100644
@@ -1286,7 +1286,11 @@ void parse_config_data(const char *config_source,
      }
 
Quoted 4 lines

tools/xl/xl_parse.c void parse_config_data(const char *config_source, · line 1289

Quoted 2 lines
tools/xl/xl_parse.c +1 -0
      if (c_info->type == LIBXL_DOMAIN_TYPE_INVALID)
+#if defined(__arm__) || defined(__aarch64__)

I think #ifdef CONFIG_ARM should DTRT and it's cleaner IMO.

CONFIG_ARM is not defined in the tools C source. So that's the only way to know if you are on Arm. This follows what is done in libxc.

I would be happy to introduce CONFIG_ARM/CONFIG_X86 if people thinks this would be useful in other places.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#7 lore raw
Quoted 25 lines · Julien Grall

Hi Roger,

Quoted 13 lines · Roger Pau Monné
Quoted 12 lines · Julien Grall
tools/libxl/libxl_arm.c +8 -1
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info)
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info)
  {
      /* ACPI is disabled by default */
      libxl_defbool_setdefault(&b_info->acpi, false);
+
+    /*
+     * Arm guest are now considered as PVH by the toolstack. To allow
+     * compatibility with previous toolstack, PV guest are automatically
+     * converted to PVH.
+     */
Quoted 8 lines

tools/libxl/libxl_arm.c int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq) · line 1157

Quoted 5 lines
tools/libxl/libxl_arm.c +5 -0
+    if (b_info->type != LIBXL_DOMAIN_TYPE_PV)
+        return;
+
+    LOG(WARN, "Converting PV guest to PVH");
+    LOG(WARN, "ARM guest are now PVH. Please update your toolstack.");

"Please update your configuration file.". Updating the toolstack won't make this message go away AFAICT :).

Quoted 4 lines

In the case of libvirt, you don't have PVH support. So you would need to update your toolstack here.

How about "Please fix your configuration file/toolstack"?

I would use "fix your configuration or update your toolstack", but I'm fine with the above.

Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
tools/libxl/libxl_arm.c +14 -0
+
+    b_info->type = LIBXL_DOMAIN_TYPE_PVH;
+
+    /*
+     * They only field in u.pv that matters on Arm are: kernel, cmdline,
+     * ramdisk.
+     */
+
+    if (!b_info->kernel && b_info->u.pv.kernel)
+            b_info->kernel = b_info->u.pv.kernel;
+
+    if (!b_info->ramdisk && b_info->u.pv.ramdisk)
+        b_info->ramdisk = b_info->u.pv.ramdisk;
+
Quoted 8 lines

tools/libxl/libxl_arm.c int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq) · line 1176

Quoted 5 lines
tools/libxl/libxl_arm.c +5 -0
+    if (!b_info->cmdline && b_info->u.pv.cmdline)
+        b_info->cmdline = b_info->u.pv.cmdline;
+
+    /* Reset b_info->u.pvh to default values */
+    memset(&b_info->u.pvh, 0, sizeof(b_info->u.pvh));

I'm afraid that's not correct. The default values for u.pvh are set by libxl__domain_build_info_setdefault.

Quoted 2 lines

I thought that this should be covered by the switch right after the call of libxl__arch_domain_build_info_setdefault. Did I miss anything?

Oh right, libxl__arch_domain_build_info_setdefault is called by libxl__domain_build_info_setdefault.

Quoted 2 lines

What I wanted to do here is resetting the union to 0 so you don't get data mangled by the pv fields.

Another possible option I think would be to mark those fields as deprecated in the IDL, and libxl__domain_build_info_copy_deprecated will take care of copying them to the new place. In fact I think all guest types should be using the top level kernel, ramdisk and cmdline fields.

I'm not specially comfortable with changing the guest type in the middle of libxl__domain_build_info_setdefault, but I also don't have a much better suggestion apart from using the deprecation helper.

From what you say above I assume bootloader or bootloader arguments are not used by ARM?

Quoted 38 lines
Quoted 29 lines
Quoted 29 lines
  }
  /*
tools/libxl/libxl_create.c +1 -1
index d4fa06daea..a6431c5d3f 100644
@@ -215,7 +215,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
      if (!b_info->event_channels)
          b_info->event_channels = 1023;
-    libxl__arch_domain_build_info_setdefault(b_info);
+    libxl__arch_domain_build_info_setdefault(gc, b_info);
      libxl_defbool_setdefault(&b_info->dm_restrict, false);
      switch (b_info->type) {
tools/libxl/libxl_x86.c +2 -1
index 81523a568f..8b6759c089 100644
@@ -613,7 +613,8 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
      return rc;
  }
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info)
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info)
  {
      libxl_defbool_setdefault(&b_info->acpi, true);
  }
tools/xl/xl_parse.c +0 -0
index 971ec1bc56..0bda28152b 100644
Quoted 8 lines

tools/xl/xl_parse.c void parse_config_data(const char *config_source, · line 1288

Quoted 6 lines
tools/xl/xl_parse.c +1 -0
@@ -1286,7 +1286,11 @@ void parse_config_data(const char *config_source,
      }
      if (c_info->type == LIBXL_DOMAIN_TYPE_INVALID)
+#if defined(__arm__) || defined(__aarch64__)

I think #ifdef CONFIG_ARM should DTRT and it's cleaner IMO.

Quoted 5 lines

CONFIG_ARM is not defined in the tools C source. So that's the only way to know if you are on Arm. This follows what is done in libxc.

I would be happy to introduce CONFIG_ARM/CONFIG_X86 if people thinks this would be useful in other places.

The tools makefile already uses CONFIG_ARM/X86, so I think it would make sense to have this for the code as well. In any case, I don't feel this should be done just for this patch, so I'm fine as-is.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw

On Thu, Aug 23, 2018 at 09:58:57AM +0200, Roger Pau Monné wrote:
[...]

Quoted 6 lines
Quoted 3 lines

What I wanted to do here is resetting the union to 0 so you don't get data mangled by the pv fields.

Another possible option I think would be to mark those fields as deprecated in the IDL, and libxl__domain_build_info_copy_deprecated

I think this is a better approach.

Quoted 52 lines

will take care of copying them to the new place. In fact I think all guest types should be using the top level kernel, ramdisk and cmdline fields.

I'm not specially comfortable with changing the guest type in the middle of libxl__domain_build_info_setdefault, but I also don't have a much better suggestion apart from using the deprecation helper.

From what you say above I assume bootloader or bootloader arguments are not used by ARM?

Quoted 41 lines
Quoted 29 lines
Quoted 29 lines
  }
  /*
tools/libxl/libxl_create.c +1 -1
index d4fa06daea..a6431c5d3f 100644
@@ -215,7 +215,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
      if (!b_info->event_channels)
          b_info->event_channels = 1023;
-    libxl__arch_domain_build_info_setdefault(b_info);
+    libxl__arch_domain_build_info_setdefault(gc, b_info);
      libxl_defbool_setdefault(&b_info->dm_restrict, false);
      switch (b_info->type) {
tools/libxl/libxl_x86.c +2 -1
index 81523a568f..8b6759c089 100644
@@ -613,7 +613,8 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
      return rc;
  }
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info)
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info)
  {
      libxl_defbool_setdefault(&b_info->acpi, true);
  }
tools/xl/xl_parse.c +0 -0
index 971ec1bc56..0bda28152b 100644
Quoted 8 lines

tools/xl/xl_parse.c void parse_config_data(const char *config_source, · line 1288

Quoted 6 lines
tools/xl/xl_parse.c +1 -0
@@ -1286,7 +1286,11 @@ void parse_config_data(const char *config_source,
      }
      if (c_info->type == LIBXL_DOMAIN_TYPE_INVALID)
+#if defined(__arm__) || defined(__aarch64__)

I think #ifdef CONFIG_ARM should DTRT and it's cleaner IMO.

CONFIG_ARM is not defined in the tools C source. So that's the only way to know if you are on Arm. This follows what is done in libxc.

Quoted 7 lines
Quoted 2 lines

I would be happy to introduce CONFIG_ARM/CONFIG_X86 if people thinks this would be useful in other places.

The tools makefile already uses CONFIG_ARM/X86, so I think it would make sense to have this for the code as well. In any case, I don't feel this should be done just for this patch, so I'm fine as-is.

I think CONFIG_ARM should already work.

There are several CONFIG_ARM* in toolstack code, though not in libxl. In any case, I think the code is fine as-is.

Wei.

Quoted 1 line

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#9 lore raw

Hi Wei,

Quoted 66 lines · Wei Liu

On Thu, Aug 23, 2018 at 09:58:57AM +0200, Roger Pau Monné wrote:
[...]

Quoted 6 lines
Quoted 3 lines

What I wanted to do here is resetting the union to 0 so you don't get data mangled by the pv fields.

Another possible option I think would be to mark those fields as deprecated in the IDL, and libxl__domain_build_info_copy_deprecated

I think this is a better approach.

Quoted 55 lines

will take care of copying them to the new place. In fact I think all guest types should be using the top level kernel, ramdisk and cmdline fields.

I'm not specially comfortable with changing the guest type in the middle of libxl__domain_build_info_setdefault, but I also don't have a much better suggestion apart from using the deprecation helper.

From what you say above I assume bootloader or bootloader arguments
are not used by ARM?

Quoted 43 lines
Quoted 29 lines
Quoted 29 lines
   }
   /*
tools/libxl/libxl_create.c +1 -1
index d4fa06daea..a6431c5d3f 100644
@@ -215,7 +215,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
       if (!b_info->event_channels)
           b_info->event_channels = 1023;
-    libxl__arch_domain_build_info_setdefault(b_info);
+    libxl__arch_domain_build_info_setdefault(gc, b_info);
       libxl_defbool_setdefault(&b_info->dm_restrict, false);
       switch (b_info->type) {
tools/libxl/libxl_x86.c +2 -1
index 81523a568f..8b6759c089 100644
@@ -613,7 +613,8 @@ int libxl__arch_domain_finalise_hw_description(libxl__gc *gc,
       return rc;
   }
-void libxl__arch_domain_build_info_setdefault(libxl_domain_build_info *b_info)
+void libxl__arch_domain_build_info_setdefault(libxl__gc *gc,
+                                              libxl_domain_build_info *b_info)
   {
       libxl_defbool_setdefault(&b_info->acpi, true);
   }
tools/xl/xl_parse.c +0 -0
index 971ec1bc56..0bda28152b 100644
Quoted 8 lines

tools/xl/xl_parse.c void parse_config_data(const char *config_source, · line 1288

Quoted 6 lines
tools/xl/xl_parse.c +1 -0
@@ -1286,7 +1286,11 @@ void parse_config_data(const char *config_source,
       }
       if (c_info->type == LIBXL_DOMAIN_TYPE_INVALID)
+#if defined(__arm__) || defined(__aarch64__)

I think #ifdef CONFIG_ARM should DTRT and it's cleaner IMO.

CONFIG_ARM is not defined in the tools C source. So that's the only way to know if you are on Arm. This follows what is done in libxc.

I would be happy to introduce CONFIG_ARM/CONFIG_X86 if people thinks this would be useful in other places.

Quoted 6 lines
Quoted 4 lines

The tools makefile already uses CONFIG_ARM/X86, so I think it would make sense to have this for the code as well. In any case, I don't feel this should be done just for this patch, so I'm fine as-is.

I think CONFIG_ARM should already work.

I don't think so. The top makefile does not pass -DCONFIG_ARM on compiler command line. This is only done in sub-directory such as console and libacpi.

Quoted 3 lines

There are several CONFIG_ARM* in toolstack code, though not in libxl. In any case, I think the code is fine as-is.

I am happy to introduce CONFIG_ARM/CONFIG_X86 if you don't mind adding -DCONFIG_ARM on the command line.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#10 lore raw
Quoted 3 lines · Julien Grall

I don't think so. The top makefile does not pass -DCONFIG_ARM on compiler command line. This is only done in sub-directory such as console and libacpi.

Indeed. That how console code did it.

Quoted 7 lines
Quoted 4 lines

There are several CONFIG_ARM* in toolstack code, though not in libxl. In any case, I think the code is fine as-is.

I am happy to introduce CONFIG_ARM/CONFIG_X86 if you don't mind adding -DCONFIG_ARM on the command line.

I'm not too fussed. Keeping your code as-is is fine.

Wei.

Quoted 5 lines

Cheers,

Signature · 1 line
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#11 lore raw
In reply to Roger Pau Monné
Quoted 31 lines · Roger Pau Monné
Quoted 24 lines · Julien Grall
Quoted 15 lines
Quoted 15 lines
tools/libxl/libxl_arm.c +14 -0
+
+    b_info->type = LIBXL_DOMAIN_TYPE_PVH;
+
+    /*
+     * They only field in u.pv that matters on Arm are: kernel, cmdline,
+     * ramdisk.
+     */
+
+    if (!b_info->kernel && b_info->u.pv.kernel)
+            b_info->kernel = b_info->u.pv.kernel;
+
+    if (!b_info->ramdisk && b_info->u.pv.ramdisk)
+        b_info->ramdisk = b_info->u.pv.ramdisk;
+
Quoted 8 lines

tools/libxl/libxl_arm.c int libxl__arch_domain_map_irq(libxl__gc *gc, uint32_t domid, int irq) · line 1176

Quoted 5 lines
tools/libxl/libxl_arm.c +5 -0
+    if (!b_info->cmdline && b_info->u.pv.cmdline)
+        b_info->cmdline = b_info->u.pv.cmdline;
+
+    /* Reset b_info->u.pvh to default values */
+    memset(&b_info->u.pvh, 0, sizeof(b_info->u.pvh));

I'm afraid that's not correct. The default values for u.pvh are set by libxl__domain_build_info_setdefault.

Quoted 2 lines

I thought that this should be covered by the switch right after the call of libxl__arch_domain_build_info_setdefault. Did I miss anything?

Oh right, libxl__arch_domain_build_info_setdefault is called by libxl__domain_build_info_setdefault.

Quoted 8 lines
Quoted 2 lines

What I wanted to do here is resetting the union to 0 so you don't get data mangled by the pv fields.

Another possible option I think would be to mark those fields as deprecated in the IDL, and libxl__domain_build_info_copy_deprecated will take care of copying them to the new place. In fact I think all guest types should be using the top level kernel, ramdisk and cmdline fields.

I will have a look at it.

Quoted 7 lines

I'm not specially comfortable with changing the guest type in the middle of libxl__domain_build_info_setdefault, but I also don't have a much better suggestion apart from using the deprecation helper.

From what you say above I assume bootloader or bootloader arguments
are not used by ARM?

That's correct.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#12 lore raw
Quoted 38 lines · Julien Grall
Quoted 35 lines · Roger Pau Monné
Quoted 25 lines · Julien Grall
Quoted 16 lines
Quoted 16 lines
tools/libxl/libxl_arm.c +5 -0
+
+    b_info->type = LIBXL_DOMAIN_TYPE_PVH;
+
+    /*
+     * They only field in u.pv that matters on Arm are: kernel, 

cmdline,
+     * ramdisk.
+     */

tools/libxl/libxl_arm.c +7 -0
+
+    if (!b_info->kernel && b_info->u.pv.kernel)
+            b_info->kernel = b_info->u.pv.kernel;
+
+    if (!b_info->ramdisk && b_info->u.pv.ramdisk)
+        b_info->ramdisk = b_info->u.pv.ramdisk;
+
Quoted 8 lines
Quoted 5 lines

+    if (!b_info->cmdline && b_info->u.pv.cmdline) +        b_info->cmdline = b_info->u.pv.cmdline; +
+    /* Reset b_info->u.pvh to default values */ +    memset(&b_info->u.pvh, 0, sizeof(b_info->u.pvh));

I'm afraid that's not correct. The default values for u.pvh are set by libxl__domain_build_info_setdefault.

Quoted 2 lines

I thought that this should be covered by the switch right after the call of libxl__arch_domain_build_info_setdefault. Did I miss anything?

Oh right, libxl__arch_domain_build_info_setdefault is called by libxl__domain_build_info_setdefault.

Quoted 2 lines

What I wanted to do here is resetting the union to 0 so you don't get data mangled by the pv fields.

Quoted 12 lines
Quoted 5 lines

Another possible option I think would be to mark those fields as deprecated in the IDL, and libxl__domain_build_info_copy_deprecated will take care of copying them to the new place. In fact I think all guest types should be using the top level kernel, ramdisk and cmdline fields.

I will have a look at it.

Quoted 4 lines

I'm not specially comfortable with changing the guest type in the middle of libxl__domain_build_info_setdefault, but I also don't have a much better suggestion apart from using the deprecation helper.

I forgot to answer to this bit. I don't think the deprecation helper will do all the jobs. There are still PV specific parameters: slack_memkb, features, e820_host.

Those are not necessary for Arm, if you don't zero them then you will not initialize the PVH structure with default values. How do you suggest to handle them?

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#13 lore raw
Quoted 50 lines · Julien Grall
Quoted 49 lines · Julien Grall
Quoted 37 lines · Roger Pau Monné
Quoted 25 lines · Julien Grall
Quoted 16 lines
Quoted 16 lines
tools/libxl/libxl_arm.c +5 -0
+
+    b_info->type = LIBXL_DOMAIN_TYPE_PVH;
+
+    /*
+     * They only field in u.pv that matters on Arm are:

kernel, cmdline,
+     * ramdisk.
+     */

tools/libxl/libxl_arm.c +7 -0
+
+    if (!b_info->kernel && b_info->u.pv.kernel)
+            b_info->kernel = b_info->u.pv.kernel;
+
+    if (!b_info->ramdisk && b_info->u.pv.ramdisk)
+        b_info->ramdisk = b_info->u.pv.ramdisk;
+
Quoted 8 lines
Quoted 5 lines

+    if (!b_info->cmdline && b_info->u.pv.cmdline) +        b_info->cmdline = b_info->u.pv.cmdline; +
+    /* Reset b_info->u.pvh to default values */ +    memset(&b_info->u.pvh, 0, sizeof(b_info->u.pvh));

I'm afraid that's not correct. The default values for u.pvh are set by libxl__domain_build_info_setdefault.

Quoted 3 lines

I thought that this should be covered by the switch right after the call of
libxl__arch_domain_build_info_setdefault. Did I miss anything?

Oh right, libxl__arch_domain_build_info_setdefault is called by libxl__domain_build_info_setdefault.

Quoted 3 lines

What I wanted to do here is resetting the union to 0 so you don't get data
mangled by the pv fields.

Quoted 5 lines

Another possible option I think would be to mark those fields as deprecated in the IDL, and libxl__domain_build_info_copy_deprecated will take care of copying them to the new place. In fact I think all guest types should be using the top level kernel, ramdisk and cmdline fields.

I will have a look at it.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

I'm not specially comfortable with changing the guest type in the middle of libxl__domain_build_info_setdefault, but I also don't have a much better suggestion apart from using the deprecation helper.

I forgot to answer to this bit. I don't think the deprecation helper will do all the jobs. There are still PV specific parameters: slack_memkb, features, e820_host.

Those can be left inside the PV sub-struct and shouldn't be marked as deprecated.

Quoted 3 lines

Those are not necessary for Arm, if you don't zero them then you will not initialize the PVH structure with default values. How do you suggest to handle them?

But I guess ARM doesn't use any of those fields (or else they should be moved to the pvh sub-struct anyway)?

In which case allowing the user to set them in the first place seems like an error to me.

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#14 lore raw

Hi Roger,

Sorry for the late reply.

Quoted 62 lines · Roger Pau Monné
Quoted 50 lines · Julien Grall
Quoted 49 lines · Julien Grall
Quoted 37 lines · Roger Pau Monné
Quoted 25 lines · Julien Grall
Quoted 16 lines
Quoted 16 lines
(quoted diff) +5 -0
+
+    b_info->type = LIBXL_DOMAIN_TYPE_PVH;
+
+    /*
+     * They only fie ld in u.pv that matters on Arm are:

kernel, cmdline,
+     * ramdisk.
+     */

(quoted diff) +7 -0
+
+    if (!b_info->kernel && b_info->u.pv.kernel)
+            b_info->kernel = b_info->u.pv.kernel;
+
+    if (!b_info->ramdisk && b_info->u.pv.ramdisk)
+        b_info->ramdisk = b_info->u.pv.ramdisk;
+
Quoted 8 lines
Quoted 5 lines

+    if (!b_info->cmdline && b_info->u.pv.cmdline) +        b_info->cmdline = b_info->u.pv.cmdline; +
+    /* Reset b_info->u.pvh to default values */ +    memset(&b_info->u.pvh, 0, sizeof(b_info->u.pvh));

I'm afraid that's not correct. The default values for u.pvh are set by libxl__domain_build_info_setdefault.

Quoted 3 lines

I thought that this should be covered by the switch right after the call of
libxl__arch_domain_build_info_setdefault. Did I miss anything?

Oh right, libxl__arch_domain_build_info_setdefault is called by libxl__domain_build_info_setdefault.

Quoted 3 lines

What I wanted to do here is resetting the union to 0 so you don't get data
mangled by the pv fields.

Quoted 5 lines

Another possible option I think would be to mark those fields as deprecated in the IDL, and libxl__domain_build_info_copy_deprecated will take care of copying them to the new place. In fact I think all guest types should be using the top level kernel, ramdisk and cmdline fields.

I will have a look at it.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

I'm not specially comfortable with changing the guest type in the middle of libxl__domain_build_info_setdefault, but I also don't have a much better suggestion apart from using the deprecation helper.

I forgot to answer to this bit. I don't think the deprecation helper will do all the jobs. There are still PV specific parameters: slack_memkb, features, e820_host.

Those can be left inside the PV sub-struct and shouldn't be marked as deprecated.

Quoted 6 lines
Quoted 3 lines

Those are not necessary for Arm, if you don't zero them then you will not initialize the PVH structure with default values. How do you suggest to handle them?

But I guess ARM doesn't use any of those fields (or else they should be moved to the pvh sub-struct anyway)?

Those fields should not be used by Arm. Looking at the current fields in pv, they all should be zeroed.

However, I am not sure if we can assume that will always be the case.
If we can assume it, then I think it would just be sufficient to have b_info->type = LIBXL_DOMAIN_TYPE_PVH in Arm.

Any thoughts?

Cheers,

Quoted 3 lines

In which case allowing the user to set them in the first place seems like an error to me.

Agreed.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#15 lore raw
Quoted 74 lines · Julien Grall

Hi Roger,

Sorry for the late reply.

Quoted 62 lines · Roger Pau Monné
Quoted 50 lines · Julien Grall
Quoted 49 lines · Julien Grall
Quoted 37 lines · Roger Pau Monné
Quoted 25 lines · Julien Grall
Quoted 16 lines
Quoted 16 lines
(quoted diff) +5 -0
+
+    b_info->type = LIBXL_DOMAIN_TYPE_PVH;
+
+    /*
+     * They only fie ld in u.pv that matters on Arm are:

kernel, cmdline,
+     * ramdisk.
+     */

(quoted diff) +7 -0
+
+    if (!b_info->kernel && b_info->u.pv.kernel)
+            b_info->kernel = b_info->u.pv.kernel;
+
+    if (!b_info->ramdisk && b_info->u.pv.ramdisk)
+        b_info->ramdisk = b_info->u.pv.ramdisk;
+
Quoted 8 lines
Quoted 5 lines

+    if (!b_info->cmdline && b_info->u.pv.cmdline) +        b_info->cmdline = b_info->u.pv.cmdline; +
+    /* Reset b_info->u.pvh to default values */ +    memset(&b_info->u.pvh, 0, sizeof(b_info->u.pvh));

I'm afraid that's not correct. The default values for u.pvh are set by libxl__domain_build_info_setdefault.

Quoted 3 lines

I thought that this should be covered by the switch right after the call of
libxl__arch_domain_build_info_setdefault. Did I miss anything?

Oh right, libxl__arch_domain_build_info_setdefault is called by libxl__domain_build_info_setdefault.

Quoted 3 lines

What I wanted to do here is resetting the union to 0 so you don't get data
mangled by the pv fields.

Quoted 5 lines

Another possible option I think would be to mark those fields as deprecated in the IDL, and libxl__domain_build_info_copy_deprecated will take care of copying them to the new place. In fact I think all guest types should be using the top level kernel, ramdisk and cmdline fields.

I will have a look at it.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

I'm not specially comfortable with changing the guest type in the middle of libxl__domain_build_info_setdefault, but I also don't have a much better suggestion apart from using the deprecation helper.

I forgot to answer to this bit. I don't think the deprecation helper will do all the jobs. There are still PV specific parameters: slack_memkb, features, e820_host.

Those can be left inside the PV sub-struct and shouldn't be marked as deprecated.

Quoted 6 lines
Quoted 3 lines

Those are not necessary for Arm, if you don't zero them then you will not initialize the PVH structure with default values. How do you suggest to handle them?

But I guess ARM doesn't use any of those fields (or else they should be moved to the pvh sub-struct anyway)?

Quoted 8 lines

Those fields should not be used by Arm. Looking at the current fields in pv, they all should be zeroed.

However, I am not sure if we can assume that will always be the case. If we can assume it, then I think it would just be sufficient to have b_info->type = LIBXL_DOMAIN_TYPE_PVH in Arm.

Any thoughts?

If we go down this route for ARM I think you should add to xl.cfg that the type option only applies to x86, and that there's only one guest type on ARM. IMO it's best to not use type if there's only one type available, so that it can be intruded later on ARM if required.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#16 lore raw

Hi,

Quoted 82 lines · Roger Pau Monné
Quoted 81 lines · Julien Grall

Hi Roger,

Sorry for the late reply.

Quoted 62 lines · Roger Pau Monné
Quoted 50 lines · Julien Grall
Quoted 49 lines · Julien Grall
Quoted 37 lines · Roger Pau Monné
Quoted 25 lines · Julien Grall
Quoted 16 lines
Quoted 16 lines
(quoted diff) +5 -0
+
+    b_info->type = LIBXL_DOMAIN_TYPE_PVH;
+
+    /*
+     * They only fie ld in u.pv that matters on Arm are:

kernel, cmdline,
+     * ramdisk.
+     */

(quoted diff) +7 -0
+
+    if (!b_info->kernel && b_info->u.pv.kernel)
+            b_info->kernel = b_info->u.pv.kernel;
+
+    if (!b_info->ramdisk && b_info->u.pv.ramdisk)
+        b_info->ramdisk = b_info->u.pv.ramdisk;
+
Quoted 8 lines
Quoted 5 lines

+    if (!b_info->cmdline && b_info->u.pv.cmdline) +        b_info->cmdline = b_info->u.pv.cmdline; +
+    /* Reset b_info->u.pvh to default values */ +    memset(&b_info->u.pvh, 0, sizeof(b_info->u.pvh));

I'm afraid that's not correct. The default values for u.pvh are set by libxl__domain_build_info_setdefault.

Quoted 3 lines

I thought that this should be covered by the switch right after the call of
libxl__arch_domain_build_info_setdefault. Did I miss anything?

Oh right, libxl__arch_domain_build_info_setdefault is called by libxl__domain_build_info_setdefault.

Quoted 3 lines

What I wanted to do here is resetting the union to 0 so you don't get data
mangled by the pv fields.

Quoted 5 lines

Another possible option I think would be to mark those fields as deprecated in the IDL, and libxl__domain_build_info_copy_deprecated will take care of copying them to the new place. In fact I think all guest types should be using the top level kernel, ramdisk and cmdline fields.

I will have a look at it.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

I'm not specially comfortable with changing the guest type in the middle of libxl__domain_build_info_setdefault, but I also don't have a much better suggestion apart from using the deprecation helper.

I forgot to answer to this bit. I don't think the deprecation helper will do all the jobs. There are still PV specific parameters: slack_memkb, features, e820_host.

Those can be left inside the PV sub-struct and shouldn't be marked as deprecated.

Quoted 6 lines
Quoted 3 lines

Those are not necessary for Arm, if you don't zero them then you will not initialize the PVH structure with default values. How do you suggest to handle them?

But I guess ARM doesn't use any of those fields (or else they should be moved to the pvh sub-struct anyway)?

Those fields should not be used by Arm. Looking at the current fields in pv, they all should be zeroed.

However, I am not sure if we can assume that will always be the case. If we can assume it, then I think it would just be sufficient to have b_info->type = LIBXL_DOMAIN_TYPE_PVH in Arm.

Quoted 6 lines
Quoted 1 line

Any thoughts?

If we go down this route for ARM I think you should add to xl.cfg that the type option only applies to x86, and that there's only one guest type on ARM. IMO it's best to not use type if there's only one type available, so that it can be intruded later on ARM if required.

That's not what we discussed before. The idea is to default Arm guest to PVH for xl. But "type=" would still be available.

We still have to support other type as other toolstack (e.g libvirt) may use PV for Arm. So the idea here is libxl will check if it was PV and convert to PVH.

In an earlier reply, you said that we can use deprecated to copy most of the options over. However, can we always assume the pv.* fields will always be zero after the value was copied over? If not, then we would have to memset them.

I asked opinion on the last bits.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#17 lore raw
Quoted 95 lines · Julien Grall

Hi,

Quoted 82 lines · Roger Pau Monné
Quoted 81 lines · Julien Grall

Hi Roger,

Sorry for the late reply.

Quoted 62 lines · Roger Pau Monné
Quoted 50 lines · Julien Grall
Quoted 49 lines · Julien Grall
Quoted 37 lines · Roger Pau Monné
Quoted 25 lines · Julien Grall
Quoted 16 lines
Quoted 16 lines
(quoted diff) +5 -0
+
+    b_info->type = LIBXL_DOMAIN_TYPE_PVH;
+
+    /*
+     * They only fie ld in u.pv that matters on Arm are:

kernel, cmdline,
+     * ramdisk.
+     */

(quoted diff) +7 -0
+
+    if (!b_info->kernel && b_info->u.pv.kernel)
+            b_info->kernel = b_info->u.pv.kernel;
+
+    if (!b_info->ramdisk && b_info->u.pv.ramdisk)
+        b_info->ramdisk = b_info->u.pv.ramdisk;
+
Quoted 8 lines
Quoted 5 lines

+    if (!b_info->cmdline && b_info->u.pv.cmdline) +        b_info->cmdline = b_info->u.pv.cmdline; +
+    /* Reset b_info->u.pvh to default values */ +    memset(&b_info->u.pvh, 0, sizeof(b_info->u.pvh));

I'm afraid that's not correct. The default values for u.pvh are set by libxl__domain_build_info_setdefault.

Quoted 3 lines

I thought that this should be covered by the switch right after the call of
libxl__arch_domain_build_info_setdefault. Did I miss anything?

Oh right, libxl__arch_domain_build_info_setdefault is called by libxl__domain_build_info_setdefault.

Quoted 3 lines

What I wanted to do here is resetting the union to 0 so you don't get data
mangled by the pv fields.

Quoted 5 lines

Another possible option I think would be to mark those fields as deprecated in the IDL, and libxl__domain_build_info_copy_deprecated will take care of copying them to the new place. In fact I think all guest types should be using the top level kernel, ramdisk and cmdline fields.

I will have a look at it.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

I'm not specially comfortable with changing the guest type in the middle of libxl__domain_build_info_setdefault, but I also don't have a much better suggestion apart from using the deprecation helper.

I forgot to answer to this bit. I don't think the deprecation helper will do all the jobs. There are still PV specific parameters: slack_memkb, features, e820_host.

Those can be left inside the PV sub-struct and shouldn't be marked as deprecated.

Quoted 6 lines
Quoted 3 lines

Those are not necessary for Arm, if you don't zero them then you will not initialize the PVH structure with default values. How do you suggest to handle them?

But I guess ARM doesn't use any of those fields (or else they should be moved to the pvh sub-struct anyway)?

Those fields should not be used by Arm. Looking at the current fields in pv, they all should be zeroed.

However, I am not sure if we can assume that will always be the case. If we can assume it, then I think it would just be sufficient to have b_info->type = LIBXL_DOMAIN_TYPE_PVH in Arm.

Quoted 6 lines
Quoted 1 line

Any thoughts?

If we go down this route for ARM I think you should add to xl.cfg that the type option only applies to x86, and that there's only one guest type on ARM. IMO it's best to not use type if there's only one type available, so that it can be intruded later on ARM if required.

That's not what we discussed before. The idea is to default Arm guest to PVH for xl. But "type=" would still be available.

Quoted 8 lines

We still have to support other type as other toolstack (e.g libvirt) may use PV for Arm. So the idea here is libxl will check if it was PV and convert to PVH.

In an earlier reply, you said that we can use deprecated to copy most of the options over. However, can we always assume the pv.* fields will always be zero after the value was copied over? If not, then we would have to memset them.

Yes, the field is cleared/disposed after the value is copied over, see libxl_C_type_copy_deprecated in gentypes.py.

Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#18 lore raw

Hi Roger,

Quoted 100 lines · Roger Pau Monné
Quoted 99 lines · Julien Grall

Hi,

Quoted 82 lines · Roger Pau Monné
Quoted 81 lines · Julien Grall

Hi Roger,

Sorry for the late reply.

Quoted 62 lines · Roger Pau Monné
Quoted 50 lines · Julien Grall
Quoted 49 lines · Julien Grall
Quoted 37 lines · Roger Pau Monné
Quoted 25 lines · Julien Grall
Quoted 16 lines
Quoted 16 lines
(quoted diff) +5 -0
+
+    b_info->type = LIBXL_DOMAIN_TYPE_PVH;
+
+    /*
+     * They only fie ld in u.pv that matters on Arm are:

kernel, cmdline,
+     * ramdisk.
+     */

(quoted diff) +7 -0
+
+    if (!b_info->kernel && b_info->u.pv.kernel)
+            b_info->kernel = b_info->u.pv.kernel;
+
+    if (!b_info->ramdisk && b_info->u.pv.ramdisk)
+        b_info->ramdisk = b_info->u.pv.ramdisk;
+
Quoted 8 lines
Quoted 5 lines

+    if (!b_info->cmdline && b_info->u.pv.cmdline) +        b_info->cmdline = b_info->u.pv.cmdline; +
+    /* Reset b_info->u.pvh to default values */ +    memset(&b_info->u.pvh, 0, sizeof(b_info->u.pvh));

I'm afraid that's not correct. The default values for u.pvh are set by libxl__domain_build_info_setdefault.

Quoted 3 lines

I thought that this should be covered by the switch right after the call of
libxl__arch_domain_build_info_setdefault. Did I miss anything?

Oh right, libxl__arch_domain_build_info_setdefault is called by libxl__domain_build_info_setdefault.

Quoted 3 lines

What I wanted to do here is resetting the union to 0 so you don't get data
mangled by the pv fields.

Quoted 5 lines

Another possible option I think would be to mark those fields as deprecated in the IDL, and libxl__domain_build_info_copy_deprecated will take care of copying them to the new place. In fact I think all guest types should be using the top level kernel, ramdisk and cmdline fields.

I will have a look at it.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

I'm not specially comfortable with changing the guest type in the middle of libxl__domain_build_info_setdefault, but I also don't have a much better suggestion apart from using the deprecation helper.

I forgot to answer to this bit. I don't think the deprecation helper will do all the jobs. There are still PV specific parameters: slack_memkb, features, e820_host.

Those can be left inside the PV sub-struct and shouldn't be marked as deprecated.

Quoted 6 lines
Quoted 3 lines

Those are not necessary for Arm, if you don't zero them then you will not initialize the PVH structure with default values. How do you suggest to handle them?

But I guess ARM doesn't use any of those fields (or else they should be moved to the pvh sub-struct anyway)?

Those fields should not be used by Arm. Looking at the current fields in pv, they all should be zeroed.

However, I am not sure if we can assume that will always be the case. If we can assume it, then I think it would just be sufficient to have b_info->type = LIBXL_DOMAIN_TYPE_PVH in Arm.

Quoted 6 lines
Quoted 1 line

Any thoughts?

If we go down this route for ARM I think you should add to xl.cfg that the type option only applies to x86, and that there's only one guest type on ARM. IMO it's best to not use type if there's only one type available, so that it can be intruded later on ARM if required.

That's not what we discussed before. The idea is to default Arm guest to PVH for xl. But "type=" would still be available.

We still have to support other type as other toolstack (e.g libvirt) may use PV for Arm. So the idea here is libxl will check if it was PV and convert to PVH.

Quoted 7 lines
Quoted 4 lines

In an earlier reply, you said that we can use deprecated to copy most of the options over. However, can we always assume the pv.* fields will always be zero after the value was copied over? If not, then we would have to memset them.

Yes, the field is cleared/disposed after the value is copied over, see libxl_C_type_copy_deprecated in gentypes.py.

That's answer part of my question :). AFAIU, nothing promise that a default value will always be 0 (see libxl_devid). I am concerned that someone may decide to add such field in either PV or PVH in the future.

Anyway, I think I find a way to address that, I will resend a new version later today.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel