Re: [PATCH v11 04/23] x86/resctrl: Apply Intel MBM quirk from rdt_get_l3_mon_config()
From: Reinette Chatre
Date: Wed Sep 09 2026 - 23:56:16 EST
Hi Tony,
On 8/31/26 10:44 AM, Tony Luck wrote:
> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
> index 0c2aa20148a1..0bce199a5f7b 100644
> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
...
> @@ -421,6 +423,20 @@ static __init int snc_get_config(void)
> return ret;
> }
>
> +static void __init intel_rdt_mbm_apply_quirk(u32 num_rmid)
> +{
> + int cf_index;
> +
> + cf_index = num_rmid / 8 - 1;
I suspect that cf_index was made an "int" because the original code
initialized it from int boot_cpu_data.x86_cache_max_rmid. Now that
cf_index is initialized from an unsigned, compared to size_t, and
used as array index ... unsigned looks more appropriate?
> + if (cf_index >= ARRAY_SIZE(mbm_cf_table)) {
> + pr_info("No MBM correction factor available\n");
> + return;
> + }
> +
> + mbm_cf_rmidthreshold = mbm_cf_table[cf_index].rmidthreshold;
> + mbm_cf = mbm_cf_table[cf_index].cf;
> +}
> +
> int __init rdt_get_l3_mon_config(struct rdt_resource *r)
> {
> struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);
> @@ -500,25 +516,14 @@ int __init rdt_get_l3_mon_config(struct rdt_resource *r)
> hw_res->mbm_cntr_assign_enabled = true;
> }
>
> + if (intel_rdt_mbm_need_quirk)
> + intel_rdt_mbm_apply_quirk(r->mon.num_rmid);
> +
> r->mon_capable = true;
>
> return 0;
> }
>
> -void __init intel_rdt_mbm_apply_quirk(void)
> -{
> - int cf_index;
> -
> - cf_index = (boot_cpu_data.x86_cache_max_rmid + 1) / 8 - 1;
> - if (cf_index >= ARRAY_SIZE(mbm_cf_table)) {
> - pr_info("No MBM correction factor available\n");
> - return;
> - }
> -
> - mbm_cf_rmidthreshold = mbm_cf_table[cf_index].rmidthreshold;
> - mbm_cf = mbm_cf_table[cf_index].cf;
> -}
> -
> static void resctrl_abmc_set_one_amd(void *arg)
> {
> bool *enable = arg;
Reinette