From fa921c78c5cd2000a6ea2bd10298118fbf076107 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Fri, 29 Aug 2008 08:57:04 +0000 Subject: [PATCH] UBUNTU: SAUCE: fix kernel oops in VirtualBox during paravirt patching Bug: 246067 Paravirtualisation patching of kernel trips a kernel oops when running in VirtualBox. Turning off interrupts around the entire paravirtualisation patching process avoids patching active code inside an interrupt. Signed-off-by: Colin Ian King --- arch/x86/kernel/alternative.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 2763cb3..54b10a9 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -420,6 +420,8 @@ extern struct paravirt_patch_site __start_parainstructions[], void __init alternative_instructions(void) { + unsigned long flags; + /* The patching is not fully atomic, so try to avoid local interruptions that might execute the to be patched code. Other CPUs are not running. */ @@ -428,7 +430,9 @@ void __init alternative_instructions(void) stop_mce(); #endif + local_irq_save(flags); apply_alternatives(__alt_instructions, __alt_instructions_end); + local_irq_restore(flags); /* switch to patch-once-at-boottime-only mode and free the * tables in case we know the number of CPUs will never ever @@ -458,7 +462,9 @@ void __init alternative_instructions(void) alternatives_smp_switch(0); } #endif + local_irq_save(flags); apply_paravirt(__parainstructions, __parainstructions_end); + local_irq_restore(flags); if (smp_alt_once) free_init_pages("SMP alternatives", -- 1.5.6.3