From: Jin Dongming <jin.dongming@np.css.fujitsu.com>
To: Huang Ying <ying.huang@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>, "H.Peter Anvin" <hpa@zytor.com>,
Andi Kleen <andi@firstfloor.org>,
Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
LKLM <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/3] [x86, next] Add mce_ser interface in /sys/kernel/debug/mce/ for test
Date: Fri, 29 Oct 2010 13:42:09 +0900 [thread overview]
Message-ID: <4CCA50A1.8050609@np.css.fujitsu.com> (raw)
If we want to test the part of mce handler for SRAO and SRAR, we need to
have a test machine whose CPU supports MCG_SER_P. If we don't have such
machine, we can not test the part of mce handler for SRAO and SRAR.
With this interface we can test the part of mce handler for SRAO and SRAR
by setting mce_ser 1 on the machine which does not support MCG_SER_P.
Usage:
if val == 1 or val == 0
Set val to mce_ser.
else
Ser the original value to mce_ser.
Note:
Please don't use mce_ser interface except mce test.
Because when the real mce exception happened, the unsuitable set
with this interface maybe change the real process of mce handler and
lead to a different result.
This patch is tested on Intel64 on next-tree.
Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
---
arch/x86/kernel/cpu/mcheck/mce.c | 39 ++++++++++++++++++++++++++++++++++++++
1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 8edb04d..ed10e76 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -2158,6 +2158,8 @@ static int __init mcheck_disable(char *str)
__setup("nomce", mcheck_disable);
#ifdef CONFIG_DEBUG_FS
+static int org_mce_ser;
+
struct dentry *mce_get_debugfs_dir(void)
{
static struct dentry *dmce;
@@ -2193,9 +2195,39 @@ static int fake_panic_set(void *data, u64 val)
DEFINE_SIMPLE_ATTRIBUTE(fake_panic_fops, fake_panic_get,
fake_panic_set, "%llu\n");
+/*
+ * mce_ser_get() can only get the current value of mce_ser.
+ * The value may be not the original value of mce_ser on this machine.
+ * So please use mce_ser_set() to confirm the original value of mce_ser.
+ */
+static int mce_ser_get(void *data, u64 *val)
+{
+ *val = mce_ser;
+ return 0;
+}
+
+/*
+ * Set the value of mce_ser with mce_ser_set().
+ * Parameter "u64 val" of mce_ser_set() :
+ * val == 1 or 0 : mce_ser = val;
+ * others : set mce_ser with the original value of mce_ser.
+ */
+static int mce_ser_set(void *data, u64 val)
+{
+ if (val == 1 || val == 0)
+ mce_ser = val;
+ else
+ mce_ser = org_mce_ser;
+ return 0;
+}
+
+DEFINE_SIMPLE_ATTRIBUTE(mce_ser_fops, mce_ser_get,
+ mce_ser_set, "%llu\n");
+
static int __init mcheck_debugfs_init(void)
{
struct dentry *dmce, *ffake_panic;
+ struct dentry *fmce_ser = NULL;
dmce = mce_get_debugfs_dir();
if (!dmce)
@@ -2205,6 +2237,13 @@ static int __init mcheck_debugfs_init(void)
if (!ffake_panic)
return -ENOMEM;
+ org_mce_ser = mce_ser;
+
+ fmce_ser = debugfs_create_file("mce_ser", 0644, dmce, NULL,
+ &mce_ser_fops);
+ if (!fmce_ser)
+ return -ENOMEM;
+
return 0;
}
late_initcall(mcheck_debugfs_init);
next reply other threads:[~2010-10-29 4:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-29 4:42 Jin Dongming [this message]
2010-10-29 8:06 ` [PATCH 2/3] [x86, next] Add mce_ser interface in /sys/kernel/debug/mce/ for test Andi Kleen
2010-11-01 0:04 ` Jin Dongming
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=4CCA50A1.8050609@np.css.fujitsu.com \
--to=jin.dongming@np.css.fujitsu.com \
--cc=andi@firstfloor.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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;
as well as URLs for NNTP newsgroup(s).