/* Shared L2 cache maps */
 DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_l2c_shared_map);
 
+static cpumask_var_t cpu_cacheinfo_mask;
+
 /* Kernel controls MTRR and/or PAT MSRs. */
 unsigned int memory_caching_control __ro_after_init;
 
                cache_cpu_init();
 }
 
-static int cache_ap_init(unsigned int cpu)
+static int cache_ap_online(unsigned int cpu)
 {
+       cpumask_set_cpu(cpu, cpu_cacheinfo_mask);
+
        if (!memory_caching_control || get_cache_aps_delayed_init())
                return 0;
 
         *      lock to prevent MTRR entry changes
         */
        stop_machine_from_inactive_cpu(cache_rendezvous_handler, NULL,
-                                      cpu_callout_mask);
+                                      cpu_cacheinfo_mask);
 
        return 0;
 }
 
+static int cache_ap_offline(unsigned int cpu)
+{
+       cpumask_clear_cpu(cpu, cpu_cacheinfo_mask);
+       return 0;
+}
+
 /*
  * Delayed cache initialization for all AP's
  */
 
 static int __init cache_ap_register(void)
 {
+       zalloc_cpumask_var(&cpu_cacheinfo_mask, GFP_KERNEL);
+       cpumask_set_cpu(smp_processor_id(), cpu_cacheinfo_mask);
+
        cpuhp_setup_state_nocalls(CPUHP_AP_CACHECTRL_STARTING,
                                  "x86/cachectrl:starting",
-                                 cache_ap_init, NULL);
+                                 cache_ap_online, cache_ap_offline);
        return 0;
 }
-core_initcall(cache_ap_register);
+early_initcall(cache_ap_register);