[PATCH v3 1/5] arm_mpam: resctrl: Pick classes for use as mbm counters

Shaopeng Tan (Fujitsu) tan.shaopeng at fujitsu.com
Mon May 11 23:50:32 PDT 2026


Hello Ben,

> From: James Morse <james.morse at arm.com>
> 
> resctrl has two types of counters, NUMA-local and global. MPAM can only
> count global either using MSC at the L3 cache or in the memory controllers.
> When global and local equate to the same thing continue just to call it
> global.
> 
> Tested-by: Shaopeng Tan <tan.shaopeng at jp.fujitsu.com>
> Tested-by: Zeng Heng <zengheng4 at huawei.com>
> Reviewed-by: Shaopeng Tan <tan.shaopeng at jp.fujitsu.com>
> Reviewed-by: Jonathan Cameron <jonathan.cameron at huawei.com>
> Signed-off-by: James Morse <james.morse at arm.com>
> Signed-off-by: Ben Horgan <ben.horgan at arm.com>
> ---
> Changes since rfc v1:
> Move finding any_mon_comp into monitor boilerplate patch
> Move mpam_resctrl_get_domain_from_cpu() into monitor boilerplate
> Remove free running check
> Trim commit message
> ---
>  drivers/resctrl/mpam_resctrl.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/drivers/resctrl/mpam_resctrl.c b/drivers/resctrl/mpam_resctrl.c
> index 226ff6f532fa..f70fa65d39e4 100644
> --- a/drivers/resctrl/mpam_resctrl.c
> +++ b/drivers/resctrl/mpam_resctrl.c
> @@ -606,6 +606,16 @@ static bool cache_has_usable_csu(struct mpam_class *class)
>          return true;
>  }
>  
> +static bool class_has_usable_mbwu(struct mpam_class *class)
> +{
> +       struct mpam_props *cprops = &class->props;
> +
> +       if (!mpam_has_feature(mpam_feat_msmon_mbwu, cprops))
> +               return false;
> +
> +       return true;
> +}
> +
>  /*
>   * Calculate the worst-case percentage change from each implemented step
>   * in the control.
> @@ -983,6 +993,22 @@ static void mpam_resctrl_pick_counters(void)
>                                  break;
>                          }
>                  }
> +
> +               if (class_has_usable_mbwu(class) &&
> +                   topology_matches_l3(class) &&
> +                   traffic_matches_l3(class)) {
> +                       pr_debug("class %u has usable MBWU, and matches L3 topology and traffic\n",
> +                                class->level);
> +
> +                       /*
> +                        * We can't distinguish traffic by destination so
> +                        * we don't know if it's staying on the same NUMA
> +                        * node. Hence, we can't calculate mbm_local except
> +                        * when we only have one L3 and it's equivalent to
> +                        * mbm_total and so always use mbm_total.
> +                        */
> +                       counter_update_class(QOS_L3_MBM_TOTAL_EVENT_ID, class);
> +               }
>          }
>  }
>  
> -- 
> 2.43.0

https://lore.kernel.org/lkml/599617aa-aade-4fde-9efa-79d592f1ff3f@arm.com/

This concerns the comment I received last time. 
I may not have fully understood it, so I'd like to clarify it once more.

Even if the system as a whole has multiple L3 caches and multiple NUMA nodes,
ABMC will be enabled as long as there is a single L3 cache and a single corresponding NUMA node.
Is my understanding correct?
If my understanding is correct, within the 'traffic_matches_l3()' function,
ABMC is enabled only when the entire system has a single NUMA node and a single L3 cache.

 870 static bool traffic_matches_l3(struct mpam_class *class)
 871 {
...
 901
 902         if (!cpumask_equal(tmp_cpumask, cpu_possible_mask)) {
 903                 pr_debug("There is more than one L3\n");
 904                 return false; *
 905         }
...
 912
 913         if (num_possible_nodes() > 1) {
 914                 pr_debug("There is more than one numa node\n");
 915                 return false;  *
 916         }
 917
...
 926 }


Also, I'd also like to confirm one more thing.
The mpam_resctrl_pick_mba() function also calls traffic_matches_l3(). 
This suggests that, except in scenarios where the entire system has a single L3 cache and a single NUMA node (ABMC is disabled),
the Memory Bandwidth allocation will also be disabled.
Is this the intended behavior? If so, could you explain why?

Best regards,
Shaopeng TAN






More information about the linux-arm-kernel mailing list