|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v10 21/25] x86: L2 CAT: implement set value flow.
>>> On 01.04.17 at 15:53, <yi.y.sun@xxxxxxxxxxxxxxx> wrote:
> --- a/xen/arch/x86/domctl.c
> +++ b/xen/arch/x86/domctl.c
> @@ -1466,6 +1466,16 @@ long arch_do_domctl(
> PSR_CBM_TYPE_L3_DATA);
> break;
>
> + case XEN_DOMCTL_PSR_CAT_OP_SET_L2_CBM:
> + if ( domctl->u.psr_cat_op.data !=
> + (uint32_t)domctl->u.psr_cat_op.data )
> + return -EINVAL;
Considering this recurring pattern I'd like to suggest to do the
check in a single place early in ...
> + ret = psr_set_val(d, domctl->u.psr_cat_op.target,
> + domctl->u.psr_cat_op.data,
> + PSR_CBM_TYPE_L2);
... the function being called here.
> --- a/xen/arch/x86/psr.c
> +++ b/xen/arch/x86/psr.c
> @@ -467,10 +467,21 @@ static struct feat_props l3_cdp_props = {
> };
>
> /* L2 CAT ops */
> +static void l2_cat_write_msr(unsigned int cos, uint32_t val,
> + enum cbm_type type, struct feat_node *feat)
> +{
> + if ( feat->cos_reg_val[cos] != val )
> + {
> + feat->cos_reg_val[cos] = val;
It's not the first time I see this pattern, so it looks like this again
would be a candidate for further code movement into generic
logic.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |