[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250916131717.2980875-1-zengheng4@huawei.com>
Date: Tue, 16 Sep 2025 21:17:17 +0800
From: Zeng Heng <zengheng4@...wei.com>
To: <james.morse@....com>
CC: <amitsinght@...vell.com>, <baisheng.gao@...soc.com>,
<baolin.wang@...ux.alibaba.com>, <bobo.shaobowang@...wei.com>,
<carl@...amperecomputing.com>, <catalin.marinas@....com>, <dakr@...nel.org>,
<dave.martin@....com>, <david@...hat.com>, <dfustini@...libre.com>,
<fenghuay@...dia.com>, <gregkh@...uxfoundation.org>, <guohanjun@...wei.com>,
<jonathan.cameron@...wei.com>, <kobak@...dia.com>, <lcherian@...vell.com>,
<lenb@...nel.org>, <linux-acpi@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<lpieralisi@...nel.org>, <peternewman@...gle.com>, <quic_jiles@...cinc.com>,
<rafael@...nel.org>, <robh@...nel.org>, <rohit.mathew@....com>,
<scott@...amperecomputing.com>, <sdonthineni@...dia.com>,
<sudeep.holla@....com>, <tan.shaopeng@...itsu.com>, <will@...nel.org>,
<xhao@...ux.alibaba.com>, <zengheng4@...wei.com>
Subject: [PATCH] arm_mpam: Try reading again if MPAM instance returns not ready
After updating the monitor configuration, the first read of the monitoring
result requires waiting for the "not ready" duration before an effective
value can be obtained.
Because a component consists of multiple MPAM instances, after updating the
configuration of each instance, should wait for the "not ready" period of
per single instance before the valid monitoring value can be obtained, not
just wait for once interval per component.
Signed-off-by: Zeng Heng <zengheng4@...wei.com>
---
It's fine to merge this patch directly into patch 7 of the responding
patchset.
---
drivers/resctrl/mpam_devices.c | 36 +++++++++++++++-------------------
1 file changed, 16 insertions(+), 20 deletions(-)
diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c
index 2962cd018207..e79a46646863 100644
--- a/drivers/resctrl/mpam_devices.c
+++ b/drivers/resctrl/mpam_devices.c
@@ -1183,11 +1183,14 @@ static void __ris_msmon_read(void *arg)
}
*m->val += now;
+ m->err = 0;
}
static int _msmon_read(struct mpam_component *comp, struct mon_read *arg)
{
int err, idx;
+ bool read_again;
+ u64 wait_jiffies;
struct mpam_msc *msc;
struct mpam_vmsc *vmsc;
struct mpam_msc_ris *ris;
@@ -1198,10 +1201,22 @@ static int _msmon_read(struct mpam_component *comp, struct mon_read *arg)
list_for_each_entry_rcu(ris, &vmsc->ris, vmsc_list) {
arg->ris = ris;
+ read_again = false;
+again:
err = smp_call_function_any(&msc->accessibility,
__ris_msmon_read, arg,
true);
+ if (arg->err == -EBUSY && !read_again) {
+ read_again = true;
+
+ wait_jiffies = usecs_to_jiffies(comp->class->nrdy_usec);
+ while (wait_jiffies)
+ wait_jiffies = schedule_timeout_uninterruptible(wait_jiffies);
+
+ goto again;
+ }
+
if (!err && arg->err)
err = arg->err;
if (err)
@@ -1218,9 +1233,7 @@ static int _msmon_read(struct mpam_component *comp, struct mon_read *arg)
int mpam_msmon_read(struct mpam_component *comp, struct mon_cfg *ctx,
enum mpam_device_features type, u64 *val)
{
- int err;
struct mon_read arg;
- u64 wait_jiffies = 0;
struct mpam_props *cprops = &comp->class->props;
might_sleep();
@@ -1237,24 +1250,7 @@ int mpam_msmon_read(struct mpam_component *comp, struct mon_cfg *ctx,
arg.val = val;
*val = 0;
- err = _msmon_read(comp, &arg);
- if (err == -EBUSY && comp->class->nrdy_usec)
- wait_jiffies = usecs_to_jiffies(comp->class->nrdy_usec);
-
- while (wait_jiffies)
- wait_jiffies = schedule_timeout_uninterruptible(wait_jiffies);
-
- if (err == -EBUSY) {
- memset(&arg, 0, sizeof(arg));
- arg.ctx = ctx;
- arg.type = type;
- arg.val = val;
- *val = 0;
-
- err = _msmon_read(comp, &arg);
- }
-
- return err;
+ return _msmon_read(comp, &arg);
}
void mpam_msmon_reset_mbwu(struct mpam_component *comp, struct mon_cfg *ctx)
--
2.25.1
Powered by blists - more mailing lists