Re: [PATCH v2 15/33] x86/intel_rdt: Adds support to enable Code Data Prioritization
From: Thomas Gleixner
Date: Thu Sep 08 2016 - 06:21:40 EST
On Thu, 8 Sep 2016, Fenghua Yu wrote:
>
> +struct clos_config {
> + unsigned long *closmap;
> + u32 max_closid;
> + u32 closids_used;
> +};
Another badly formatted and undocumented structure
> +struct clos_config cconfig;
> +bool cdp_enabled;
Once more global variables without a declaration in a header and no user
outside of this file.
> +#define __DCBM_TABLE_INDEX(x) (x << 1)
> +#define __ICBM_TABLE_INDEX(x) ((x << 1) + 1)
>
> struct rdt_remote_data {
> int msr;
> @@ -122,22 +123,28 @@ static int closid_alloc(u32 *closid)
>
> lockdep_assert_held(&rdtgroup_mutex);
>
> - maxid = boot_cpu_data.x86_cache_max_closid;
> - id = find_first_zero_bit(closmap, maxid);
> + maxid = cconfig.max_closid;
Cute. You can remove all that code because maxid is always 0.
> /*
> * Set only one cpu in cpumask in all cpus that share the same cache.
> */
> @@ -191,7 +213,7 @@ static inline bool rdt_cpumask_update(int cpu)
> */
> static void cbm_update_msrs(void *dummy)
> {
> - int maxid = boot_cpu_data.x86_cache_max_closid;
> + int maxid = cconfig.max_closid;
Ditto
> size = BITS_TO_LONGS(maxid) * sizeof(long);
> - closmap = kzalloc(size, GFP_KERNEL);
> - if (!closmap) {
> + cconfig.closmap = kzalloc(size, GFP_KERNEL);
> + if (!cconfig.closmap) {
Simply because it's never initialized.
Thanks,
tglx