Re: [PATCH] x86/resctrl: Do not round up mba_MBps values in schemata file

From: Reinette Chatre
Date: Fri Sep 27 2024 - 18:47:24 EST


+Martin

Hi Tony,

On 9/27/24 3:30 PM, Tony Luck wrote:
> When the mba_MBps mount option is used Linux initializes the
> MBA control values in the schemata file to MBA_MAX_MBPS (which
> is defined as U32_MAX). So the schemata file contains this line:
>
> MB:0=4294967295;1=4294967295
>
> If a user edits the schemata file with vi(1) (or other editor) and
> simply writes that line back, it gets changed to:
>
> MB:0= 4;1= 4
>
> which sets maximum bandwidth to a very low value.
>
> This happens because bw_validate() unconditionally rounds user supplied
> values up to next multiple of r->membw.bw_gran. That results in a value
> that will not fit into d->mbps_val[closid].
>
> Rounding up only makes sense when mba_MBps is not enabled and control
> values are expressed as percentage values.
>
> Skip the roundup() when mba_MBps is enabled.
>
> Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>
> ---

A fix for this issue is already being discussed. Please see latest fix
at [1] that additionally addresses the issue if a user attempts to
write a value larger than 4294967295. Could you please check if that
fix works for you?

Thank you.

Reinette

[1] https://lore.kernel.org/all/a7c80676-0761-4618-ac07-0b53434b1a9b@xxxxxxxxx/