From: Borislav Petkov <bp@alien8.de>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Chen Gong <gong.chen@linux.intel.com>, X86 ML <x86@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Oleg Nesterov <oleg@redhat.com>, Tony Luck <tony.luck@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 4/5] x86/mce: Simplify flow when handling recoverable memory errors
Date: Tue, 11 Nov 2014 17:13:09 +0100 [thread overview]
Message-ID: <20141111161309.GG31490@pd.tnic> (raw)
In-Reply-To: <CALCETrULeLC3MhqdG5yJKXp9YL6ir3gOO4e9WGt1X3kkKMXdJw@mail.gmail.com>
On Tue, Nov 11, 2014 at 07:42:48AM -0800, Andy Lutomirski wrote:
> The last time I looked at the MCE code, I got a bit lost in the
> control flow. Is there ever a userspace-killing MCE that's delivered
> from kernel mode?
Yep, so while you're executing a userspace process, you get
an #MC raised which reports an error for which action is
required, i.e. look at all those MCE_AR_SEVERITY errors in
arch/x86/kernel/cpu/mcheck/mce-severity.c.
It happened within the context of current so we go and run the #MC
handler which decides that the process needs to be killed in order to
contain the error. So after we exit the handler and before we return to
try to sched in the process again on any core, we want to actually kill
it and poison all its memory.
> By that, I mean that I think that all userspace-killing MCEs go have
> user_mode_vm(regs) and go through paranoid_exit.
Yes.
> If so, why do you need to jump through hoops at all? You can't call
> do_exit, but it should be completely safe to force a fatal signal and
> let the scheduler and signal code take care of killing the process,
> right? For that matter, you should also be able to poke at vm
> structures, etc.
Well, we do that already. memory-failure.c does kill the processes when
it decides to.
The only question is whether adding two new members to task_struct is
ok. It is nicely convenient and it all falls into place.
In the #MC handler we do:
if (worst == MCE_AR_SEVERITY) {
/* schedule action before return to userland */
+ current->paddr = m.addr;
+ current->restartable = !!(m.mcgstatus & MCG_STATUS_RIPV);
set_thread_flag(TIF_MCE_NOTIFY);
}
and then before we return to userspace we do:
+ if (!current->restartable)
flags |= MF_MUST_KILL;
if (memory_failure(pfn, MCE_VECTOR, flags) < 0) {
and the MF_MUST_KILL makes sure memory_failure() does a force_sig().
So I think this is ok, I only think that people might oppose the two new
members to task_struct but it looks clean to me this way. IMHO at least.
> Or is there a meaningful case where mce_notify_process needs to help
> with recovery but the original MCE happened with !user_mode_vm(regs)?
Well, for the !user_mode_vm(regs) case we panic anyway.
Thanks Andy.
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
next prev parent reply other threads:[~2014-11-11 16:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-14 6:49 x86, MCE: MCE event ring management Chen, Gong
2014-08-14 6:49 ` [PATCH v2 1/5] x86, MCE: Provide a lock-less memory pool to save error record Chen, Gong
2014-08-14 6:49 ` [PATCH v2 2/5] x86, MCE: Don't use percpu for MCE workqueue/irq_work Chen, Gong
2014-08-14 6:49 ` [PATCH v2 3/5] x86, MCE: Remove mce_ring for SRAO error Chen, Gong
2014-08-14 6:49 ` [PATCH v2 4/5] x86/mce: Simplify flow when handling recoverable memory errors Chen, Gong
2014-11-11 11:42 ` Borislav Petkov
2014-11-11 15:42 ` Andy Lutomirski
2014-11-11 16:13 ` Borislav Petkov [this message]
2014-11-11 16:22 ` Andy Lutomirski
2014-11-11 16:30 ` Borislav Petkov
2014-11-11 17:15 ` Andy Lutomirski
2014-11-11 18:22 ` Borislav Petkov
2014-11-11 18:34 ` Andy Lutomirski
2014-11-11 18:38 ` Borislav Petkov
2014-11-11 20:10 ` Andy Lutomirski
2014-11-12 17:20 ` Oleg Nesterov
2014-11-12 17:25 ` Andy Lutomirski
2014-11-12 17:27 ` Borislav Petkov
2014-08-14 6:49 ` [PATCH v2 5/5] x86, MCE: Avoid potential deadlock in MCE context Chen, Gong
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=20141111161309.GG31490@pd.tnic \
--to=bp@alien8.de \
--cc=gong.chen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.