EDAC, sb_edac: Classify memory mirroring modes.
Borislav Petkov
maintainerPATCH 1/1 EDAC, sb_edac: Classify memory mirroring modes.
Quoted 60 lines · Qiuxu Zhuo
Basically there are full memory mirroring and address range partial memory mirroring(supported by Haswell EX and Broadwell EX) modes.
a) In full memory mirroring, the memory behind each memory controller is mirrored, the memory is split into two identical mirrors (primary and secondary), half of the memory is reserved for redundancy.
b) In address range partial memory mirroring, the memory size(range) of primary and secondary behind each memory controller can be user defined by the TAD0 register. The rest memory ranges defined by TAD1/TAD2/... in that memory controller are non-mirrored.
For more detail mirroring, see the following link written by Tony Luck:
https://01.org/lkp/blogs/tonyluck/2016/address-range-partial-memory-mirroring-linuxCurrently the
sb_edacdriver only supports address decoding in full
memory mirroring and non-mirroring modes. In address range partial memory
mirroring mode, it may fail to decode address that falls in non-mirroring
area (the following was one of this kind failed logs).
---
mce: Uncorrected hardware memory error in user-access at566d53a400
Memory failure:0x566d53a: Killing einj_mem_uc:4647 due to hardware memory corruption
Memory failure:0x566d53a: recovery action for dirty LRU page: Recovered
mce: [Hardware Error]: Machine check events logged
EDAC sbridge MC1: HANDLING MCE MEMORY ERROR
EDAC sbridge MC1: CPU 48: Machine Check Event: 0 Bank 7:ec00000000010090
EDAC sbridge MC1: TSC4b914aa5a99dab
EDAC sbridge MC1: ADDR566d53a400
EDAC sbridge MC1: MISC1443a0c86
EDAC sbridge MC1: PROCESSOR 0:406f1 TIME 1499712764 SOCKET 2 APIC 80
EDAC MC1: 0 UE Can't discover the memory rank for ch addr0x7fb54e900on any memory ( page:0x0 offset:0x0 grain:32)
mce: [Hardware Error]: Machine check events logged
---This patch classifies memory mirroring modes, and makes the address decoding in address range partial memory mode correct.
Signed-off-by Qiuxu Zhuo <[email protected]>--- drivers/edac/sb_edac.c | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-)drivers/edac/sb_edac.c +6
-0@@ -300,6 +300,12 @@ enum domain { SOCK, }; +enum mirroring_mode { +NON_MIRRORING , +ADDR_RANGE_MIRRORING , +FULL_MIRRORING , +}; +struct sbridge_pvt ;struct sbridge_info {enum type type;
drivers/edac/sb_edac.c struct sbridge_pvt { · line 388
Quoted 7 lines
drivers/edac/sb_edac.c +2
-1@@ -377,8 +383,9 @@ struct sbridge_pvt {struct sbridge_channel channel[NUM_CHANNELS ];/* Memory type detection */ -bool is_mirrored, is_lockstep, is_close_pg; +bool is_cur_addr_mirrored, is_lockstep, is_close_pg;bool is_chan_hash; +enum mirroring_mode mirroring_md;
Call that variable simply "mirror_mode"
Quoted 17 lines
drivers/edac/sb_edac.c +0
-4/* Memory description */ u64 tolm, tohm;@@ -1648,10 +1655,6 @@ static int get_dimm_config(struct mem_ctl_info *mci)enum edac_type mode;u32 reg; -if (pvt->info.type ==HASWELL || pvt->info.type ==BROADWELL ) { -pci_read_config_dword (pvt->pci_ha,HASWELL_HASYSDEFEATURE2 , ®); - pvt->is_chan_hash =GET_BITFIELD (reg,21 ,21 ); - } pvt->sbridge_dev->node_id = pvt->info.get_node_id (pvt); edac_dbg(0, "mc#%d: Node ID: %d, source ID: %d\n", pvt->sbridge_dev->mc,@@ -1663,21 +1666,32 @@ static int get_dimm_config(struct mem_ctl_info *mci)*/ if (pvt->info.type ==KNIGHTS_LANDING ) { mode =EDAC_S4ECD4ED ;
drivers/edac/sb_edac.c static int get_dimm_config(struct mem_ctl_info *mci) · line 1677
Quoted 10 lines
drivers/edac/sb_edac.c +4
-1- pvt->is_mirrored = false; + pvt->mirroring_md =NON_MIRRORING ; + pvt->is_cur_addr_mirrored = false;if (knl_get_dimm_capacity (pvt, knl_mc_sizes) !=0 )return -1 ;pci_read_config_dword (pvt->pci_ta,KNL_MCMTR , &pvt->info.mcmtr); }else { +if (pvt->info.type ==HASWELL || pvt->info.type ==BROADWELL ) { +pci_read_config_dword (pvt->pci_ha,HASWELL_HASYSDEFEATURE2 , ®);
Error handling.
Quoted 7 lines
drivers/edac/sb_edac.c +7
-0+ pvt->is_chan_hash =GET_BITFIELD (reg,21 ,21 ); +if (GET_BITFIELD (reg,28 ,28 )) { + pvt->mirroring_md =ADDR_RANGE_MIRRORING ; +edac_dbg (0 ,"Address range partial memory mirroring is enabled\n" ); + goto next; + } + }