From: "Luck, Tony" <tony.luck@intel.com>
To: linux-kernel@vger.kernel.org
Cc: Seiji Aguchi <seiji.aguchi@hds.com>,
David Woodhouse <dwmw2@infradead.org>,
Marco Stornelli <marco.stornelli@gmail.com>,
Artem Bityutskiy <Artem.Bityutskiy@nokia.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: [RFC] pstore: Don't use persistent store for normal shutdown
Date: Mon, 21 Mar 2011 11:24:23 -0700 [thread overview]
Message-ID: <4d8797d74168a6441@agluck-desktop.sc.intel.com> (raw)
In commit 04c6862c055fb687c90d9652f32c11a063df15cf
kmsg_dump: add kmsg_dump() calls to the reboot, halt, poweroff and emergency_restart paths
Seiji Aguchi added kmsg_dump options for all the "normal" ways
that a system can be shut down (KEXEC, RESTART, HALT and POWEROFF).
It doesn't seem useful to save the kernel log to persistent store
in these cases.
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
My /dev/pstore changes have been merged - and I immediately noticed that they
now save a record on every shutdown. Some simple detective work with git found
that kmsg_dump now has some new "reasons" for calling its subscribers.
This patch excludes the four "normal shutdown" cases from being logged
to persistent store, on the assumption that we don't want to clutter up
a limited amount of storage space with routine data. My presumption is
that there is some other subscriber to kmsg_dump that is doing something
with these reason codes ... is that right? Or do you think that we should
save the tail of kernel log into persistent store for every shutdown?
Perhaps we could save less data for these new reasons? Other ideas?
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index ce9ad84..4ca44c6 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -61,15 +61,34 @@ static void pstore_dump(struct kmsg_dumper *dumper,
unsigned long s1_start, s2_start;
unsigned long l1_cpy, l2_cpy;
unsigned long size, total = 0;
- char *dst;
+ char *dst, *why;
u64 id;
int hsize, part = 1;
+ switch (reason) {
+ case KMSG_DUMP_KEXEC:
+ case KMSG_DUMP_RESTART:
+ case KMSG_DUMP_HALT:
+ case KMSG_DUMP_POWEROFF:
+ return;
+ case KMSG_DUMP_OOPS:
+ why = "oops";
+ break;
+ case KMSG_DUMP_PANIC:
+ why = "panic";
+ break;
+ case KMSG_DUMP_EMERG:
+ why = "emergency";
+ break;
+ default:
+ why = "unknown";
+ break;
+ }
mutex_lock(&psinfo->buf_mutex);
oopscount++;
while (total < kmsg_bytes) {
dst = psinfo->buf;
- hsize = sprintf(dst, "Oops#%d Part%d\n", oopscount, part++);
+ hsize = sprintf(dst, "%s#%d Part%d\n", why, oopscount, part++);
size = psinfo->bufsize - hsize;
dst += hsize;
next reply other threads:[~2011-03-21 18:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-21 18:24 Luck, Tony [this message]
2011-03-21 19:49 ` [RFC] pstore: Don't use persistent store for normal shutdown Seiji Aguchi
2011-03-21 20:27 ` Tony Luck
2011-03-21 21:47 ` Seiji Aguchi
2011-03-21 22:01 ` Tony Luck
2011-03-22 8:42 ` Artem Bityutskiy
2011-03-22 8:54 ` Américo Wang
2011-03-22 19:55 ` Luck, Tony
2011-03-22 22:17 ` Seiji Aguchi
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=4d8797d74168a6441@agluck-desktop.sc.intel.com \
--to=tony.luck@intel.com \
--cc=Artem.Bityutskiy@nokia.com \
--cc=akpm@linux-foundation.org \
--cc=dwmw2@infradead.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marco.stornelli@gmail.com \
--cc=seiji.aguchi@hds.com \
--cc=torvalds@linux-foundation.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