Re: [PATCH, RFC] panic-note: Annotation from user space for panics

Matt Mackall
2009-11-18T00:57:11Z

On Tue, 2009-11-17 at 16:28 -0800, Eric W. Biederman wrote:
> David VomLehn <dvomlehn@cisco.com> writes:
>
> > On Tue, Nov 17, 2009 at 10:45:43AM -0500, Eric W. Biederman wrote:
> > ...
> >> Why not use the kdump hook? If you handle a kernel panic that way
> >> you get enhanced reliability and full user space support. All in a hook
> >> that is already present and already works.
> >
> > I'm a big fan of avoiding reinvention of the wheel--if I can use something
> > already present, I will. However, I'm not clear about how much of the problem
> > I'm addressing will be solved by using a kdump hook. If I understand
> > correctly, you'd still need a pseudo-file somewhere to actually get the data
> > from user space to kernel space. *Then* you could use a kdump hook to
> > transfer the data to flash or some memory area that will be retained across
> > boots. Is this the approach to which you were referring? If so, I have a
> > couple more questions:
> >
> > 1. In what ways would this be better than, say, a panic_notifier?
>
> A couple of ways.
>
> - You are doing the work in a known good kernel instead of the kernel
> that just paniced for some unknown reason.
> - All of the control logic is in user space (not the kernel) so you can
> potentially do something as simple as "date >> logfile" to get the
> date.
>
> > 2. Where would you suggest tying in? (Particularly since not all architectures
> > currently support kdump)
>
> No changes are needed kernel side. You just need an appropriate kernel and
> initrd for your purpose.
>
> All of the interesting architectures support kexec, and if an
> architecture doesn't it isn't hard to add. The architecture specific
> part is very simple. A pain to debug initially but very simple.

As much as I like kexec, it loses on memory footprint by about 100x.
It's not appropriate for all use cases, especially things like
consumer-grade wireless access points and phones.

--
http://selenic.com : development and support for Mercurial and Linux