* [RFC PATCH 1/4] RAS: Add a menuconfig option with descriptive text
2015-07-22 8:40 [RFC PATCH 0/4] x86/ras: Move AMD MCE injection module to arch/x86/ Borislav Petkov
@ 2015-07-22 8:40 ` Borislav Petkov
2015-07-22 8:40 ` [RFC PATCH 2/4] x86/mce: Rename rcu_dereference_check_mce() to mce_log_get_idx_check() Borislav Petkov
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Borislav Petkov @ 2015-07-22 8:40 UTC (permalink / raw)
To: X86-ML; +Cc: Tony Luck, Aravind Gopalakrishnan, LKML, Linux EDAC
From: Borislav Petkov <bp@suse.de>
Text taken a previous patch from "Gong Chen" <gong.chen@linux.intel.com>.
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Gong Chen <gong.chen@linux.intel.com>
---
drivers/ras/Kconfig | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/drivers/ras/Kconfig b/drivers/ras/Kconfig
index f9da613052c2..d6ddf1267a7f 100644
--- a/drivers/ras/Kconfig
+++ b/drivers/ras/Kconfig
@@ -1,2 +1,32 @@
-config RAS
- bool
+menuconfig RAS
+ bool "Reliability, Availability, Serviceability features"
+ help
+ Reliability, availability, and serviceability (RAS) is a computer
+ hardware engineering term. Computers designed with higher levels
+ of RAS have a multitude of features that protect data integrity
+ and help them stay available for long periods of time without
+ failure.
+
+ Reliability can be defined as the probability that the system will
+ produce correct outputs up to some given time. Reliability is
+ enhanced by features that help to avoid, detect and repair hardware
+ faults.
+
+ Availability is the probability a system is operational at a given
+ time, i.e. the amount of time a device is actually operating as the
+ percentage of total time it should be operating.
+
+ Serviceability or maintainability is the simplicity and speed with
+ which a system can be repaired or maintained; if the time to repair
+ a failed system increases, then availability will decrease.
+
+ Note that Reliability and Availability are distinct concepts:
+ Reliability is a measure of the ability of a system to function
+ correctly, including avoiding data corruption, whereas Availability
+ measures how often it is available for use, even though it may not
+ be functioning correctly. For example, a server may run forever and
+ so have ideal availability, but may be unreliable, with frequent
+ data corruption.
+
+if RAS
+endif
--
2.5.0.rc2.28.g6003e7f
^ permalink raw reply related [flat|nested] 6+ messages in thread* [RFC PATCH 2/4] x86/mce: Rename rcu_dereference_check_mce() to mce_log_get_idx_check()
2015-07-22 8:40 [RFC PATCH 0/4] x86/ras: Move AMD MCE injection module to arch/x86/ Borislav Petkov
2015-07-22 8:40 ` [RFC PATCH 1/4] RAS: Add a menuconfig option with descriptive text Borislav Petkov
@ 2015-07-22 8:40 ` Borislav Petkov
2015-07-23 15:58 ` Paul E. McKenney
2015-07-22 8:40 ` [RFC PATCH 3/4] x86/mce: Add a wrapper around mce_log() for injection Borislav Petkov
2015-07-22 8:40 ` [RFC PATCH 4/4] x86/ras: Move AMD MCE injector to arch/x86/ras/ Borislav Petkov
3 siblings, 1 reply; 6+ messages in thread
From: Borislav Petkov @ 2015-07-22 8:40 UTC (permalink / raw)
To: X86-ML; +Cc: Tony Luck, Aravind Gopalakrishnan, LKML, Linux EDAC
From: Borislav Petkov <bp@suse.de>
The "rcu_" prefix misleads for it being a proper RCU interface which
is not. It basically checks whether we're preemptible or holding the
chrdev_read mutex.
Rename it accordingly.
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
---
arch/x86/kernel/cpu/mcheck/mce.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 5a19adb86b8f..36c065e6fa94 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -52,11 +52,11 @@
static DEFINE_MUTEX(mce_chrdev_read_mutex);
-#define rcu_dereference_check_mce(p) \
+#define mce_log_get_idx_check(p) \
({ \
rcu_lockdep_assert(rcu_read_lock_sched_held() || \
lockdep_is_held(&mce_chrdev_read_mutex), \
- "suspicious rcu_dereference_check_mce() usage"); \
+ "suspicious mce_log_get_idx_check() usage"); \
smp_load_acquire(&(p)); \
})
@@ -165,7 +165,7 @@ void mce_log(struct mce *mce)
mce->finished = 0;
wmb();
for (;;) {
- entry = rcu_dereference_check_mce(mcelog.next);
+ entry = mce_log_get_idx_check(mcelog.next);
for (;;) {
/*
@@ -1812,7 +1812,7 @@ static ssize_t mce_chrdev_read(struct file *filp, char __user *ubuf,
goto out;
}
- next = rcu_dereference_check_mce(mcelog.next);
+ next = mce_log_get_idx_check(mcelog.next);
/* Only supports full reads right now */
err = -EINVAL;
--
2.5.0.rc2.28.g6003e7f
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [RFC PATCH 2/4] x86/mce: Rename rcu_dereference_check_mce() to mce_log_get_idx_check()
2015-07-22 8:40 ` [RFC PATCH 2/4] x86/mce: Rename rcu_dereference_check_mce() to mce_log_get_idx_check() Borislav Petkov
@ 2015-07-23 15:58 ` Paul E. McKenney
0 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2015-07-23 15:58 UTC (permalink / raw)
To: Borislav Petkov
Cc: X86-ML, Tony Luck, Aravind Gopalakrishnan, LKML, Linux EDAC
On Wed, Jul 22, 2015 at 10:40:26AM +0200, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
>
> The "rcu_" prefix misleads for it being a proper RCU interface which
> is not. It basically checks whether we're preemptible or holding the
> chrdev_read mutex.
>
> Rename it accordingly.
>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
> arch/x86/kernel/cpu/mcheck/mce.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
> index 5a19adb86b8f..36c065e6fa94 100644
> --- a/arch/x86/kernel/cpu/mcheck/mce.c
> +++ b/arch/x86/kernel/cpu/mcheck/mce.c
> @@ -52,11 +52,11 @@
>
> static DEFINE_MUTEX(mce_chrdev_read_mutex);
>
> -#define rcu_dereference_check_mce(p) \
> +#define mce_log_get_idx_check(p) \
> ({ \
> rcu_lockdep_assert(rcu_read_lock_sched_held() || \
> lockdep_is_held(&mce_chrdev_read_mutex), \
> - "suspicious rcu_dereference_check_mce() usage"); \
> + "suspicious mce_log_get_idx_check() usage"); \
> smp_load_acquire(&(p)); \
> })
>
> @@ -165,7 +165,7 @@ void mce_log(struct mce *mce)
> mce->finished = 0;
> wmb();
> for (;;) {
> - entry = rcu_dereference_check_mce(mcelog.next);
> + entry = mce_log_get_idx_check(mcelog.next);
> for (;;) {
>
> /*
> @@ -1812,7 +1812,7 @@ static ssize_t mce_chrdev_read(struct file *filp, char __user *ubuf,
> goto out;
> }
>
> - next = rcu_dereference_check_mce(mcelog.next);
> + next = mce_log_get_idx_check(mcelog.next);
>
> /* Only supports full reads right now */
> err = -EINVAL;
> --
> 2.5.0.rc2.28.g6003e7f
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [RFC PATCH 3/4] x86/mce: Add a wrapper around mce_log() for injection
2015-07-22 8:40 [RFC PATCH 0/4] x86/ras: Move AMD MCE injection module to arch/x86/ Borislav Petkov
2015-07-22 8:40 ` [RFC PATCH 1/4] RAS: Add a menuconfig option with descriptive text Borislav Petkov
2015-07-22 8:40 ` [RFC PATCH 2/4] x86/mce: Rename rcu_dereference_check_mce() to mce_log_get_idx_check() Borislav Petkov
@ 2015-07-22 8:40 ` Borislav Petkov
2015-07-22 8:40 ` [RFC PATCH 4/4] x86/ras: Move AMD MCE injector to arch/x86/ras/ Borislav Petkov
3 siblings, 0 replies; 6+ messages in thread
From: Borislav Petkov @ 2015-07-22 8:40 UTC (permalink / raw)
To: X86-ML; +Cc: Tony Luck, Aravind Gopalakrishnan, LKML, Linux EDAC
From: Borislav Petkov <bp@suse.de>
Will be used by an injector module in a following patch.
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/kernel/cpu/mcheck/mce-internal.h | 2 ++
arch/x86/kernel/cpu/mcheck/mce.c | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/arch/x86/kernel/cpu/mcheck/mce-internal.h b/arch/x86/kernel/cpu/mcheck/mce-internal.h
index 70d43f541bed..f5e507e6ae6f 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-internal.h
+++ b/arch/x86/kernel/cpu/mcheck/mce-internal.h
@@ -79,3 +79,5 @@ static inline int apei_clear_mce(u64 record_id)
return -EINVAL;
}
#endif
+
+void mce_inject_log(struct mce *m);
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 36c065e6fa94..64d1ae916428 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -199,6 +199,13 @@ void mce_log(struct mce *mce)
set_bit(0, &mce_need_notify);
}
+void mce_inject_log(struct mce *m)
+{
+ mutex_lock(&mce_chrdev_read_mutex);
+ mce_log(m);
+ mutex_unlock(&mce_chrdev_read_mutex);
+}
+
static struct notifier_block mce_srao_nb;
void mce_register_decode_chain(struct notifier_block *nb)
--
2.5.0.rc2.28.g6003e7f
^ permalink raw reply related [flat|nested] 6+ messages in thread* [RFC PATCH 4/4] x86/ras: Move AMD MCE injector to arch/x86/ras/
2015-07-22 8:40 [RFC PATCH 0/4] x86/ras: Move AMD MCE injection module to arch/x86/ Borislav Petkov
` (2 preceding siblings ...)
2015-07-22 8:40 ` [RFC PATCH 3/4] x86/mce: Add a wrapper around mce_log() for injection Borislav Petkov
@ 2015-07-22 8:40 ` Borislav Petkov
3 siblings, 0 replies; 6+ messages in thread
From: Borislav Petkov @ 2015-07-22 8:40 UTC (permalink / raw)
To: X86-ML; +Cc: Tony Luck, Aravind Gopalakrishnan, LKML, Linux EDAC
From: Borislav Petkov <bp@suse.de>
This is an x86-specific module and would benefit from being closer to
the arch code. Move it there. Update copyright while at it.
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/Makefile | 2 ++
arch/x86/ras/Kconfig | 11 +++++++++++
arch/x86/ras/Makefile | 2 ++
{drivers/edac => arch/x86/ras}/mce_amd_inj.c | 6 +++---
drivers/edac/Kconfig | 10 ----------
drivers/edac/Makefile | 1 -
drivers/ras/Kconfig | 3 +++
7 files changed, 21 insertions(+), 14 deletions(-)
create mode 100644 arch/x86/ras/Kconfig
create mode 100644 arch/x86/ras/Makefile
rename {drivers/edac => arch/x86/ras}/mce_amd_inj.c (98%)
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 118e6debc483..0f38418719ab 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -212,6 +212,8 @@ drivers-$(CONFIG_PM) += arch/x86/power/
drivers-$(CONFIG_FB) += arch/x86/video/
+drivers-$(CONFIG_RAS) += arch/x86/ras/
+
####
# boot loader support. Several targets are kept for legacy purposes
diff --git a/arch/x86/ras/Kconfig b/arch/x86/ras/Kconfig
new file mode 100644
index 000000000000..10fea5fc821e
--- /dev/null
+++ b/arch/x86/ras/Kconfig
@@ -0,0 +1,11 @@
+config AMD_MCE_INJ
+ tristate "Simple MCE injection interface for AMD processors"
+ depends on RAS && EDAC_DECODE_MCE && DEBUG_FS
+ default n
+ help
+ This is a simple debugfs interface to inject MCEs and test different
+ aspects of the MCE handling code.
+
+ WARNING: Do not even assume this interface is staying stable!
+
+
diff --git a/arch/x86/ras/Makefile b/arch/x86/ras/Makefile
new file mode 100644
index 000000000000..dd2c98b84037
--- /dev/null
+++ b/arch/x86/ras/Makefile
@@ -0,0 +1,2 @@
+obj-$(CONFIG_AMD_MCE_INJ) += mce_amd_inj.o
+
diff --git a/drivers/edac/mce_amd_inj.c b/arch/x86/ras/mce_amd_inj.c
similarity index 98%
rename from drivers/edac/mce_amd_inj.c
rename to arch/x86/ras/mce_amd_inj.c
index 4c73e4d03d46..17e35b5bf779 100644
--- a/drivers/edac/mce_amd_inj.c
+++ b/arch/x86/ras/mce_amd_inj.c
@@ -6,7 +6,7 @@
* This file may be distributed under the terms of the GNU General Public
* License version 2.
*
- * Copyright (c) 2010-14: Borislav Petkov <bp@alien8.de>
+ * Copyright (c) 2010-15: Borislav Petkov <bp@alien8.de>
* Advanced Micro Devices Inc.
*/
@@ -19,7 +19,7 @@
#include <linux/uaccess.h>
#include <asm/mce.h>
-#include "mce_amd.h"
+#include "../kernel/cpu/mcheck/mce-internal.h"
/*
* Collect all the MCi_XXX settings
@@ -195,7 +195,7 @@ static void do_inject(void)
i_mce.status |= MCI_STATUS_MISCV;
if (inj_type == SW_INJ) {
- amd_decode_mce(NULL, 0, &i_mce);
+ mce_inject_log(&i_mce);
return;
}
diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig
index 8677ead2a8e1..ef25000a5bc6 100644
--- a/drivers/edac/Kconfig
+++ b/drivers/edac/Kconfig
@@ -61,16 +61,6 @@ config EDAC_DECODE_MCE
which occur really early upon boot, before the module infrastructure
has been initialized.
-config EDAC_MCE_INJ
- tristate "Simple MCE injection interface"
- depends on EDAC_DECODE_MCE && DEBUG_FS
- default n
- help
- This is a simple debugfs interface to inject MCEs and test different
- aspects of the MCE handling code.
-
- WARNING: Do not even assume this interface is staying stable!
-
config EDAC_MM_EDAC
tristate "Main Memory EDAC (Error Detection And Correction) reporting"
select RAS
diff --git a/drivers/edac/Makefile b/drivers/edac/Makefile
index 28ef2a519f65..ae3c5f3ce405 100644
--- a/drivers/edac/Makefile
+++ b/drivers/edac/Makefile
@@ -17,7 +17,6 @@ edac_core-y += edac_pci.o edac_pci_sysfs.o
endif
obj-$(CONFIG_EDAC_GHES) += ghes_edac.o
-obj-$(CONFIG_EDAC_MCE_INJ) += mce_amd_inj.o
edac_mce_amd-y := mce_amd.o
obj-$(CONFIG_EDAC_DECODE_MCE) += edac_mce_amd.o
diff --git a/drivers/ras/Kconfig b/drivers/ras/Kconfig
index d6ddf1267a7f..c8fd3106c33b 100644
--- a/drivers/ras/Kconfig
+++ b/drivers/ras/Kconfig
@@ -29,4 +29,7 @@ menuconfig RAS
data corruption.
if RAS
+
+source arch/x86/ras/Kconfig
+
endif
--
2.5.0.rc2.28.g6003e7f
^ permalink raw reply related [flat|nested] 6+ messages in thread