Skip to contentSkip to conversation

x86 fixes for v3.15

GIT PULL H. Peter Anvin 3 participants 3 messages Jun 7, 2014 – Jun 8, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Linus,

A significantly larger than I'd like set of patches for just below the wire. All of these, however, fix real problems. However, if you feel it is too scary we can do it for the merge window and rely on pushing them into -stable.

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.

The following changes since commit d2cfd3105094f593bc1fbd0b042a7752ddf08691:

Merge tag 'sound-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound (2014-06-03 12:07:30 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/urgent

for you to fetch changes up to 745c51673e289acf4d9ffc2835524de73ef923fd:

x86/boot: EFI_MIXED should not prohibit loading above 4G (2014-06-07 09:31:00 -0700)

----------------------------------------------------------------
Dave Young (2):
x86/efi: earlyprintk=efi,keep fix
x86/efi: Do not export efi runtime map in case old map

H. Peter Anvin (1):
Merge tag 'efi-urgent' into x86/urgent

Igor Mammedov (3):
x86: Fix list/memory corruption on CPU hotplug
x86/smpboot: Log error on secondary CPU wakeup failure at ERR level x86/smpboot: Initialize secondary CPU only if master CPU will wait for it

Matt Fleming (1):
x86/boot: EFI_MIXED should not prohibit loading above 4G

Yinghai Lu (1):
x86: irq: Get correct available vectors for cpu disable

 arch/x86/boot/header.S       |   3 +-
 arch/x86/kernel/cpu/common.c |  27 ++++++-----
 arch/x86/kernel/irq.c        |  16 +++++--
 arch/x86/kernel/smpboot.c    | 104 +++++++++++++------------------------------
 arch/x86/platform/efi/efi.c  |   3 ++
 5 files changed, 64 insertions(+), 89 deletions(-)
arch/x86/boot/header.S +1 -2
index 0ca9a5c362bc..84c223479e3c 100644
@@ -375,8 +375,7 @@ xloadflags:
 # define XLF0 0
 #endif
 
-#if defined(CONFIG_RELOCATABLE) && defined(CONFIG_X86_64) && \
-	!defined(CONFIG_EFI_MIXED)
+#if defined(CONFIG_RELOCATABLE) && defined(CONFIG_X86_64)
    /* kernel/boot_param/ramdisk could be loaded above 4g */
 # define XLF1 XLF_CAN_BE_LOADED_ABOVE_4G
 #else
arch/x86/kernel/cpu/common.c +16 -11
index a135239badb7..a4bcbacdbe0b 100644
@@ -1221,6 +1221,17 @@ static void dbg_restore_debug_regs(void)
 #define dbg_restore_debug_regs()
 #endif /* ! CONFIG_KGDB */
 
+static void wait_for_master_cpu(int cpu)
+{
+	/*
+	 * wait for ACK from master CPU before continuing
+	 * with AP initialization
+	 */
+	WARN_ON(cpumask_test_and_set_cpu(cpu, cpu_initialized_mask));
+	while (!cpumask_test_cpu(cpu, cpu_callout_mask))
+		cpu_relax();
+}
+
 /*
  * cpu_init() initializes state that is per-CPU. Some data is already
  * initialized (naturally) in the bootstrap process, such as the GDT
@@ -1236,16 +1247,17 @@ void cpu_init(void)
 	struct task_struct *me;
 	struct tss_struct *t;
 	unsigned long v;
-	int cpu;
+	int cpu = stack_smp_processor_id();
 	int i;
 
+	wait_for_master_cpu(cpu);
+
 	/*
 	 * Load microcode on this cpu if a valid microcode is available.
 	 * This is early microcode loading procedure.
 	 */
 	load_ucode_ap();
 
-	cpu = stack_smp_processor_id();
 	t = &per_cpu(init_tss, cpu);
 	oist = &per_cpu(orig_ist, cpu);
 
@@ -1257,9 +1269,6 @@ void cpu_init(void)
 
 	me = current;
 
-	if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask))
-		panic("CPU#%d already initialized!\n", cpu);
-
 	pr_debug("Initializing CPU#%d\n", cpu);
 
 	clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
@@ -1336,13 +1345,9 @@ void cpu_init(void)
 	struct tss_struct *t = &per_cpu(init_tss, cpu);
 	struct thread_struct *thread = &curr->thread;
 
-	show_ucode_info_early();
+	wait_for_master_cpu(cpu);
 
-	if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask)) {
-		printk(KERN_WARNING "CPU#%d already initialized!\n", cpu);
-		for (;;)
-			local_irq_enable();
-	}
+	show_ucode_info_early();
 
 	printk(KERN_INFO "Initializing CPU#%d\n", cpu);
 
arch/x86/kernel/irq.c +12 -4
index 283a76a9cc40..11ccfb0a63e7 100644
@@ -17,6 +17,7 @@
 #include <asm/idle.h>
 #include <asm/mce.h>
 #include <asm/hw_irq.h>
+#include <asm/desc.h>
 
 #define CREATE_TRACE_POINTS
 #include <asm/trace/irq_vectors.h>
@@ -334,10 +335,17 @@ int check_irq_vectors_for_cpu_disable(void)
 	for_each_online_cpu(cpu) {
 		if (cpu == this_cpu)
 			continue;
-		for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS;
-		     vector++) {
-			if (per_cpu(vector_irq, cpu)[vector] < 0)
-				count++;
+		/*
+		 * We scan from FIRST_EXTERNAL_VECTOR to first system
+		 * vector. If the vector is marked in the used vectors
+		 * bitmap or an irq is assigned to it, we don't count
+		 * it as available.
+		 */
+		for (vector = FIRST_EXTERNAL_VECTOR;
+		     vector < first_system_vector; vector++) {
+			if (!test_bit(vector, used_vectors) &&
+			    per_cpu(vector_irq, cpu)[vector] < 0)
+					count++;
 		}
 	}
 
arch/x86/kernel/smpboot.c +32 -72

155 lines not on this page · raw message

arch/x86/platform/efi/efi.c +3 -0
index 3781dd39e8bd..4d36932ca4f2 100644
@@ -919,6 +919,9 @@ static void __init save_runtime_map(void)
 	void *tmp, *p, *q = NULL;
 	int count = 0;
 
+	if (efi_enabled(EFI_OLD_MEMMAP))
+		return;
+
 	for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
 		md = p;
 
#1 lore raw
Quoted 5 lines · H. Peter Anvin

A significantly larger than I'd like set of patches for just below the wire. All of these, however, fix real problems. However, if you feel it is too scary we can do it for the merge window and rely on pushing them into -stable.

Ugh. I really don't like the timing, but the patches themselves look ok. So I ended up pulling them into my 3.15 branch, even if it's just a day before release.

I'm really hoping they've gone through all the regular x86 build/boot test machinery..

Linus

#2 lore raw
Quoted 7 lines · Linus Torvalds
Quoted 5 lines · H. Peter Anvin

A significantly larger than I'd like set of patches for just below the wire. All of these, however, fix real problems. However, if you feel it is too scary we can do it for the merge window and rely on pushing them into -stable.

Quoted 6 lines

Ugh. I really don't like the timing, but the patches themselves look ok. So I ended up pulling them into my 3.15 branch, even if it's just a day before release.

I'm really hoping they've gone through all the regular x86 build/boot test machinery..

They have ... yet that's just a tiny cross section of what is out there, so I'm too nervous about them a bit, especially the smpboot hotplug fix :-/

Thanks,

Ingo