x86: call free_init_pages() with irqs enabled in alternative_instructions()
[platform/kernel/linux-arm64.git] / arch / x86 / kernel / alternative.c
index bd72d94..dff1c9e 100644 (file)
@@ -10,6 +10,7 @@
 #include <asm/pgtable.h>
 #include <asm/mce.h>
 #include <asm/nmi.h>
+#include <asm/vsyscall.h>
 
 #define MAX_PATCH_LEN (255-1)
 
@@ -414,9 +415,6 @@ void __init alternative_instructions(void)
                        alternatives_smp_unlock(__smp_locks, __smp_locks_end,
                                                _text, _etext);
                }
-               free_init_pages("SMP alternatives",
-                               (unsigned long)__smp_locks,
-                               (unsigned long)__smp_locks_end);
        } else {
                alternatives_smp_module_add(NULL, "core kernel",
                                            __smp_locks, __smp_locks_end,
@@ -427,6 +425,11 @@ void __init alternative_instructions(void)
        apply_paravirt(__parainstructions, __parainstructions_end);
        local_irq_restore(flags);
 
+       if (smp_alt_once)
+               free_init_pages("SMP alternatives",
+                               (unsigned long)__smp_locks,
+                               (unsigned long)__smp_locks_end);
+
        restart_nmi();
 #ifdef CONFIG_X86_MCE
        restart_mce();