mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Ingo Molnar <mingo@kernel.org>
Cc: ShuoX Liu <shuox.liu@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Borislav Petkov <bp@alien8.de>,
	Yanmin Zhang <yanmin_zhang@linux.intel.com>,
	"Luck, Tony" <tony.luck@intel.com>,
	"andi@firstfloor.org" <andi@firstfloor.org>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v7 2/2] x86 mce: use new printk recursion disabling interface
Date: Mon, 25 Jun 2012 15:14:21 +0200	[thread overview]
Message-ID: <1340630061.2507.61.camel@laptop> (raw)
In-Reply-To: <20120625091734.GA25839@gmail.com>

On Mon, 2012-06-25 at 11:17 +0200, Ingo Molnar wrote:
> * ShuoX Liu <shuox.liu@intel.com> wrote:
> 
> > From: ShuoX Liu <shuox.liu@intel.com>
> > 
> > On x86 machines, some times MCE happens just when kernel calls printk
> > to output some log info to serial console, while usually MCE module in
> > kernel is used to print out some hardware error information, such like
> > bad cache or bad memory bank. That causes printk recursion and printk
> > would omit MCE printk output.
> > 
> > We hit it when running MTBF testing on Android ATOM mobiles.
> > 
> > Here in print_mce, we choose to disable printk recursion to make sure
> > MCE logs printed out.
> > 
> > Signed-off-by: Yanmin Zhang <yanmin_zhang@linux.intel.com>
> > Signed-off-by: ShuoX Liu <shuox.liu@intel.com>
> > ---
> >  arch/x86/kernel/cpu/mcheck/mce.c |    6 +++++-
> >  1 files changed, 5 insertions(+), 1 deletions(-)
> > 
> > diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
> > index 2afcbd2..6056e94 100644
> > --- a/arch/x86/kernel/cpu/mcheck/mce.c
> > +++ b/arch/x86/kernel/cpu/mcheck/mce.c
> > @@ -242,6 +242,7 @@ static void print_mce(struct mce *m)
> >  {
> >  	int ret = 0;
> >  
> > +	printk_recursion_check_disable();
> >  	pr_emerg(HW_ERR "CPU %d: Machine Check Exception: %Lx Bank %d: %016Lx\n",
> >  	       m->extcpu, m->mcgstatus, m->bank, m->status);
> >  
> > @@ -275,10 +276,13 @@ static void print_mce(struct mce *m)
> >  	 * (if the CPU has an implementation for that)
> >  	 */
> >  	ret = atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, m);
> > -	if (ret == NOTIFY_STOP)
> > +	if (ret == NOTIFY_STOP) {
> > +		printk_recursion_check_enable();
> >  		return;
> > +	}
> >  
> >  	pr_emerg_ratelimited(HW_ERR "Run the above through 'mcelog --ascii'\n");
> > +	printk_recursion_check_enable();
> 
> Ok, this looks useful and it solves a real problem, but I'd 
> prefer a better interface: instead of exposing the guts of 
> printk to drivers in an unsafe manner (and allowing them to keep 
> printk in an unsafe state indefinitely), shouldn't we instead 
> introduce printk_emergency() (and variants) that just disable 
> the recursion check, do the printk and then enable them?

I really don't see why you'd do anything like the above. For one the
oops_in_progress thing is exported, so you could simply use that, you're
going to panic the machine here anyway, right?

Furthermore the whole recursion stuff is broken anyway, see:
  http://marc.info/?l=linux-kernel&m=132446646923333

That also introduces recursive_printk() which you could (ab)use if
needed.

That said, its not entirely clear to me what context you're in when
you're calling this print_mce(), it looks like its only used from
mce_panic().

That already does bust_spinlocks() which already increments the
oops_in_progress thing, so WTF are you doing anyway?


  reply	other threads:[~2012-06-25 13:14 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-23  1:58 [PATCH] printk: ignore recursion_bug flag when MCE in progress ShuoX Liu
2012-05-23 10:01 ` Borislav Petkov
2012-05-24  0:38   ` Yanmin Zhang
2012-05-24  5:59   ` [PATCH v2] printk: ignore recursion_bug flag in HW error handle process ShuoX Liu
2012-05-24  6:11     ` Borislav Petkov
2012-05-24 22:56       ` Andrew Morton
2012-05-25  0:30         ` Yanmin Zhang
2012-05-25  7:19           ` [PATCH 1/2] printk: add interface for disabling recursion check ShuoX Liu
2012-05-25  7:21             ` [PATCH 2/2] x86 mce: use new printk recursion disabling interface ShuoX Liu
2012-05-25  7:41               ` Borislav Petkov
2012-05-25  8:00                 ` ShuoX Liu
2012-05-28  2:07                 ` ShuoX Liu
2012-05-30  9:08                   ` Borislav Petkov
2012-05-31  0:30                     ` Yanmin Zhang
2012-06-04  3:04                     ` [PATCH v4 1/2] printk: add interface for disabling recursion check ShuoX Liu
2012-06-04  3:07                       ` [PATCH v4 2/2] x86 mce: use new printk recursion disabling interface ShuoX Liu
2012-06-22 23:41                         ` Andrew Morton
2012-06-26 20:45                           ` Borislav Petkov
2012-05-25 16:09             ` [PATCH 1/2] printk: add interface for disabling recursion check Luck, Tony
2012-05-28  0:30               ` Yanmin Zhang
2012-05-28  2:54                 ` [PATCH v3 " ShuoX Liu
2012-05-28  2:56                   ` [PATCH v3 2/2] x86 mce: use new printk recursion disabling interface ShuoX Liu
2012-06-04 17:12                     ` Borislav Petkov
2012-06-05  0:32                       ` Yanmin Zhang
2012-06-05  8:14                         ` Borislav Petkov
2012-06-05  9:53                           ` [PATCH v5 1/2] printk: add interface for disabling recursion check ShuoX Liu
2012-06-05  9:55                             ` [PATCH v5 2/2] x86 mce: use new printk recursion disabling interface ShuoX Liu
2012-06-05 15:15                               ` Borislav Petkov
2012-06-06  0:36                                 ` Yanmin Zhang
2012-06-06  8:31                                   ` [PATCH v6 1/2] printk: add interface for disabling recursion check ShuoX Liu
2012-06-06  8:34                                     ` [PATCH v6 2/2] x86 mce: use new printk recursion disabling interface ShuoX Liu
2012-06-06 15:22                                       ` Borislav Petkov
2012-06-07  2:13                                         ` Yanmin Zhang
2012-06-07  2:57                                         ` [PATCH v7 1/2] printk: add interface for disabling recursion check ShuoX Liu
2012-06-07  3:00                                           ` [PATCH v7 2/2] x86 mce: use new printk recursion disabling interface ShuoX Liu
2012-06-08 12:34                                             ` Borislav Petkov
2012-06-25  9:17                                             ` Ingo Molnar
2012-06-25 13:14                                               ` Peter Zijlstra [this message]
2012-06-26 20:43                                                 ` Borislav Petkov
2012-06-07 13:19                                           ` [PATCH v7 1/2] printk: add interface for disabling recursion check bing deng
2012-06-07 13:38                                             ` Borislav Petkov
2012-06-08 12:30                                           ` Borislav Petkov

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=1340630061.2507.61.camel@laptop \
    --to=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@kernel.org \
    --cc=shuox.liu@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=yanmin_zhang@linux.intel.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

Powered by JetHome