[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH RFC 13/31] tools/libxc: Wire a featureset through to cpuid policy logic



On Wed, 2015-12-16 at 21:24 +0000, Andrew Cooper wrote:
> Later changes will cause the cpuid generation logic to seed their
> information
> from a featureset.ÂÂThis patch adds the infrastructure to specify a
> featureset, and will obtain the appropriate default from Xen if omitted.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
> CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
> CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> CC: Wei Liu <wei.liu2@xxxxxxxxxx>
> ---
> Âtools/libxc/include/xenctrl.h |ÂÂ3 ++
> Âtools/libxc/xc_cpuid_x86.cÂÂÂÂ| 90
> ++++++++++++++++++++++++++++++++++++++-----
> Â2 files changed, 84 insertions(+), 9 deletions(-)
> 
> diff --git a/tools/libxc/include/xenctrl.h
> b/tools/libxc/include/xenctrl.h
> index 27e1f45..b44aec7 100644
> --- a/tools/libxc/include/xenctrl.h
> +++ b/tools/libxc/include/xenctrl.h
> @@ -2211,6 +2211,9 @@ int xc_cpuid_set(xc_interface *xch,
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂchar **config_transformed);
> Âint xc_cpuid_apply_policy(xc_interface *xch,
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂdomid_t domid);
> +int xc_cpuid_apply_policy_with_featureset(xc_interface *xch, domid_t domid,
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂuint32_t *featureset,
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂunsigned int nr_features);

We should aim to eventually only have one apply policy interface here not
two, unless there is some good reason why xc_cpuid_apply_policy() should
remain?

AIUI passing featureset==NULL is going to be semantically identical to the
old interface, so I think we should just go with adding the new parameters
to the existing function.

> @@ -103,6 +109,32 @@ static int get_cpuid_domain_info(xc_interface *xch, 
> domid_t domid,
> ÂÂÂÂÂinfo->hvm = di.hvm;
> ÂÂÂÂÂinfo->pvh = di.pvh;
> Â
> +ÂÂÂÂ/* Get featureset information. */
> +ÂÂÂÂrc = xc_get_featureset(xch, XEN_SYSCTL_featureset_host,
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ&host_nr_features, NULL);
> +ÂÂÂÂif ( rc )
> +ÂÂÂÂÂÂÂÂreturn rc;
> +
> +ÂÂÂÂif ( host_nr_features < XEN_FEATURESET_7c0 )
> +ÂÂÂÂÂÂÂÂreturn -EINVAL;

Could we assert this? I mean if Xen and libxc don't agree on this then
something went pretty wrong during the dev window.

> +
> +ÂÂÂÂinfo->featureset = calloc(host_nr_features, sizeof(*info->featureset));
> +ÂÂÂÂif ( !info->featureset )
> +ÂÂÂÂÂÂÂÂreturn -ENOMEM;
> +
> +ÂÂÂÂinfo->nr_features = host_nr_features;
> +
> +ÂÂÂÂif ( featureset )
> +ÂÂÂÂ{
> +ÂÂÂÂÂÂÂÂmemcpy(info->featureset, featureset,
> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂmin(host_nr_features, nr_features) * 
> sizeof(*info->featureset));
> +
> +ÂÂÂÂÂÂÂÂ/* Check for trucated set bits. */

"truncated"

Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.