Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull x86 fixes from Peter Anvin:
"A significantly larger than I'd like set of patches for just below the
wire. All of these, however, fix real problems.

The one thing that is genuinely scary in here is the change of SMP
initialization, but that *does* fix a confirmed hang when booting
virtual machines.

There is also a patch to actually do the right thing about not
offlining a CPU when there are not enough interrupt vectors available
in the system; the accounting was done incorrectly. The worst case
for that patch is that we fail to offline CPUs when we should (the new
code is strictly more conservative than the old), so is not
particularly risky.

Most of the rest is minor stuff; the EFI patches are all about
exporting correct information to boot loaders and kexec"

* 'x86/urgent' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
x86/boot: EFI_MIXED should not prohibit loading above 4G
x86/smpboot: Initialize secondary CPU only if master CPU will wait for it
x86/smpboot: Log error on secondary CPU wakeup failure at ERR level
x86: Fix list/memory corruption on CPU hotplug
x86: irq: Get correct available vectors for cpu disable
x86/efi: Do not export efi runtime map in case old map
x86/efi: earlyprintk=efi,keep fix

+66 -91
+1 -2
arch/x86/boot/header.S
··· 375 375 # define XLF0 0 376 376 #endif 377 377 378 - #if defined(CONFIG_RELOCATABLE) && defined(CONFIG_X86_64) && \ 379 - !defined(CONFIG_EFI_MIXED) 378 + #if defined(CONFIG_RELOCATABLE) && defined(CONFIG_X86_64) 380 379 /* kernel/boot_param/ramdisk could be loaded above 4g */ 381 380 # define XLF1 XLF_CAN_BE_LOADED_ABOVE_4G 382 381 #else
+16 -11
arch/x86/kernel/cpu/common.c
··· 1221 1221 #define dbg_restore_debug_regs() 1222 1222 #endif /* ! CONFIG_KGDB */ 1223 1223 1224 + static void wait_for_master_cpu(int cpu) 1225 + { 1226 + /* 1227 + * wait for ACK from master CPU before continuing 1228 + * with AP initialization 1229 + */ 1230 + WARN_ON(cpumask_test_and_set_cpu(cpu, cpu_initialized_mask)); 1231 + while (!cpumask_test_cpu(cpu, cpu_callout_mask)) 1232 + cpu_relax(); 1233 + } 1234 + 1224 1235 /* 1225 1236 * cpu_init() initializes state that is per-CPU. Some data is already 1226 1237 * initialized (naturally) in the bootstrap process, such as the GDT ··· 1247 1236 struct task_struct *me; 1248 1237 struct tss_struct *t; 1249 1238 unsigned long v; 1250 - int cpu; 1239 + int cpu = stack_smp_processor_id(); 1251 1240 int i; 1241 + 1242 + wait_for_master_cpu(cpu); 1252 1243 1253 1244 /* 1254 1245 * Load microcode on this cpu if a valid microcode is available. ··· 1258 1245 */ 1259 1246 load_ucode_ap(); 1260 1247 1261 - cpu = stack_smp_processor_id(); 1262 1248 t = &per_cpu(init_tss, cpu); 1263 1249 oist = &per_cpu(orig_ist, cpu); 1264 1250 ··· 1268 1256 #endif 1269 1257 1270 1258 me = current; 1271 - 1272 - if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask)) 1273 - panic("CPU#%d already initialized!\n", cpu); 1274 1259 1275 1260 pr_debug("Initializing CPU#%d\n", cpu); 1276 1261 ··· 1345 1336 struct tss_struct *t = &per_cpu(init_tss, cpu); 1346 1337 struct thread_struct *thread = &curr->thread; 1347 1338 1348 - show_ucode_info_early(); 1339 + wait_for_master_cpu(cpu); 1349 1340 1350 - if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask)) { 1351 - printk(KERN_WARNING "CPU#%d already initialized!\n", cpu); 1352 - for (;;) 1353 - local_irq_enable(); 1354 - } 1341 + show_ucode_info_early(); 1355 1342 1356 1343 printk(KERN_INFO "Initializing CPU#%d\n", cpu); 1357 1344
+12 -4
arch/x86/kernel/irq.c
··· 17 17 #include <asm/idle.h> 18 18 #include <asm/mce.h> 19 19 #include <asm/hw_irq.h> 20 + #include <asm/desc.h> 20 21 21 22 #define CREATE_TRACE_POINTS 22 23 #include <asm/trace/irq_vectors.h> ··· 335 334 for_each_online_cpu(cpu) { 336 335 if (cpu == this_cpu) 337 336 continue; 338 - for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS; 339 - vector++) { 340 - if (per_cpu(vector_irq, cpu)[vector] < 0) 341 - count++; 337 + /* 338 + * We scan from FIRST_EXTERNAL_VECTOR to first system 339 + * vector. If the vector is marked in the used vectors 340 + * bitmap or an irq is assigned to it, we don't count 341 + * it as available. 342 + */ 343 + for (vector = FIRST_EXTERNAL_VECTOR; 344 + vector < first_system_vector; vector++) { 345 + if (!test_bit(vector, used_vectors) && 346 + per_cpu(vector_irq, cpu)[vector] < 0) 347 + count++; 342 348 } 343 349 } 344 350
+34 -74
arch/x86/kernel/smpboot.c
··· 111 111 static void smp_callin(void) 112 112 { 113 113 int cpuid, phys_id; 114 - unsigned long timeout; 115 114 116 115 /* 117 116 * If waken up by an INIT in an 82489DX configuration ··· 129 130 * (This works even if the APIC is not enabled.) 130 131 */ 131 132 phys_id = read_apic_id(); 132 - if (cpumask_test_cpu(cpuid, cpu_callin_mask)) { 133 - panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__, 134 - phys_id, cpuid); 135 - } 136 - pr_debug("CPU#%d (phys ID: %d) waiting for CALLOUT\n", cpuid, phys_id); 137 - 138 - /* 139 - * STARTUP IPIs are fragile beasts as they might sometimes 140 - * trigger some glue motherboard logic. Complete APIC bus 141 - * silence for 1 second, this overestimates the time the 142 - * boot CPU is spending to send the up to 2 STARTUP IPIs 143 - * by a factor of two. This should be enough. 144 - */ 145 - 146 - /* 147 - * Waiting 2s total for startup (udelay is not yet working) 148 - */ 149 - timeout = jiffies + 2*HZ; 150 - while (time_before(jiffies, timeout)) { 151 - /* 152 - * Has the boot CPU finished it's STARTUP sequence? 153 - */ 154 - if (cpumask_test_cpu(cpuid, cpu_callout_mask)) 155 - break; 156 - cpu_relax(); 157 - } 158 - 159 - if (!time_before(jiffies, timeout)) { 160 - panic("%s: CPU%d started up but did not get a callout!\n", 161 - __func__, cpuid); 162 - } 163 133 164 134 /* 165 135 * the boot CPU has finished the init stage and is spinning ··· 718 750 unsigned long start_ip = real_mode_header->trampoline_start; 719 751 720 752 unsigned long boot_error = 0; 721 - int timeout; 722 753 int cpu0_nmi_registered = 0; 754 + unsigned long timeout; 723 755 724 756 /* Just in case we booted with a single CPU. */ 725 757 alternatives_enable_smp(); ··· 767 799 } 768 800 769 801 /* 802 + * AP might wait on cpu_callout_mask in cpu_init() with 803 + * cpu_initialized_mask set if previous attempt to online 804 + * it timed-out. Clear cpu_initialized_mask so that after 805 + * INIT/SIPI it could start with a clean state. 806 + */ 807 + cpumask_clear_cpu(cpu, cpu_initialized_mask); 808 + smp_mb(); 809 + 810 + /* 770 811 * Wake up a CPU in difference cases: 771 812 * - Use the method in the APIC driver if it's defined 772 813 * Otherwise, ··· 787 810 boot_error = wakeup_cpu_via_init_nmi(cpu, start_ip, apicid, 788 811 &cpu0_nmi_registered); 789 812 813 + 790 814 if (!boot_error) { 791 815 /* 792 - * allow APs to start initializing. 816 + * Wait 10s total for a response from AP 793 817 */ 794 - pr_debug("Before Callout %d\n", cpu); 795 - cpumask_set_cpu(cpu, cpu_callout_mask); 796 - pr_debug("After Callout %d\n", cpu); 797 - 798 - /* 799 - * Wait 5s total for a response 800 - */ 801 - for (timeout = 0; timeout < 50000; timeout++) { 802 - if (cpumask_test_cpu(cpu, cpu_callin_mask)) 803 - break; /* It has booted */ 818 + boot_error = -1; 819 + timeout = jiffies + 10*HZ; 820 + while (time_before(jiffies, timeout)) { 821 + if (cpumask_test_cpu(cpu, cpu_initialized_mask)) { 822 + /* 823 + * Tell AP to proceed with initialization 824 + */ 825 + cpumask_set_cpu(cpu, cpu_callout_mask); 826 + boot_error = 0; 827 + break; 828 + } 804 829 udelay(100); 830 + schedule(); 831 + } 832 + } 833 + 834 + if (!boot_error) { 835 + /* 836 + * Wait till AP completes initial initialization 837 + */ 838 + while (!cpumask_test_cpu(cpu, cpu_callin_mask)) { 805 839 /* 806 840 * Allow other tasks to run while we wait for the 807 841 * AP to come online. This also gives a chance 808 842 * for the MTRR work(triggered by the AP coming online) 809 843 * to be completed in the stop machine context. 810 844 */ 845 + udelay(100); 811 846 schedule(); 812 847 } 813 - 814 - if (cpumask_test_cpu(cpu, cpu_callin_mask)) { 815 - print_cpu_msr(&cpu_data(cpu)); 816 - pr_debug("CPU%d: has booted.\n", cpu); 817 - } else { 818 - boot_error = 1; 819 - if (*trampoline_status == 0xA5A5A5A5) 820 - /* trampoline started but...? */ 821 - pr_err("CPU%d: Stuck ??\n", cpu); 822 - else 823 - /* trampoline code not run */ 824 - pr_err("CPU%d: Not responding\n", cpu); 825 - if (apic->inquire_remote_apic) 826 - apic->inquire_remote_apic(apicid); 827 - } 828 - } 829 - 830 - if (boot_error) { 831 - /* Try to put things back the way they were before ... */ 832 - numa_remove_cpu(cpu); /* was set by numa_add_cpu */ 833 - 834 - /* was set by do_boot_cpu() */ 835 - cpumask_clear_cpu(cpu, cpu_callout_mask); 836 - 837 - /* was set by cpu_init() */ 838 - cpumask_clear_cpu(cpu, cpu_initialized_mask); 839 - 840 - set_cpu_present(cpu, false); 841 - per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID; 842 848 } 843 849 844 850 /* mark "stuck" area as not stuck */ ··· 881 921 882 922 err = do_boot_cpu(apicid, cpu, tidle); 883 923 if (err) { 884 - pr_debug("do_boot_cpu failed %d\n", err); 924 + pr_err("do_boot_cpu failed(%d) to wakeup CPU#%u\n", err, cpu); 885 925 return -EIO; 886 926 } 887 927
+3
arch/x86/platform/efi/efi.c
··· 919 919 void *tmp, *p, *q = NULL; 920 920 int count = 0; 921 921 922 + if (efi_enabled(EFI_OLD_MEMMAP)) 923 + return; 924 + 922 925 for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) { 923 926 md = p; 924 927