linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] x86, fpu: run device not available trap with interrupts enabled
Date: Sun, 13 Jun 2010 18:03:45 +0300	[thread overview]
Message-ID: <1276441427-31514-3-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1276441427-31514-1-git-send-email-avi@redhat.com>

In order to allow a task's fpu state to fully float, we may need to
bring it back from another processor.  To do that, we need interrupts to
be enabled so we can fire off an IPI to that processor.

May break 80386/7 combos with FERR# wired through the interrupt controller.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 arch/x86/kernel/traps.c |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

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
-- 
1.7.1


  parent reply	other threads:[~2010-06-13 15:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-13 15:03 [PATCH 0/4] Really lazy fpu Avi Kivity
2010-06-13 15:03 ` [PATCH 1/4] x86, fpu: merge __save_init_fpu() implementations Avi Kivity
2010-06-13 15:03 ` Avi Kivity [this message]
2010-06-13 15:03 ` [PATCH 3/4] x86, fpu: Let the fpu remember which cpu it is active on Avi Kivity
2010-06-13 15:03 ` [PATCH 4/4] x86, fpu: don't save fpu state when switching from a task Avi Kivity
2010-06-13 20:45 ` [PATCH 0/4] Really lazy fpu Valdis.Kletnieks
2010-06-14  7:47   ` Avi Kivity
2010-06-16  7:24 ` Avi Kivity
2010-06-16  7:32   ` H. Peter Anvin
2010-06-16  8:02     ` Avi Kivity
2010-06-16  8:39       ` Ingo Molnar
2010-06-16  9:01         ` Samuel Thibault
2010-06-16  9:43           ` Avi Kivity
2010-06-16  9:10         ` Nick Piggin
2010-06-16  9:30           ` Avi Kivity
2010-06-16  9:28         ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1276441427-31514-3-git-send-email-avi@redhat.com \
    --to=avi@redhat.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).