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

Re: [Xen-devel] [PATCH v9 12/25] x86: refactor psr: L3 CAT: set value: implement cos id picking flow.



On 17-03-28 04:40:41, Jan Beulich wrote:
> >>> On 28.03.17 at 12:31, <yi.y.sun@xxxxxxxxxxxxxxx> wrote:
> > On 17-03-28 02:45:13, Jan Beulich wrote:
> >> >>> On 28.03.17 at 06:58, <yi.y.sun@xxxxxxxxxxxxxxx> wrote:
> >> > On 17-03-27 04:37:37, Jan Beulich wrote:
> >> >> >>> On 16.03.17 at 12:08, <yi.y.sun@xxxxxxxxxxxxxxx> wrote:
> >> >> > +static bool cat_fits_cos_max(const uint32_t val[],
> >> >> > +                             const struct feat_node *feat,
> >> >> > +                             unsigned int cos)
> >> >> > +{
> >> >> > +    if ( cos > feat->info.cat_info.cos_max &&
> >> >> > +         val[0] != feat->cos_reg_val[0] )
> >> >> > +            /*
> >> >> > +             * Exceed cos_max and value to set is not default,
> >> >> > +             * return error.
> >> >> > +             */
> >> >> > +            return false;
> >> >> > +
> >> >> > +    return true;
> >> >> > +}
> >> >> 
> >> >> Same here - with cos_max moved out, the hook would seem to
> >> >> become unnecessary.
> >> >> 
> >> > As explanation in previous patch, CDP has different behavior.
> >> > static bool l3_cdp_fits_cos_max(...)
> >> > {
> >> >     if ( cos > feat->info.cat_info.cos_max &&
> >> >          (val[0] != get_cdp_data(feat, 0) || val[1] != 
> >> > get_cdp_code(feat, 0)) )
> >> >             /*
> >> >              * Exceed cos_max and value to set is not default,
> >> >              * return error.
> >> >              */
> >> >             return false;
> >> > 
> >> >     return true;
> >> > 
> >> > }
> >> 
> >> As said in reply, by making get_val() flexible enough you should
> >> be able to avoid this.
> > 
> > Sorry, I am confused here. 'fits_cos_max' is called during set value 
> > process.
> > Why "making get_val() flexible enough" can avoid this?
> 
> Because that would then replace the get_cdp_data() and
> get_cdp_code() calls above.
> 
I think we at least need a 'get_val()' hook. I try to implement CAT/CDP hook.
Please help to check if this is what you thought.

static void cat_get_val(const struct feat_node *feat, unsigned int cos,
                        enum cbm_type type, int flag, uint32_t *val)
{
    *val = feat->cos_reg_val[cos];
}

static void l3_cdp_get_val(const struct feat_node *feat, unsigned int cos,
                           enum cbm_type type, int flag, uint32_t *val)
{
    if ( type == PSR_CBM_TYPE_L3_DATA || flag == 0 )
        *val = get_cdp_data(feat, cos);
    if ( type == PSR_CBM_TYPE_L3_CODE || flag == 1 )
        *val = get_cdp_code(feat, cos);
}

static bool fits_cos_max(const uint32_t val[],
                         uint32_t array_len,
                         const struct psr_socket_info *info,
                         unsigned int cos)
{
    unsigned int i, j;
    const struct feat_node *feat;
    uint32_t default_val;
        
    for ( i = 0; i < PSR_SOCKET_MAX_FEAT; i++ )
    {
        if ( !info->features[i] )
            continue;

        feat = info->features[i];

        if ( array_len < feat->cos_num )
            return false;
        
        /* Move the fits_cos_max() hook content into caller here. */
        if ( cos > feat->props->cos_max )
        {
            for ( j = 0; j < feat->cos_num; j++ )
            {
                /* cos_reg_val[0] always stores the default value so set cos to 
0. */
                feat->props->get_val(feat, 0, 0, j, &default_val);
                if ( val[j] != default_val )
                    return false;
            }
        }

        val += feat->cos_num;
    }

    return true;
}

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