lkml.org 
[lkml]   [2024]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH v1 03/31] x86/resctrl: Move ctrlval string parsing policy away from the arch code
    From
    >   /*
    > * Check whether MBA bandwidth percentage value is correct. The value is
    > * checked against the minimum and max bandwidth values specified by the
    > @@ -59,8 +68,8 @@ static bool bw_validate(char *buf, unsigned long *data, struct rdt_resource *r)
    > return true;
    > }
    >
    > -int parse_bw(struct rdt_parse_data *data, struct resctrl_schema *s,
    > - struct rdt_domain *d)
    > +static int parse_bw(struct rdt_parse_data *data, struct resctrl_schema *s,
    > + struct rdt_domain *d)
    > {
    > struct resctrl_staged_config *cfg;
    > u32 closid = data->rdtgrp->closid;
    > @@ -138,8 +147,8 @@ static bool cbm_validate(char *buf, u32 *data, struct rdt_resource *r)
    > * Read one cache bit mask (hex). Check that it is valid for the current
    > * resource type.
    > */
    > -int parse_cbm(struct rdt_parse_data *data, struct resctrl_schema *s,
    > - struct rdt_domain *d)
    > +static int parse_cbm(struct rdt_parse_data *data, struct resctrl_schema *s,
    > + struct rdt_domain *d)
    > {
    > struct rdtgroup *rdtgrp = data->rdtgrp;
    > struct resctrl_staged_config *cfg;
    > @@ -195,6 +204,14 @@ int parse_cbm(struct rdt_parse_data *data, struct resctrl_schema *s,
    > return 0;
    > }
    >
    > +static ctrlval_parser_t *get_parser(struct rdt_resource *res)
    > +{
    > + if (res->fflags & RFTYPE_RES_CACHE)
    > + return &parse_cbm;
    > + else
    > + return &parse_bw;
    > +}

    Besides what Reinette said, I'd have added here something that would
    fire in case someone adds something unexpected in the future, like

    WARN_ON_ONCE(!(res->fflags & (RFTYPE_RES_CACHE|RFTYPE_RES_MB));

    At the beginning of the function.


    Apart from that, nothing jumped at me.

    --
    Cheers,

    David / dhildenb


    \
     
     \ /
      Last update: 2024-05-27 16:31    [W:8.252 / U:0.036 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site