Re: [PATCH 1/3] x86/resctrl: Get max rmid and occupancy scale directly from CPUID instead of cpuinfo_x86
From: Fenghua Yu
Date: Sun Jun 16 2019 - 23:42:46 EST
On Sun, Jun 16, 2019 at 07:52:33PM +0200, Borislav Petkov wrote:
> 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?
After think this code again, ecx and ebx in sub-leaf CPUID.f.1 actually
contains the number of rmid and monitoring scale. The two variables are
always valid if any of L3 occupancy, MBM total, and MBM local monitoring
features is supported. So there is no need to check the features to get
the info.
But seems this patch is not needed according to Thomas?
Should I do the following changes in the next version of patch set?
1. Remove patch #1
2. Change patch #2 to the patch in https://lkml.org/lkml/2019/6/16/274
3. Keep patch #3
Please advice.
Thanks.
-Fenghua