[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 05/01/16 15:42, Ian Campbell wrote:
> 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.

Will do.

>
>> @@ -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.

Will do.

>
>> +
>> +    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"

Will fix.

~Andrew

_______________________________________________
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®.