From: Jin Dongming <jin.dongming@np.css.fujitsu.com>
To: "H.Peter Anvin" <hpa@zytor.com>
Cc: LKLM <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@linux.intel.com>,
Huang Ying <ying.huang@intel.com>,
Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>,
Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Subject: x86, mce: cleanup initcall of debugfs for mce
Date: Tue, 04 Aug 2009 14:33:26 +0900 [thread overview]
Message-ID: <4A77C826.1050304@np.css.fujitsu.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: 0001-x86-mce-cleanup-initcall-of-debugfs-for-mce.patch --]
[-- Type: text/plain, Size: 4129 bytes --]
From 2aab4e427e42cd85b3f1b58774e1d08c54ae9882 Mon Sep 17 00:00:00 2001
From: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Date: Tue, 4 Aug 2009 12:11:22 +0900
Subject: [PATCH] x86,mce: cleanup initcall of debugfs for mce.
This patch is made based on the v5 patches of Huangying for mce.
Before using this patch, please apply the patches of Huangying.
The patches' URLs of Huangying are listed as following:
1.x86: MCE: Support specifying context for software mce injection
URL: http://marc.info/?l=linux-kernel&m=124900459100786&w=2
2.x86: MCE: Support specifying raise mode for software MCE injection
URL: http://marc.info/?l=linux-kernel&m=124900459100795&w=2
3.x86: MCE: Move debugfs mce dir creating to mce.c
URL: http://marc.info/?l=linux-kernel&m=124900459100790&w=2
4.x86: MCE: Fake panic support for MCE testing
URL: http://marc.info/?l=linux-kernel&m=124900453800724&w=2
There are two initcall functions in the patches of Huangying,
mce_debugfs_init() used in mce.c and severities_debugfs_init() used
in mce-severity.c. I think an initcall function is enough for mce
debug. So we make them into one initcall function.
This version is based x86-tip/mce.
Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Reviewed-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
---
arch/x86/kernel/cpu/mcheck/mce-internal.h | 2 +-
arch/x86/kernel/cpu/mcheck/mce-severity.c | 13 +++----------
arch/x86/kernel/cpu/mcheck/mce.c | 24 +++++++++++-------------
3 files changed, 15 insertions(+), 24 deletions(-)
diff --git a/arch/x86/kernel/cpu/mcheck/mce-internal.h b/arch/x86/kernel/cpu/mcheck/mce-internal.h
index 32996f9..ca8421d 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-internal.h
+++ b/arch/x86/kernel/cpu/mcheck/mce-internal.h
@@ -22,7 +22,7 @@ struct mce_bank {
};
int mce_severity(struct mce *a, int tolerant, char **msg);
-struct dentry *mce_get_debugfs_dir(void);
+int __init severities_debugfs_init(struct dentry *dmce);
extern int mce_ser;
diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c
index bc35a07..49e57ab 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-severity.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c
@@ -193,22 +193,15 @@ static const struct file_operations severities_coverage_fops = {
.write = severities_coverage_write,
};
-static int __init severities_debugfs_init(void)
+int __init severities_debugfs_init(struct dentry *dmce)
{
- struct dentry *dmce = NULL, *fseverities_coverage = NULL;
+ struct dentry *fseverities_coverage = NULL;
- dmce = mce_get_debugfs_dir();
- if (dmce == NULL)
- goto err_out;
fseverities_coverage = debugfs_create_file("severities-coverage",
0444, dmce, NULL,
&severities_coverage_fops);
if (fseverities_coverage == NULL)
- goto err_out;
+ return -ENOMEM;
return 0;
-
-err_out:
- return -ENOMEM;
}
-late_initcall(severities_debugfs_init);
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 54bd1b2..37b6526 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2018,16 +2018,6 @@ static int __init mcheck_disable(char *str)
__setup("nomce", mcheck_disable);
#ifdef CONFIG_DEBUG_FS
-struct dentry *mce_get_debugfs_dir(void)
-{
- static struct dentry *dmce;
-
- if (!dmce)
- dmce = debugfs_create_dir("mce", NULL);
-
- return dmce;
-}
-
static void mce_reset(void)
{
cpu_missing = 0;
@@ -2055,17 +2045,25 @@ DEFINE_SIMPLE_ATTRIBUTE(fake_panic_fops, fake_panic_get,
static int __init mce_debugfs_init(void)
{
- struct dentry *dmce, *ffake_panic;
+ struct dentry *dmce = NULL, *ffake_panic = NULL;
- dmce = mce_get_debugfs_dir();
+ dmce = debugfs_create_dir("mce", NULL);
if (!dmce)
return -ENOMEM;
ffake_panic = debugfs_create_file("fake_panic", 0444, dmce, NULL,
&fake_panic_fops);
if (!ffake_panic)
- return -ENOMEM;
+ goto err_out;
+
+ if (severities_debugfs_init(dmce))
+ goto err_out;
return 0;
+
+err_out:
+ debugfs_remove_recursive(dmce);
+
+ return -ENOMEM;
}
late_initcall(mce_debugfs_init);
#endif
--
1.6.2.2
reply other threads:[~2009-08-04 5:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4A77C826.1050304@np.css.fujitsu.com \
--to=jin.dongming@np.css.fujitsu.com \
--cc=ak@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kaneshige.kenji@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=seto.hidetoshi@jp.fujitsu.com \
--cc=ying.huang@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