From: Tim Bird <tim.bird@am.sony.com>
To: David VomLehn <dvomlehn@cisco.com>
Cc: Grant Likely <grant.likely@secretlab.ca>,
Daniel Walker <dwalker@mvista.com>,
linux-embedded@vger.kernel.org
Subject: Re: [PATCH] [RFC] emit-crash-char: Allow diversion of printk output for crash logging
Date: Wed, 13 Aug 2008 12:02:28 -0700 [thread overview]
Message-ID: <48A32FC4.7060006@am.sony.com> (raw)
In-Reply-To: <48A32068.3010000@cisco.com>
David VomLehn wrote:
> Our use case is:
> 1. We register a panic handler
> 2. The kernel panics and calls our panic handler
> 3. We register a function to log printk output
> 4. We print registers, stack, memory, and various other pieces of
> information using standard kernel functions, which all use printk
> 5. As printk output is generated, we store it in memory
> 6. We unregister the printk logging function
> 7. The panic handler exits
> 8. The kernel does the rest of its usual panic handling
>
> I'm not proposing storing the data in a specific place; that will be up
> to the platform. We will be storing in a piece of memory set aside for
> this purpose, but storing it in NOR flash makes a lot of sense, too, or
> using NAND flash or possibly even disk. All I'm proposing is a small
> framework that will allow plugging in a logging function when needed and
> removing it when done. I'll do the common piece that looks like a fake
> console and we, and other people, can use the simpler interface it
> provides.
I'm not sure exactly what triggers the transition from step 5 to 6 in
your steps above. That is, how do you know when to unregister the
printk logging function?
But, taking a step back, instead of storing the information somewhere
else, why not just use the log buffer as the storage medium, and transfer
that all-at-once when you've collected the information you want? That is,
change your steps to:
1. Register a panic handler
2. The kernel panics and calls our panic handler
3. Record the current position of the log buffer insertion point
4. Print registers, stack, memory, and various other pieces of
information using standard kernel functions, which all use printk
5. As printk output is generated - it is stored by the kernel
in the log buffer (no change to printk code is needed).
** (not sure what the trigger is to stop, here) **
6. Record the current position of the log buffer, and transfer
data logged between steps 3 and 6 to wherever you like. That
is, copy it directly from the log buffer.
7. The panic handler exits
8. The kernel does the rest of its usual panic handling
This reduces your intrusion to just your trigger points, and
grabbing the log buffer position. (Side Note - the way the log
buffer position is stored is a bit funky. It is an absolute
value that monotonically increases, and is masked when used
to refer to the buffer. This is why the log buffer size
is constrained to a power of two).
-- Tim
=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Corporation of America
=============================
next prev parent reply other threads:[~2008-08-13 19:02 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-08 2:20 [PATCH] [RFC] emit-crash-char: Allow diversion of printk output for crash logging David VomLehn
2008-08-08 15:55 ` Daniel Walker
2008-08-08 16:05 ` Mike Frysinger
2008-08-08 16:17 ` Daniel Walker
2008-08-08 18:09 ` Mike Frysinger
2008-08-08 20:10 ` Daniel Walker
2008-08-08 20:13 ` Mike Frysinger
2008-08-08 20:47 ` Daniel Walker
2008-08-08 21:24 ` [PATCH] [RFC] emit-crash-char: Allow diversion of printkoutput " Haller, John H (John)
2008-08-08 22:01 ` Daniel Walker
2008-08-11 23:34 ` [PATCH] [RFC] emit-crash-char: Allow diversion of printk output " David VomLehn
2008-08-12 22:39 ` Grant Likely
2008-08-13 1:30 ` David VomLehn
2008-08-13 2:12 ` Grant Likely
2008-08-13 17:56 ` David VomLehn
2008-08-13 19:02 ` Tim Bird [this message]
2008-08-13 20:27 ` David VomLehn
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=48A32FC4.7060006@am.sony.com \
--to=tim.bird@am.sony.com \
--cc=dvomlehn@cisco.com \
--cc=dwalker@mvista.com \
--cc=grant.likely@secretlab.ca \
--cc=linux-embedded@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.