[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251024193422.00000bc5@huawei.com>
Date: Fri, 24 Oct 2025 19:34:22 +0100
From: Jonathan Cameron <jonathan.cameron@...wei.com>
To: James Morse <james.morse@....com>
CC: <linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
<linux-acpi@...r.kernel.org>, D Scott Phillips OS
<scott@...amperecomputing.com>, <carl@...amperecomputing.com>,
<lcherian@...vell.com>, <bobo.shaobowang@...wei.com>,
<tan.shaopeng@...itsu.com>, <baolin.wang@...ux.alibaba.com>, Jamie Iles
<quic_jiles@...cinc.com>, Xin Hao <xhao@...ux.alibaba.com>,
<peternewman@...gle.com>, <dfustini@...libre.com>, <amitsinght@...vell.com>,
David Hildenbrand <david@...hat.com>, Dave Martin <dave.martin@....com>, Koba
Ko <kobak@...dia.com>, Shanker Donthineni <sdonthineni@...dia.com>,
<fenghuay@...dia.com>, <baisheng.gao@...soc.com>, Rob Herring
<robh@...nel.org>, Rohit Mathew <rohit.mathew@....com>, "Rafael Wysocki"
<rafael@...nel.org>, Len Brown <lenb@...nel.org>, Lorenzo Pieralisi
<lpieralisi@...nel.org>, Hanjun Guo <guohanjun@...wei.com>, Sudeep Holla
<sudeep.holla@....com>, Catalin Marinas <catalin.marinas@....com>, "Will
Deacon" <will@...nel.org>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Danilo Krummrich <dakr@...nel.org>, Jeremy Linton <jeremy.linton@....com>,
Gavin Shan <gshan@...hat.com>, Fenghua Yu <fenghuay@...ia.com>
Subject: Re: [PATCH v3 27/29] arm_mpam: Add helper to reset saved mbwu state
On Fri, 17 Oct 2025 18:56:43 +0000
James Morse <james.morse@....com> wrote:
> resctrl expects to reset the bandwidth counters when the filesystem
> is mounted.
>
> To allow this, add a helper that clears the saved mbwu state. Instead
> of cross calling to each CPU that can access the component MSC to
> write to the counter, set a flag that causes it to be zero'd on the
> the next read. This is easily done by forcing a configuration update.
>
> Signed-off-by: James Morse <james.morse@....com>
> Reviewed-by: Fenghua Yu <fenghuay@...ia.com>
> Tested-by: Fenghua Yu <fenghuay@...dia.com>
A couple of little places in here where I think moving things back to earlier
patches would reduce churn a little which is always nice for reviewers.
Either way
Reviewed-by: Jonathan Cameron <jonathan.cameron@...wei.com>
> ---
> Changes since v2:
> * Switched to guard and fixed non _srcu list walker.
> * Made a comment about what is proteted by which lock a list.
> ---
> drivers/resctrl/mpam_devices.c | 46 ++++++++++++++++++++++++++++++++-
> drivers/resctrl/mpam_internal.h | 7 ++++-
> 2 files changed, 51 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
> index c207a6d2832c..89d4f42168ed 100644
> --- a/drivers/resctrl/mpam_devices.c
> +++ b/drivers/resctrl/mpam_devices.c
> /*
> * Read the existing configuration to avoid re-writing the same values.
> * This saves waiting for 'nrdy' on subsequent reads.
> @@ -1090,7 +1100,10 @@ static void __ris_msmon_read(void *arg)
> read_msmon_ctl_flt_vals(m, &cur_ctl, &cur_flt);
> clean_msmon_ctl_val(&cur_ctl);
> gen_msmon_ctl_flt_vals(m, &ctl_val, &flt_val);
> - if (cur_flt != flt_val || cur_ctl != (ctl_val | MSMON_CFG_x_CTL_EN))
> + config_mismatch = cur_flt != flt_val ||
> + cur_ctl != (ctl_val | MSMON_CFG_x_CTL_EN);
Push back to earlier patch perhaps? I guess someone might ask why you don't do it
inline, but to me it seems complex enough that I doubt they will.
Nice to reduce the churn where it is easy to do.
> +
> + if (config_mismatch || reset_on_next_read)
> write_msmon_ctl_flt_vals(m, ctl_val, flt_val);
>
> switch (m->type) {
> @@ -1242,6 +1255,37 @@ int mpam_msmon_read(struct mpam_component *comp, struct mon_cfg *ctx,
> return err;
> }
> diff --git a/drivers/resctrl/mpam_internal.h b/drivers/resctrl/mpam_internal.h
> index ff38b4bbfc2b..6632699ae814 100644
> --- a/drivers/resctrl/mpam_internal.h
> +++ b/drivers/resctrl/mpam_internal.h
> @@ -204,10 +204,14 @@ struct mon_cfg {
>
> /*
> * Changes to enabled and cfg are protected by the msc->lock.
> - * Changes to prev_val and correction are protected by the msc's mon_sel_lock.
> + * The msc's mon_sel_lock protects:
Nice to push this formatting change back to earlier patch so this
becomes a one line change.
> + * - reset_on_next_read
> + * - prev_val
> + * - correction
> */
> struct msmon_mbwu_state {
> bool enabled;
> + bool reset_on_next_read;
> struct mon_cfg cfg;
Powered by blists - more mailing lists