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

Re: [Xen-devel] [PATCH v4] x86: psr: support co-exist features' values setting



On 17-10-11 14:59:23, Chao Peng wrote:
> On Wed, 2017-10-11 at 09:55 +0800, Yi Sun wrote:
> >  static void do_write_psr_msrs(void *data)
> >  {
> > -    const struct cos_write_info *info = data;
> > -    struct feat_node *feat = info->feature;
> > -    const struct feat_props *props = info->props;
> > -    unsigned int i, cos = info->cos, cos_num = props->cos_num;
> > +    struct cos_write_info *info = data;
> > +    unsigned int i, index = 0, cos = info->cos;
> > +    struct psr_socket_info *socket_info =
> > +                            get_socket_info(cpu_to_socket(smp_process
> > or_id()));
> >  
> > -    for ( i = 0; i < cos_num; i++ )
> > +    /*
> > +     * Iterate all featuers to write different value (not same as
> > MSR) for
> > +     * each feature.
> > +     */
> > +    for ( i = 0; i < ARRAY_SIZE(feat_props); i++ )
> >      {
> > -        if ( feat->cos_reg_val[cos * cos_num + i] != info->val[i] )
> > +        struct feat_node *feat = socket_info->features[i];
> > +        const struct feat_props *props = feat_props[i];
> > +        unsigned int cos_num, j;
> > +
> > +        if ( !feat || !props )
> > +            continue;
> > +
> > +        cos_num = props->cos_num;
> > +        if ( info->array_len < index + cos_num )
> > +        {
> > +            info->result = -ENOSPC;
> > +            return;
> 
> This will have side effect (You may have run write_msr for some features
> already) when you return the error. It probably will not cause logic
> error here, there is performance penalty however (writing MSR and
> sending IPI).
> 
> Another thing is this error is a real error that we want to propagate to
> user? E.g, I don't quite understand in which case the condition can
> happen? If this is only a program error then ASSERT can be used.
> 
Thanks! If error happens, this error is a program error. So, an ASSERT here
is better.

> Chao

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