hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/arch/x86/kernel/smpboot.c
....@@ -100,6 +100,17 @@
100100 DEFINE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info);
101101 EXPORT_PER_CPU_SYMBOL(cpu_info);
102102
103
+struct mwait_cpu_dead {
104
+ unsigned int control;
105
+ unsigned int status;
106
+};
107
+
108
+/*
109
+ * Cache line aligned data for mwait_play_dead(). Separate on purpose so
110
+ * that it's unlikely to be touched by other CPUs.
111
+ */
112
+static DEFINE_PER_CPU_ALIGNED(struct mwait_cpu_dead, mwait_cpu_dead);
113
+
103114 /* Logical package management. We might want to allocate that dynamically */
104115 unsigned int __max_logical_packages __read_mostly;
105116 EXPORT_SYMBOL(__max_logical_packages);
....@@ -227,8 +238,7 @@
227238 load_cr3(swapper_pg_dir);
228239 __flush_tlb_all();
229240 #endif
230
- cpu_init_exception_handling();
231
- cpu_init();
241
+ cpu_init_secondary();
232242 rcu_cpu_starting(raw_smp_processor_id());
233243 x86_cpuinit.early_percpu_clock_init();
234244 smp_callin();
....@@ -1675,10 +1685,10 @@
16751685 */
16761686 static inline void mwait_play_dead(void)
16771687 {
1688
+ struct mwait_cpu_dead *md = this_cpu_ptr(&mwait_cpu_dead);
16781689 unsigned int eax, ebx, ecx, edx;
16791690 unsigned int highest_cstate = 0;
16801691 unsigned int highest_subcstate = 0;
1681
- void *mwait_ptr;
16821692 int i;
16831693
16841694 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
....@@ -1713,13 +1723,6 @@
17131723 (highest_subcstate - 1);
17141724 }
17151725
1716
- /*
1717
- * This should be a memory location in a cache line which is
1718
- * unlikely to be touched by other processors. The actual
1719
- * content is immaterial as it is not actually modified in any way.
1720
- */
1721
- mwait_ptr = &current_thread_info()->flags;
1722
-
17231726 wbinvd();
17241727
17251728 while (1) {
....@@ -1731,9 +1734,9 @@
17311734 * case where we return around the loop.
17321735 */
17331736 mb();
1734
- clflush(mwait_ptr);
1737
+ clflush(md);
17351738 mb();
1736
- __monitor(mwait_ptr, 0, 0);
1739
+ __monitor(md, 0, 0);
17371740 mb();
17381741 __mwait(eax, 0);
17391742