EDAC patch queue for 37
Subsystems (2)
cover EDAC patch queue for 37
From: Borislav Petkov <[email protected]>
Hi,
since the merge window will be there soon, I think its time to unload some of the stuff in the pending EDAC queue. Besides cleanups and fixes, this series adds an error injection module which is selected by default when MCE decoding is enabled. The idea behind it is to be able to inject MCE signatures over /sysfs so that the MCE decoding code and amd64_edac can be tested on production kernels without the need to recompile them.
So have a look, rant while there's time and so on...
Thanks,
Boris.
PATCH 1/8 EDAC: Fix error return
From: Borislav Petkov <[email protected]>
We should return a negative value when we cannot get the toplevel edac sysfs class.
--- drivers/edac/edac_mc_sysfs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/edac/edac_mc_sysfs.c +1 -1
@@ -1011,7 +1011,7 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci)*/ int edac_sysfs_setup_mc_kset (void ) { -int err =0 ; +int err = -EINVAL ;struct sysdev_class *edac_class;debugf1 ("%s()\n" , __func__);
Signature · 1 line
1.7.1
PATCH 2/8 EDAC, MCE: Add HW_ERR prefix
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
.. so that the user knows what she's looking at there in dmesg. Also, fix a minor cosmetic output inconsistency.
--- drivers/edac/edac_mce_amd.c | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-)
drivers/edac/edac_mce_amd.c +17 -17
@@ -133,7 +133,7 @@ static void amd_decode_dc_mce(u64 mc0_status)u32 ec = mc0_status &0xffff ;u32 xec = (mc0_status >>16 ) &0xf ; -pr_emerg ("Data Cache Error" ); +pr_emerg (HW_ERR "Data Cache Error: " );if (xec ==1 &&TLB_ERROR (ec))pr_cont (": %s TLB multimatch.\n" ,LL_MSG (ec));
@@ -168,7 +168,7 @@ static void amd_decode_dc_mce(u64 mc0_status)return ; wrong_dc_mce: -pr_warning ("Corrupted DC MCE info?\n" ); +pr_emerg (HW_ERR "Corrupted DC MCE info?\n" ); }static void amd_decode_ic_mce (u64 mc1_status)
@@ -176,7 +176,7 @@ static void amd_decode_ic_mce(u64 mc1_status)u32 ec = mc1_status &0xffff ;u32 xec = (mc1_status >>16 ) &0xf ; -pr_emerg ("Instruction Cache Error" ); +pr_emerg (HW_ERR "Instruction Cache Error" );if (xec ==1 &&TLB_ERROR (ec))pr_cont (": %s TLB multimatch.\n" ,LL_MSG (ec));
@@ -225,7 +225,7 @@ static void amd_decode_ic_mce(u64 mc1_status)return ; wrong_ic_mce: -pr_warning ("Corrupted IC MCE info?\n" ); +pr_emerg (HW_ERR "Corrupted IC MCE info?\n" ); }static void amd_decode_bu_mce (u64 mc2_status)
@@ -233,7 +233,7 @@ static void amd_decode_bu_mce(u64 mc2_status)u32 ec = mc2_status &0xffff ;u32 xec = (mc2_status >>16 ) &0xf ; -pr_emerg ("Bus Unit Error" ); +pr_emerg (HW_ERR "Bus Unit Error" );if (xec ==0x1 )pr_cont (" in the write data buffers.\n" );
@@ -267,7 +267,7 @@ static void amd_decode_bu_mce(u64 mc2_status)return ; wrong_bu_mce: -pr_warning ("Corrupted BU MCE info?\n" ); +pr_emerg (HW_ERR "Corrupted BU MCE info?\n" ); }static void amd_decode_ls_mce (u64 mc3_status)
@@ -275,7 +275,7 @@ static void amd_decode_ls_mce(u64 mc3_status)u32 ec = mc3_status &0xffff ;u32 xec = (mc3_status >>16 ) &0xf ; -pr_emerg ("Load Store Error" ); +pr_emerg (HW_ERR "Load Store Error" );if (xec ==0x0 ) {u8 rrrr = (ec >>4 ) &0xf ;
@@ -288,7 +288,7 @@ static void amd_decode_ls_mce(u64 mc3_status)return ; wrong_ls_mce: -pr_warning ("Corrupted LS MCE info?\n" ); +pr_emerg (HW_ERR "Corrupted LS MCE info?\n" ); }void amd_decode_nb_mce (int node_id,struct err_regs *regs,int handle_errors)
@@ -304,7 +304,7 @@ void amd_decode_nb_mce(int node_id, struct err_regs *regs, int handle_errors)if (TLB_ERROR (ec) && !report_gart_errors)return ; -pr_emerg ("Northbridge Error, node %d" , node_id); +pr_emerg (HW_ERR "Northbridge Error, node %d" , node_id);/* * F10h, revD can disable ErrCpu[3:0] so check that first and also the
@@ -323,7 +323,7 @@ void amd_decode_nb_mce(int node_id, struct err_regs *regs, int handle_errors)pr_cont ("\n" ); } -pr_emerg ("%s.\n" ,EXT_ERR_MSG (regs->nbsl)); +pr_emerg (HW_ERR "%s.\n" ,EXT_ERR_MSG (regs->nbsl));if (BUS_ERROR (ec) && nb_bus_decoder)nb_bus_decoder (node_id, regs);
@@ -334,26 +334,26 @@ static void amd_decode_fr_mce(u64 mc5_status) {/* we have only one error signature so match all fields at once. */ if ((mc5_status &0xffff ) ==0x0f0f ) -pr_emerg (" FR Error: CPU Watchdog timer expire.\n" ); +pr_emerg (HW_ERR " FR Error: CPU Watchdog timer expire.\n" );else -pr_warning ("Corrupted FR MCE info?\n" ); +pr_emerg (HW_ERR "Corrupted FR MCE info?\n" ); }static inline void amd_decode_err_code (unsigned int ec) {if (TLB_ERROR (ec)) { -pr_emerg ("Transaction: %s, Cache Level %s\n" , +pr_emerg (HW_ERR "Transaction: %s, Cache Level: %s\n" ,TT_MSG (ec),LL_MSG (ec)); }else if (MEM_ERROR (ec)) { -pr_emerg ("Transaction: %s, Type: %s, Cache Level: %s" , +pr_emerg (HW_ERR "Transaction: %s, Type: %s, Cache Level: %s" ,RRRR_MSG (ec),TT_MSG (ec),LL_MSG (ec)); }else if (BUS_ERROR (ec)) { -pr_emerg ("Transaction type: %s(%s), %s, Cache Level: %s, " +pr_emerg (HW_ERR "Transaction type: %s(%s), %s, Cache Level: %s, " "Participating Processor: %s\n" ,RRRR_MSG (ec),II_MSG (ec),TO_MSG (ec),LL_MSG (ec),PP_MSG (ec)); }else -pr_warning ("Huh? Unknown MCE error 0x%x\n" , ec); +pr_emerg (HW_ERR "Huh? Unknown MCE error 0x%x\n" , ec); } static int amd_decode_mce(struct notifier_block *nb, unsigned long val,
@@ -363,7 +363,7 @@ static int amd_decode_mce(struct notifier_block *nb, unsigned long val,struct err_regs regs;int node, ecc; -pr_emerg ("MC%d_STATUS: " , m->bank); +pr_emerg (HW_ERR "MC%d_STATUS: " , m->bank); pr_cont("%sorrected error, other errors lost: %s, " "CPU context corrupt: %s",
Signature · 1 line
1.7.1
PATCH 3/8 EDAC, MCE: Remove unused function parameter
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Remove remains from previous functionality.
--- drivers/edac/amd64_edac_dbg.c | 2 +- drivers/edac/edac_mce_amd.c | 7 ++----- drivers/edac/edac_mce_amd.h | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-)
drivers/edac/amd64_edac_dbg.c +1 -1
@@ -24,7 +24,7 @@ static ssize_t amd64_nbea_store(struct mem_ctl_info *mci, const char *data,/* Process the Mapping request */ /* TODO: Add race prevention */ -amd_decode_nb_mce (pvt->mc_node_id, &pvt->ctl_error_info,1 ); +amd_decode_nb_mce (pvt->mc_node_id, &pvt->ctl_error_info);return count; }
drivers/edac/edac_mce_amd.c +2 -5
@@ -291,13 +291,10 @@ wrong_ls_mce:pr_emerg (HW_ERR "Corrupted LS MCE info?\n" ); } -void amd_decode_nb_mce (int node_id,struct err_regs *regs,int handle_errors) +void amd_decode_nb_mce (int node_id,struct err_regs *regs) {u32 ec =ERROR_CODE (regs->nbsl); -if (!handle_errors) -return ; -/* * GART TLB error reporting is disabled by default. Bail out early. */
@@ -402,7 +399,7 @@ static int amd_decode_mce(struct notifier_block *nb, unsigned long val, regs.nbeah = (u32)(m->addr >>32 ); node =amd_get_nb_id (m->extcpu); -amd_decode_nb_mce (node, ®s,1 ); +amd_decode_nb_mce (node, ®s);break ;case 5 :
drivers/edac/edac_mce_amd.h +1 -1
@@ -64,6 +64,6 @@ struct err_regs {void amd_report_gart_errors (bool );void amd_register_ecc_decoder (void (*f)(int ,struct err_regs *));void amd_unregister_ecc_decoder (void (*f)(int ,struct err_regs *)); -void amd_decode_nb_mce (int ,struct err_regs *,int ); +void amd_decode_nb_mce (int ,struct err_regs *);#endif /* _EDAC_MCE_AMD_H */
Signature · 1 line
1.7.1
PATCH 4/8 EDAC, MCE: Sanitize error codes
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Clean up error codes names, shorten to mnemonics, add RRRR boundary checking.
--- drivers/edac/edac_mce_amd.c | 63 +++++++++++-------------------------------- drivers/edac/edac_mce_amd.h | 5 ++- 2 files changed, 19 insertions(+), 49 deletions(-)
drivers/edac/edac_mce_amd.c +16 -47
@@ -30,62 +30,31 @@ EXPORT_SYMBOL_GPL(amd_unregister_ecc_decoder);* string representation for the different MCA reported error types, see F3x48 * or MSR0000_0411. */ -const char *tt_msgs[] = {/* transaction type */ -"instruction" , -"data" , -"generic" , -"reserved" -}; + +/* transaction type */ +const char *tt_msgs[] = {"INSN" ,"DATA" ,"GEN" ,"RESV" };EXPORT_SYMBOL_GPL (tt_msgs); -const char *ll_msgs[] = {/* cache level */ -"L0" , -"L1" , -"L2" , -"L3/generic" -}; +/* cache level */ +const char *ll_msgs[] = {"RESV" ,"L1" ,"L2" ,"L3/GEN" };EXPORT_SYMBOL_GPL (ll_msgs); +/* memory transaction type */ const char *rrrr_msgs[] = { -"generic" , -"generic read" , -"generic write" , -"data read" , -"data write" , -"inst fetch" , -"prefetch" , -"evict" , -"snoop" , -"reserved RRRR= 9" , -"reserved RRRR= 10" , -"reserved RRRR= 11" , -"reserved RRRR= 12" , -"reserved RRRR= 13" , -"reserved RRRR= 14" , -"reserved RRRR= 15" +"GEN" ,"RD" ,"WR" ,"DRD" ,"DWR" ,"IRD" ,"PRF" ,"EV" ,"SNP" };EXPORT_SYMBOL_GPL (rrrr_msgs); -const char *pp_msgs[] = {/* participating processor */ -"local node originated (SRC)" , -"local node responded to request (RES)" , -"local node observed as 3rd party (OBS)" , -"generic" -}; +/* participating processor */ +const char *pp_msgs[] = {"SRC" ,"RES" ,"OBS" ,"GEN" };EXPORT_SYMBOL_GPL (pp_msgs); -const char *to_msgs[] = { -"no timeout" , -"timed out" -}; +/* request timeout */ +const char *to_msgs[] = {"no timeout" ,"timed out" };EXPORT_SYMBOL_GPL (to_msgs); -const char *ii_msgs[] = {/* memory or i/o */ -"mem access" , -"reserved" , -"i/o access" , -"generic" -}; +/* memory or i/o */ +const char *ii_msgs[] = {"MEM" ,"RESV" ,"IO" ,"GEN" };EXPORT_SYMBOL_GPL (ii_msgs);/*
@@ -336,16 +305,16 @@ static void amd_decode_fr_mce(u64 mc5_status)pr_emerg (HW_ERR "Corrupted FR MCE info?\n" ); } -static inline void amd_decode_err_code (unsigned int ec) +static inline void amd_decode_err_code (u16 ec) {if (TLB_ERROR (ec)) {pr_emerg (HW_ERR "Transaction: %s, Cache Level: %s\n" ,TT_MSG (ec),LL_MSG (ec)); }else if (MEM_ERROR (ec)) { -pr_emerg (HW_ERR "Transaction: %s, Type: %s, Cache Level: %s" , +pr_emerg (HW_ERR "Transaction: %s, Type: %s, Cache Level: %s\n" ,RRRR_MSG (ec),TT_MSG (ec),LL_MSG (ec)); }else if (BUS_ERROR (ec)) { -pr_emerg (HW_ERR "Transaction type: %s(%s), %s, Cache Level: %s, " +pr_emerg (HW_ERR "Transaction: %s (%s), %s, Cache Level: %s, " "Participating Processor: %s\n" ,RRRR_MSG (ec),II_MSG (ec),TO_MSG (ec),LL_MSG (ec),PP_MSG (ec));
drivers/edac/edac_mce_amd.h +3 -2
@@ -20,13 +20,14 @@#define II_MSG (x) ii_msgs[II(x)]#define LL (x) (((x) >> 0) & 0x3)#define LL_MSG (x) ll_msgs[LL(x)] -#define RRRR (x) (((x) >> 4) & 0xf) -#define RRRR_MSG (x) rrrr_msgs[RRRR(x)]#define TO (x) (((x) >> 8) & 0x1)#define TO_MSG (x) to_msgs[TO(x)]#define PP (x) (((x) >> 9) & 0x3)#define PP_MSG (x) pp_msgs[PP(x)] +#define RRRR (x) (((x) >> 4) & 0xf) +#define RRRR_MSG (x) ((RRRR(x) < 9) ? rrrr_msgs[RRRR(x)] : "Wrong R4!") +#define K8_NBSH 0x4C#define K8_NBSH_VALID_BIT BIT(31)
Signature · 1 line
1.7.1
PATCH 5/8 EDAC, MCE: Pass complete MCE info to decoders
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
... instead of the MCi_STATUS info only for improved handling of certain types of errors later.
--- drivers/edac/amd64_edac.c | 13 +++++-- drivers/edac/amd64_edac_dbg.c | 10 ++++- drivers/edac/edac_mce_amd.c | 74 +++++++++++++++++++--------------------- drivers/edac/edac_mce_amd.h | 6 ++-- 4 files changed, 56 insertions(+), 47 deletions(-)
drivers/edac/amd64_edac.c +10 -3
@@ -2073,11 +2073,18 @@ static inline void __amd64_decode_bus_error(struct mem_ctl_info *mci,amd64_handle_ue (mci, info); } -void amd64_decode_bus_error (int node_id,struct err_regs *regs) +void amd64_decode_bus_error (int node_id,struct mce *m,u32 nbcfg) {struct mem_ctl_info *mci = mci_lookup[node_id]; +struct err_regs regs; -__amd64_decode_bus_error (mci, regs); + regs.nbsl = (u32 ) m->status; + regs.nbsh = (u32)(m->status >>32 ); + regs.nbeal = (u32 ) m->addr; + regs.nbeah = (u32)(m->addr >>32 ); + regs.nbcfg = nbcfg; + +__amd64_decode_bus_error (mci, ®s);/* * Check the UE bit of the NB status high register, if set generate some
@@ -2086,7 +2093,7 @@ void amd64_decode_bus_error(int node_id, struct err_regs *regs)* * FIXME: this should go somewhere else, if at all. */ -if (regs->nbsh &K8_NBSH_UC_ERR && !report_gart_errors) +if (regs.nbsh &K8_NBSH_UC_ERR && !report_gart_errors)edac_mc_handle_ue_no_info (mci,"UE bit is set" ); }
drivers/edac/amd64_edac_dbg.c +8 -2
@@ -10,11 +10,14 @@ static ssize_t amd64_nbea_store(struct mem_ctl_info *mci, const char *data, size_t count) {struct amd64_pvt *pvt = mci->pvt_info; -unsigned long long value; +u64 value;int ret =0 ; +struct mce m; ret =strict_strtoull (data,16 , &value);if (ret != -EINVAL ) { +struct err_regs *regs = &pvt->ctl_error_info; +debugf0 ("received NBEA= 0x%llx\n" , value);/* place the value into the virtual error packet */
@@ -22,9 +25,12 @@ static ssize_t amd64_nbea_store(struct mem_ctl_info *mci, const char *data, value >>=32 ; pvt->ctl_error_info.nbeah = (u32 ) value; + m.addr = value; + m.status = regs->nbsl | ((u64 )regs->nbsh <<32 ); +/* Process the Mapping request */ /* TODO: Add race prevention */ -amd_decode_nb_mce (pvt->mc_node_id, &pvt->ctl_error_info); +amd_decode_nb_mce (pvt->mc_node_id, &m, regs->nbcfg);return count; }
drivers/edac/edac_mce_amd.c +35 -39
185 lines not on this page · raw message
drivers/edac/edac_mce_amd.h +3 -3
@@ -63,8 +63,8 @@ struct err_regs {void amd_report_gart_errors (bool ); -void amd_register_ecc_decoder (void (*f)(int ,struct err_regs *)); -void amd_unregister_ecc_decoder (void (*f)(int ,struct err_regs *)); -void amd_decode_nb_mce (int ,struct err_regs *); +void amd_register_ecc_decoder (void (*f)(int ,struct mce *,u32 )); +void amd_unregister_ecc_decoder (void (*f)(int ,struct mce *,u32 )); +void amd_decode_nb_mce (int ,struct mce *,u32 );#endif /* _EDAC_MCE_AMD_H */
Signature · 1 line
1.7.1
PATCH 6/8 EDAC: Export edac sysfs class to users.
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Move toplevel sysfs class to the stub and make it available to non-modularized code too. Add proper refcounting of its users and move the registration functionality into the reference counting routines.
--- drivers/edac/edac_device_sysfs.c | 16 +++++--- drivers/edac/edac_mc_sysfs.c | 9 +++- drivers/edac/edac_module.c | 79 +------------------------------------- drivers/edac/edac_module.h | 1 - drivers/edac/edac_pci_sysfs.c | 10 +++- drivers/edac/edac_stub.c | 51 ++++++++++++++++++++++-- include/linux/edac.h | 4 ++ 7 files changed, 75 insertions(+), 95 deletions(-)
drivers/edac/edac_device_sysfs.c +10 -6
@@ -13,6 +13,7 @@#include <linux/ctype.h> #include <linux/module.h> #include <linux/slab.h> +#include <linux/edac.h> #include "edac_core.h" #include "edac_module.h"
@@ -235,7 +236,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev)debugf1 ("%s()\n" , __func__);/* get the /sys/devices/system/edac reference */ - edac_class =edac_get_edac_class (); + edac_class =edac_get_sysfs_class ();if (edac_class ==NULL ) {debugf1 ("%s() no edac_class error\n" , __func__); err = -ENODEV ;
@@ -255,7 +256,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev)if (!try_module_get (edac_dev->owner)) { err = -ENODEV ; - goto err_out; + goto err_mod_get; }/* register */
@@ -282,6 +283,9 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) err_kobj_reg:module_put (edac_dev->owner); +err_mod_get: +edac_put_sysfs_class (); + err_out:return err; }
@@ -290,12 +294,11 @@ err_out:* edac_device_unregister_sysfs_main_kobj: * the '..../edac/<name>' kobject */ -void edac_device_unregister_sysfs_main_kobj ( -struct edac_device_ctl_info *edac_dev) +void edac_device_unregister_sysfs_main_kobj (struct edac_device_ctl_info *dev) {debugf0 ("%s()\n" , __func__);debugf4 ("%s() name of kobject is: %s\n" , - __func__,kobject_name (&edac_dev->kobj)); + __func__,kobject_name (&dev->kobj));/* * Unregister the edac device's kobject and
@@ -304,7 +307,8 @@ void edac_device_unregister_sysfs_main_kobj(* a) module_put() this module * b) 'kfree' the memory */ -kobject_put (&edac_dev->kobj); +kobject_put (&dev->kobj); +edac_put_sysfs_class (); }/* edac_dev -> instance information */
drivers/edac/edac_mc_sysfs.c +6 -3
@@ -11,6 +11,7 @@#include <linux/ctype.h> #include <linux/slab.h> +#include <linux/edac.h> #include <linux/bug.h> #include "edac_core.h"
@@ -1017,7 +1018,7 @@ int edac_sysfs_setup_mc_kset(void)debugf1 ("%s()\n" , __func__);/* get the /sys/devices/system/edac class reference */ - edac_class =edac_get_edac_class (); + edac_class =edac_get_sysfs_class ();if (edac_class ==NULL ) {debugf1 ("%s() no edac_class error=%d\n" , __func__, err); goto fail_out;
@@ -1028,15 +1029,16 @@ int edac_sysfs_setup_mc_kset(void)if (!mc_kset) { err = -ENOMEM ;debugf1 ("%s() Failed to register '.../edac/mc'\n" , __func__); - goto fail_out; + goto fail_kset; }debugf1 ("%s() Registered '.../edac/mc' kobject\n" , __func__);return 0 ; +fail_kset: +edac_put_sysfs_class (); -/* error unwind stack */ fail_out:return err; }
@@ -1049,5 +1051,6 @@ fail_out:void edac_sysfs_teardown_mc_kset (void ) {kset_unregister (mc_kset); +edac_put_sysfs_class (); }
drivers/edac/edac_module.c +1 -78
113 lines not on this page · raw message
drivers/edac/edac_module.h +0 -1
@@ -42,7 +42,6 @@ extern void edac_device_unregister_sysfs_main_kobj( struct edac_device_ctl_info *edac_dev);extern int edac_device_create_sysfs (struct edac_device_ctl_info *edac_dev);extern void edac_device_remove_sysfs (struct edac_device_ctl_info *edac_dev); -extern struct sysdev_class *edac_get_edac_class (void );/* edac core workqueue: single CPU mode */ extern struct workqueue_struct *edac_workqueue;
drivers/edac/edac_pci_sysfs.c +7 -3
@@ -7,7 +7,7 @@* */ #include <linux/module.h> -#include <linux/sysdev.h> +#include <linux/edac.h> #include <linux/slab.h> #include <linux/ctype.h>
@@ -354,7 +354,7 @@ static int edac_pci_main_kobj_setup(void)/* First time, so create the main kobject and its * controls and atributes */ - edac_class =edac_get_edac_class (); + edac_class =edac_get_sysfs_class ();if (edac_class ==NULL ) {debugf1 ("%s() no edac_class\n" , __func__); err = -ENODEV ;
@@ -368,7 +368,7 @@ static int edac_pci_main_kobj_setup(void)if (!try_module_get (THIS_MODULE )) {debugf1 ("%s() try_module_get() failed\n" , __func__); err = -ENODEV ; - goto decrement_count_fail; + goto mod_get_fail; } edac_pci_top_main_kobj =kzalloc (sizeof (struct kobject ),GFP_KERNEL );
@@ -403,6 +403,9 @@ kobject_init_and_add_fail: kzalloc_fail:module_put (THIS_MODULE ); +mod_get_fail: +edac_put_sysfs_class (); + decrement_count_fail:/* if are on this error exit, nothing to tear down */ atomic_dec (&edac_pci_sysfs_refcount);
@@ -429,6 +432,7 @@ static void edac_pci_main_kobj_teardown(void) __func__);kobject_put (edac_pci_top_main_kobj); } +edac_put_sysfs_class (); }/*
drivers/edac/edac_stub.c +47 -4
66 lines not on this page · raw message
include/linux/edac.h +4 -0
@@ -13,6 +13,7 @@#define _LINUX_EDAC_H_#include <asm/atomic.h> +#include <linux/sysdev.h> #define EDAC_OPSTATE_INVAL -1#define EDAC_OPSTATE_POLL 0
@@ -22,9 +23,12 @@extern int edac_op_state;extern int edac_err_assert;extern atomic_t edac_handlers; +extern struct sysdev_class edac_class;extern int edac_handler_set (void );extern void edac_atomic_assert_error (void ); +extern struct sysdev_class *edac_get_sysfs_class (void ); +extern void edac_put_sysfs_class (void );static inline void opstate_init (void ) {
Signature · 1 line
1.7.1
PATCH 7/8 EDAC, MCE: Rework MCE injection
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Add sysfs injection facilities for testing the MCE decoding code. Remove large parts of amd64_edac_dbg.c, as a result, which did only NB MCE injection anyway and the new injection code supports that functionality already.
More importantly, make the injection module build as module by default so that MCE decoding code in production kernels like those in RHEL and SLES can be tested without the need for rebuilding them with EDAC_DEBUG enabled.
--- drivers/edac/Kconfig | 14 +++- drivers/edac/Makefile | 2 + drivers/edac/amd64_edac.h | 2 +- drivers/edac/amd64_edac_dbg.c | 213 +++-------------------------------------- drivers/edac/edac_mce_amd.c | 4 +- drivers/edac/edac_mce_amd.h | 4 +- drivers/edac/mce_amd_inj.c | 171 +++++++++++++++++++++++++++++++++ 7 files changed, 203 insertions(+), 207 deletions(-) create mode 100644 drivers/edac/mce_amd_inj.c
drivers/edac/Kconfig +12 -2
@@ -39,7 +39,7 @@ config EDAC_DEBUG there're four debug levels (x=0,1,2,3 from low to high). Usually you should select 'N'. - config EDAC_DECODE_MCE +config EDAC_DECODE_MCE tristate "Decode MCEs in human-readable form (only on AMD for now)" depends on CPU_SUP_AMD && X86_MCE default y
@@ -51,6 +51,16 @@ config EDAC_DEBUG which occur really early upon boot, before the module infrastructure has been initialized. +config EDAC_MCE_INJ + tristate "Simple MCE injection interface over /sysfs" + depends on EDAC_DECODE_MCE + default m + help + This is a simple interface to inject MCEs over /sysfs and test + the MCE decoding code in EDAC. + + This is currently AMD-only. + config EDAC_MM_EDAC tristate "Main Memory EDAC (Error Detection And Correction) reporting" help
@@ -72,7 +82,7 @@ config EDAC_AMD64 Families of Memory Controllers (K8, F10h and F11h) config EDAC_AMD64_ERROR_INJECTION - bool "Sysfs Error Injection facilities" + bool "Sysfs HW Error injection facilities" depends on EDAC_AMD64 help Recent Opterons (Family 10h and later) provide for Memory Error
drivers/edac/Makefile +2 -0
@@ -17,6 +17,8 @@ ifdef CONFIG_PCI edac_core-objs += edac_pci.o edac_pci_sysfs.o endif +obj-$(CONFIG_EDAC_MCE_INJ) += mce_amd_inj.o + obj-$(CONFIG_EDAC_DECODE_MCE) += edac_mce_amd.o obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o
drivers/edac/amd64_edac.h +1 -1
@@ -486,7 +486,7 @@ extern const char *ext_msgs[32];extern const char *htlink_msgs[8 ];#ifdef CONFIG_EDAC_DEBUG -#define NUM_DBG_ATTRS 9 +#define NUM_DBG_ATTRS 5#else #define NUM_DBG_ATTRS 0#endif
drivers/edac/amd64_edac_dbg.c +12 -201
244 lines not on this page · raw message
drivers/edac/edac_mce_amd.c +2 -2
@@ -324,8 +324,7 @@ static inline void amd_decode_err_code(u16 ec)pr_emerg (HW_ERR "Huh? Unknown MCE error 0x%x\n" , ec); } -static int amd_decode_mce (struct notifier_block *nb,unsigned long val, -void *data) +int amd_decode_mce (struct notifier_block *nb,unsigned long val,void *data) {struct mce *m = (struct mce *)data;int node, ecc;
@@ -379,6 +378,7 @@ static int amd_decode_mce(struct notifier_block *nb, unsigned long val,return NOTIFY_STOP ; } +EXPORT_SYMBOL_GPL (amd_decode_mce);static struct notifier_block amd_mce_dec_nb = { .notifier_call = amd_decode_mce,
drivers/edac/edac_mce_amd.h +3 -1
@@ -1,6 +1,8 @@#ifndef _EDAC_MCE_AMD_H#define _EDAC_MCE_AMD_H +#include <linux/notifier.h> +#include <asm/mce.h> #define ERROR_CODE (x) ((x) & 0xffff)
@@ -61,10 +63,10 @@ struct err_regs { u32 nbeal; }; -void amd_report_gart_errors (bool );void amd_register_ecc_decoder (void (*f)(int ,struct mce *,u32 ));void amd_unregister_ecc_decoder (void (*f)(int ,struct mce *,u32 ));void amd_decode_nb_mce (int ,struct mce *,u32 ); +int amd_decode_mce (struct notifier_block *nb,unsigned long val,void *data);#endif /* _EDAC_MCE_AMD_H */
drivers/edac/mce_amd_inj.c new file +171 -0
171 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 8/8 EDAC, MCE: Rename files
In reply to Borislav PetkovFrom: Borislav Petkov <[email protected]>
Drop "edac_" string from the filenames since they're prefixed with edac/ in their pathname anyway.
--- drivers/edac/Makefile | 1 + drivers/edac/amd64_edac.h | 2 +- drivers/edac/edac_mce_amd.c | 414 ------------------------------------------- drivers/edac/edac_mce_amd.h | 72 -------- drivers/edac/mce_amd.c | 414 +++++++++++++++++++++++++++++++++++++++++++ drivers/edac/mce_amd.h | 72 ++++++++ drivers/edac/mce_amd_inj.c | 2 +- 7 files changed, 489 insertions(+), 488 deletions(-) delete mode 100644 drivers/edac/edac_mce_amd.c delete mode 100644 drivers/edac/edac_mce_amd.h create mode 100644 drivers/edac/mce_amd.c create mode 100644 drivers/edac/mce_amd.h
drivers/edac/Makefile +1 -0
@@ -19,6 +19,7 @@ endif obj-$(CONFIG_EDAC_MCE_INJ) += mce_amd_inj.o +edac_mce_amd-objs := mce_amd.o obj-$(CONFIG_EDAC_DECODE_MCE) += edac_mce_amd.o obj-$(CONFIG_EDAC_AMD76X) += amd76x_edac.o
drivers/edac/amd64_edac.h +1 -1
@@ -72,7 +72,7 @@#include <linux/edac.h> #include <asm/msr.h> #include "edac_core.h" -#include "edac_mce_amd.h" +#include "mce_amd.h" #define amd64_printk(level, fmt, arg...) \ edac_printk(level, "amd64", fmt, ##arg)
drivers/edac/edac_mce_amd.c deleted +0 -414
414 lines not on this page · raw message
drivers/edac/edac_mce_amd.h deleted +0 -72
72 lines not on this page · raw message
drivers/edac/mce_amd.c new file +414 -0
414 lines not on this page · raw message
drivers/edac/mce_amd.h new file +72 -0
72 lines not on this page · raw message
drivers/edac/mce_amd_inj.c +1 -1
@@ -15,7 +15,7 @@#include <linux/edac.h> #include <asm/mce.h> -#include "edac_mce_amd.h" +#include "mce_amd.h" struct edac_mce_attr {struct attribute attr;
Signature · 1 line
1.7.1