Re: [PATCH v5 04/40] x86/resctrl: Use schema type to determine how to parse schema values
From: Reinette Chatre
Date: Wed Oct 23 2024 - 17:14:46 EST
Hi James,
On 10/4/24 11:03 AM, James Morse wrote:
> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> index 2abe17574407..11153271cbdc 100644
> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> @@ -2201,7 +2201,7 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn)
> }
>
> for_each_mon_capable_rdt_resource(r) {
> - fflags = fflags_from_resource(r) | RFTYPE_MON_INFO;
> + fflags = fflags_from_resource(r) | RFTYPE_MON_INFO;
> sprintf(name, "%s_MON", r->name);
> ret = rdtgroup_mkdir_info_resdir(r, name, fflags);
> if (ret)
Stray hunk.
> diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h
> index 496ddcaa4ecf..54ec87339038 100644
> --- a/include/linux/resctrl.h
> +++ b/include/linux/resctrl.h
> @@ -183,7 +183,6 @@ struct resctrl_membw {
> u32 *mb_map;
> };
>
> -struct rdt_parse_data;
> struct resctrl_schema;
>
> enum resctrl_scope {
> @@ -192,6 +191,17 @@ enum resctrl_scope {
> RESCTRL_L3_NODE,
> };
>
> +/**
> + * enum resctrl_schema_fmt - The format user-space provides for a schema.
> + * @RESCTRL_SCHEMA_BITMAP: The schema is a bitmap in hex.
> + * @RESCTRL_SCHEMA_RANGE: The schema is a number, either a percentage
> + * or a MBps value.
The description of RESCTRL_SCHEMA_RANGE appears to aim to be specific. Considering this
it should also include the "multiples of one eighth GB/s" input option used on
AMD systems.
The software controller is the only user of actual bandwidth and for its
use it should be "MiBps".
> + */
> +enum resctrl_schema_fmt {
> + RESCTRL_SCHEMA_BITMAP,
> + RESCTRL_SCHEMA_RANGE,
> +};
> +
> /**
> * struct rdt_resource - attributes of a resctrl resource
> * @rid: The index of the resource
> @@ -208,7 +218,7 @@ enum resctrl_scope {
> * @data_width: Character width of data when displaying
> * @default_ctrl: Specifies default cache cbm or memory B/W percent.
> * @format_str: Per resource format string to show domain value
> - * @parse_ctrlval: Per resource function pointer to parse control values
> + * @schema_fmt: Which format string and parser is used for this schema.
Please fix alignment.
> * @evt_list: List of monitoring events
> * @cdp_capable: Is the CDP feature available on this resource
> */
> @@ -227,9 +237,7 @@ struct rdt_resource {
> int data_width;
> u32 default_ctrl;
> const char *format_str;
> - int (*parse_ctrlval)(struct rdt_parse_data *data,
> - struct resctrl_schema *s,
> - struct rdt_ctrl_domain *d);
> + enum resctrl_schema_fmt schema_fmt;
> struct list_head evt_list;
> bool cdp_capable;
> };
Reinette