diff mbox

[2/4] x86, fpu: run device not available trap with interrupts enabled

Message ID 1276441427-31514-3-git-send-email-avi@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Avi Kivity June 13, 2010, 3:03 p.m. UTC
None
diff mbox

Patch

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 142d70c..c7d67cb 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -740,7 +740,6 @@  asmlinkage void math_state_restore(void)
 	struct task_struct *tsk = thread->task;
 
 	if (!tsk_used_math(tsk)) {
-		local_irq_enable();
 		/*
 		 * does a slab alloc which can sleep
 		 */
@@ -751,7 +750,6 @@  asmlinkage void math_state_restore(void)
 			do_group_exit(SIGKILL);
 			return;
 		}
-		local_irq_disable();
 	}
 
 	clts();				/* Allow maths ops (or we recurse) */
@@ -774,21 +772,20 @@  void math_emulate(struct math_emu_info *info)
 dotraplinkage void __kprobes
 do_device_not_available(struct pt_regs *regs, long error_code)
 {
+	preempt_disable();
+	local_irq_enable();
 #ifdef CONFIG_X86_32
 	if (read_cr0() & X86_CR0_EM) {
 		struct math_emu_info info = { };
 
-		conditional_sti(regs);
-
 		info.regs = regs;
 		math_emulate(&info);
-	} else {
-		math_state_restore(); /* interrupts still off */
-		conditional_sti(regs);
-	}
+	} else
+		math_state_restore();
 #else
 	math_state_restore();
 #endif
+	preempt_enable();
 }
 
 #ifdef CONFIG_X86_32