lkml.org 
[lkml]   [2019]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] RAS/CEC: Add debugfs switch to disable at run time
Date
Useful when running error injection tests that want to
see all of the MCi_(STATUS|ADDR|MISC) data via /dev/mcelog.

Signed-off-by: Tony Luck <tony.luck@intel.com>
---
drivers/ras/cec.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index 2d9ec378a8bc..a2ceedcd8516 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -123,6 +123,9 @@ static u64 dfs_pfn;
/* Amount of errors after which we offline */
static unsigned int count_threshold = COUNT_MASK;

+/* debugfs switch to enable/disable CEC */
+static u64 cec_enabled = 1;
+
/*
* The timer "decays" element count each timer_interval which is 24hrs by
* default.
@@ -400,6 +403,14 @@ static int count_threshold_set(void *data, u64 val)
}
DEFINE_DEBUGFS_ATTRIBUTE(count_threshold_ops, u64_get, count_threshold_set, "%lld\n");

+static int enable_set(void *data, u64 val)
+{
+ ce_arr.disabled = !val;
+ return 0;
+}
+
+DEFINE_DEBUGFS_ATTRIBUTE(enable_ops, u64_get, enable_set, "%lld\n");
+
static int array_dump(struct seq_file *m, void *v)
{
struct ce_array *ca = &ce_arr;
@@ -451,7 +462,7 @@ static const struct file_operations array_ops = {

static int __init create_debugfs_nodes(void)
{
- struct dentry *d, *pfn, *decay, *count, *array;
+ struct dentry *d, *pfn, *decay, *count, *array, *enable;

d = debugfs_create_dir("cec", ras_debugfs_dir);
if (!d) {
@@ -485,6 +496,13 @@ static int __init create_debugfs_nodes(void)
goto err;
}

+ enable = debugfs_create_file("enable", S_IRUSR | S_IWUSR, d,
+ &cec_enabled, &enable_ops);
+ if (!enable) {
+ pr_warn("Error creating enable debugfs node!\n");
+ goto err;
+ }
+

return 0;

--
2.19.1
\
 
 \ /
  Last update: 2019-04-19 00:02    [W:1.204 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site