Skip to content

Commit 01a0021

Browse files
benhor01James Morse
authored andcommitted
arm_mpam: resctrl: Hide CDP emulation behind CONFIG_EXPERT
When CDP is not enabled, the 'rmid_entry's in the limbo list, rmid_busy_llc, map directly to a (PARTID,PMG) pair and when CDP is enabled the mapping is to two different pairs. As the limbo list is reused between mounts and CDP disabled on unmount this can lead to stale mapping and the limbo handler will then make monitor reads with potentially out of range PARTID. This may then cause an MPAM error interrupt and the driver will disable MPAM. No problems are expected if you just mount the resctrl file system once with CDP enabled and never unmount it. Hide CDP emulation behind CONFIG_EXPERT to protect the unwary. Signed-off-by: Ben Horgan <ben.horgan@arm.com> Reviewed-by: Gavin Shan <gshan@redhat.com> Reviewed-by: Zeng Heng <zengheng4@huawei.com> Reviewed-by: James Morse <james.morse@arm.com> Tested-by: Gavin Shan <gshan@redhat.com> Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Jesse Chick <jessechick@os.amperecomputing.com> Signed-off-by: James Morse <james.morse@arm.com>
1 parent 6789fb9 commit 01a0021

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

drivers/resctrl/mpam_resctrl.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@ int resctrl_arch_set_cdp_enabled(enum resctrl_res_level rid, bool enable)
8282
u32 partid_i = RESCTRL_RESERVED_CLOSID, partid_d = RESCTRL_RESERVED_CLOSID;
8383
int cpu;
8484

85+
if (!IS_ENABLED(CONFIG_EXPERT) && enable) {
86+
/*
87+
* If the resctrl fs is mounted more than once, sequentially,
88+
* then CDP can lead to the use of out of range PARTIDs.
89+
*/
90+
pr_warn("CDP not supported\n");
91+
return -EOPNOTSUPP;
92+
}
93+
94+
if (enable)
95+
pr_warn("CDP is an expert feature and may cause MPAM to malfunction.\n");
96+
8597
/*
8698
* resctrl_arch_set_cdp_enabled() is only called with enable set to
8799
* false on error and unmount.

0 commit comments

Comments
 (0)