From patchwork Sun Jun 13 15:03:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Avi Kivity X-Patchwork-Id: 105828 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5DF5Vcb002806 for ; Sun, 13 Jun 2010 15:05:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754260Ab0FMPEL (ORCPT ); Sun, 13 Jun 2010 11:04:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26788 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752730Ab0FMPEI (ORCPT ); Sun, 13 Jun 2010 11:04:08 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o5DF3nRV009842 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 13 Jun 2010 11:03:49 -0400 Received: from cleopatra.tlv.redhat.com (cleopatra.tlv.redhat.com [10.35.255.11]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o5DF3mqf001779; Sun, 13 Jun 2010 11:03:48 -0400 Received: from file.tlv.redhat.com (file.tlv.redhat.com [10.35.255.8]) by cleopatra.tlv.redhat.com (Postfix) with ESMTP id BFA75250AD8; Sun, 13 Jun 2010 18:03:47 +0300 (IDT) From: Avi Kivity To: Ingo Molnar , "H. Peter Anvin" 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 Message-Id: <1276441427-31514-3-git-send-email-avi@redhat.com> In-Reply-To: <1276441427-31514-1-git-send-email-avi@redhat.com> References: <1276441427-31514-1-git-send-email-avi@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sun, 13 Jun 2010 15:05:31 +0000 (UTC) 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