]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
tools/libxl: Re-position CPUID handling during domain construction
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 2 Jan 2020 19:44:36 +0000 (19:44 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 29 May 2020 16:33:03 +0000 (17:33 +0100)
CPUID handling needs to be earlier in construction.  Move it from its current
position in libxl__build_post() to libxl__build_pre() for fresh builds, and
libxl__srm_callout_callback_static_data_done() for the migration/resume case.

Later changes will make the migration/resume case conditional on whether CPUID
data was present in the migration stream, and the libxc layer took care of
restoring it.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/libxl_create.c
tools/libxl/libxl_dom.c

index baed817a962c55c7d10f9f7c1b30f22999fc3122..cc7340c48db8c8cb7444c2b0bae93c9b307d86ea 100644 (file)
@@ -1433,8 +1433,12 @@ int libxl__srm_callout_callback_static_data_done(void *user)
     libxl__save_helper_state *shs = user;
     libxl__domain_create_state *dcs = shs->caller_state;
     STATE_AO_GC(dcs->ao);
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+
+    libxl_domain_config *d_config = dcs->guest_config;
+    libxl_domain_build_info *info = &d_config->b_info;
 
-    /* Nothing to do (yet). */
+    libxl__cpuid_legacy(ctx, dcs->guest_domid, info);
 
     return 0;
 }
index 71cb578923abe8bdde746a7ee3b4f3fb2201f8a1..dd1aff89a34bc9b31c1042ca791b37ee472adc62 100644 (file)
@@ -387,6 +387,12 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
 
     rc = libxl__arch_domain_create(gc, d_config, domid);
 
+    /* Construct a CPUID policy, but only for brand new domains.  Domains
+     * being migrated-in/restored have CPUID handled during the
+     * static_data_done() callback. */
+    if (!state->restore)
+        libxl__cpuid_legacy(ctx, domid, info);
+
     return rc;
 }
 
@@ -454,8 +460,6 @@ int libxl__build_post(libxl__gc *gc, uint32_t domid,
     if (rc)
         return rc;
 
-    libxl__cpuid_legacy(ctx, domid, info);
-
     if (info->type == LIBXL_DOMAIN_TYPE_HVM
         && !libxl_ms_vm_genid_is_zero(&info->u.hvm.ms_vm_genid)) {
         rc = libxl__ms_vm_genid_set(gc, domid,