From: dragos.tatulea@intel.com
To: cbouatmailru@gmail.com, linux-kernel@vger.kernel.org
Cc: adrian.hunter@intel.com, octavian.purdila@intel.com
Subject: [PATCH 2/8] pstore: add debugfs support for causing dumps and panics
Date: Mon, 15 Oct 2012 14:38:51 +0300 [thread overview]
Message-ID: <1350301137-16912-3-git-send-email-dragos.tatulea@intel.com> (raw)
In-Reply-To: <1350301137-16912-1-git-send-email-dragos.tatulea@intel.com>
From: Adrian Hunter <adrian.hunter@intel.com>
There are 2 debugfs files:
pstore/dump writing a kmsg dump reason code
will cause a dump to persistent
storage
pstore/panic writing anything will cause
a panic
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
--
fs/pstore/platform.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index c4ea778..9d65723 100644
-- a/fs/pstore/platform.c
++ b/fs/pstore/platform.c
@@ -33,6 +33,7 @@
#include <linux/hardirq.h>
#include <linux/jiffies.h>
#include <linux/workqueue.h>
#include <linux/debugfs.h>
#include "internal.h"
@@ -206,6 +207,54 @@ static int pstore_write_compat(enum pstore_type_id type,
return psi->write_buf(type, reason, id, part, psinfo->buf, size, psi);
}
#ifdef CONFIG_DEBUG_FS
static DEFINE_SPINLOCK(dbg_lock);
static int dbg_dump(void *data, u64 val)
{
unsigned long flags;
switch (val) {
case KMSG_DUMP_PANIC:
case KMSG_DUMP_OOPS:
case KMSG_DUMP_EMERG:
case KMSG_DUMP_RESTART:
case KMSG_DUMP_HALT:
case KMSG_DUMP_POWEROFF:
spin_lock_irqsave(&dbg_lock, flags);
kmsg_dump(val);
spin_unlock_irqrestore(&dbg_lock, flags);
return 0;
}
return -EINVAL;
}
DEFINE_SIMPLE_ATTRIBUTE(dbg_dump_fops, NULL, dbg_dump, "%llu\n");
static int dbg_panic(void *data, u64 val)
{
panic(KERN_EMERG "pstore debugging panic!\n");
return 0;
}
DEFINE_SIMPLE_ATTRIBUTE(dbg_panic_fops, NULL, dbg_panic, "%llu\n");
static void pstore_debugfs_init(void)
{
struct dentry *root;
root = debugfs_create_dir("pstore", NULL);
debugfs_create_file("dump", S_IWUSR, root, NULL, &dbg_dump_fops);
debugfs_create_file("panic", S_IWUSR, root, NULL, &dbg_panic_fops);
}
#else
static inline void pstore_debugfs_init(void)
{
}
#endif
/*
* platform specific persistent storage driver registers with
* us here. If pstore is already mounted, call the platform
@@ -257,6 +306,8 @@ int pstore_register(struct pstore_info *psi)
add_timer(&pstore_timer);
}
pstore_debugfs_init();
return 0;
}
EXPORT_SYMBOL_GPL(pstore_register);
-
1.7.9.5
next prev parent reply other threads:[~2012-10-15 11:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-15 11:38 [PATCH 0/8] pstore: add interface for dumpers and add task list dumper dragos.tatulea
2012-10-15 11:38 ` [PATCH 1/8] pstore: add flags dragos.tatulea
2012-10-15 11:38 ` dragos.tatulea [this message]
2012-10-15 11:38 ` [PATCH 3/8] pstore: add support for external writers dragos.tatulea
2012-10-15 11:38 ` [PATCH 4/8] pstore: allow storing different type id's in ram backend dragos.tatulea
2012-10-15 11:38 ` [PATCH 5/8] pstore: add task list dumper dragos.tatulea
2012-10-15 11:38 ` [PATCH 6/8] pstore: do not run timer while pstore is not mounted dragos.tatulea
2012-10-15 11:38 ` [PATCH 7/8] pstore: make sure pstore_write exists on flush error dragos.tatulea
2012-10-15 11:38 ` [PATCH 8/8] pstore: max out console log level during sysfs dump switch dragos.tatulea
2012-10-15 16:39 ` [PATCH 0/8] pstore: add interface for dumpers and add task list dumper Anton Vorontsov
2012-10-15 16:41 ` Anton Vorontsov
2012-10-15 11:40 dragos.tatulea
2012-10-15 11:40 ` [PATCH 2/8] pstore: add debugfs support for causing dumps and panics dragos.tatulea
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=1350301137-16912-3-git-send-email-dragos.tatulea@intel.com \
--to=dragos.tatulea@intel.com \
--cc=adrian.hunter@intel.com \
--cc=cbouatmailru@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=octavian.purdila@intel.com \
/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
all inboxes | Powered by JetHome®