Re: [RFC v3] arm,x86,fs/resctrl: Generic schema description Proof of Concept
From: Chen Yu
Date: Tue Dec 01 2026 - 07:27:56 EST
Hi Reinette,
On Wed, Nov 25, 2026 at 03:15:04PM -0800, Reinette Chatre wrote:
> Hi Chenyu,
>
> > OK, I'm also thinking of the min/max/opt clamp among different controls. As you mentioned in the cover
> > letter, this logic can be embedded in fs/resctrl(by doing santity check in the staging buffer)
>
> In the cover letter I was actually trying to convey that doing this reliably and consistently in
> resctrl filesystem is difficult and leaning towards this being done by architecture. resctrl
> filesystem should be able to handle relationships among controls if they support the same
> control values, but that is not guaranteed.
>
> Consider, for example, the example of MPAM's min and max controls (I think region-aware may
> have similar layout in legacy mode?):
>
> info/
> └── MB/
> └── schemata/
> ├── MB/
> │ └── MB_MAX/
> └── MB_MIN/
>
> When in legacy mode user space can set new control values for the MB and MB_MIN controls - since
> the MPAM driver manages the conversion from MB control value to MB_MAX control value it is not
> obvious how resctrl filesystem can enforce the relationship.
>
> For now I've just left it as-is - the filesystem allows user space to write a control value to
> the MIN control that is larger than the control value written to MAX.
>
> As noted this is still an open so we can discuss now as part of this RFC how best to handle this.
>
Thanks very much for providing the direction.
[Open1]:
If I understand correctly, control_mode determines what the schemata file
displays. I thought that in "legacy" mode, schemata would show only the legacy
controls. In the MPAM case, shouldn't "MB" be the only control displayed in
legacy mode? Why is "MB_L3_MIN" at the same level as the MB control? Did I miss
a discussion about this? I expected to see only:
# cat /sys/fs/resctrl/info/MB/control_mode
[legacy] native
# cat /sys/fs/resctrl/schemata
MB:0=100;1=100
rather than:
# cat /sys/fs/resctrl/info/MB/control_mode
[legacy] native
# cat /sys/fs/resctrl/schemata
MB:0=100;1=100
MB_L3_MIN:0=0;1=0
MB_L3_MIN is at the same level as the MB control because
in the code it is added in the same level as MB control:
list_add_tail(&mb->r_ctrl.entry, &r->controls);
list_add_tail(&mb_max->r_ctrl.entry, &mb->r_ctrl.emulated_by);
list_add_tail(&mb_min->r_ctrl.entry, &r->controls);
As a result, in legacy mode the control iteration helper
resctrl_enabled_ctrl_iter_next() iterates over both MB and MB_L3_MIN. That is
why schemata displays both of them. I wonder for this case,
can we add a dummy legacy MIN control, and link the MB_L3_MIN
under the legacy MIN control, so we can only display the controls
in the first level?
[Open2]:
Besides, if I understand correctly, the comparison between multiple controls
comes down to this check:
verify that user_min <= hw_max && user_max >= hw_min.
Intel region-aware MBA requires this sanity check, but MPAM might not. As Ben
mentioned: "The MPAM hardware configuration is still well-defined if
MIN is greater than MAX". So we can implement this check in the arch driver.
Can we say that min/max comparisons only happen between native controls? Since
the legacy control does not currently support min or max, would every new
control be a native control?
If that assumption holds, the validation could introduce
resctrl_arch_valid_range_bw(r, ctrl, bw) and call it from bw_validate().
If the values are invalid, then it will be discarded from the staged_buffer
and not reach the hardware update. I'm thinking of something like below:
bool resctrl_arch_valid_range_bw(struct rdt_resource *r, struct resctrl_ctrl *ctrl,
u32 bw)
{
struct resctrl_hw_ctrl *hw_ctrl = resctrl_to_arch_ctrl(ctrl);
if (!hw_ctrl->valid_range)
return true;
return hw_ctrl->valid_range(r, ctrl, bw);
}
hw_ctrl->valid_range = erdt_valid_range;
erdt_valid_range()
{
/* Do the ERDT-specific min/max/opt sanity check. */
}
thanks,
Chenyu