Re: [PATCH 1/3] x86/resctrl: Get max rmid and occupancy scale directly from CPUID instead of cpuinfo_x86

From: Borislav Petkov
Date: Sun Jun 16 2019 - 13:57:36 EST


On Sun, Jun 16, 2019 at 10:14:08AM -0700, Fenghua Yu wrote:
> @@ -617,13 +617,20 @@ static void l3_mon_evt_init(struct rdt_resource *r)
> list_add_tail(&mbm_local_event.list, &r->evt_list);
> }
>
> -int rdt_get_mon_l3_config(struct rdt_resource *r)
> +int __init rdt_get_mon_l3_config(struct rdt_resource *r)
> {
> unsigned int cl_size = boot_cpu_data.x86_cache_size;
> + u32 eax, ebx, ecx, edx;
> int ret;
>
> - r->mon_scale = boot_cpu_data.x86_cache_occ_scale;
> - r->num_rmid = boot_cpu_data.x86_cache_max_rmid + 1;
> + /*
> + * At this point, CQM LLC and one of L3 occupancy, MBM total, and
> + * MBM local monitoring features must be supported. So sub-leaf
> + * (EAX=0xf, ECX=1) contains needed information for this resource.
> + */
> + cpuid_count(0xf, 1, &eax, &ebx, &ecx, &edx);
> + r->num_rmid = ecx + 1;
> + r->mon_scale = ebx;
>
> /*
> * A reasonable upper limit on the max threshold is the number

This is simpler than that:

https://lkml.kernel.org/r/20190614174959.GF198207@xxxxxxxxxxxxxxxxxxxxxxxx

Why?


--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.