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

Re: [Xen-devel] [PATCH v1 05/13] x86: implement get hw info flow for MBA



On Wed, 2017-08-09 at 15:41 +0800, Yi Sun wrote:
> This patch implements get HW info flow for MBA including its callback
> function and sysctl interface.
> 
> Signed-off-by: Yi Sun <yi.y.sun@xxxxxxxxxxxxxxx>
> ---
> v1:
>     - sort 'PSR_INFO_IDX_' macros as feature.
>       (suggested by Chao Peng)
>     - rename 'PSR_INFO_IDX_MBA_LINEAR' to 'PSR_INFO_IDX_MBA_FLAG'.
>     - rename 'linear' in 'struct mba_info' to 'flags' for future
> extension.
>       (suggested by Chao Peng)
> ---
>  xen/arch/x86/psr.c          | 13 ++++++++++++-
>  xen/arch/x86/sysctl.c       | 19 +++++++++++++++++++
>  xen/include/asm-x86/psr.h   |  2 ++
>  xen/include/public/sysctl.h |  8 ++++++++
>  4 files changed, 41 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
> index d94a5b1..9455e67 100644
> --- a/xen/arch/x86/psr.c
> +++ b/xen/arch/x86/psr.c
> @@ -264,6 +264,10 @@ static enum psr_feat_type
> psr_val_type_to_feat_type(enum psr_val_type type)
>          feat_type = FEAT_TYPE_L2_CAT;
>          break;
>  
> +    case PSR_VAL_TYPE_MBA:
> +        feat_type = FEAT_TYPE_MBA;
> +        break;
> +
>      default:
>          ASSERT_UNREACHABLE();
>      }
> @@ -490,7 +494,14 @@ static const struct feat_props l2_cat_props = {
>  static bool mba_get_feat_info(const struct feat_node *feat,
>                                uint32_t data[], unsigned int
> array_len)
>  {
> -    return false;
> +    if ( array_len != PSR_INFO_ARRAY_SIZE )
> +        return false;
> +
> +    data[PSR_INFO_IDX_COS_MAX] = feat->cos_max;
> +    data[PSR_INFO_IDX_MBA_THRTL_MAX] = feat->mba_info.thrtl_max;
> +    data[PSR_INFO_IDX_MBA_FLAG] = feat->mba_info.linear;

Once it becomes a flag, then good practice would be operating it as a
flag. E.g. here assigning a bool value to a flag bit is error-prone once
more bits get used. Like XEN_SYSCTL_PSR_CAT_L3_CDP, you can set/clear
XEN_SYSCTL_PSR_MBA_LINEAR bit respectively.

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