From: "Shargorodsky Atal (EXT-Teleca/Helsinki)" <ext-atal.shargorodsky@nokia.com>
To: "dedekind1@gmail.com" <dedekind1@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
"Koskinen Aaro \(Nokia-D/Helsinki\)" <aaro.koskinen@nokia.com>,
linux-mtd <linux-mtd@lists.infradead.org>,
Simon Kagstrom <simon.kagstrom@netinsight.net>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>, Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH v11 4/5] core: Add kernel message dumper to call on oopses and panics
Date: Mon, 26 Oct 2009 12:40:02 +0200 [thread overview]
Message-ID: <1256553602.5822.29.camel@atal-desktop> (raw)
In-Reply-To: <1256403957.29885.357.camel@localhost>
On Sat, 2009-10-24 at 19:05 +0200, Artem Bityutskiy wrote:
> On Fri, 2009-10-23 at 18:53 +0300, Shargorodsky Atal
> (EXT-Teleca/Helsinki) wrote:
> > Hi all,
> >
> > On Thu, 2009-10-22 at 08:25 +0200, ext Simon Kagstrom wrote:
> >
> > > Thanks to everyone for the reviewing and suggestions!
> > >
> >
> > I have a couple of questions:
> >
> > 1. If somebody writes a module that uses dumper for uploading the
> > oopses/panics logs via some pay-per-byte medium, since he has no way
> > to know in a module if the panic_on_oops flag is set, he'll have
> > to upload both oops and the following panic, because he does not
> > know for sure that the panic was caused by the oops. Hence he
> > pays twice for the same information, right?
>
> Looks like a valid point to me. Indeed, in this case we will first call
> 'kmsg_dump(KMSG_DUMP_OOPS)' from 'oops_exit()', and then call it from
> 'panic()'. And the dumper may dump the same information, which is not
> nice.
>
> I've looked briefly and tried to figure out how to fix this. But I
> cannot find an clean way. And I was confused by the die/oops/etc code.
> My question is, why the code does not work the following way instead?
>
> diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
> index 2d8a371..8f322c7 100644
> --- a/arch/x86/kernel/dumpstack.c
> +++ b/arch/x86/kernel/dumpstack.c
> @@ -235,13 +235,12 @@ void __kprobes oops_end(unsigned long flags, struct pt_regs *regs, int signr)
> raw_local_irq_restore(flags);
> oops_exit();
>
> - if (!signr)
> - return;
> if (in_interrupt())
> panic("Fatal exception in interrupt");
> if (panic_on_oops)
> panic("Fatal exception");
> - do_exit(signr);
> + if (signr)
> + do_exit(signr);
> }
>
> int __kprobes __die(const char *str, struct pt_regs *regs, long err)
>
> If the code worked like this, I think the problem indicated by Atal
> could be easily fixed.
>
Could as well be, but will not help us much on arch/arm. :)
> > 2. We tried to use panic notifiers mechanism to print additional
> > information that we want to see in mtdoops logs and it worked well,
> > but having the kmsg_dump(KMSG_DUMP_PANIC) before the
> > atomic_notifier_call_chain() breaks this functionality.
> > Can we the call kmsg_dump() after the notifiers had been invoked?
>
> Atal, I think you should just attach your patch, it is easier to express
> what you mean.
>
> But for me it looks like atomic_notifier_call_chain() can be moved up.
>
> Anyway, please, show your patch.
>
Inlined:
>From 12343c0918853f326b042c6e285b0e184565564f Mon Sep 17 00:00:00 2001
Message-Id:
<12343c0918853f326b042c6e285b0e184565564f.1256223642.git.ext-atal.shargorodsky@nokia.com>
From: Atal Shargorodsky <ext-atal.shargorodsky@nokia.com>
Date: Fri, 2 Oct 2009 17:34:56 +0300
Subject: [PATCH 1/3] debug: introduction of panic info buffer module
The feature of having an option for application to add some data
to be printed at panic could be useful for debugging systems where
the hardware, the kernel, the firmware for supplementary chips, etc.
are under constant development and kernel version does not identify
the exact setup in which the panic occurred.
The way to supply the string is to write it to debugfs file named
panic_info_buff. Currently the buffer length is limited to 1KB - 1B.
Signed-off-by: Atal Shargorodsky <ext-atal.shargorodsky@nokia.com>
---
drivers/misc/panic_info_buff.c | 92
++++++++++++++++++++++++++++++++++++++++
1 files changed, 92 insertions(+), 0 deletions(-)
create mode 100644 drivers/misc/panic_info_buff.c
diff --git a/drivers/misc/panic_info_buff.c
b/drivers/misc/panic_info_buff.c
new file mode 100644
index 0000000..fa6d2b1
--- /dev/null
+++ b/drivers/misc/panic_info_buff.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) Nokia Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/uaccess.h>
+#include <linux/debugfs.h>
+#include <linux/notifier.h>
+
+#define PANIC_BUFFER_MAX_LEN 1024
+static char panic_info_buff[PANIC_BUFFER_MAX_LEN];
+static struct dentry *panic_info_buff_debugfs;
+
+static int panic_info_buff_open(struct inode *inode, struct file *file)
+{
+ return 0;
+}
+
+static ssize_t panic_info_buff_write(struct file *file,
+ const char __user *buf, size_t len, loff_t *off)
+{
+ if (len >= PANIC_BUFFER_MAX_LEN)
+ return -EINVAL;
+ if (copy_from_user(panic_info_buff, buf, len))
+ return -EFAULT;
+ panic_info_buff[len] = '\0';
+ return len;
+}
+
+static struct file_operations panic_info_buff_fops = {
+ .open = panic_info_buff_open,
+ .write = panic_info_buff_write,
+ .llseek = no_llseek,
+ .owner = THIS_MODULE,
+};
+
+static int panic_info_buff_event(struct notifier_block *this,
+ unsigned long event, void *ptr)
+{
+ if (panic_info_buff[0] == '\0')
+ printk(KERN_EMERG "Panic info buffer is empty.\n");
+ else
+ printk(KERN_EMERG "Panic info buffer:\n"
+ "%s\nBuffer total length: %d characters.\n",
+ panic_info_buff,
+ strlen(panic_info_buff));
+ return NOTIFY_OK;
+}
+
+static struct notifier_block panic_info_buff_block = {
+ .notifier_call = panic_info_buff_event,
+ .priority = 1,
+};
+
+static int __devinit panic_info_buff_init(void)
+{
+ panic_info_buff_debugfs = debugfs_create_file("panic_info_buff",
+ S_IFREG | S_IWUSR | S_IWGRP,
+ NULL, NULL, &panic_info_buff_fops);
+ atomic_notifier_chain_register(&panic_notifier_list,
+ &panic_info_buff_block);
+ return 0;
+}
+module_init(panic_info_buff_init);
+
+static void __devexit panic_info_buff_exit(void)
+{
+ debugfs_remove(panic_info_buff_debugfs);
+ atomic_notifier_chain_unregister(&panic_notifier_list,
+ &panic_info_buff_block);
+
+}
+module_exit(panic_info_buff_exit);
+
+MODULE_AUTHOR("Nokia Corporation");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("panic_info_buff");
--
1.5.4.3
next prev parent reply other threads:[~2009-10-26 10:43 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-15 7:40 [PATCH v7 0/5]: mtdoops: fixes and improvements Simon Kagstrom
2009-10-15 7:47 ` [PATCH v7 1/5]: mtdoops: avoid erasing already empty areas Simon Kagstrom
2009-10-23 3:57 ` Artem Bityutskiy
2009-10-15 7:47 ` [PATCH v7 2/5]: mtdoops: Keep track of used/unused mtdoops pages in an array Simon Kagstrom
2009-10-23 4:08 ` Artem Bityutskiy
2009-10-15 7:47 ` [PATCH v7 3/5]: mtdoops: Make page (record) size configurable Simon Kagstrom
2009-10-23 4:13 ` Artem Bityutskiy
2009-10-23 6:58 ` Simon Kagstrom
2009-10-15 7:48 ` [PATCH v7 4/5]: core: Add kernel message dumper to call on oopses and panics Simon Kagstrom
2009-10-15 9:31 ` Ingo Molnar
2009-10-15 14:10 ` [PATCH v8 4/5] " Simon Kagstrom
2009-10-15 15:46 ` Ingo Molnar
2009-10-16 7:46 ` [PATCH v9 " Simon Kagstrom
2009-10-16 8:09 ` Ingo Molnar
2009-10-16 8:24 ` Artem Bityutskiy
2009-10-16 9:25 ` [PATCH v10 " Simon Kagstrom
2009-10-16 10:10 ` Ingo Molnar
2009-10-16 11:00 ` Artem Bityutskiy
2009-10-16 12:57 ` Ingo Molnar
2009-10-16 12:09 ` [PATCH v11 " Simon Kagstrom
2009-10-19 11:48 ` Artem Bityutskiy
2009-10-19 12:50 ` Ingo Molnar
2009-10-21 23:33 ` Linus Torvalds
2009-10-22 6:25 ` Simon Kagstrom
2009-10-22 6:36 ` Artem Bityutskiy
2009-10-22 6:42 ` Simon Kagstrom
2009-10-22 8:52 ` Artem Bityutskiy
2009-10-22 8:58 ` Simon Kagstrom
2009-10-23 7:22 ` Ingo Molnar
2009-10-23 15:53 ` Shargorodsky Atal (EXT-Teleca/Helsinki)
2009-10-24 17:05 ` Artem Bityutskiy
2009-10-26 10:40 ` Shargorodsky Atal (EXT-Teleca/Helsinki) [this message]
2009-10-26 7:41 ` Simon Kagstrom
2009-10-26 10:36 ` Shargorodsky Atal (EXT-Teleca/Helsinki)
2009-10-26 11:53 ` Simon Kagstrom
2009-10-26 15:13 ` Shargorodsky Atal (EXT-Teleca/Helsinki)
2009-10-26 15:37 ` Simon Kagstrom
2009-10-16 11:25 ` [PATCH v10 " Aaro Koskinen
2009-10-15 7:48 ` [PATCH v7 5/5]: mtdoops: refactor as a kmsg_dumper Simon Kagstrom
2009-10-15 14:10 ` [PATCH v8 " Simon Kagstrom
2009-10-16 7:46 ` [PATCH v9 " Simon Kagstrom
2009-10-23 4:32 ` [PATCH v7 " Artem Bityutskiy
2009-10-23 6:34 ` Simon Kagstrom
2010-01-06 14:33 ` David Woodhouse
2010-01-07 6:47 ` Simon Kagstrom
2009-10-29 12:35 ` [PATCH v12 0/4]: mtdoops: fixes and improvements Simon Kagstrom
2009-10-29 12:41 ` [PATCH v12 1/4]: mtdoops: Keep track of used/unused mtdoops pages in an array Simon Kagstrom
2009-10-29 15:24 ` Artem Bityutskiy
2009-10-29 12:41 ` [PATCH v12 2/4]: mtdoops: Add a maximum MTD partition size Simon Kagstrom
2009-10-29 15:27 ` Artem Bityutskiy
2009-11-03 6:23 ` Artem Bityutskiy
2009-10-29 12:41 ` [PATCH v12 3/4]: mtdoops: Make page (record) size configurable Simon Kagstrom
2009-11-03 6:23 ` Artem Bityutskiy
2009-11-03 7:27 ` Simon Kagstrom
2009-11-03 7:45 ` Artem Bityutskiy
2009-10-29 12:41 ` [PATCH v12 4/4]: mtdoops: refactor as a kmsg_dumper Simon Kagstrom
2009-11-03 7:29 ` Artem Bityutskiy
2009-11-03 13:19 ` [PATCH v13 " Simon Kagstrom
2009-11-10 9:55 ` Simon Kagstrom
2009-11-10 11:53 ` Artem Bityutskiy
2009-11-10 11:58 ` Simon Kagstrom
2009-11-10 16:04 ` Artem Bityutskiy
2009-11-10 16:11 ` Artem Bityutskiy
2009-11-11 9:46 ` Simon Kagstrom
2009-11-11 10:29 ` Artem Bityutskiy
2009-11-11 11:27 ` Simon Kagstrom
2009-11-11 11:34 ` Artem Bityutskiy
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=1256553602.5822.29.camel@atal-desktop \
--to=ext-atal.shargorodsky@nokia.com \
--cc=aaro.koskinen@nokia.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=mingo@elte.hu \
--cc=simon.kagstrom@netinsight.net \
--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