]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
arm_mpam: resctrl: Hide CDP emulation behind CONFIG_EXPERT
authorBen Horgan <ben.horgan@arm.com>
Fri, 13 Mar 2026 14:45:58 +0000 (14:45 +0000)
committerJames Morse <james.morse@arm.com>
Fri, 27 Mar 2026 15:30:19 +0000 (15:30 +0000)
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>
drivers/resctrl/mpam_resctrl.c

index 2111542f485e17ff1a3398a4f81f472fb42b1e5d..2331e6ddb814b6fd2db47c4f913d3893179a9017 100644 (file)
@@ -82,6 +82,18 @@ int resctrl_arch_set_cdp_enabled(enum resctrl_res_level rid, bool enable)
        u32 partid_i = RESCTRL_RESERVED_CLOSID, partid_d = RESCTRL_RESERVED_CLOSID;
        int cpu;
 
+       if (!IS_ENABLED(CONFIG_EXPERT) && enable) {
+               /*
+                * If the resctrl fs is mounted more than once, sequentially,
+                * then CDP can lead to the use of out of range PARTIDs.
+                */
+               pr_warn("CDP not supported\n");
+               return -EOPNOTSUPP;
+       }
+
+       if (enable)
+               pr_warn("CDP is an expert feature and may cause MPAM to malfunction.\n");
+
        /*
         * resctrl_arch_set_cdp_enabled() is only called with enable set to
         * false on error and unmount.