mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: Borislav Petkov <bp@alien8.de>
Cc: "Luck, Tony" <tony.luck@intel.com>,
	Prarit Bhargava <prarit@redhat.com>,
	Vivek Goyal <vgoyal@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Junichi Nomura <j-nomura@ce.jp.nec.com>,
	Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Subject: Re: [PATCH v5] x86: mce: kexec: switch MCE handler for kexec/kdump
Date: Thu, 5 Mar 2015 09:37:52 +0000	[thread overview]
Message-ID: <20150305093752.GA11764@hori1.linux.bs1.fc.nec.co.jp> (raw)
In-Reply-To: <20150305085735.GE3915@pd.tnic>

On Thu, Mar 05, 2015 at 09:57:35AM +0100, Borislav Petkov wrote:
> On Thu, Mar 05, 2015 at 06:45:10AM +0000, Naoya Horiguchi wrote:
...
> > 
> > Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> > Cc: <stable@vger.kernel.org>        [2.6.32+]
> 
> I don't think you can CC stable on something which looks like a new
> feature to me.

OK, I drop it.

> It is most likely that distros will pick it up separately.
> 
> > ---
> > ChangeLog v4 -> v5:
> > - drop MCE_UC/AR_SEVERITY re-ordering
> > - move most of code to arch/x86/kernel/crash.c
> > - export some MCE internal variables/routines via arch/x86/include/asm/mce.h
> > 
> > ChangeLog v3 -> v4:
> > - fixed AR and UC order in enum severity_level because UC is severer than AR
> >   by definition. Current code is not affected by this wrong order by chance.
> > - check severity in machine_check_under_kdump(), and call mce_panic() if the
> >   resultant severity is as bad as or worse than MCE_AR_SEVERITY.
> > - use static global variable kdump_cpu instead of mca_cfg->kdump_cpu
> > - reduce "#ifdef CONFIG_KEXEC"
> > - add "#ifdef CONFIG_X86_MCE" for declaration of machine_check_under_kdump()
> >   in mce.h
> > - update comment on switch_mce_handler_for_kdump()
> > 
> > ChangeLog v2 -> v3
> > - go to "switch MCE handler" approach
> > 
> > ChangeLog v1 -> v2
> > - clear MSR_IA32_MCG_CTL, MSR_IA32_MCx_CTL, and CR4.MCE instead of using
> >   global flag to ignore MCE events.
> > - fixed the description of the problem
> > ---
> >  arch/x86/include/asm/mce.h                | 19 +++++++
> >  arch/x86/kernel/cpu/mcheck/mce-internal.h | 13 -----
> >  arch/x86/kernel/cpu/mcheck/mce.c          | 10 ++--
> >  arch/x86/kernel/crash.c                   | 87 +++++++++++++++++++++++++++++++
> >  4 files changed, 111 insertions(+), 18 deletions(-)
> > 
> > diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
> > index 51b26e895933..fbb385611a14 100644
> > --- a/arch/x86/include/asm/mce.h
> > +++ b/arch/x86/include/asm/mce.h
> > @@ -248,4 +248,23 @@ struct cper_sec_mem_err;
> >  extern void apei_mce_report_mem_error(int corrected,
> >  				      struct cper_sec_mem_err *mem_err);
> >  
> > +enum severity_level {
> > +	MCE_NO_SEVERITY,
> > +	MCE_DEFERRED_SEVERITY,
> > +	MCE_UCNA_SEVERITY = MCE_DEFERRED_SEVERITY,
> > +	MCE_KEEP_SEVERITY,
> > +	MCE_SOME_SEVERITY,
> > +	MCE_AO_SEVERITY,
> > +	MCE_UC_SEVERITY,
> > +	MCE_AR_SEVERITY,
> > +	MCE_PANIC_SEVERITY,
> > +};
> > +
> > +int mce_severity(struct mce *a, int tolerant, char **msg, bool is_excp);
> > +
> > +extern void mce_panic(char *msg, struct mce *final, char *exp);
> 
> mce_panic is doing a lot of MCE-specific stuff like flushing out mcelog
> etc. I don't think you need all that in your case - I think in your case
> you simply want to panic().

print_mce() doesn't help?

> > +extern u64 mce_rdmsrl(u32 msr);
> > +extern void mce_wrmsrl(u32 msr, u64 v);
> 
> Those wrap error injection. I don't think you need that either - use
> generic rd/wrmsr* functions.
> 
> > +extern inline void mce_gather_info(struct mce *m, struct pt_regs *regs);
> 
> This has a vm86 mode special case. Also probably not needed for you. You
> can simply read MSR_IA32_MCG_STATUS in a simplified, private version.
> 
> > +extern void (*quirk_no_way_out)(int bank, struct mce *m, struct pt_regs *regs);
> 
> Now this is exposing a really MCE-internal function. You probably should add a
> 
> 	mce_callback(bank, m, regs);
> 
> in a prepatch and call it from your code.

Currently quirk_no_way_out() is set only for a specific CPU model, so even
if we define another callback for kdump code, setting it to a real function
need to be done in MCE internal function, __mcheck_cpu_apply_quirks() ?

It seems that in this version I relied on reusing exisiting code too much.
So I'll do only what I really need. Then, if the model specific behavior
(what quirk_sandybridge_ifu() does) doesn't affect machine_check_under_kdump()'s
behavior, simply stop copying this part is a right thing to do?


> With the above simplified versions used, the rest of the patch becomes
> almost trivial.

Other than that, I'm OK to write in the simplified form.

Thanks,
Naoya Horiguchi

  reply	other threads:[~2015-03-05  9:42 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03  9:01 [PATCH v3 1/2] " Naoya Horiguchi
2015-03-03  9:01 ` [PATCH v3 2/2] x86: mce: comment about MCE synchronization timeout on definition of tolerant Naoya Horiguchi
2015-03-03 18:09 ` [PATCH v3 1/2] x86: mce: kexec: switch MCE handler for kexec/kdump Luck, Tony
2015-03-04  7:41   ` [PATCH v4] " Naoya Horiguchi
2015-03-04 23:12     ` Luck, Tony
2015-03-05  1:24       ` Naoya Horiguchi
2015-03-05  6:45         ` [PATCH v5] " Naoya Horiguchi
2015-03-05  8:57           ` Borislav Petkov
2015-03-05  9:37             ` Naoya Horiguchi [this message]
2015-03-06  2:59               ` [PATCH v6] " Naoya Horiguchi
2015-03-06  8:34                 ` Borislav Petkov
2015-03-06  9:09                   ` Naoya Horiguchi
2015-03-06  9:27                     ` Borislav Petkov
2015-03-06  9:32                       ` Naoya Horiguchi
2015-03-06 10:22                         ` [PATCH v7] " Naoya Horiguchi
2015-04-06  7:18                           ` Naoya Horiguchi
2015-04-06 11:59                             ` Borislav Petkov
2015-04-07  8:00                               ` Naoya Horiguchi
2015-04-07  8:02                                 ` [PATCH v8] " Naoya Horiguchi
2015-04-09  6:13                                   ` Borislav Petkov
2015-04-09  6:57                                     ` Naoya Horiguchi
2015-04-09  7:02                                       ` Borislav Petkov
2015-04-09 18:07                                         ` Luck, Tony
2015-04-09  8:00                                     ` Ingo Molnar
2015-04-09  8:21                                       ` Borislav Petkov
2015-04-09  8:59                                         ` Naoya Horiguchi
2015-04-09  9:53                                           ` Borislav Petkov
2015-04-09 18:22                                             ` Luck, Tony
2015-04-09 19:05                                               ` Borislav Petkov
2015-04-10  0:49                                                 ` Naoya Horiguchi
2015-04-10  4:07                                                   ` Naoya Horiguchi
2015-04-10  7:24                                                     ` Borislav Petkov
2015-04-28  8:41                                                   ` Baoquan He
2015-04-09  8:39                                       ` Naoya Horiguchi
2015-04-09  9:13                                         ` Ingo Molnar
2015-04-06 11:56                           ` [PATCH v7] " Borislav Petkov
2015-04-07  7:59                             ` Naoya Horiguchi
2015-03-06  8:28               ` [PATCH v5] " Borislav Petkov
2015-03-06  5:44         ` [PATCH v4] " Naoya Horiguchi
2015-03-05  8:48       ` Borislav Petkov
2015-03-03 18:53 ` [PATCH v3 1/2] " Borislav Petkov
2015-03-04  7:51   ` Naoya Horiguchi
2015-03-04  9:12     ` Borislav Petkov
2015-03-05  1:27       ` Naoya Horiguchi

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=20150305093752.GA11764@hori1.linux.bs1.fc.nec.co.jp \
    --to=n-horiguchi@ah.jp.nec.com \
    --cc=bp@alien8.de \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=k-ueda@ct.jp.nec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prarit@redhat.com \
    --cc=tony.luck@intel.com \
    --cc=vgoyal@redhat.com \
    /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

all inboxes | Powered by JetHome®