|
@@ -3764,7 +3764,7 @@ static void __init uncore_cpu_setup(void *dummy)
|
|
|
|
|
|
static int __init uncore_cpu_init(void)
|
|
|
{
|
|
|
- int ret, cpu, max_cores;
|
|
|
+ int ret, max_cores;
|
|
|
|
|
|
max_cores = boot_cpu_data.x86_max_cores;
|
|
|
switch (boot_cpu_data.x86_model) {
|
|
@@ -3808,29 +3808,6 @@ static int __init uncore_cpu_init(void)
|
|
|
if (ret)
|
|
|
return ret;
|
|
|
|
|
|
- get_online_cpus();
|
|
|
-
|
|
|
- for_each_online_cpu(cpu) {
|
|
|
- int i, phys_id = topology_physical_package_id(cpu);
|
|
|
-
|
|
|
- for_each_cpu(i, &uncore_cpu_mask) {
|
|
|
- if (phys_id == topology_physical_package_id(i)) {
|
|
|
- phys_id = -1;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (phys_id < 0)
|
|
|
- continue;
|
|
|
-
|
|
|
- uncore_cpu_prepare(cpu, phys_id);
|
|
|
- uncore_event_init_cpu(cpu);
|
|
|
- }
|
|
|
- on_each_cpu(uncore_cpu_setup, NULL, 1);
|
|
|
-
|
|
|
- register_cpu_notifier(&uncore_cpu_nb);
|
|
|
-
|
|
|
- put_online_cpus();
|
|
|
-
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -3859,6 +3836,41 @@ static int __init uncore_pmus_register(void)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
+static void uncore_cpumask_init(void)
|
|
|
+{
|
|
|
+ int cpu;
|
|
|
+
|
|
|
+ /*
|
|
|
+ * ony invoke once from msr or pci init code
|
|
|
+ */
|
|
|
+ if (!cpumask_empty(&uncore_cpu_mask))
|
|
|
+ return;
|
|
|
+
|
|
|
+ get_online_cpus();
|
|
|
+
|
|
|
+ for_each_online_cpu(cpu) {
|
|
|
+ int i, phys_id = topology_physical_package_id(cpu);
|
|
|
+
|
|
|
+ for_each_cpu(i, &uncore_cpu_mask) {
|
|
|
+ if (phys_id == topology_physical_package_id(i)) {
|
|
|
+ phys_id = -1;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (phys_id < 0)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ uncore_cpu_prepare(cpu, phys_id);
|
|
|
+ uncore_event_init_cpu(cpu);
|
|
|
+ }
|
|
|
+ on_each_cpu(uncore_cpu_setup, NULL, 1);
|
|
|
+
|
|
|
+ register_cpu_notifier(&uncore_cpu_nb);
|
|
|
+
|
|
|
+ put_online_cpus();
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
static int __init intel_uncore_init(void)
|
|
|
{
|
|
|
int ret;
|
|
@@ -3877,6 +3889,7 @@ static int __init intel_uncore_init(void)
|
|
|
uncore_pci_exit();
|
|
|
goto fail;
|
|
|
}
|
|
|
+ uncore_cpumask_init();
|
|
|
|
|
|
uncore_pmus_register();
|
|
|
return 0;
|