From: tip-bot for Siarhei Liakh <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: Siarhei.Liakh@concurrent-rt.com, linux-kernel@vger.kernel.org,
bpetkov@suse.de, tglx@linutronix.de,
siarhei.liakh@concurrent-rt.com, mingo@kernel.org,
luto@kernel.org, hpa@zytor.com
Subject: [tip:x86/urgent] x86: Call fixup_exception() before notify_die() in math_error()
Date: Wed, 20 Jun 2018 02:48:48 -0700 [thread overview]
Message-ID: <tip-3ae6295ccb7cf6d344908209701badbbbb503e40@git.kernel.org> (raw)
In-Reply-To: <DM5PR11MB201156F1CAB2592B07C79A03B17D0@DM5PR11MB2011.namprd11.prod.outlook.com>
Commit-ID: 3ae6295ccb7cf6d344908209701badbbbb503e40
Gitweb: https://git.kernel.org/tip/3ae6295ccb7cf6d344908209701badbbbb503e40
Author: Siarhei Liakh <Siarhei.Liakh@concurrent-rt.com>
AuthorDate: Thu, 14 Jun 2018 19:36:07 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 20 Jun 2018 11:44:56 +0200
x86: Call fixup_exception() before notify_die() in math_error()
fpu__drop() has an explicit fwait which under some conditions can trigger a
fixable FPU exception while in kernel. Thus, we should attempt to fixup the
exception first, and only call notify_die() if the fixup failed just like
in do_general_protection(). The original call sequence incorrectly triggers
KDB entry on debug kernels under particular FPU-intensive workloads.
Andy noted, that this makes the whole conditional irq enable thing even
more inconsistent, but fixing that it outside the scope of this.
Signed-off-by: Siarhei Liakh <siarhei.liakh@concurrent-rt.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andy Lutomirski <luto@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: "Borislav Petkov" <bpetkov@suse.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/DM5PR11MB201156F1CAB2592B07C79A03B17D0@DM5PR11MB2011.namprd11.prod.outlook.com
---
arch/x86/kernel/traps.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 03f3d7695dac..162a31d80ad5 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -834,16 +834,18 @@ static void math_error(struct pt_regs *regs, int error_code, int trapnr)
char *str = (trapnr == X86_TRAP_MF) ? "fpu exception" :
"simd exception";
- if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, SIGFPE) == NOTIFY_STOP)
- return;
cond_local_irq_enable(regs);
if (!user_mode(regs)) {
- if (!fixup_exception(regs, trapnr)) {
- task->thread.error_code = error_code;
- task->thread.trap_nr = trapnr;
+ if (fixup_exception(regs, trapnr))
+ return;
+
+ task->thread.error_code = error_code;
+ task->thread.trap_nr = trapnr;
+
+ if (notify_die(DIE_TRAP, str, regs, error_code,
+ trapnr, SIGFPE) != NOTIFY_STOP)
die(str, regs, error_code);
- }
return;
}
prev parent reply other threads:[~2018-06-20 9:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-14 19:36 [PATCH] " Siarhei Liakh
2018-06-18 21:47 ` Andy Lutomirski
2018-06-19 6:23 ` Thomas Gleixner
2018-06-19 15:23 ` Andy Lutomirski
[not found] ` <DM5PR11MB2011397361BB5C0FB3D4FDFFB1700@DM5PR11MB2011.namprd11.prod.outlook.com>
[not found] ` <B739D98B-BA3F-40F6-82DF-6444546B6B4C@amacapital.net>
2018-06-19 19:56 ` Siarhei Liakh
2018-06-20 9:48 ` tip-bot for Siarhei Liakh [this message]
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=tip-3ae6295ccb7cf6d344908209701badbbbb503e40@git.kernel.org \
--to=tipbot@zytor.com \
--cc=Siarhei.Liakh@concurrent-rt.com \
--cc=bpetkov@suse.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome