public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "long.wanglong" <long.wanglong@huawei.com>
To: Jiri Kosina <jkosina@suse.cz>
Cc: 王龙 <wanglong@laoqinren.net>, rostedt <rostedt@goodmis.org>,
	paulmck <paulmck@linux.vnet.ibm.com>, pmladek <pmladek@suse.cz>,
	dzickus <dzickus@redhat.com>,
	johannes <johannes@sipsolutions.net>, koct9i <koct9i@gmail.com>,
	tglx <tglx@linutronix.de>, mingo <mingo@redhat.com>,
	hpa <hpa@zytor.com>, x86 <x86@kernel.org>,
	atomlin <atomlin@redhat.com>, akpm <akpm@linux-foundation.org>,
	"sasha.levin" <sasha.levin@oracle.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	peifeiyue <peifeiyue@huawei.com>,
	"morgan.wang" <morgan.wang@huawei.com>
Subject: Re: [RFC] how to perform a safe NMI stack trace on all CPUs on x86?
Date: Thu, 14 May 2015 19:20:35 +0800	[thread overview]
Message-ID: <55548503.2050406@huawei.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1505131621200.8186@pobox.suse.cz>

On 2015/5/13 22:26, Jiri Kosina wrote:
> On Wed, 13 May 2015, 王龙 wrote:
> 
>> Hi all,
>>
>> In kernel before 3.19, when trigger_all_cpu_backtrace() is called on x86, 
>> it will trigger an NMI on each CPU and call show_regs(). But this can lead
>> to a hard lock up if the NMI comes in on another printk().
>>
>> The commit a9edc88093287183ac934be44f295f183b2c62dd (x86/nmi: Perform a safe 
>> NMI stack trace on all CPUs) fix this problem on kernel mainline. when the NMI 
>> triggers, it switches the printk routine for that CPU to call a NMI safe printk 
>> function that records the printk in a per_cpu seq_buf descriptor. After all 
>> NMIs have finished recording its data, the seq_bufs are printed in a safe 
>> context. But how do we fix this problem in older version of kernel(eg, 3.10 stable)? 
>> The 3.10 stable has no "switch printk routine" and "seq_buf" infrastructures.
>>
>> Could anyone give me some ideas?
> 
> Either you backport seq_buf-based aproach to the older kernel, or, if you 
> are working on 3.4 kernel or earlier (basically any kernel preceeding the 
> printk() revamp that happened in 7ff9554bb57 and after), you can use 
> slightly simpler aproach.
> 
> It's an aproach we used initially when finding out the issue for the first 
> time, and it is proven to work as well (but it's not applicable after Kay 
> added all the complexity to printk()).
> 
> You can see it in our SLE11 kernel tree, available on
> 	
> 	http://kernel.suse.com/cgit/kernel/commit/?h=SLE11-SP4&id=8d62ae68ff61d77ae3c4899f05dbd9c9742b14c9
> 
> for example.
> 
> It's up to you to judget which is the least painful way :)
> 

Hi Jiri Kosina,

For 3.10 stable, the only way to solve this problem is backport seq_buf-based aproach.

I will backport necessary patches to 3.10 stable. Welcome you to review my backport patches.

Best Regards
Wang Long





      reply	other threads:[~2015-05-14 12:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-13 14:14 [RFC] how to perform a safe NMI stack trace on all CPUs on x86? 王龙
2015-05-13 14:22 ` Steven Rostedt
2015-05-14 11:15   ` long.wanglong
2015-05-13 14:26 ` Jiri Kosina
2015-05-14 11:20   ` long.wanglong [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=55548503.2050406@huawei.com \
    --to=long.wanglong@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=atomlin@redhat.com \
    --cc=dzickus@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jkosina@suse.cz \
    --cc=johannes@sipsolutions.net \
    --cc=koct9i@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=morgan.wang@huawei.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peifeiyue@huawei.com \
    --cc=pmladek@suse.cz \
    --cc=rostedt@goodmis.org \
    --cc=sasha.levin@oracle.com \
    --cc=tglx@linutronix.de \
    --cc=wanglong@laoqinren.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox