Skip to content

Commit 3889fc6

Browse files
committed
NVIDIA: SAUCE: Fix mbm_L3_assign and mon_local_bytes
Add local bytes counter in mpam_resctrl_counters[] to fix missing mbm_local_bytes monitoring on Grace. Add mon->assigned_counters check to enable mbm_L3_assignments config file on Grace. Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
1 parent aed787f commit 3889fc6

1 file changed

Lines changed: 13 additions & 21 deletions

File tree

drivers/resctrl/mpam_resctrl.c

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static struct mpam_resctrl_res mpam_resctrl_controls[RDT_NUM_RESOURCES];
4545
* to those supported by MPAM.
4646
* Class pointer may be NULL.
4747
*/
48-
#define MPAM_MAX_EVENT QOS_L3_MBM_TOTAL_EVENT_ID
48+
#define MPAM_MAX_EVENT QOS_L3_MBM_LOCAL_EVENT_ID
4949
static struct mpam_resctrl_mon mpam_resctrl_counters[MPAM_MAX_EVENT + 1];
5050

5151
#define for_each_mpam_resctrl_mon(mon, eventid) \
@@ -179,21 +179,6 @@ static void resctrl_reset_task_closids(void)
179179
read_unlock(&tasklist_lock);
180180
}
181181

182-
static struct mpam_resctrl_mon *mpam_resctrl_mon_from_res(struct mpam_resctrl_res *res)
183-
{
184-
struct mpam_resctrl_mon *mon;
185-
enum resctrl_event_id eventid;
186-
187-
if (!res->class)
188-
return NULL;
189-
190-
for_each_mpam_resctrl_mon(mon, eventid) {
191-
if (mon->class == res->class)
192-
return mon;
193-
}
194-
return NULL;
195-
}
196-
197182
static struct mpam_resctrl_res *mpam_resctrl_res_from_mon(struct mpam_resctrl_mon *mon)
198183
{
199184
struct mpam_resctrl_res *res;
@@ -1365,15 +1350,22 @@ void resctrl_arch_config_cntr(struct rdt_resource *r, struct rdt_l3_mon_domain *
13651350
bool resctrl_arch_mbm_cntr_assign_enabled(struct rdt_resource *r)
13661351
{
13671352
struct mpam_resctrl_res *res;
1368-
struct mpam_resctrl_mon *mon;
1353+
enum resctrl_event_id evt;
13691354

13701355
res = container_of(r, struct mpam_resctrl_res, resctrl_res);
13711356

1372-
mon = mpam_resctrl_mon_from_res(res);
1373-
if (!mon)
1374-
return false;
1357+
/* OCCUP shares the L3 class but has no MBWU assigned_counters. */
1358+
for (evt = QOS_L3_MBM_TOTAL_EVENT_ID; evt <= QOS_L3_MBM_LOCAL_EVENT_ID;
1359+
evt++) {
1360+
struct mpam_resctrl_mon *mon = &mpam_resctrl_counters[evt];
13751361

1376-
return mon->assigned_counters ? true : false;
1362+
if (!mon->assigned_counters)
1363+
continue;
1364+
if (mpam_resctrl_res_from_mon(mon) == res)
1365+
return true;
1366+
}
1367+
1368+
return false;
13771369
}
13781370

13791371
int resctrl_arch_mbm_cntr_assign_set(struct rdt_resource *r, bool enable)

0 commit comments

Comments
 (0)