Re: [PATCH v2 24/29] arm_mpam: Track bandwidth counter state for overflow and power management

Jonathan Cameron
2025-09-12T13:24:24Z

On Wed, 10 Sep 2025 20:43:04 +0000
James Morse <james.morse@arm.com> wrote:

> Bandwidth counters need to run continuously to correctly reflect the
> bandwidth.
>
> The value read may be lower than the previous value read in the case
> of overflow and when the hardware is reset due to CPU hotplug.
>
> Add struct mbwu_state to track the bandwidth counter to allow overflow
> and power management to be handled.
>
> Signed-off-by: James Morse <james.morse@arm.com>
Trivial comment inline. I haven't spent enough time thinking about this
to give a proper review so no tags yet.

Jonathan

> ---
> Changes since v1:
> * Fixed lock/unlock typo.
> ---
> drivers/resctrl/mpam_devices.c | 154 +++++++++++++++++++++++++++++++-
> drivers/resctrl/mpam_internal.h | 23 +++++
> 2 files changed, 175 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
> index 1543c33c5d6a..eeb62ed94520 100644
> --- a/drivers/resctrl/mpam_devices.c
> +++ b/drivers/resctrl/mpam_devices.c
> @@ -918,6 +918,7 @@ static void gen_msmon_ctl_flt_vals(struct mon_read *m, u32 *ctl_val,
> *ctl_val |= MSMON_CFG_x_CTL_MATCH_PARTID;
>
> *flt_val = FIELD_PREP(MSMON_CFG_x_FLT_PARTID, ctx->partid);
> +
Unrelated change. If it makes sense figure out where to push it back to.

> if (m->ctx->match_pmg) {
> *ctl_val |= MSMON_CFG_x_CTL_MATCH_PMG;
> *flt_val |= FIELD_PREP(MSMON_CFG_x_FLT_PMG, ctx->pmg);