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

Re: [Xen-devel] [PATCH v2 23/30] xen+tools: Export maximum host and guest cpu featuresets via SYSCTL



On 17/02/16 08:30, Jan Beulich wrote:
>>>> On 05.02.16 at 14:42, <andrew.cooper3@xxxxxxxxxx> wrote:
>> @@ -190,6 +191,71 @@ long arch_do_sysctl(
>>          }
>>          break;
>>  
>> +    case XEN_SYSCTL_get_cpu_featureset:
>> +    {
>> +        const uint32_t *featureset;
>> +        unsigned int nr;
>> +
>> +        /* Request for maximum number of features? */
>> +        if ( guest_handle_is_null(sysctl->u.cpu_featureset.features) )
>> +        {
>> +            sysctl->u.cpu_featureset.nr_features = FSCAPINTS;
>> +            if ( __copy_field_to_guest(u_sysctl, sysctl,
>> +                                       u.cpu_featureset.nr_features) )
>> +                ret = -EFAULT;
>> +            break;
>> +        }
>> +
>> +        /* Clip the number of entries. */
>> +        nr = sysctl->u.cpu_featureset.nr_features;
>> +        if ( nr > FSCAPINTS )
>> +            nr = FSCAPINTS;
> min() (perhaps even allowing to obviate the comment)?

They are different types, and you specifically objected to min_t() before.

>
>> +        switch ( sysctl->u.cpu_featureset.index )
>> +        {
>> +        case XEN_SYSCTL_cpu_featureset_raw:
>> +            featureset = raw_featureset;
>> +            break;
>> +
>> +        case XEN_SYSCTL_cpu_featureset_host:
>> +            featureset = host_featureset;
>> +            break;
>> +
>> +        case XEN_SYSCTL_cpu_featureset_pv:
>> +            featureset = pv_featureset;
>> +            break;
>> +
>> +        case XEN_SYSCTL_cpu_featureset_hvm:
>> +            featureset = hvm_featureset;
>> +            break;
>> +
>> +        default:
>> +            featureset = NULL;
>> +            break;
>> +        }
>> +
>> +        /* Bad featureset index? */
>> +        if ( !ret && !featureset )
>> +            ret = -EINVAL;
> Nothing above altered "ret" from its zero value, so the check here
> is pointless.

So it is.

>
>> --- a/xen/include/public/sysctl.h
>> +++ b/xen/include/public/sysctl.h
>> @@ -766,6 +766,29 @@ struct xen_sysctl_tmem_op {
>>  typedef struct xen_sysctl_tmem_op xen_sysctl_tmem_op_t;
>>  DEFINE_XEN_GUEST_HANDLE(xen_sysctl_tmem_op_t);
>>  
>> +/*
>> + * XEN_SYSCTL_get_cpu_featureset (x86 specific)
>> + *
>> + * Return information about the maximum sets of features which can be 
>> offered
>> + * to different types of guests.  This is all strictly information as found 
>> in
>> + * `cpuid` feature leaves with no synthetic additions.
>> + */
> The reference to guests in the comment conflicts with the raw and
> host types below.

I will reword.

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