libxl: don't ignore the return value from xc_cpuid_apply_policy

Also change libxl__cpuid_legacy to propagate the error from
xc_cpuid_apply_policy into callers.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
This commit is contained in:
Roger Pau Monne authored and Andrew Cooper committed 2021-05-04 18:35:35 +01:00
1 parent ec4b43107f
commit 34990446ca
5 files changed
+16 -7

No files matched your search

+9 -2
View File
@@ -426,11 +426,13 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
return 0;
}
void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
int libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
libxl_domain_build_info *info)
{
GC_INIT(ctx);
bool pae = true;
bool itsc;
int r;
/*
* Gross hack. Using libxl_defbool_val() here causes libvirt to crash in
@@ -469,8 +471,13 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
itsc = (libxl_defbool_val(info->disable_migrate) ||
info->tsc_mode == LIBXL_TSC_MODE_ALWAYS_EMULATE);
xc_cpuid_apply_policy(ctx->xch, domid, restore, NULL, 0,
r = xc_cpuid_apply_policy(ctx->xch, domid, restore, NULL, 0,
pae, itsc, nested_virt, info->cpuid);
if (r)
LOGEVD(ERROR, -r, domid, "Failed to apply CPUID policy");
GC_FREE;
return r ? ERROR_FAIL : 0;
}
static const char *input_names[2] = { "leaf", "subleaf" };
+3 -2
View File
@@ -1434,6 +1434,7 @@ int libxl__srm_callout_callback_static_data_done(unsigned int missing,
libxl_domain_config *d_config = dcs->guest_config;
libxl_domain_build_info *info = &d_config->b_info;
int rc = 0;
/*
* CPUID/MSR information is not present in pre Xen-4.14 streams.
@@ -1443,9 +1444,9 @@ int libxl__srm_callout_callback_static_data_done(unsigned int missing,
* stream doesn't contain any CPUID data.
*/
if (missing & XGR_SDD_MISSING_CPUID)
libxl__cpuid_legacy(ctx, dcs->guest_domid, true, info);
rc = libxl__cpuid_legacy(ctx, dcs->guest_domid, true, info);
return 0;
return rc;
}
void libxl__srm_callout_callback_restore_results(xen_pfn_t store_mfn,
+1 -1
View File
@@ -384,7 +384,7 @@ int libxl__build_pre(libxl__gc *gc, uint32_t domid,
* being migrated-in/restored have CPUID handled during the
* static_data_done() callback. */
if (!state->restore)
libxl__cpuid_legacy(ctx, domid, false, info);
rc = libxl__cpuid_legacy(ctx, domid, false, info);
return rc;
}
+1 -1
View File
@@ -2052,7 +2052,7 @@ typedef yajl_gen_status (*libxl__gen_json_callback)(yajl_gen hand, void *);
_hidden char *libxl__object_to_json(libxl_ctx *ctx, const char *type,
libxl__gen_json_callback gen, void *p);
_hidden void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool retore,
_hidden int libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool retore,
libxl_domain_build_info *info);
/* Calls poll() again - useful to check whether a signaled condition
+2 -1
View File
@@ -34,9 +34,10 @@ int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
return 0;
}
void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
int libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
libxl_domain_build_info *info)
{
return 0;
}
yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.