| .. | .. |
|---|
| 100 | 100 | DEFINE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info); |
|---|
| 101 | 101 | EXPORT_PER_CPU_SYMBOL(cpu_info); |
|---|
| 102 | 102 | |
|---|
| 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 | + |
|---|
| 103 | 114 | /* Logical package management. We might want to allocate that dynamically */ |
|---|
| 104 | 115 | unsigned int __max_logical_packages __read_mostly; |
|---|
| 105 | 116 | EXPORT_SYMBOL(__max_logical_packages); |
|---|
| .. | .. |
|---|
| 227 | 238 | load_cr3(swapper_pg_dir); |
|---|
| 228 | 239 | __flush_tlb_all(); |
|---|
| 229 | 240 | #endif |
|---|
| 230 | | - cpu_init_exception_handling(); |
|---|
| 231 | | - cpu_init(); |
|---|
| 241 | + cpu_init_secondary(); |
|---|
| 232 | 242 | rcu_cpu_starting(raw_smp_processor_id()); |
|---|
| 233 | 243 | x86_cpuinit.early_percpu_clock_init(); |
|---|
| 234 | 244 | smp_callin(); |
|---|
| .. | .. |
|---|
| 1675 | 1685 | */ |
|---|
| 1676 | 1686 | static inline void mwait_play_dead(void) |
|---|
| 1677 | 1687 | { |
|---|
| 1688 | + struct mwait_cpu_dead *md = this_cpu_ptr(&mwait_cpu_dead); |
|---|
| 1678 | 1689 | unsigned int eax, ebx, ecx, edx; |
|---|
| 1679 | 1690 | unsigned int highest_cstate = 0; |
|---|
| 1680 | 1691 | unsigned int highest_subcstate = 0; |
|---|
| 1681 | | - void *mwait_ptr; |
|---|
| 1682 | 1692 | int i; |
|---|
| 1683 | 1693 | |
|---|
| 1684 | 1694 | if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD || |
|---|
| .. | .. |
|---|
| 1713 | 1723 | (highest_subcstate - 1); |
|---|
| 1714 | 1724 | } |
|---|
| 1715 | 1725 | |
|---|
| 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 = ¤t_thread_info()->flags; |
|---|
| 1722 | | - |
|---|
| 1723 | 1726 | wbinvd(); |
|---|
| 1724 | 1727 | |
|---|
| 1725 | 1728 | while (1) { |
|---|
| .. | .. |
|---|
| 1731 | 1734 | * case where we return around the loop. |
|---|
| 1732 | 1735 | */ |
|---|
| 1733 | 1736 | mb(); |
|---|
| 1734 | | - clflush(mwait_ptr); |
|---|
| 1737 | + clflush(md); |
|---|
| 1735 | 1738 | mb(); |
|---|
| 1736 | | - __monitor(mwait_ptr, 0, 0); |
|---|
| 1739 | + __monitor(md, 0, 0); |
|---|
| 1737 | 1740 | mb(); |
|---|
| 1738 | 1741 | __mwait(eax, 0); |
|---|
| 1739 | 1742 | |
|---|