public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Keith Owens <kaos@ocs.com.au>, Jay Lan <jlan@sgi.com>,
	Christoph Lameter <cl@linux-foundation.org>,
	Stefan Richter <stefanr@s5r6.in-berlin.de>,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	jmerkey@wolfmountaingroup.com,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Josh Boyer <jwboyer@gmail.com>,
	linux-kernel@vger.kernel.org,
	Takenori Nagano <t-nagano@ah.jp.nec.com>,
	Bernhard Walle <bwalle@suse.de>
Subject: Re: [ANNOUNCE] Merkey's Kernel Debugger
Date: Fri, 8 Aug 2008 09:29:53 -0400	[thread overview]
Message-ID: <20080808132953.GB3840@redhat.com> (raw)
In-Reply-To: <20080808022916.GM24801@one.firstfloor.org>

On Fri, Aug 08, 2008 at 04:29:16AM +0200, Andi Kleen wrote:
> > panic() is the only place where kdump gets a chance to run first and
> > panic notifiers are not executed.
> 
> To be fully clear panic() that is called outside oops/exception context
> 
> s/panic/die notifiers/
> 
> > 
> > To me so far only in kernel debugger seems to be a reasonable candiate
> 
> Yes a kernel debugger should be able to hook into panic()
> 
> In fact it can do that already by just setting a break point,
> but clearly having a real notifier is preferable.
> 
> The use case would be then that the kernel debugger would
> have some command to trigger a dump.
> 
> > which needs to run before kdump after a panic event. If a debugger
> > is really getting merged into the kernel, then I think debugger can
> 
> kgdb is already merged. Also the x86 notifiers are general
> enough that there are a couple of debuggers floating around
> that are just using existing interfaces (as in need very little in terms
> of core patching) 
> 
> > put a hook in the panic() before kdump. Wouldn't this solve the problem?
> 
> Yes it would, but right now there is no such hook. Also if there 
> was such a hook kdump could use it like everyone else.  
> 
> There's a priority scheme in notifiers so you can still run usually last.

Hi Andi,

IIUC, there are two lists for exception and panic notifications. All the
exceptios, NMI related notifications go through "die_chain" and
all the panic notifications are done through "panic_notifier_list".

Are you suggesting that kdump should be put onto panic_notifier_list, in
such a way so that it runs last?

Just few points to ponder.

- panic_notifier_list is exported and any module can register and make use
  of it. As you mentioned in your other mail, there are lot of drivers out
  there with crappy code and if we do it, all the drivers get a chance
  to do stuff after panic() and there is no gurantee that kdump code will
  ever get a chance to run.

- Kdump is built on the philosophy that after a panic(), one should do as
  as little as possible in the kernel and all the actions should be
  deferred to new kernel. That's why we recommend that all the panic
  notifier actions (except debugger), should be done in second kernel. It
  does introduce a little delay in notification but it also makes it more
  reliable.

- Neil Horman, has already provided infrastructure so that one can put
  it user space code in second kernel's initrd and it will be executed. 
  This can be easily done for modules also. 

But somehow nobody seems to be interested in doing things in second kernel
and everybody wants to run its post panic code in the first kernel. So
far, except debugger, we have not run into any strong case which needs to
run post panic code in first kernel and things will not work out if post
panic actions are taken in second kernel.

That's why there is always resistance from our side to move kdump to panic
notifier list so that we can make modules do the right thing and that
is, run in second kernel. The moment kdump is put onto panic_notifier_list,
nobody will think of doing anything in second kernel (because it takes extra
effort). Everybody will register a panic notifier handler in first kernel
and be happy..

If everybody thinks that they can do something meaningful in a crashed
kernel after panic() and that's the way to go, then so be it. In that
case we should export all the panic_notifier_list registered users to 
userspace (throug /sysfs or something) and then let user change the 
priority of various tools on the list based on his needs.

Adding all the infrastructure for changing priority of handlers from user
space becomes little messy and Eric had NAKed such patches. But it at least
allows a user to decide in what order he wants to run the various tools upon
panic().

But given an option, I would think that debugger should put a break point
in panic() and rest of the handlers should run in second kernel.

Thanks
Vivek

  parent reply	other threads:[~2008-08-08 13:30 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-03 17:22 [ANNOUNCE] Merkey's Kernel Debugger jmerkey
     [not found] ` <17494.166.70.238.46.1217784156.squirrel@webmail.wolfmountaingroup.com >
2008-08-03 19:36   ` jmerkey
2008-08-03 20:00     ` Rene Herman
2008-08-04  0:14     ` Josh Boyer
2008-08-04  2:19       ` jmerkey
2008-08-04 13:41         ` Stefan Richter
2008-08-04 14:33           ` jmerkey
2008-08-05  9:41             ` Geert Uytterhoeven
2008-08-05 15:02               ` jmerkey
2008-08-05 15:33                 ` Nick Piggin
2008-08-05 15:19                   ` jmerkey
2008-08-05 15:45                     ` Nick Piggin
2008-08-05 15:32                       ` jmerkey
2008-08-05 16:38                         ` Nick Piggin
2008-08-05 16:45                           ` jmerkey
2008-08-06 19:47                           ` Rene Herman
2008-08-05 16:04                     ` Chris Friesen
2008-08-05 16:39                       ` jmerkey
2008-08-07 20:43                         ` Daniel Barkalow
2008-08-07 21:02                           ` jmerkey
2008-08-07 21:04                             ` jmerkey
2008-08-05 17:21                     ` Paul Mundt
2008-08-05 17:10                       ` jmerkey
2008-08-06  3:08                   ` Andi Kleen
2008-08-06  5:50                     ` Nick Piggin
2008-08-07 17:45                       ` Christoph Lameter
2008-08-07 17:53                         ` jmerkey
2008-08-07 18:08                         ` Stefan Richter
2008-08-07 19:10                           ` Christoph Lameter
2008-08-07 19:47                             ` Jay Lan
2008-08-07 19:34                               ` jmerkey
2008-08-08  1:26                                 ` Vivek Goyal
2008-08-07 20:06                               ` Andi Kleen
2008-08-07 20:07                                 ` Bernhard Walle
2008-08-07 20:09                                   ` Andi Kleen
2008-08-07 20:11                                     ` Bernhard Walle
2008-08-07 22:28                                 ` Keith Owens
2008-08-08  1:15                                   ` Vivek Goyal
2008-08-08  2:29                                     ` Andi Kleen
2008-08-08 12:08                                       ` Cliff Wickman
2008-08-08 12:20                                         ` Andi Kleen
2008-08-08 13:19                                           ` jmerkey
2008-08-08 15:06                                           ` Cliff Wickman
2008-08-08 13:29                                       ` Vivek Goyal [this message]
2008-08-08 14:50                                         ` Cliff Wickman
2008-08-08 16:57                                           ` Jay Lan
2008-08-11 12:56                                           ` Vivek Goyal
2008-08-08 18:03                                         ` Andi Kleen
2008-08-11 13:02                                           ` Vivek Goyal
2008-08-11 13:11                                             ` jmerkey
2008-08-11 13:50                                               ` Andi Kleen
2008-08-11 16:16                                                 ` jmerkey
2008-08-18  9:12                                             ` Takenori Nagano
2008-08-08  8:40                         ` Nick Piggin
2008-08-06 13:11                     ` Bill Davidsen
2008-08-06 13:37                       ` Stefan Richter
2008-08-06 13:54                       ` Olivier Galibert
2008-08-06 13:45                         ` jmerkey
2008-08-06 14:16                       ` Nick Piggin
2008-08-06 17:21                     ` Jason Wessel
2008-08-06 18:57                       ` Andi Kleen
2008-08-07 12:45                         ` jmerkey
2008-08-07 15:17                           ` Peter Zijlstra
2008-08-07 16:07                           ` Andi Kleen
2008-08-07 15:52                             ` jmerkey
2008-08-07 17:04                               ` Stefan Richter
2008-08-08  0:28                           ` Stefan Richter
2008-08-11 10:36 ` jidong xiao

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=20080808132953.GB3840@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=bwalle@suse.de \
    --cc=cl@linux-foundation.org \
    --cc=geert@linux-m68k.org \
    --cc=jlan@sgi.com \
    --cc=jmerkey@wolfmountaingroup.com \
    --cc=jwboyer@gmail.com \
    --cc=kaos@ocs.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=stefanr@s5r6.in-berlin.de \
    --cc=t-nagano@ah.jp.nec.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