aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@kernel.org>2017-05-08 20:09:10 -0400
committerIngo Molnar <mingo@kernel.org>2017-05-09 02:14:24 -0400
commitd2b6dc61a8dd3c429609b993778cb54e75a5c5f0 (patch)
tree97e9ceeb4b2c54f18f212b79e38046e4fb5941a4
parent861ce4a3244c21b0af64f880d5bfe5e6e2fb9e4a (diff)
x86/boot/32: Fix UP boot on Quark and possibly other platforms
This partially reverts commit: 23b2a4ddebdd17f ("x86/boot/32: Defer resyncing initial_page_table until per-cpu is set up") That commit had one definite bug and one potential bug. The definite bug is that setup_per_cpu_areas() uses a differnet generic implementation on UP kernels, so initial_page_table never got resynced. This was fine for access to percpu data (it's in the identity map on UP), but it breaks other users of initial_page_table. The potential bug is that helpers like efi_init() would be called before the tables were synced. Avoid both problems by just syncing the page tables in setup_arch() *and* setup_per_cpu_areas(). Reported-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Andy Lutomirski <luto@kernel.org> Cc: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Juergen Gross <jgross@suse.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Garnier <thgarnie@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/kernel/setup.c15
-rw-r--r--arch/x86/kernel/setup_percpu.c10
2 files changed, 20 insertions, 5 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 603a1669a2ec..0b4d3c686b1e 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1225,6 +1225,21 @@ void __init setup_arch(char **cmdline_p)
1225 1225
1226 kasan_init(); 1226 kasan_init();
1227 1227
1228#ifdef CONFIG_X86_32
1229 /* sync back kernel address range */
1230 clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY,
1231 swapper_pg_dir + KERNEL_PGD_BOUNDARY,
1232 KERNEL_PGD_PTRS);
1233
1234 /*
1235 * sync back low identity map too. It is used for example
1236 * in the 32-bit EFI stub.
1237 */
1238 clone_pgd_range(initial_page_table,
1239 swapper_pg_dir + KERNEL_PGD_BOUNDARY,
1240 min(KERNEL_PGD_PTRS, KERNEL_PGD_BOUNDARY));
1241#endif
1242
1228 tboot_probe(); 1243 tboot_probe();
1229 1244
1230 map_vsyscall(); 1245 map_vsyscall();
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index bb1e8cc0bc84..10edd1e69a68 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -291,11 +291,11 @@ void __init setup_per_cpu_areas(void)
291 291
292#ifdef CONFIG_X86_32 292#ifdef CONFIG_X86_32
293 /* 293 /*
294 * Sync back kernel address range. We want to make sure that 294 * Sync back kernel address range again. We already did this in
295 * all kernel mappings, including percpu mappings, are available 295 * setup_arch(), but percpu data also needs to be available in
296 * in the smpboot asm. We can't reliably pick up percpu 296 * the smpboot asm. We can't reliably pick up percpu mappings
297 * mappings using vmalloc_fault(), because exception dispatch 297 * using vmalloc_fault(), because exception dispatch needs
298 * needs percpu data. 298 * percpu data.
299 */ 299 */
300 clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY, 300 clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY,
301 swapper_pg_dir + KERNEL_PGD_BOUNDARY, 301 swapper_pg_dir + KERNEL_PGD_BOUNDARY,