]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
x86/resctrl: Block use of mba_MBps mount option on Sub-NUMA Cluster (SNC) systems
authorTony Luck <tony.luck@intel.com>
Fri, 28 Jun 2024 21:56:07 +0000 (14:56 -0700)
committerBorislav Petkov (AMD) <bp@alien8.de>
Tue, 2 Jul 2024 17:49:54 +0000 (19:49 +0200)
When SNC is enabled there is a mismatch between the MBA control function
which operates at L3 cache scope and the MBM monitor functions which
measure memory bandwidth on each SNC node.

Block use of the mba_MBps when scopes for MBA/MBM do not match.

Improve user diagnostics by adding invalfc() message when mba_MBps
is not supported.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Tested-by: Babu Moger <babu.moger@amd.com>
Link: https://lore.kernel.org/r/20240628215619.76401-8-tony.luck@intel.com
arch/x86/kernel/cpu/resctrl/rdtgroup.c

index eb3bbfa96d5ab23c89d4bb0eb35e0d74fc9d1dfe..d3b0fa9582669646e4cb9a0f62776d668adee327 100644 (file)
@@ -2335,14 +2335,18 @@ static void mba_sc_domain_destroy(struct rdt_resource *r,
 
 /*
  * MBA software controller is supported only if
- * MBM is supported and MBA is in linear scale.
+ * MBM is supported and MBA is in linear scale,
+ * and the MBM monitor scope is the same as MBA
+ * control scope.
  */
 static bool supports_mba_mbps(void)
 {
+       struct rdt_resource *rmbm = &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl;
        struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl;
 
        return (is_mbm_local_enabled() &&
-               r->alloc_capable && is_mba_linear());
+               r->alloc_capable && is_mba_linear() &&
+               r->ctrl_scope == rmbm->mon_scope);
 }
 
 /*
@@ -2750,6 +2754,7 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param)
 {
        struct rdt_fs_context *ctx = rdt_fc2context(fc);
        struct fs_parse_result result;
+       const char *msg;
        int opt;
 
        opt = fs_parse(fc, rdt_fs_parameters, param, &result);
@@ -2764,8 +2769,9 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param)
                ctx->enable_cdpl2 = true;
                return 0;
        case Opt_mba_mbps:
+               msg = "mba_MBps requires local MBM and linear scale MBA at L3 scope";
                if (!supports_mba_mbps())
-                       return -EINVAL;
+                       return invalfc(fc, msg);
                ctx->enable_mba_mbps = true;
                return 0;
        case Opt_debug: