Re: [PATCH v12 12/25] arm,x86,fs/resctrl: Allocate maximum needed rmid_ptrs[]
From: Babu Moger
Date: Tue Sep 22 2026 - 09:21:27 EST
Hi Reinette,
On 9/21/26 19:30, Reinette Chatre wrote:
Hi Babu,
Thank you for taking a look.
On 9/21/26 10:45 AM, Babu Moger wrote:
On 9/16/26 18:13, Tony Luck wrote:
...
Tony did so in v11 but I proposed it to be changed [1]. This series adds@@ -45,6 +45,9 @@ static DEFINE_MUTEX(domain_list_lock);
*/
DEFINE_PER_CPU(struct resctrl_pqr_state, pqr_state);
+/* Number of RMIDS values that can be written to IA32_PQR_ASSOC.RMID */
+static u32 pqr_assoc_num_rmid;
+
static void mba_wrmsr_intel(struct msr_param *m);
static void cat_wrmsr(struct msr_param *m);
static void mba_wrmsr_amd(struct msr_param *m);
@@ -124,6 +127,28 @@ u32 resctrl_arch_system_num_rmid_idx(void)
return num_rmids == U32_MAX ? 0 : num_rmids;
}
+/**
+ * resctrl_arch_system_max_rmid_idx - Largest possible number of RMIDs
+ *
+ * Return: Maximum possible number of RMIDs used for boot time allocations.
+ */
+u32 resctrl_arch_system_max_rmid_idx(void)
+{
+ struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl;
+ u32 num_rmid = pqr_assoc_num_rmid;
Why not use "cpuid_ebx(0xf) + 1" instead of global variable?
multiple consumers of this value so it seems more efficient to enumerate
it once and re-use that value when needed. Locating this one-time enumeration
with all the other monitoring information enumerated from hardware in
get_rdt_mon_resources() also has the benefit of keeping all monitoring data
enumeration together.
Ok. Sounds good to me.
Thanks
Babu