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

Re: [Xen-devel] [PATCH v7 05/16] x86: implement data structure and CPU init flow for MBA



>>> On 13.10.17 at 10:40, <yi.y.sun@xxxxxxxxxxxxxxx> wrote:
> @@ -319,11 +340,13 @@ static bool cat_init_feature(const struct cpuid_leaf 
> *regs,
>          feat->cos_max = (feat->cos_max - 1) >> 1;
>  
>          /* We reserve cos=0 as default cbm (all bits within cbm_len are 1). 
> */
> -        get_cdp_code(feat, 0) = cat_default_val(feat->cbm_len);
> -        get_cdp_data(feat, 0) = cat_default_val(feat->cbm_len);
> +        get_cdp_code(feat, 0) = cat_default_val(feat->cat.cbm_len);
> +        get_cdp_data(feat, 0) = cat_default_val(feat->cat.cbm_len);
>  
> -        wrmsrl(MSR_IA32_PSR_L3_MASK(0), cat_default_val(feat->cbm_len));
> -        wrmsrl(MSR_IA32_PSR_L3_MASK(1), cat_default_val(feat->cbm_len));
> +        wrmsrl(MSR_IA32_PSR_L3_MASK(0),
> +               cat_default_val(feat->cat.cbm_len));
> +        wrmsrl(MSR_IA32_PSR_L3_MASK(1),
> +               cat_default_val(feat->cat.cbm_len));

No need to split lines here afaics.

> +static bool mba_init_feature(const struct cpuid_leaf *regs,
> +                            struct feat_node *feat,
> +                            struct psr_socket_info *info,
> +                            enum psr_feat_type type)
> +{
> +    /* No valid value so do not enable feature. */
> +    if ( !regs->a || !regs->d || type != FEAT_TYPE_MBA )
> +        return false;
> +
> +    feat->cos_max = min(opt_cos_max, regs->d & CAT_COS_MAX_MASK);

Even if this and ...

> +    if ( feat->cos_max < 1 )
> +        return false;
> +
> +    feat->mba.thrtl_max = (regs->a & MBA_THRTL_MAX_MASK) + 1;

... this mask don't strictly require it (as they're starting at bit 0),
please use MASK_EXTR() in such cases.

With both taken care of 
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan


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