Skip to contentSkip to conversation

tools/libxl: pass libxl__domain_build_state to libxl__arch_domain_create

PATCH In review Igor Druzhinin 3 participants 5 messages Feb 3, 2021 – Feb 5, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 tools/libxl: pass libxl__domain_build_state to libxl__arch_domain_create

No functional change.

---
New patch in v2 as requested.

---
 tools/libs/light/libxl_arch.h | 6 ++++--
 tools/libs/light/libxl_arm.c  | 4 +++-
 tools/libs/light/libxl_dom.c  | 2 +-
 tools/libs/light/libxl_x86.c  | 6 ++++--
 4 files changed, 12 insertions(+), 6 deletions(-)
tools/libs/light/libxl_arch.h +4 -2
index 6a91775..c305d70 100644
@@ -30,8 +30,10 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
 
 /* arch specific internal domain creation function */
 _hidden
-int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
-               uint32_t domid);
+int libxl__arch_domain_create(libxl__gc *gc,
+                              libxl_domain_config *d_config,
+                              libxl__domain_build_state *state,
+                              uint32_t domid);
 
 /* setup arch specific hardware description, i.e. DTB on ARM */
 _hidden
tools/libs/light/libxl_arm.c +3 -1
index 66e8a06..8c4eda3 100644
@@ -126,7 +126,9 @@ int libxl__arch_domain_save_config(libxl__gc *gc,
     return 0;
 }
 
-int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
+int libxl__arch_domain_create(libxl__gc *gc,
+                              libxl_domain_config *d_config,
+                              ibxl__domain_build_state *state,
                               uint32_t domid)
 {
     return 0;
tools/libs/light/libxl_dom.c +1 -1
index 1916857..842a51c 100644
@@ -378,7 +378,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
     state->store_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->store_domid);
     state->console_port = xc_evtchn_alloc_unbound(ctx->xch, domid, state->console_domid);
 
-    rc = libxl__arch_domain_create(gc, d_config, domid);
+    rc = libxl__arch_domain_create(gc, d_config, state, domid);
 
     /* Construct a CPUID policy, but only for brand new domains.  Domains
      * being migrated-in/restored have CPUID handled during the
tools/libs/light/libxl_x86.c +4 -2
index 91a9fc7..91169d1 100644
@@ -453,8 +453,10 @@ static int hvm_set_conf_params(libxl__gc *gc, uint32_t domid,
     return ret;
 }
 
-int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
-        uint32_t domid)
+int libxl__arch_domain_create(libxl__gc *gc,
+                              libxl_domain_config *d_config,
+                              libxl__domain_build_state *state,
+                              uint32_t domid)
 {
     const libxl_domain_build_info *info = &d_config->b_info;
     int ret = 0;
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 2/2 tools/libxl: only set viridian flags on new domains

Domains migrating or restoring should have viridian HVM param key in the migration stream already and setting that twice results in Xen returing -EEXIST on the second attempt later (during migration stream parsing) in case the values don't match. That causes migration/restore operation to fail at destination side.

That issue is now resurfaced by the latest commits (983524671 and 7e5cffcd1e) extending default viridian feature set making the values from the previous migration streams and those set at domain construction different.

---
 tools/libs/light/libxl_x86.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/libs/light/libxl_x86.c +4 -1
index 91169d1..58187ed 100644
@@ -468,7 +468,10 @@ int libxl__arch_domain_create(libxl__gc *gc,
         (ret = hvm_set_conf_params(gc, domid, info)) != 0)
         goto out;
 
-    if (info->type == LIBXL_DOMAIN_TYPE_HVM &&
+    /* Viridian flags are already a part of the migration stream so set
+     * them here only for brand new domains. */
+    if (!state->restore &&
+        info->type == LIBXL_DOMAIN_TYPE_HVM &&
         (ret = hvm_set_viridian_features(gc, domid, info)) != 0)
         goto out;
 
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH v2 2/2] tools/libxl: only set viridian flags on new domains

Igor Druzhinin writes ("[PATCH v2 2/2] tools/libxl: only set viridian flags on new domains"):

Quoted 6 lines

Domains migrating or restoring should have viridian HVM param key in the migration stream already and setting that twice results in Xen returing -EEXIST on the second attempt later (during migration stream parsing) in case the values don't match. That causes migration/restore operation to fail at destination side.

Quoted 6 lines

That issue is now resurfaced by the latest commits (983524671 and 7e5cffcd1e) extending default viridian feature set making the values from the previous migration streams and those set at domain construction different.

Thanks for splitting this up.

Andy, I think from irc that this meets with your approval but can I have a formal R-b ? If so please put my tools maintainer ack on it too.

Thanks,
Ian.

Reviewed-by
#3 lore raw

Re: [PATCH v2 2/2] tools/libxl: only set viridian flags on new domains

Quoted 13 lines · Ian Jackson

Igor Druzhinin writes ("[PATCH v2 2/2] tools/libxl: only set viridian flags on new domains"):

Quoted 6 lines

Domains migrating or restoring should have viridian HVM param key in the migration stream already and setting that twice results in Xen returing -EEXIST on the second attempt later (during migration stream parsing) in case the values don't match. That causes migration/restore operation to fail at destination side.

Quoted 6 lines

That issue is now resurfaced by the latest commits (983524671 and 7e5cffcd1e) extending default viridian feature set making the values from the previous migration streams and those set at domain construction different.

Quoted 7 lines

Thanks for splitting this up.

Andy, I think from irc that this meets with your approval but can I have a formal R-b ? If so please put my tools maintainer ack on it too.