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

Re: [Xen-devel] [PATCH v9 10/25] x86: refactor psr: L3 CAT: set value: assemble features value array.



On 17-03-28 11:12:43, Yi Sun wrote:
> On 17-03-27 04:17:28, Jan Beulich wrote:
> > >>> On 16.03.17 at 12:08, <yi.y.sun@xxxxxxxxxxxxxxx> wrote:
> > > --- a/xen/arch/x86/psr.c
> > > +++ b/xen/arch/x86/psr.c
[...]

> > >  static int gather_val_array(uint32_t val[],
> > > @@ -589,7 +672,34 @@ static int gather_val_array(uint32_t val[],
> > >                              const struct psr_socket_info *info,
> > >                              unsigned int old_cos)
> > >  {
> > > -    return -EINVAL;
> > > +    const struct feat_node *feat;
> > > +    unsigned int i;
> > > +
> > > +    if ( !val )
> > > +        return -EINVAL;
> > > +
> > > +    /* Get all features current values according to old_cos. */
> > > +    for ( i = 0; i < PSR_SOCKET_MAX_FEAT; i++ )
> > > +    {
> > > +        if ( !info->features[i] )
> > > +            continue;
> > > +
> > > +        feat = info->features[i];
> > > +
> > > +        if ( old_cos > feat->ops.get_cos_max(feat) )
> > > +            old_cos = 0;
> > > +
> > > +        /* value getting order is same as feature array */
> > > +        feat->ops.get_old_val(val, feat, old_cos);
> > > +
> > > +        array_len -= feat->cos_num;
> > 
> > So this I should really have asked about on a much earlier patch,
> > but I've recognize the oddity only now: Why is cos_num
> > per-feature-node instead of per-feature? This should really be a
> > field in struct feat_ops (albeit the name "ops" then will be slightly
> > misleading, but I think that's tolerable if you can't think of a better
> > name).
> > 
> Ok, I got your meaning. How about 'feat_props'? No matter operations or
> variables are all properties of the feature.
> 
One more thing here. If we move 'cos_max' into 'feat_ops', we cannot declare
'feat_ops' as const. Because we have to assign value to 'cos_max' in
cat_init_feature().

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

 


Rackspace

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