* [PATCH 2/2] kmsg_dump: adding to reboot, halt, poweroff and emergency_restart path
2010-11-17 15:00 ` [PATCH 1/2] " Seiji Aguchi
@ 2010-11-17 15:03 ` Seiji Aguchi
2010-11-18 8:17 ` Artem Bityutskiy
2010-11-23 8:58 ` KOSAKI Motohiro
2010-11-18 8:16 ` [PATCH 1/2] " Artem Bityutskiy
2010-11-23 8:54 ` KOSAKI Motohiro
2 siblings, 2 replies; 8+ messages in thread
From: Seiji Aguchi @ 2010-11-17 15:03 UTC (permalink / raw)
To: Andrew Morton, Artem.Bityutskiy@nokia.com, ext KOSAKI Motohiro,
simon.kagstrom@netinsight.net, David.Woodhouse@intel.com,
anders.grafstrom@netinsight.net, jason.wessel@windriver.com,
jslaby@suse.cz, jmorris@namei.org, eparis@redhat.com, hch@lst.de,
linux-kernel@vger.kernel.org, kyungmin.park@samsung.com,
marco.stornelli@gmail.com, namhyung@gmail.com, Aaron Durbin,
randy.dunlap@oracle.com
Cc: dle-develop@lists.sourceforge.net, Satoru Moriya, Seiji Aguchi
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2748 bytes --]
We need to know the reason why system rebooted in support service.
However, we can't inform our customers of the reason because
final messages are lost on current Linux kernel.
This patch improves the situation above because the final messages
are saved by adding kmsg_dump() to reboot, halt, poweroff and
emergency_restart path.
Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
---
include/linux/kmsg_dump.h | 4 ++++
kernel/printk.c | 4 ++++
kernel/sys.c | 6 ++++++
3 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
index 24b4414..2a0d7d6 100644
--- a/include/linux/kmsg_dump.h
+++ b/include/linux/kmsg_dump.h
@@ -18,6 +18,10 @@ enum kmsg_dump_reason {
KMSG_DUMP_OOPS,
KMSG_DUMP_PANIC,
KMSG_DUMP_KEXEC,
+ KMSG_DUMP_RESTART,
+ KMSG_DUMP_HALT,
+ KMSG_DUMP_POWEROFF,
+ KMSG_DUMP_EMERG,
};
/**
diff --git a/kernel/printk.c b/kernel/printk.c
index b2ebaee..c5648b4 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1516,6 +1516,10 @@ static const char * const kmsg_reasons[] = {
[KMSG_DUMP_OOPS] = "oops",
[KMSG_DUMP_PANIC] = "panic",
[KMSG_DUMP_KEXEC] = "kexec",
+ [KMSG_DUMP_RESTART] = "restart",
+ [KMSG_DUMP_HALT] = "halt",
+ [KMSG_DUMP_POWEROFF] = "poweroff",
+ [KMSG_DUMP_EMERG] = "emergency_restart",
};
static const char *kmsg_to_str(enum kmsg_dump_reason reason)
diff --git a/kernel/sys.c b/kernel/sys.c
index 7f5a0cd..3eab886 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -43,6 +43,8 @@
#include <linux/kprobes.h>
#include <linux/user_namespace.h>
+#include <linux/kmsg_dump.h>
+
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/unistd.h>
@@ -285,6 +287,7 @@ out_unlock:
*/
void emergency_restart(void)
{
+ kmsg_dump(KMSG_DUMP_EMERG);
machine_emergency_restart();
}
EXPORT_SYMBOL_GPL(emergency_restart);
@@ -312,6 +315,7 @@ void kernel_restart(char *cmd)
printk(KERN_EMERG "Restarting system.\n");
else
printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd);
+ kmsg_dump(KMSG_DUMP_RESTART);
machine_restart(cmd);
}
EXPORT_SYMBOL_GPL(kernel_restart);
@@ -333,6 +337,7 @@ void kernel_halt(void)
kernel_shutdown_prepare(SYSTEM_HALT);
sysdev_shutdown();
printk(KERN_EMERG "System halted.\n");
+ kmsg_dump(KMSG_DUMP_HALT);
machine_halt();
}
@@ -351,6 +356,7 @@ void kernel_power_off(void)
disable_nonboot_cpus();
sysdev_shutdown();
printk(KERN_EMERG "Power down.\n");
+ kmsg_dump(KMSG_DUMP_POWEROFF);
machine_power_off();
}
EXPORT_SYMBOL_GPL(kernel_power_off);
--
1.7.2.2
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 2/2] kmsg_dump: adding to reboot, halt, poweroff and emergency_restart path
2010-11-17 15:03 ` [PATCH 2/2] " Seiji Aguchi
@ 2010-11-18 8:17 ` Artem Bityutskiy
2010-11-23 8:58 ` KOSAKI Motohiro
1 sibling, 0 replies; 8+ messages in thread
From: Artem Bityutskiy @ 2010-11-18 8:17 UTC (permalink / raw)
To: Seiji Aguchi
Cc: Andrew Morton, ext KOSAKI Motohiro, simon.kagstrom@netinsight.net,
David.Woodhouse@intel.com, anders.grafstrom@netinsight.net,
jason.wessel@windriver.com, jslaby@suse.cz, jmorris@namei.org,
eparis@redhat.com, hch@lst.de, linux-kernel@vger.kernel.org,
kyungmin.park@samsung.com, marco.stornelli@gmail.com,
namhyung@gmail.com, Aaron Durbin, randy.dunlap@oracle.com,
dle-develop@lists.sourceforge.net, Satoru Moriya
On Wed, 2010-11-17 at 10:03 -0500, Seiji Aguchi wrote:
> We need to know the reason why system rebooted in support service.
> However, we can't inform our customers of the reason because
> final messages are lost on current Linux kernel.
>
> This patch improves the situation above because the final messages
> are saved by adding kmsg_dump() to reboot, halt, poweroff and
> emergency_restart path.
>
> Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
Looks ok,
Reviewed-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] kmsg_dump: adding to reboot, halt, poweroff and emergency_restart path
2010-11-17 15:03 ` [PATCH 2/2] " Seiji Aguchi
2010-11-18 8:17 ` Artem Bityutskiy
@ 2010-11-23 8:58 ` KOSAKI Motohiro
1 sibling, 0 replies; 8+ messages in thread
From: KOSAKI Motohiro @ 2010-11-23 8:58 UTC (permalink / raw)
To: Seiji Aguchi
Cc: kosaki.motohiro, Andrew Morton, Artem.Bityutskiy@nokia.com,
simon.kagstrom@netinsight.net, David.Woodhouse@intel.com,
anders.grafstrom@netinsight.net, jason.wessel@windriver.com,
jslaby@suse.cz, jmorris@namei.org, eparis@redhat.com, hch@lst.de,
linux-kernel@vger.kernel.org, kyungmin.park@samsung.com,
marco.stornelli@gmail.com, namhyung@gmail.com, Aaron Durbin,
randy.dunlap@oracle.com, dle-develop@lists.sourceforge.net,
Satoru Moriya
> We need to know the reason why system rebooted in support service.
> However, we can't inform our customers of the reason because
> final messages are lost on current Linux kernel.
>
> This patch improves the situation above because the final messages
> are saved by adding kmsg_dump() to reboot, halt, poweroff and
> emergency_restart path.
>
> Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
This patch doesn't have any notification consumer. It's too bad.
As far as I know, some poeple are now discussing to make generic
firmware access interface. perhaps your one can be integrate it.
Please see and join following discussion.
From: "Luck, Tony" <tony.luck@intel.com>
Subject: [RFC] persistent store
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] kmsg_dump: adding to reboot, halt, poweroff and emergency_restart path
2010-11-17 15:00 ` [PATCH 1/2] " Seiji Aguchi
2010-11-17 15:03 ` [PATCH 2/2] " Seiji Aguchi
@ 2010-11-18 8:16 ` Artem Bityutskiy
2010-11-23 8:54 ` KOSAKI Motohiro
2 siblings, 0 replies; 8+ messages in thread
From: Artem Bityutskiy @ 2010-11-18 8:16 UTC (permalink / raw)
To: Seiji Aguchi
Cc: Andrew Morton, ext KOSAKI Motohiro, simon.kagstrom@netinsight.net,
David.Woodhouse@intel.com, anders.grafstrom@netinsight.net,
jason.wessel@windriver.com, jslaby@suse.cz, jmorris@namei.org,
eparis@redhat.com, hch@lst.de, linux-kernel@vger.kernel.org,
kyungmin.park@samsung.com, marco.stornelli@gmail.com,
namhyung@gmail.com, Aaron Durbin, randy.dunlap@oracle.com,
dle-develop@lists.sourceforge.net, Satoru Moriya
On Wed, 2010-11-17 at 10:00 -0500, Seiji Aguchi wrote:
> This patch alters mtdoops and ramoops to perform their actions only for KMSG_DUMP_PANIC,
> KMSG_DUMP_OOPS and KMSG_DUMP_KEXEC because they would like to log crashes only.
>
> Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
Looks OK,
Reviewed-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] kmsg_dump: adding to reboot, halt, poweroff and emergency_restart path
2010-11-17 15:00 ` [PATCH 1/2] " Seiji Aguchi
2010-11-17 15:03 ` [PATCH 2/2] " Seiji Aguchi
2010-11-18 8:16 ` [PATCH 1/2] " Artem Bityutskiy
@ 2010-11-23 8:54 ` KOSAKI Motohiro
2 siblings, 0 replies; 8+ messages in thread
From: KOSAKI Motohiro @ 2010-11-23 8:54 UTC (permalink / raw)
To: Seiji Aguchi
Cc: kosaki.motohiro, Andrew Morton, Artem.Bityutskiy@nokia.com,
simon.kagstrom@netinsight.net, David.Woodhouse@intel.com,
anders.grafstrom@netinsight.net, jason.wessel@windriver.com,
jslaby@suse.cz, jmorris@namei.org, eparis@redhat.com, hch@lst.de,
linux-kernel@vger.kernel.org, kyungmin.park@samsung.com,
marco.stornelli@gmail.com, namhyung@gmail.com, Aaron Durbin,
randy.dunlap@oracle.com, dle-develop@lists.sourceforge.net,
Satoru Moriya
> This patch alters mtdoops and ramoops to perform their actions only for KMSG_DUMP_PANIC,
> KMSG_DUMP_OOPS and KMSG_DUMP_KEXEC because they would like to log crashes only.
>
> Signed-off-by: Seiji Aguchi <seiji.aguchi@hds.com>
>
> ---
> drivers/char/ramoops.c | 5 +++++
> drivers/mtd/mtdoops.c | 5 +++++
> 2 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c index 73dcb0e..8998b29 100644
> --- a/drivers/char/ramoops.c
> +++ b/drivers/char/ramoops.c
> @@ -69,6 +69,11 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
> char *buf;
> struct timeval timestamp;
>
> + if (reason != KMSG_DUMP_OOPS &&
> + reason != KMSG_DUMP_PANIC &&
> + reason != KMSG_DUMP_KEXEC)
> + return;
> +
> /* Only dump oopses if dump_oops is set */
> if (reason == KMSG_DUMP_OOPS && !dump_oops)
> return;
> diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c index 1ee72f3..c948150 100644
> --- a/drivers/mtd/mtdoops.c
> +++ b/drivers/mtd/mtdoops.c
> @@ -307,6 +307,11 @@ static void mtdoops_do_dump(struct kmsg_dumper *dumper,
> unsigned long l1_cpy, l2_cpy;
> char *dst;
>
> + if (reason != KMSG_DUMP_OOPS &&
> + reason != KMSG_DUMP_PANIC &&
> + reason != KMSG_DUMP_KEXEC)
> + return;
> +
> /* Only dump oopses if dump_oops is set */
> if (reason == KMSG_DUMP_OOPS && !dump_oops)
> return;
Looks good.
Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
^ permalink raw reply [flat|nested] 8+ messages in thread