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

Re: [Xen-devel] [PATCH v6 2/3] x86: add domctl cmd to set/get CDP code/data CBM



On Thu, Oct 08, 2015 at 11:23:56AM +0800, He Chen wrote:
> CDP extends CAT and provides the capacity to control L3 code & data
> cache. With CDP, one COS corresponds to two CMBs(code & data). cbm_type
> is added to distinguish different CBM operations. Besides, new domctl
> cmds are introdunced to support set/get CDP CBM. Some CAT functions to
> operation CBMs are extended to support CDP.
> 
> Signed-off-by: He Chen <he.chen@xxxxxxxxxxxxxxx>
> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> ---
> Changes in v6:
> * remove variable need_write and restruct code in psr_set_l3_cbm
> * remove redundant type == PSR_CBM_TYPE_L3 in psr_get_l3_cbm

Looks good to me. Just several coding style issues. With that fixed:
Reviewed-by: Chao Peng <chao.p.peng@xxxxxxxxxxxxxxx>

> +static int find_cos(struct psr_cat_cbm *map, unsigned int cos_max,
> +                    uint64_t cbm_code, uint64_t cbm_data, bool_t cdp_enabled)
> +{
> +    unsigned int cos;
> +
> +    for ( cos = 0; cos <= cos_max; cos++ )
> +    {
> +        if( map[cos].ref &&
            ^ space

> +            ((!cdp_enabled && map[cos].cbm == cbm_code) ||
> +             (cdp_enabled && map[cos].code == cbm_code &&
> +                             map[cos].data == cbm_data)))
                                                          ^space
> +            return cos;
> +    }
> +
> +    return -ENOENT;
> +}

> @@ -371,53 +450,71 @@ int psr_set_l3_cbm(struct domain *d, unsigned int 
> socket, uint64_t cbm)
>      if ( !psr_check_cbm(info->cbm_len, cbm) )
>          return -EINVAL;
>  
> +    if ( !cdp_enabled && (type == PSR_CBM_TYPE_L3_CODE ||
> +                          type == PSR_CBM_TYPE_L3_DATA) )
> +        return -ENXIO;
> +
> +    cos_max = info->cos_max;
>      old_cos = d->arch.psr_cos_ids[socket];
>      map = info->cos_to_cbm;
>  
> -    spin_lock(&info->cbm_lock);
> -
> -    for ( cos = 0; cos <= info->cos_max; cos++ )
> +    switch( type )
            ^ space

> +
> +        /* We try to avoid writing MSR. */
> +        if ( (cdp_enabled &&
> +             (map[cos].code != cbm_code || map[cos].data != cbm_data)) ||
> +             (!cdp_enabled && map[cos].cbm != cbm_code))
                                                         ^ space 
> +        {

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