This is the version 2 of the HERM patches
Subsystems (17)
RFC PATCH v2 2/16 events/hw_event: use __string() trace macros for events
In reply to Mauro Carvalho ChehabSome data there uses temporary alloced space. Just attributing string pointers directly won't work on such cases.
--- include/trace/events/hw_event.h | 78 +++++++++++++++++++------------------- 1 files changed, 39 insertions(+), 39 deletions(-)
include/trace/events/hw_event.h +39 -39
@@ -20,17 +20,17 @@ DECLARE_EVENT_CLASS(hw_event_class,TP_ARGS (type, instance),TP_STRUCT__entry ( - __field( const char *, type ) + __string( type, type ) __field( unsigned int, instance ) ),TP_fast_assign ( - __entry->type = type; + __assign_str(type, type); __entry->instance = instance; ),TP_printk ("Initialized %s#%d\n" , - __entry->type, +__get_str (type), __entry->instance) );
@@ -70,8 +70,8 @@ TRACE_EVENT(mc_corrected_error, __field( unsigned long, syndrome ) __field( int, row ) __field( int, channel ) - __field( const char *, label ) - __field( const char *, msg ) + __string( label, mci->csrows[row].channels[channel].label) + __string( msg, msg ) ), TP_fast_assign(
@@ -82,16 +82,16 @@ TRACE_EVENT(mc_corrected_error, __entry->syndrome = syndrome; __entry->row = row; __entry->channel = channel; - __entry->label = mci->csrows[row].channels[channel].label; - __entry->msg = msg; +__assign_str (label, mci->csrows[row].channels[channel].label); +__assign_str (msg, msg); ), TP_printk(HW_ERR "mce#%d: Corrected error %s on label \"%s\" " "(page 0x%lux, offset 0x%lux, grain %ud, " "syndrome 0x%lux, row %d, channel %d)\n", __entry->mc_index, - __entry->msg, - __entry->label, + __get_str(msg), + __get_str(label), __entry->page_frame_number, __entry->offset_in_page, __entry->grain,
@@ -116,8 +116,8 @@ TRACE_EVENT(mc_uncorrected_error, __field( unsigned long, offset_in_page ) __field( u32, grain ) __field( int, row ) - __field( const char *, msg ) - __field( const char *, label ) + __string( msg, msg ) + __string( label, label ) ), TP_fast_assign(
@@ -126,15 +126,15 @@ TRACE_EVENT(mc_uncorrected_error, __entry->offset_in_page = offset_in_page; __entry->grain = mci->csrows[row].grain; __entry->row = row; - __entry->msg = msg; - __entry->label = label; +__assign_str (msg, msg); +__assign_str (label, label); ), TP_printk(HW_ERR "mce#%d: Uncorrected error %s on label \"%s\"" "(page 0x%lux, offset 0x%lux, grain %ud, row %d)\n", __entry->mc_index, - __entry->msg, - __entry->label, + __get_str(msg), + __get_str(label), __entry->page_frame_number, __entry->offset_in_page, __entry->grain,
@@ -160,23 +160,23 @@ TRACE_EVENT(mc_corrected_error_fbd, __field( unsigned int, mc_index ) __field( int, row ) __field( int, channel ) - __field( const char *, label ) - __field( const char *, msg ) + __string( label, mci->csrows[row].channels[channel].label) + __string( msg, msg ) ), TP_fast_assign( __entry->mc_index = mci->mc_idx; __entry->row = row; __entry->channel = channel; - __entry->label = mci->csrows[row].channels[channel].label; - __entry->msg = msg; +__assign_str (label, mci->csrows[row].channels[channel].label); +__assign_str (msg, msg); ),TP_printk (HW_ERR "mce#%d: Corrected Error %s on label \"%s\" " "(row %d, channel %d)\n" , __entry->mc_index, - __entry->msg, - __entry->label, +__get_str (msg), +__get_str (label), __entry->row, __entry->channel) );
@@ -194,8 +194,8 @@ TRACE_EVENT(mc_uncorrected_error_fbd, __field( int, row ) __field( int, channela ) __field( int, channelb ) - __field( const char *, msg ) -__field (const char *, label ) + __string( msg, msg ) +__string ( label, label ) ), TP_fast_assign(
@@ -203,15 +203,15 @@ TRACE_EVENT(mc_uncorrected_error_fbd, __entry->row = row; __entry->channela = channela; __entry->channelb = channelb; - __entry->msg = msg; - __entry->label = label; +__assign_str (msg, msg); +__assign_str (label, label); ),TP_printk (HW_ERR "mce#%d: Uncorrected Error %s on label \"%s\" " "(row %d, channels: %d, %d)\n" , __entry->mc_index, - __entry->msg, - __entry->label, +__get_str (msg), +__get_str (label), __entry->row, __entry->channela, __entry->channelb)
@@ -236,8 +236,8 @@ TRACE_EVENT(mc_out_of_range, TP_ARGS(mci, type, field, invalid_val, min, max),TP_STRUCT__entry ( -__field (const char *,type ) - __field( const char *, field ) +__string (type ,type ) +__string ( field, field ) __field( unsigned int, mc_index )__field ( int, invalid_val ) __field( int, min )
@@ -245,8 +245,8 @@ TRACE_EVENT(mc_out_of_range, ), TP_fast_assign( - __entry->type = type; - __entry->field = field; + __assign_str(type, type); +__assign_str (field, field); __entry->mc_index = mci->mc_idx; __entry->invalid_val = invalid_val; __entry->min = min;
@@ -255,8 +255,8 @@ TRACE_EVENT(mc_out_of_range,TP_printk (HW_ERR "mce#%d %s: %s=%d is not between %d and %d\n" , __entry->mc_index, - __entry->type, - __entry->field, +__get_str (type), +__get_str (field), __entry->invalid_val, __entry->min, __entry->max)
@@ -274,18 +274,18 @@ TRACE_EVENT(mc_corrected_error_no_info,TP_ARGS (mci, msg),TP_STRUCT__entry ( - __field( const char *, msg ) + __string( msg, msg ) __field( unsigned int, mc_index ) ),TP_fast_assign ( - __entry->msg = msg; + __assign_str(msg, msg); __entry->mc_index = mci->mc_idx; ),TP_printk (HW_ERR "mce#%d: Corrected Error: %s\n" , __entry->mc_index, - __entry->msg) +__get_str (msg)) ); TRACE_EVENT(mc_uncorrected_error_no_info,
@@ -294,18 +294,18 @@ TRACE_EVENT(mc_uncorrected_error_no_info,TP_ARGS (mci, msg),TP_STRUCT__entry ( - __field( const char *, msg ) + __string( msg, msg ) __field( unsigned int, mc_index ) ),TP_fast_assign ( - __entry->msg = msg; + __assign_str(msg, msg); __entry->mc_index = mci->mc_idx; ),TP_printk (HW_ERR "mce#%d: Uncorrected Error: %s\n" , __entry->mc_index, - __entry->msg) +__get_str (msg)) );
Signature · 1 line
1.7.8
RFC PATCH v2 1/16 events/hw_event: Create a Hardware Events Report Mecanism (HERM)
In reply to Mauro Carvalho ChehabAdds a trace class for handle hardware events
Part of the description bellow is shamelessly copied from Tony Luck's notes about the Hardware Error BoF during LPC 2010 [1]. Tony, thanks for your notes and discussions to generate the h/w error reporting requirements.
[1] http://lwn.net/Articles/416669/
We have several subsystems & methods for reporting hardware errors:
1) EDAC ("Error Detection and Correction"). In its original form this consisted of a platform specific driver that read topology information and error counts from chipset registers and reported the results via a sysfs interface.
2) mcelog - x86 specific decoding of machine check bank registers reporting in binary form via /dev/mcelog. Recent additions make use of the APEI extensions that were documented in version 4.0a of the ACPI specification to acquire more information about errors without having to rely reading chipset registers directly. A user level programs decodes into somewhat human readable format.
3) drivers/edac/mce_amd.c - this driver hooks into the mcelog path and decodes errors reported via machine check bank registers in AMD processors to the console log using printk();
Each of these mechanisms has a band of followers ... and none of them appear to meet all the needs of all users.
In order to provide a proper hardware event subsystem, let's encapsulate hardware events into a common trace facility, and make both edac and mce drivers to use it. After that, common facilities can be moved into a new core for hardware events reporting subsystem. This patch is the first of a series, and just touches at mce.
--- drivers/edac/edac_mc.c | 32 ++++ include/trace/events/hw_event.h | 322 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 354 insertions(+), 0 deletions(-) create mode 100644 include/trace/events/hw_event.h
drivers/edac/edac_mc.c +32 -0
@@ -34,6 +34,9 @@#include "edac_core.h" #include "edac_module.h" +#define CREATE_TRACE_POINTS +#include <trace/events/hw_event.h> +/* lock to memory controller's control array */ static DEFINE_MUTEX (mem_ctls_mutex);static LIST_HEAD (mc_devices);
@@ -224,6 +227,9 @@ struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows,* which will perform kobj unregistration and the actual free * will occur during the kobject callback operation */ + +trace_hw_event_init ("mce" , (unsigned )edac_index); +return mci; }EXPORT_SYMBOL_GPL (edac_mc_alloc);
@@ -685,6 +691,7 @@ void edac_mc_handle_ce(struct mem_ctl_info *mci,/* FIXME - maybe make panic on INTERNAL ERROR an option */ if (row >= mci->nr_csrows || row <0 ) {/* something is wrong */ +trace_mc_out_of_range (mci,"CE" ,"row" , row,0 , mci->nr_csrows);edac_mc_printk (mci,KERN_ERR ,"INTERNAL ERROR: row out of range " "(%d >= %d)\n" , row, mci->nr_csrows);
@@ -694,6 +701,8 @@ void edac_mc_handle_ce(struct mem_ctl_info *mci,if (channel >= mci->csrows[row].nr_channels || channel <0 ) {/* something is wrong */ +trace_mc_out_of_range (mci,"CE" ,"channel" , channel, +0 , mci->csrows[row].nr_channels); edac_mc_printk(mci, KERN_ERR, "INTERNAL ERROR: channel out of range " "(%d >= %d)\n", channel,
@@ -702,6 +711,9 @@ void edac_mc_handle_ce(struct mem_ctl_info *mci,return ; } +trace_mc_corrected_error (mci, page_frame_number, offset_in_page, + syndrome, row, channel, msg); +if (edac_mc_get_log_ce ())/* FIXME - put in DIMM location */ edac_mc_printk(mci, KERN_WARNING,
@@ -737,6 +749,7 @@ EXPORT_SYMBOL_GPL(edac_mc_handle_ce);void edac_mc_handle_ce_no_info (struct mem_ctl_info *mci,const char *msg) { +trace_mc_corrected_error_no_info (mci, msg);if (edac_mc_get_log_ce ())edac_mc_printk (mci,KERN_WARNING ,"CE - no information available: %s\n" , msg);
@@ -761,6 +774,8 @@ void edac_mc_handle_ue(struct mem_ctl_info *mci,/* FIXME - maybe make panic on INTERNAL ERROR an option */ if (row >= mci->nr_csrows || row <0 ) {/* something is wrong */ +trace_mc_out_of_range (mci,"UE" ,"row" , row, +0 , mci->nr_csrows);edac_mc_printk (mci,KERN_ERR ,"INTERNAL ERROR: row out of range " "(%d >= %d)\n" , row, mci->nr_csrows);
@@ -781,6 +796,8 @@ void edac_mc_handle_ue(struct mem_ctl_info *mci, pos += chars; } +trace_mc_uncorrected_error (mci, page_frame_number, offset_in_page, + row, msg, labels);if (edac_mc_get_log_ue ())edac_mc_printk (mci,KERN_EMERG , "UE page 0x%lx, offset 0x%lx, grain %d, row %d, "
@@ -801,6 +818,7 @@ EXPORT_SYMBOL_GPL(edac_mc_handle_ue);void edac_mc_handle_ue_no_info (struct mem_ctl_info *mci,const char *msg) { +trace_mc_uncorrected_error_no_info (mci, msg);if (edac_mc_get_panic_on_ue ())panic ("EDAC MC%d: Uncorrected Error" , mci->mc_idx);
@@ -828,6 +846,9 @@ void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci,if (csrow >= mci->nr_csrows) {/* something is wrong */ + +trace_mc_out_of_range (mci,"UE FBDIMM" ,"row" , csrow, +0 , mci->nr_csrows);edac_mc_printk (mci,KERN_ERR ,"INTERNAL ERROR: row out of range (%d >= %d)\n" , csrow, mci->nr_csrows);
@@ -837,6 +858,8 @@ void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci,if (channela >= mci->csrows[csrow].nr_channels) {/* something is wrong */ +trace_mc_out_of_range (mci,"UE FBDIMM" ,"channel-a" , channela, +0 , mci->csrows[csrow].nr_channels); edac_mc_printk(mci, KERN_ERR, "INTERNAL ERROR: channel-a out of range " "(%d >= %d)\n",
@@ -847,6 +870,8 @@ void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci,if (channelb >= mci->csrows[csrow].nr_channels) {/* something is wrong */ +trace_mc_out_of_range (mci,"UE FBDIMM" ,"channel-b" , channelb, +0 , mci->csrows[csrow].nr_channels); edac_mc_printk(mci, KERN_ERR, "INTERNAL ERROR: channel-b out of range " "(%d >= %d)\n",
@@ -866,6 +891,8 @@ void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci, chars =snprintf (pos, len +1 ,"-%s" , mci->csrows[csrow].channels[channelb].label); +trace_mc_uncorrected_error_fbd (mci, csrow, channela, channelb, + msg, labels);if (edac_mc_get_log_ue ())edac_mc_printk (mci,KERN_EMERG , "UE row %d, channel-a= %d channel-b= %d "
@@ -890,6 +917,8 @@ void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci,/* Ensure boundary values */ if (csrow >= mci->nr_csrows) {/* something is wrong */ +trace_mc_out_of_range (mci,"CE FBDIMM" ,"row" , csrow, +0 , mci->nr_csrows);edac_mc_printk (mci,KERN_ERR ,"INTERNAL ERROR: row out of range (%d >= %d)\n" , csrow, mci->nr_csrows);
@@ -898,6 +927,8 @@ void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci, }if (channel >= mci->csrows[csrow].nr_channels) {/* something is wrong */ +trace_mc_out_of_range (mci,"UE FBDIMM" ,"channel" , channel, +0 , mci->csrows[csrow].nr_channels);edac_mc_printk (mci,KERN_ERR ,"INTERNAL ERROR: channel out of range (%d >= %d)\n" , channel, mci->csrows[csrow].nr_channels);
@@ -905,6 +936,7 @@ void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci,return ; } +trace_mc_corrected_error_fbd (mci, csrow, channel, msg);if (edac_mc_get_log_ce ())/* FIXME - put in DIMM location */ edac_mc_printk(mci, KERN_WARNING,
include/trace/events/hw_event.h new file +322 -0
322 lines not on this page · raw message
Signature · 1 line
1.7.8
RFC PATCH v2 3/16 hw_event: Consolidate uncorrected/corrected error msgs into one
In reply to Mauro Carvalho ChehabThis is an RFC patch, consolidating two trace calls into one. Not sure if this is the better thing to do, but it simplifies the error tracepoint, while still keeping the technical details that may be needed by someone debugging the driver or for the vendors to double-check what's happening inside the system.
--- drivers/edac/edac_mc.c | 51 +++++++-- include/linux/edac.h | 6 + include/trace/events/hw_event.h | 231 ++++----------------------------------- 3 files changed, 68 insertions(+), 220 deletions(-)
drivers/edac/edac_mc.c +41 -10
@@ -685,6 +685,7 @@ void edac_mc_handle_ce(struct mem_ctl_info *mci, int row, int channel, const char *msg) { unsigned long remapped_page; +char detail[80 ];debugf3 ("MC%d: %s()\n" , mci->mc_idx, __func__);
@@ -711,8 +712,15 @@ void edac_mc_handle_ce(struct mem_ctl_info *mci,return ; } -trace_mc_corrected_error (mci, page_frame_number, offset_in_page, - syndrome, row, channel, msg); +/* Memory type dependent details about the error */ +snprintf (detail,sizeof (detail), +" (page 0x%lx, offset 0x%lx, grain %d, " +"syndrome 0x%lx, row %d, channel %d)\n" , + page_frame_number, offset_in_page, + mci->csrows[row].grain, syndrome, row, channel); +trace_mc_error (HW_EVENT_ERR_CORRECTED , mci->mc_idx, + mci->csrows[row].channels[channel].label, + msg, detail);if (edac_mc_get_log_ce ())/* FIXME - put in DIMM location */
@@ -749,7 +757,8 @@ EXPORT_SYMBOL_GPL(edac_mc_handle_ce);void edac_mc_handle_ce_no_info (struct mem_ctl_info *mci,const char *msg) { -trace_mc_corrected_error_no_info (mci, msg); +trace_mc_error (HW_EVENT_ERR_CORRECTED , mci->mc_idx, +"unknown" , msg,"" );if (edac_mc_get_log_ce ())edac_mc_printk (mci,KERN_WARNING ,"CE - no information available: %s\n" , msg);
@@ -768,6 +777,7 @@ void edac_mc_handle_ue(struct mem_ctl_info *mci,char *pos = labels;int chan;int chars; +char detail[80 ];debugf3 ("MC%d: %s()\n" , mci->mc_idx, __func__);
@@ -796,8 +806,15 @@ void edac_mc_handle_ue(struct mem_ctl_info *mci, pos += chars; } -trace_mc_uncorrected_error (mci, page_frame_number, offset_in_page, - row, msg, labels); +/* Memory type dependent details about the error */ +snprintf (detail,sizeof (detail), +"page 0x%lx, offset 0x%lx, grain %d, row %d " , + page_frame_number, offset_in_page, + mci->csrows[row].grain, row); +trace_mc_error (HW_EVENT_ERR_UNCORRECTED , mci->mc_idx, + labels, + msg, detail); +if (edac_mc_get_log_ue ())edac_mc_printk (mci,KERN_EMERG , "UE page 0x%lx, offset 0x%lx, grain %d, row %d, "
@@ -818,7 +835,8 @@ EXPORT_SYMBOL_GPL(edac_mc_handle_ue);void edac_mc_handle_ue_no_info (struct mem_ctl_info *mci,const char *msg) { -trace_mc_uncorrected_error_no_info (mci, msg); +trace_mc_error (HW_EVENT_ERR_UNCORRECTED , mci->mc_idx, +"unknown" , msg,"" );if (edac_mc_get_panic_on_ue ())panic ("EDAC MC%d: Uncorrected Error" , mci->mc_idx);
@@ -843,6 +861,7 @@ void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci,char labels[len +1 ];char *pos = labels;int chars; +char detail[80 ];if (csrow >= mci->nr_csrows) {/* something is wrong */
@@ -891,8 +910,13 @@ void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci, chars =snprintf (pos, len +1 ,"-%s" , mci->csrows[csrow].channels[channelb].label); -trace_mc_uncorrected_error_fbd (mci, csrow, channela, channelb, - msg, labels); +/* Memory type dependent details about the error */ +snprintf (detail,sizeof (detail), +"row %d, channel-a= %d channel-b= %d " , + csrow, channela, channelb); +trace_mc_error (HW_EVENT_ERR_UNCORRECTED , mci->mc_idx, + labels, + msg, detail);if (edac_mc_get_log_ue ())edac_mc_printk (mci,KERN_EMERG , "UE row %d, channel-a= %d channel-b= %d "
@@ -913,7 +937,7 @@ EXPORT_SYMBOL(edac_mc_handle_fbd_ue);void edac_mc_handle_fbd_ce (struct mem_ctl_info *mci,unsigned int csrow,unsigned int channel,char *msg) { - +char detail[80 ];/* Ensure boundary values */ if (csrow >= mci->nr_csrows) {/* something is wrong */
@@ -936,7 +960,14 @@ void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci,return ; } -trace_mc_corrected_error_fbd (mci, csrow, channel, msg); +/* Memory type dependent details about the error */ +snprintf (detail,sizeof (detail), +"(row %d, channel %d)\n" , + csrow, channel); +trace_mc_error (HW_EVENT_ERR_CORRECTED , mci->mc_idx, + mci->csrows[csrow].channels[channel].label, + msg, detail); +if (edac_mc_get_log_ce ())/* FIXME - put in DIMM location */ edac_mc_printk(mci, KERN_WARNING,
include/linux/edac.h +6 -0
@@ -66,6 +66,12 @@ enum dev_type {#define DEV_FLAG_X32 BIT(DEV_X32)#define DEV_FLAG_X64 BIT(DEV_X64) +enum hw_event_mc_err_type { +HW_EVENT_ERR_CORRECTED , +HW_EVENT_ERR_UNCORRECTED , +HW_EVENT_ERR_FATAL , +}; +/* memory types */ enum mem_type {MEM_EMPTY =0 ,/* Empty csrow */
include/trace/events/hw_event.h +21 -210
258 lines not on this page · raw message
Signature · 1 line
1.7.8
RFC PATCH v2 4/16 drivers/edac: rename channel_info to csrow_channel_info
In reply to Mauro Carvalho ChehabNewer memory architectures use the term "channel" with a different meaning.
On a traditional architecture, the memory controller directly access the memory chips, via csrows and channels.
On some modern architectures like FBDIMM, there's a microcontroller chip, called Advanced Memory Buffer (AMB) that serves as the interface between the memory controller and the memory chips.
It is up to the AMB to talk with the csrows of the DRAM chips.
The bus that exchanges information between the memory controller and the CPU is also called "channel", but it is not associated with the csrow channel. The entire csrow concept is not even visible to the memory controller, as using csrows is a task for the AMB.
The drivers that support such memories currently need to fake information and to abuse on EDAC structures, as the subsystem was conceived with the idea that the csrow would always be visible by the CPU.
To make things a little worse, they don't do it on a consistent way, as the concepts are not clear enough.
In order to fix it, let's correct the concept of a channel inside a csrow. Then, we can work to provide a way to represent the memory on a way that would be more architecture-independent.
--- drivers/edac/edac_mc.c | 6 +++--- include/linux/edac.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/edac/edac_mc.c +3 -3
@@ -43,7 +43,7 @@ static LIST_HEAD(mc_devices);#ifdef CONFIG_EDAC_DEBUG -static void edac_mc_dump_channel (struct channel_info *chan) +static void edac_mc_dump_channel (struct csrow_channel_info *chan) {debugf4 ("\tchannel = %p\n" , chan);debugf4 ("\tchannel->chan_idx = %d\n" , chan->chan_idx);
@@ -160,7 +160,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows, {struct mem_ctl_info *mci;struct csrow_info *csi, *csrow; -struct channel_info *chi, *chp, *chan; +struct csrow_channel_info *chi, *chp, *chan;void *pvt;unsigned size;int row, chn;
@@ -185,7 +185,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows,* rather than an imaginary chunk of memory located at address 0. */ csi = (struct csrow_info *)(((char *)mci) + ((unsigned long )csi)); - chi = (struct channel_info *)(((char *)mci) + ((unsigned long )chi)); + chi = (struct csrow_channel_info *)(((char *)mci) + ((unsigned long )chi)); pvt = sz_pvt ? (((char *)mci) + ((unsigned long )pvt)) :NULL ;/* setup index and various internal pointers */
include/linux/edac.h +3 -3
@@ -191,7 +191,7 @@ enum scrub_type {* Socket: A physical connector on the motherboard that accepts * a single memory stick. * -* Channel: Set of memory devices on a memory stick that must be +* Csrow-channel: Set of memory devices on a memory stick that must be * grouped in parallel with one or more additional * channels from other memory sticks. This parallel * grouping of the output from multiple channels are
@@ -249,7 +249,7 @@ enum scrub_type {* PS - I enjoyed writing all that about as much as you enjoyed reading it. */ -struct channel_info { +struct csrow_channel_info {int chan_idx;/* channel index */ u32 ce_count;/* Correctable Errors for this CHANNEL */ char label[EDAC_MC_LABEL_LEN +1 ];/* DIMM label on motherboard */
@@ -276,7 +276,7 @@ struct csrow_info {/* channel information for this csrow */ u32 nr_channels; -struct channel_info *channels; +struct csrow_channel_info *channels; };struct mcidev_sysfs_group {
Signature · 1 line
1.7.8
RFC PATCH v2 14/16 edac: Add per-dimm sysfs show nodes
In reply to Mauro Carvalho ChehabAdd sysfs nodes to describe DIMM properties: size, memory type, dev type and edac mode.
With this change, the physical memory characteristics should be presented, as detected by the memory controller.
--- drivers/edac/edac_mc_sysfs.c | 44 +++++++++++++++++++++++++++++++++++++---- 1 files changed, 39 insertions(+), 5 deletions(-)
drivers/edac/edac_mc_sysfs.c +39 -5
@@ -144,7 +144,13 @@ static ssize_t csrow_ce_count_show(struct csrow_info *csrow, char *data,static ssize_t csrow_size_show (struct csrow_info *csrow,char *data,int private) { -return sprintf (data,"%u\n" ,PAGES_TO_MiB (csrow->channels[0 ].dimm->nr_pages)); +int i; +u32 nr_pages =0 ; + +for (i =0 ; i < csrow->nr_channels; i++) + nr_pages += csrow->channels[i].dimm->nr_pages; + +return sprintf (data,"%u\n" ,PAGES_TO_MiB (nr_pages)); } static ssize_t csrow_mem_type_show(struct csrow_info *csrow, char *data,
@@ -497,14 +503,42 @@ static ssize_t dimmdev_label_store(struct dimm_info *dimm,return max_size; } +static ssize_t dimmdev_size_show (struct dimm_info *dimm,char *data) +{ +return sprintf (data,"%u\n" ,PAGES_TO_MiB (dimm->nr_pages)); +} + +static ssize_t dimmdev_mem_type_show (struct dimm_info *dimm,char *data) +{ +return sprintf (data,"%s\n" , mem_types[dimm->mtype]); +} + +static ssize_t dimmdev_dev_type_show (struct dimm_info *dimm,char *data) +{ +return sprintf (data,"%s\n" , dev_types[dimm->dtype]); +} + +static ssize_t dimmdev_edac_mode_show (struct dimm_info *dimm,char *data) +{ +return sprintf (data,"%s\n" , edac_caps[dimm->edac_mode]); +} +/* default cwrow<id>/attribute files */ -DIMMDEV_ATTR (label,S_IRUGO |S_IWUSR , dimmdev_label_show, dimmdev_label_store); -DIMMDEV_ATTR (location,S_IRUGO , dimmdev_location_show,NULL ); +DIMMDEV_ATTR (dimm_label,S_IRUGO |S_IWUSR , dimmdev_label_show, dimmdev_label_store); +DIMMDEV_ATTR (dimm_location,S_IRUGO , dimmdev_location_show,NULL ); +DIMMDEV_ATTR (dimm_size,S_IRUGO , dimmdev_size_show,NULL ); +DIMMDEV_ATTR (dimm_mem_type,S_IRUGO , dimmdev_mem_type_show,NULL ); +DIMMDEV_ATTR (dimm_dev_type,S_IRUGO , dimmdev_dev_type_show,NULL ); +DIMMDEV_ATTR (dimm_edac_mode,S_IRUGO , dimmdev_edac_mode_show,NULL );/* default attributes of the DIMM<id> object */ static struct dimmdev_attribute *default_dimm_attr[] = { - &attr_label, - &attr_location, + &attr_dimm_label, + &attr_dimm_location, + &attr_dimm_size, + &attr_dimm_mem_type, + &attr_dimm_dev_type, + &attr_dimm_edac_mode,NULL , };
Signature · 1 line
1.7.8
RFC PATCH v2 11/16 edac: move dimm properties to struct dimm_info
In reply to Mauro Carvalho ChehabWhile inside a csrow, the properties should be equal, some memory controllers aren't able to access csrows, as they're ridden by other chips.
So, we need to get rid of the per-csrow data. The first step is to move grain, mtype, dtype and edac_mode to the per-dimm struct.
--- drivers/edac/amd64_edac.c | 30 +++++++++++------- drivers/edac/amd76x_edac.c | 10 ++++-- drivers/edac/cell_edac.c | 10 +++++- drivers/edac/cpc925_edac.c | 62 ++++++++++++++++++++----------------- drivers/edac/e752x_edac.c | 44 ++++++++++++++------------ drivers/edac/e7xxx_edac.c | 44 +++++++++++++++----------- drivers/edac/edac_mc.c | 66 ++++++++++++++++++---------------------- drivers/edac/edac_mc_sysfs.c | 6 ++-- drivers/edac/i3000_edac.c | 18 ++++++----- drivers/edac/i3200_edac.c | 18 ++++++----- drivers/edac/i5000_edac.c | 24 +++++++-------- drivers/edac/i5100_edac.c | 16 +++------- drivers/edac/i5400_edac.c | 9 ++--- drivers/edac/i7300_edac.c | 19 ++++++----- drivers/edac/i7core_edac.c | 18 +++++----- drivers/edac/i82443bxgx_edac.c | 13 +++++--- drivers/edac/i82860_edac.c | 11 ++++-- drivers/edac/i82875p_edac.c | 17 +++++++--- drivers/edac/i82975x_edac.c | 10 ++++-- drivers/edac/mpc85xx_edac.c | 13 +++++--- drivers/edac/mv64x60_edac.c | 18 ++++++----- drivers/edac/pasemi_edac.c | 10 ++++-- drivers/edac/ppc4xx_edac.c | 13 +++++--- drivers/edac/r82600_edac.c | 10 ++++-- drivers/edac/sb_edac.c | 18 +++++----- drivers/edac/tile_edac.c | 13 ++++---- drivers/edac/x38_edac.c | 17 +++++----- include/linux/edac.h | 21 ++++++++----- 28 files changed, 315 insertions(+), 263 deletions(-)
drivers/edac/amd64_edac.c +18 -12
@@ -2168,7 +2168,9 @@ static int init_csrows(struct mem_ctl_info *mci)struct amd64_pvt *pvt = mci->pvt_info;u64 input_addr_min, input_addr_max, sys_addr, base, mask;u32 val; -int i, empty =1 ; +int i, j, empty =1 ; +enum mem_type mtype; +enum edac_type edac_mode;amd64_read_pci_cfg (pvt->F3,NBCFG , &val);
@@ -2202,7 +2204,21 @@ static int init_csrows(struct mem_ctl_info *mci) csrow->page_mask = ~mask;/* 8 bytes of resolution */ - csrow->mtype =amd64_determine_memory_type (pvt, i); + mtype =amd64_determine_memory_type (pvt, i); + +/* +* determine whether CHIPKILL or JUST ECC or NO ECC is operating +*/ +if (pvt->nbcfg &NBCFG_ECC_ENABLE ) + edac_mode = (pvt->nbcfg &NBCFG_CHIPKILL ) ? +EDAC_S4ECD4ED :EDAC_SECDED ; +else + edac_mode =EDAC_NONE ; + +for (j =0 ; j < pvt->channel_count; j++) { + csrow->channels[j].dimm->mtype = mtype; + csrow->channels[j].dimm->edac_mode = edac_mode; + }debugf1 (" for MC node %d csrow %d:\n" , pvt->mc_node_id, i); debugf1(" input_addr_min: 0x%lx input_addr_max: 0x%lx\n",
@@ -2214,16 +2230,6 @@ static int init_csrows(struct mem_ctl_info *mci)"last_page: 0x%lx\n" , (unsigned )csrow->nr_pages, csrow->first_page, csrow->last_page); - -/* -* determine whether CHIPKILL or JUST ECC or NO ECC is operating -*/ -if (pvt->nbcfg &NBCFG_ECC_ENABLE ) - csrow->edac_mode = - (pvt->nbcfg &NBCFG_CHIPKILL ) ? -EDAC_S4ECD4ED :EDAC_SECDED ; -else - csrow->edac_mode =EDAC_NONE ; }return empty;
drivers/edac/amd76x_edac.c +6 -4
@@ -186,11 +186,13 @@ static void amd76x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, enum edac_type edac_mode) {struct csrow_info *csrow; +struct dimm_info *dimm;u32 mba, mba_base, mba_mask, dms;int index;for (index =0 ; index < mci->nr_csrows; index++) { csrow = &mci->csrows[index]; + dimm = csrow->channels[0 ].dimm;/* find the DRAM Chip Select Base address and mask */ pci_read_config_dword(pdev,
@@ -206,10 +208,10 @@ static void amd76x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, csrow->nr_pages = (mba_mask +1 ) >>PAGE_SHIFT ; csrow->last_page = csrow->first_page + csrow->nr_pages -1 ; csrow->page_mask = mba_mask >>PAGE_SHIFT ; - csrow->grain = csrow->nr_pages <<PAGE_SHIFT ; - csrow->mtype =MEM_RDDR ; - csrow->dtype = ((dms >> index) &0x1 ) ?DEV_X4 :DEV_UNKNOWN ; - csrow->edac_mode = edac_mode; + dimm->grain = csrow->nr_pages <<PAGE_SHIFT ; + dimm->mtype =MEM_RDDR ; + dimm->dtype = ((dms >> index) &0x1 ) ?DEV_X4 :DEV_UNKNOWN ; + dimm->edac_mode = edac_mode; } }
drivers/edac/cell_edac.c +8 -2
@@ -124,8 +124,10 @@ static void cell_edac_check(struct mem_ctl_info *mci)static void __devinit cell_edac_init_csrows (struct mem_ctl_info *mci) {struct csrow_info *csrow = &mci->csrows[0 ]; +struct dimm_info *dimm;struct cell_edac_priv *priv = mci->pvt_info;struct device_node *np; +int j;for (np =NULL ; (np =of_find_node_by_name (np,"memory" )) !=NULL ;) {
@@ -142,8 +144,12 @@ static void __devinit cell_edac_init_csrows(struct mem_ctl_info *mci) csrow->first_page = r.start >>PAGE_SHIFT ; csrow->nr_pages =resource_size (&r) >>PAGE_SHIFT ; csrow->last_page = csrow->first_page + csrow->nr_pages -1 ; - csrow->mtype =MEM_XDR ; - csrow->edac_mode =EDAC_SECDED ; + +for (j =0 ; j < csrow->nr_channels; j++) { + dimm = csrow->channels[j].dimm; + dimm->mtype =MEM_XDR ; + dimm->edac_mode =EDAC_SECDED ; + } dev_dbg(mci->dev, "Initialized on node %d, chanmask=0x%x," " first_page=0x%lx, nr_pages=0x%x\n",
drivers/edac/cpc925_edac.c +33 -29
81 lines not on this page · raw message
drivers/edac/e752x_edac.c +24 -20
62 lines not on this page · raw message
drivers/edac/e7xxx_edac.c +25 -19
60 lines not on this page · raw message
drivers/edac/edac_mc.c +30 -36
155 lines not on this page · raw message
drivers/edac/edac_mc_sysfs.c +3 -3
@@ -150,19 +150,19 @@ static ssize_t csrow_size_show(struct csrow_info *csrow, char *data,static ssize_t csrow_mem_type_show (struct csrow_info *csrow,char *data,int private) { -return sprintf (data,"%s\n" , mem_types[csrow->mtype]); +return sprintf (data,"%s\n" , mem_types[csrow->channels[0 ].dimm->mtype]); }static ssize_t csrow_dev_type_show (struct csrow_info *csrow,char *data,int private) { -return sprintf (data,"%s\n" , dev_types[csrow->dtype]); +return sprintf (data,"%s\n" , dev_types[csrow->channels[0 ].dimm->dtype]); }static ssize_t csrow_edac_mode_show (struct csrow_info *csrow,char *data,int private) { -return sprintf (data,"%s\n" , edac_caps[csrow->edac_mode]); +return sprintf (data,"%s\n" , edac_caps[csrow->channels[0 ].dimm->edac_mode]); }/* show/store functions for DIMM Label attributes */
drivers/edac/i3000_edac.c +10 -8
@@ -304,7 +304,7 @@ static int i3000_is_interleaved(const unsigned char *c0dra,static int i3000_probe1 (struct pci_dev *pdev,int dev_idx) {int rc; -int i; +int i, j;struct mem_ctl_info *mci =NULL ;unsigned long last_cumul_size;int interleaved, nr_channels;
@@ -386,19 +386,21 @@ static int i3000_probe1(struct pci_dev *pdev, int dev_idx) cumul_size <<=1 ;debugf3 ("MC: %s(): (%d) cumul_size 0x%x\n" , __func__, i, cumul_size); -if (cumul_size == last_cumul_size) { - csrow->mtype =MEM_EMPTY ; +if (cumul_size == last_cumul_size)continue ; - } csrow->first_page = last_cumul_size; csrow->last_page = cumul_size -1 ; csrow->nr_pages = cumul_size - last_cumul_size; last_cumul_size = cumul_size; - csrow->grain =I3000_DEAP_GRAIN ; - csrow->mtype =MEM_DDR2 ; - csrow->dtype =DEV_UNKNOWN ; - csrow->edac_mode =EDAC_UNKNOWN ; + +for (j =0 ; j < nr_channels; j++) { +struct dimm_info *dimm = csrow->channels[j].dimm; + dimm->grain =I3000_DEAP_GRAIN ; + dimm->mtype =MEM_DDR2 ; + dimm->dtype =DEV_UNKNOWN ; + dimm->edac_mode =EDAC_UNKNOWN ; + } }/*
drivers/edac/i3200_edac.c +10 -8
@@ -330,7 +330,7 @@ static unsigned long drb_to_nr_pages(static int i3200_probe1 (struct pci_dev *pdev,int dev_idx) {int rc; -int i; +int i, j;struct mem_ctl_info *mci =NULL ;unsigned long last_page;u16 drbs[I3200_CHANNELS ][I3200_RANKS_PER_CHANNEL ];
@@ -386,20 +386,22 @@ static int i3200_probe1(struct pci_dev *pdev, int dev_idx) i /I3200_RANKS_PER_CHANNEL , i % I3200_RANKS_PER_CHANNEL); -if (nr_pages ==0 ) { - csrow->mtype =MEM_EMPTY ; +if (nr_pages ==0 )continue ; - } csrow->first_page = last_page +1 ; last_page += nr_pages; csrow->last_page = last_page; csrow->nr_pages = nr_pages; - csrow->grain = nr_pages <<PAGE_SHIFT ; - csrow->mtype =MEM_DDR2 ; - csrow->dtype =DEV_UNKNOWN ; - csrow->edac_mode =EDAC_UNKNOWN ; +for (j =0 ; j < nr_channels; j++) { +struct dimm_info *dimm = csrow->channels[j].dimm; + + dimm->grain = nr_pages <<PAGE_SHIFT ; + dimm->mtype =MEM_DDR2 ; + dimm->dtype =DEV_UNKNOWN ; + dimm->edac_mode =EDAC_UNKNOWN ; + } }i3200_clear_error_info (mci);
drivers/edac/i5000_edac.c +11 -13
@@ -1268,25 +1268,23 @@ static int i5000_init_csrows(struct mem_ctl_info *mci) p_csrow->last_page =9 + csrow *20 ; p_csrow->page_mask =0xFFF ; - p_csrow->grain =8 ; - csrow_megs =0 ;for (channel =0 ; channel < pvt->maxch; channel++) { csrow_megs += pvt->dimm_info[csrow][channel].megabytes; - } + p_csrow->channels[channel].dimm->grain =8 ; - p_csrow->nr_pages = csrow_megs <<8 ; +/* Assume DDR2 for now */ + p_csrow->channels[channel].dimm->mtype =MEM_FB_DDR2 ; -/* Assume DDR2 for now */ - p_csrow->mtype =MEM_FB_DDR2 ; +/* ask what device type on this row */ +if (MTR_DRAM_WIDTH (mtr)) + p_csrow->channels[channel].dimm->dtype =DEV_X8 ; +else + p_csrow->channels[channel].dimm->dtype =DEV_X4 ; -/* ask what device type on this row */ -if (MTR_DRAM_WIDTH (mtr)) - p_csrow->dtype =DEV_X8 ; -else - p_csrow->dtype =DEV_X4 ; - - p_csrow->edac_mode =EDAC_S8ECD8ED ; + p_csrow->channels[channel].dimm->edac_mode =EDAC_S8ECD8ED ; + } + p_csrow->nr_pages = csrow_megs <<8 ; empty =0 ; }
drivers/edac/i5100_edac.c +5 -11
@@ -867,27 +867,21 @@ static void __devinit i5100_init_csrows(struct mem_ctl_info *mci)*/ mci->csrows[i].first_page = total_pages; mci->csrows[i].last_page = total_pages + npages -1 ; - mci->csrows[i].page_mask =0UL ; - mci->csrows[i].nr_pages = npages; - mci->csrows[i].grain =32 ; mci->csrows[i].csrow_idx = i; - mci->csrows[i].dtype = - (priv->mtr[chan][rank].width ==4 ) ?DEV_X4 :DEV_X8 ; - mci->csrows[i].ue_count =0 ; - mci->csrows[i].ce_count =0 ; - mci->csrows[i].mtype =MEM_RDDR2 ; - mci->csrows[i].edac_mode =EDAC_SECDED ; mci->csrows[i].mci = mci; mci->csrows[i].nr_channels =1 ; - mci->csrows[i].channels[0 ].chan_idx =0 ; - mci->csrows[i].channels[0 ].ce_count =0 ; mci->csrows[i].channels[0 ].csrow = mci->csrows + i; total_pages += npages; mci->csrows[i].channels[0 ].dimm = dimm; dimm->location.mc_channel = chan; dimm->location.mc_dimm_number = rank; + dimm->grain =32 ; + dimm->dtype = (priv->mtr[chan][rank].width ==4 ) ? +DEV_X4 :DEV_X8 ; + dimm->mtype =MEM_RDDR2 ; + dimm->edac_mode =EDAC_SECDED ;snprintf (dimm->label,sizeof (dimm->label),"DIMM%u" ,i5100_rank_to_slot (mci, chan, rank));
drivers/edac/i5400_edac.c +4 -5
@@ -1166,11 +1166,6 @@ static int i5400_init_csrows(struct mem_ctl_info *mci) p_csrow->last_page =9 + csrow *20 ; p_csrow->page_mask =0xFFF ; - p_csrow->grain =8 ; - p_csrow->dtype =MTR_DRAM_WIDTH (mtr) ?DEV_X8 :DEV_X4 ; - p_csrow->mtype =MEM_RDDR2 ; - p_csrow->edac_mode =EDAC_SECDED ; - csrow_megs =0 ;for (channel =0 ; channel < pvt->maxch; channel++) csrow_megs += pvt->dimm_info[csrow][channel].megabytes;
@@ -1179,6 +1174,10 @@ static int i5400_init_csrows(struct mem_ctl_info *mci) dimm->location.mc_channel = channel; dimm->location.mc_dimm_number = csrow / pvt->maxch; + dimm->grain =8 ; + dimm->dtype =MTR_DRAM_WIDTH (mtr) ?DEV_X8 :DEV_X4 ; + dimm->mtype =MEM_RDDR2 ; + dimm->edac_mode =EDAC_SECDED ; mci->nr_dimms++; dimm++;
drivers/edac/i7300_edac.c +10 -9
@@ -618,6 +618,7 @@ static int decode_mtr(struct i7300_pvt *pvt, int slot, int ch, int branch, struct i7300_dimm_info *dinfo, struct csrow_info *p_csrow, + struct dimm_info *dimm, u32 *nr_pages) { int mtr, ans, addrBits, channel;
@@ -663,10 +664,7 @@ static int decode_mtr(struct i7300_pvt *pvt,debugf2 ("\t\tNUMCOL: %s\n" , numcol_toString[MTR_DIMM_COLS (mtr)]);debugf2 ("\t\tSIZE: %d MB\n" , dinfo->megabytes); - p_csrow->grain =8 ; - p_csrow->mtype =MEM_FB_DDR2 ; p_csrow->csrow_idx = slot; - p_csrow->page_mask =0 ;/* * The type of error detection actually depends of the
@@ -677,15 +675,17 @@ static int decode_mtr(struct i7300_pvt *pvt,* See datasheet Sections 7.3.6 to 7.3.8 */ + dimm->grain =8 ; + dimm->mtype =MEM_FB_DDR2 ;if (IS_SINGLE_MODE (pvt->mc_settings_a)) { - p_csrow->edac_mode =EDAC_SECDED ; + dimm->edac_mode =EDAC_SECDED ;debugf2 ("\t\tECC code is 8-byte-over-32-byte SECDED+ code\n" ); }else {debugf2 ("\t\tECC code is on Lockstep mode\n" );if (MTR_DRAM_WIDTH (mtr) ==8 ) - p_csrow->edac_mode =EDAC_S8ECD8ED ; + dimm->edac_mode =EDAC_S8ECD8ED ;else - p_csrow->edac_mode =EDAC_S4ECD4ED ; + dimm->edac_mode =EDAC_S4ECD4ED ; }/* ask what device type on this row */
@@ -694,9 +694,9 @@ static int decode_mtr(struct i7300_pvt *pvt,IS_SCRBALGO_ENHANCED (pvt->mc_settings) ? "enhanced" : "normal"); - p_csrow->dtype =DEV_X8 ; + dimm->dtype =DEV_X8 ; }else - p_csrow->dtype =DEV_X4 ; + dimm->dtype =DEV_X4 ;return mtr; }
@@ -824,7 +824,8 @@ static int i7300_init_csrows(struct mem_ctl_info *mci) dimm->location.mc_dimm_number = slot; mtr =decode_mtr (pvt, slot, ch, branch, - dinfo, p_csrow, &nr_pages); + dinfo, p_csrow, dimm, + &nr_pages);/* if no DIMMS on this row, continue */ if (!MTR_DIMMS_PRESENT (mtr))continue ;
drivers/edac/i7core_edac.c +9 -9
@@ -725,7 +725,6 @@ static int get_dimm_config(struct mem_ctl_info *mci) csr->nr_pages = npages; csr->page_mask =0 ; - csr->grain =8 ; csr->csrow_idx = csrow; csr->nr_channels =1 ;
@@ -736,30 +735,31 @@ static int get_dimm_config(struct mem_ctl_info *mci)switch (banks) {case 4 : - csr->dtype =DEV_X4 ; + dimm->dtype =DEV_X4 ;break ;case 8 : - csr->dtype =DEV_X8 ; + dimm->dtype =DEV_X8 ;break ;case 16 : - csr->dtype =DEV_X16 ; + dimm->dtype =DEV_X16 ;break ;default : - csr->dtype =DEV_UNKNOWN ; + dimm->dtype =DEV_UNKNOWN ; } csr->channels[0 ].dimm = dimm; + dimm->location.mc_channel = i; dimm->location.mc_dimm_number = j;snprintf (dimm->label,sizeof (dimm->label),"CPU#%uChannel#%u_DIMM#%u" , pvt->i7core_dev->socket, i, j); + dimm->grain =8 ; + dimm->edac_mode = mode; + dimm->mtype = mtype; + mci->nr_dimms++; dimm++; - - csr->edac_mode = mode; - csr->mtype = mtype; - csrow++; }
drivers/edac/i82443bxgx_edac.c +8 -5
@@ -12,7 +12,7 @@* 440GX fix by Jason Uhlenkott <[email protected]>. * * Written with reference to 82443BX Host Bridge Datasheet: -* http://download.intel.com/design/chipsets/datashts/29063301.pdf +* http://download.intel.com/design/chipsets/datashts/29063301.pdf * references to this document given in []. * * This module doesn't support the 440LX, but it may be possible to
@@ -189,6 +189,7 @@ static void i82443bxgx_init_csrows(struct mem_ctl_info *mci, enum mem_type mtype) {struct csrow_info *csrow; +struct dimm_info *dimm;int index;u8 drbar, dramc;u32 row_base, row_high_limit, row_high_limit_last;
@@ -197,6 +198,8 @@ static void i82443bxgx_init_csrows(struct mem_ctl_info *mci, row_high_limit_last =0 ;for (index =0 ; index < mci->nr_csrows; index++) { csrow = &mci->csrows[index]; + dimm = csrow->channels[0 ].dimm; +pci_read_config_byte (pdev,I82443BXGX_DRB + index, &drbar);debugf1 ("MC%d: %s: %s() Row=%d DRB = %#0x\n" , mci->mc_idx, __FILE__, __func__, index, drbar);
@@ -219,12 +222,12 @@ static void i82443bxgx_init_csrows(struct mem_ctl_info *mci, csrow->last_page = (row_high_limit >>PAGE_SHIFT ) -1 ; csrow->nr_pages = csrow->last_page - csrow->first_page +1 ;/* EAP reports in 4kilobyte granularity [61] */ - csrow->grain =1 <<12 ; - csrow->mtype = mtype; + dimm->grain =1 <<12 ; + dimm->mtype = mtype;/* I don't think 440BX can tell you device type? FIXME? */ - csrow->dtype =DEV_UNKNOWN ; + dimm->dtype =DEV_UNKNOWN ;/* Mode is global to all rows on 440BX */ - csrow->edac_mode = edac_mode; + dimm->edac_mode = edac_mode; row_high_limit_last = row_high_limit; } }
drivers/edac/i82860_edac.c +7 -4
@@ -140,6 +140,7 @@ static void i82860_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev)u16 value;u32 cumul_size;struct csrow_info *csrow; +struct dimm_info *dimm;int index;pci_read_config_word (pdev,I82860_MCHCFG , &mchcfg_ddim);
@@ -153,6 +154,8 @@ static void i82860_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev)*/ for (index =0 ; index < mci->nr_csrows; index++) { csrow = &mci->csrows[index]; + dimm = csrow->channels[0 ].dimm; +pci_read_config_word (pdev,I82860_GBA + index *2 , &value); cumul_size = (value &I82860_GBA_MASK ) << (I82860_GBA_SHIFT -PAGE_SHIFT );
@@ -166,10 +169,10 @@ static void i82860_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev) csrow->last_page = cumul_size -1 ; csrow->nr_pages = cumul_size - last_cumul_size; last_cumul_size = cumul_size; - csrow->grain =1 <<12 ;/* I82860_EAP has 4KiB reolution */ - csrow->mtype =MEM_RMBS ; - csrow->dtype =DEV_UNKNOWN ; - csrow->edac_mode = mchcfg_ddim ?EDAC_SECDED :EDAC_NONE ; + dimm->grain =1 <<12 ;/* I82860_EAP has 4KiB reolution */ + dimm->mtype =MEM_RMBS ; + dimm->dtype =DEV_UNKNOWN ; + dimm->edac_mode = mchcfg_ddim ?EDAC_SECDED :EDAC_NONE ; } }
drivers/edac/i82875p_edac.c +12 -5
@@ -342,11 +342,13 @@ static void i82875p_init_csrows(struct mem_ctl_info *mci, void __iomem * ovrfl_window, u32 drc) {struct csrow_info *csrow; +struct dimm_info *dimm; +unsigned nr_chans =dual_channel_active (drc) +1 ;unsigned long last_cumul_size;u8 value;u32 drc_ddim;/* DRAM Data Integrity Mode 0=none,2=edac */ u32 cumul_size; -int index; +int index, j; drc_ddim = (drc >>18 ) &0x1 ; last_cumul_size =0 ;
@@ -371,10 +373,15 @@ static void i82875p_init_csrows(struct mem_ctl_info *mci, csrow->last_page = cumul_size -1 ; csrow->nr_pages = cumul_size - last_cumul_size; last_cumul_size = cumul_size; - csrow->grain =1 <<12 ;/* I82875P_EAP has 4KiB reolution */ - csrow->mtype =MEM_DDR ; - csrow->dtype =DEV_UNKNOWN ; - csrow->edac_mode = drc_ddim ?EDAC_SECDED :EDAC_NONE ; + +for (j =0 ; j < nr_chans; j++) { + dimm = csrow->channels[j].dimm; + + dimm->grain =1 <<12 ;/* I82875P_EAP has 4KiB reolution */ + dimm->mtype =MEM_DDR ; + dimm->dtype =DEV_UNKNOWN ; + dimm->edac_mode = drc_ddim ?EDAC_SECDED :EDAC_NONE ; + } } }
drivers/edac/i82975x_edac.c +6 -4
@@ -365,6 +365,7 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci,u32 cumul_size;int index, chan;struct dimm_info *dimm; +enum dev_type dtype; last_cumul_size =0 ;
@@ -402,6 +403,7 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci,* [0-7] for single-channel; i.e. csrow->nr_channels = 1 * [0-3] for dual-channel; i.e. csrow->nr_channels = 2 */ + dtype =i82975x_dram_type (mch_window, index);for (chan =0 ; chan < csrow->nr_channels; chan++) { mci->csrows[index].channels[chan].dimm = dimm; dimm->location.csrow = index;
@@ -409,6 +411,10 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci,strncpy (csrow->channels[chan].dimm->label, labels[(index >>1 ) + (chan *2 )],EDAC_MC_LABEL_LEN ); + dimm->grain =1 <<6 ;/* I82975X_EAP has 64B resolution */ + dimm->dtype = dtype; + dimm->mtype =MEM_DDR2 ;/* I82975x supports only DDR2 */ + dimm->edac_mode =EDAC_SECDED ;/* only supported */ dimm++; mci->nr_dimms++; }
@@ -420,10 +426,6 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci, csrow->last_page = cumul_size -1 ; csrow->nr_pages = cumul_size - last_cumul_size; last_cumul_size = cumul_size; - csrow->grain =1 <<6 ;/* I82975X_EAP has 64B resolution */ - csrow->mtype =MEM_DDR2 ;/* I82975x supports only DDR2 */ - csrow->dtype =i82975x_dram_type (mch_window, index); - csrow->edac_mode =EDAC_SECDED ;/* only supported */ } }
drivers/edac/mpc85xx_edac.c +8 -5
@@ -883,6 +883,7 @@ static void __devinit mpc85xx_init_csrows(struct mem_ctl_info *mci) {struct mpc85xx_mc_pdata *pdata = mci->pvt_info;struct csrow_info *csrow; +struct dimm_info *dimm;u32 sdram_ctl;u32 sdtype;enum mem_type mtype;
@@ -929,6 +930,8 @@ static void __devinit mpc85xx_init_csrows(struct mem_ctl_info *mci)u32 end; csrow = &mci->csrows[index]; + dimm = csrow->channels[0 ].dimm; + cs_bnds =in_be32 (pdata->mc_vbase +MPC85XX_MC_CS_BNDS_0 + (index *MPC85XX_MC_CS_BNDS_OFS ));
@@ -945,12 +948,12 @@ static void __devinit mpc85xx_init_csrows(struct mem_ctl_info *mci) csrow->first_page = start; csrow->last_page = end; csrow->nr_pages = end +1 - start; - csrow->grain =8 ; - csrow->mtype = mtype; - csrow->dtype =DEV_UNKNOWN ; + dimm->grain =8 ; + dimm->mtype = mtype; + dimm->dtype =DEV_UNKNOWN ;if (sdram_ctl &DSC_X32_EN ) - csrow->dtype =DEV_X32 ; - csrow->edac_mode =EDAC_SECDED ; + dimm->dtype =DEV_X32 ; + dimm->edac_mode =EDAC_SECDED ; } }
drivers/edac/mv64x60_edac.c +10 -8
@@ -656,6 +656,8 @@ static void mv64x60_init_csrows(struct mem_ctl_info *mci, struct mv64x60_mc_pdata *pdata) {struct csrow_info *csrow; +struct dimm_info *dimm; +u32 devtype;u32 ctl;
@@ -664,30 +666,30 @@ static void mv64x60_init_csrows(struct mem_ctl_info *mci, ctl =in_le32 (pdata->mc_vbase +MV64X60_SDRAM_CONFIG ); csrow = &mci->csrows[0 ]; - csrow->first_page =0 ; + dimm = csrow->channels[0 ].dimm; csrow->nr_pages = pdata->total_mem >>PAGE_SHIFT ; csrow->last_page = csrow->first_page + csrow->nr_pages -1 ; - csrow->grain =8 ; + dimm->grain =8 ; - csrow->mtype = (ctl &MV64X60_SDRAM_REGISTERED ) ?MEM_RDDR :MEM_DDR ; + dimm->mtype = (ctl &MV64X60_SDRAM_REGISTERED ) ?MEM_RDDR :MEM_DDR ; devtype = (ctl >>20 ) &0x3 ;switch (devtype) {case 0x0 : - csrow->dtype =DEV_X32 ; + dimm->dtype =DEV_X32 ;break ;case 0x2 :/* could be X8 too, but no way to tell */ - csrow->dtype =DEV_X16 ; + dimm->dtype =DEV_X16 ;break ;case 0x3 : - csrow->dtype =DEV_X4 ; + dimm->dtype =DEV_X4 ;break ;default : - csrow->dtype =DEV_UNKNOWN ; + dimm->dtype =DEV_UNKNOWN ;break ; } - csrow->edac_mode =EDAC_SECDED ; + dimm->edac_mode =EDAC_SECDED ; }static int __devinit mv64x60_mc_err_probe (struct platform_device *pdev)
drivers/edac/pasemi_edac.c +6 -4
@@ -135,11 +135,13 @@ static int pasemi_edac_init_csrows(struct mem_ctl_info *mci, enum edac_type edac_mode) {struct csrow_info *csrow; +struct dimm_info *dimm;u32 rankcfg;int index;for (index =0 ; index < mci->nr_csrows; index++) { csrow = &mci->csrows[index]; + dimm = csrow->channels[0 ].dimm; pci_read_config_dword(pdev, MCDRAM_RANKCFG + (index * 12),
@@ -177,10 +179,10 @@ static int pasemi_edac_init_csrows(struct mem_ctl_info *mci, csrow->last_page = csrow->first_page + csrow->nr_pages -1 ; last_page_in_mmc += csrow->nr_pages; csrow->page_mask =0 ; - csrow->grain =PASEMI_EDAC_ERROR_GRAIN ; - csrow->mtype =MEM_DDR ; - csrow->dtype =DEV_UNKNOWN ; - csrow->edac_mode = edac_mode; + dimm->grain =PASEMI_EDAC_ERROR_GRAIN ; + dimm->mtype =MEM_DDR ; + dimm->dtype =DEV_UNKNOWN ; + dimm->edac_mode = edac_mode; }return 0 ; }
drivers/edac/ppc4xx_edac.c +8 -5
@@ -895,7 +895,7 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)enum mem_type mtype;enum dev_type dtype;enum edac_type edac_mode; -int row; +int row, j;u32 mbxcf, size;static u32 ppc4xx_last_page;
@@ -975,15 +975,18 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)* possible values would be the PLB width (16), the * page size (PAGE_SIZE) or the memory width (2 or 4). */ +for (j =0 ; j < csi->nr_channels; j++) { +struct dimm_info *dimm = csi->channels[j].dimm; - csi->grain =1 ; + dimm->grain =1 ; - csi->mtype = mtype; - csi->dtype = dtype; + dimm->mtype = mtype; + dimm->dtype = dtype; - csi->edac_mode = edac_mode; + dimm->edac_mode = edac_mode; ppc4xx_last_page += csi->nr_pages; + } } done:
drivers/edac/r82600_edac.c +6 -4
@@ -216,6 +216,7 @@ static void r82600_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, u8 dramcr) {struct csrow_info *csrow; +struct dimm_info *dimm;int index;u8 drbar;/* SDRAM Row Boundary Address Register */ u32 row_high_limit, row_high_limit_last;
@@ -227,6 +228,7 @@ static void r82600_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev,for (index =0 ; index < mci->nr_csrows; index++) { csrow = &mci->csrows[index]; + dimm = csrow->channels[0 ].dimm;/* find the DRAM Chip Select Base address and mask */ pci_read_config_byte (pdev,R82600_DRBA + index, &drbar);
@@ -250,13 +252,13 @@ static void r82600_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, csrow->nr_pages = csrow->last_page - csrow->first_page +1 ;/* Error address is top 19 bits - so granularity is * * 14 bits */ - csrow->grain =1 <<14 ; - csrow->mtype = reg_sdram ?MEM_RDDR :MEM_DDR ; + dimm->grain =1 <<14 ; + dimm->mtype = reg_sdram ?MEM_RDDR :MEM_DDR ;/* FIXME - check that this is unknowable with this chipset */ - csrow->dtype =DEV_UNKNOWN ; + dimm->dtype =DEV_UNKNOWN ;/* Mode is global on 82600 */ - csrow->edac_mode = ecc_on ?EDAC_SECDED :EDAC_NONE ; + dimm->edac_mode = ecc_on ?EDAC_SECDED :EDAC_NONE ; row_high_limit_last = row_high_limit; } }
drivers/edac/sb_edac.c +9 -9
@@ -637,22 +637,18 @@ static int get_dimm_config(struct mem_ctl_info *mci) pvt->sbridge_dev->mc, i, j, size, npages, banks, ranks, rows, cols); - csr = &mci->csrows[csrow]; +/* +* Fake stuff. This controller doesn't see +* csrows. +*/ + csr = &mci->csrows[csrow]; csr->first_page = last_page; csr->last_page = last_page + npages -1 ; - csr->page_mask =0UL ;/* Unused */ csr->nr_pages = npages; - csr->grain =32 ; csr->csrow_idx = csrow; - csr->dtype = (banks ==8 ) ?DEV_X8 :DEV_X4 ; - csr->ce_count =0 ; - csr->ue_count =0 ; - csr->mtype = mtype; - csr->edac_mode = mode; csr->nr_channels =1 ; csr->channels[0 ].chan_idx = i; - csr->channels[0 ].ce_count =0 ; pvt->csrow_map[i][j] = csrow; last_page += npages; csrow++;
@@ -660,6 +656,10 @@ static int get_dimm_config(struct mem_ctl_info *mci) csr->channels[0 ].dimm = dimm; dimm->location.mc_channel = i; dimm->location.mc_dimm_number = j; + dimm->grain =32 ; + dimm->dtype = (banks ==8 ) ?DEV_X8 :DEV_X4 ; + dimm->mtype = mtype; + dimm->edac_mode = mode;snprintf (dimm->label,sizeof (dimm->label),"CPU_SrcID#%u_Channel#%u_DIMM#%u" , pvt->sbridge_dev->source_id, i, j);
drivers/edac/tile_edac.c +7 -6
@@ -84,6 +84,7 @@ static int __devinit tile_edac_init_csrows(struct mem_ctl_info *mci)struct csrow_info *csrow = &mci->csrows[0 ];struct tile_edac_priv *priv = mci->pvt_info;struct mshim_mem_info mem_info; +struct dimm_info *dimm = csrow->channels[0 ].dimm; if (hv_dev_pread(priv->hv_devhdl, 0, (HV_VirtAddr)&mem_info, sizeof(struct mshim_mem_info), MSHIM_MEM_INFO_OFF) !=
@@ -93,16 +94,16 @@ static int __devinit tile_edac_init_csrows(struct mem_ctl_info *mci) }if (mem_info.mem_ecc) - csrow->edac_mode =EDAC_SECDED ; + dimm->edac_mode =EDAC_SECDED ;else - csrow->edac_mode =EDAC_NONE ; + dimm->edac_mode =EDAC_NONE ;switch (mem_info.mem_type) {case DDR2 : - csrow->mtype =MEM_DDR2 ; + dimm->mtype =MEM_DDR2 ;break ;case DDR3 : - csrow->mtype =MEM_DDR3 ; + dimm->mtype =MEM_DDR3 ;break ;default :
@@ -112,8 +113,8 @@ static int __devinit tile_edac_init_csrows(struct mem_ctl_info *mci) csrow->first_page =0 ; csrow->nr_pages = mem_info.mem_size >>PAGE_SHIFT ; csrow->last_page = csrow->first_page + csrow->nr_pages -1 ; - csrow->grain =TILE_EDAC_ERROR_GRAIN ; - csrow->dtype =DEV_UNKNOWN ; + dimm->grain =TILE_EDAC_ERROR_GRAIN ; + dimm->dtype =DEV_UNKNOWN ;return 0 ; }
drivers/edac/x38_edac.c +9 -8
@@ -317,7 +317,7 @@ static unsigned long drb_to_nr_pages(static int x38_probe1 (struct pci_dev *pdev,int dev_idx) {int rc; -int i; +int i, j;struct mem_ctl_info *mci =NULL ;unsigned long last_page;u16 drbs[X38_CHANNELS ][X38_RANKS_PER_CHANNEL ];
@@ -372,20 +372,21 @@ static int x38_probe1(struct pci_dev *pdev, int dev_idx) i /X38_RANKS_PER_CHANNEL , i % X38_RANKS_PER_CHANNEL); -if (nr_pages ==0 ) { - csrow->mtype =MEM_EMPTY ; +if (nr_pages ==0 )continue ; - } csrow->first_page = last_page +1 ; last_page += nr_pages; csrow->last_page = last_page; csrow->nr_pages = nr_pages; - csrow->grain = nr_pages <<PAGE_SHIFT ; - csrow->mtype =MEM_DDR2 ; - csrow->dtype =DEV_UNKNOWN ; - csrow->edac_mode =EDAC_UNKNOWN ; +for (j =0 ; j < x38_channel_num; j++) { +struct dimm_info *dimm = csrow->channels[j].dimm; + dimm->grain = nr_pages <<PAGE_SHIFT ; + dimm->mtype =MEM_DDR2 ; + dimm->dtype =DEV_UNKNOWN ; + dimm->edac_mode =EDAC_UNKNOWN ; + } }x38_clear_error_info (mci);
include/linux/edac.h +13 -8
@@ -270,6 +270,13 @@ struct dimm_info { } location;struct kobject kobj;/* sysfs kobject for this csrow */ struct mem_ctl_info *mci;/* the parent */ + +u32 grain;/* granularity of reported error in bytes */ +enum dev_type dtype;/* memory device type */ +enum mem_type mtype;/* memory dimm type */ +enum edac_type edac_mode;/* EDAC mode for this dimm */ + +u32 ce_count;/* Correctable Errors for this dimm */ };struct csrow_channel_info {
@@ -280,19 +287,17 @@ struct csrow_channel_info { };struct csrow_info { -unsigned long first_page;/* first page number in dimm */ -unsigned long last_page;/* last page number in dimm */ +unsigned long first_page;/* first page number in csrow */ +unsigned long last_page;/* last page number in csrow */ +u32 nr_pages;/* number of pages in csrow */ unsigned long page_mask;/* used for interleaving - * 0UL for non intlv */ -u32 nr_pages;/* number of pages in csrow */ -u32 grain;/* granularity of reported error in bytes */ -int csrow_idx;/* the chip-select row */ -enum dev_type dtype;/* memory device type */ +int csrow_idx;/* the chip-select row */ +u32 ue_count;/* Uncorrectable Errors for this csrow */ u32 ce_count;/* Correctable Errors for this csrow */ -enum mem_type mtype;/* memory csrow type */ -enum edac_type edac_mode;/* EDAC mode for this csrow */ +struct mem_ctl_info *mci;/* the parent */ struct kobject kobj;/* sysfs kobject for this csrow */
Signature · 1 line
1.7.8
RFC PATCH v2 13/16 edac: move nr_pages to dimm struct
In reply to Mauro Carvalho ChehabThe number of pages is a dimm property. Move it to the dimm struct. After this change, it is possible to add sysfs nodes for the DIMM's that will properly represent the physical socket characteristics.
--- drivers/edac/amd64_edac.c | 12 +++------ drivers/edac/amd76x_edac.c | 6 ++-- drivers/edac/cell_edac.c | 8 ++++-- drivers/edac/cpc925_edac.c | 8 ++++-- drivers/edac/e752x_edac.c | 6 +++- drivers/edac/e7xxx_edac.c | 5 ++- drivers/edac/edac_mc.c | 29 +++++++++++++--------- drivers/edac/edac_mc_sysfs.c | 52 ++++++++++++++++++++++++++++++---------- drivers/edac/i3000_edac.c | 6 +++- drivers/edac/i3200_edac.c | 3 +- drivers/edac/i5000_edac.c | 14 ++++++---- drivers/edac/i5100_edac.c | 10 +------- drivers/edac/i5400_edac.c | 3 +- drivers/edac/i7300_edac.c | 17 ++---------- drivers/edac/i7core_edac.c | 9 +----- drivers/edac/i82443bxgx_edac.c | 2 +- drivers/edac/i82860_edac.c | 2 +- drivers/edac/i82875p_edac.c | 5 ++- drivers/edac/i82975x_edac.c | 6 +++- drivers/edac/mpc85xx_edac.c | 3 +- drivers/edac/mv64x60_edac.c | 3 +- drivers/edac/pasemi_edac.c | 14 +++++----- drivers/edac/ppc4xx_edac.c | 5 ++- drivers/edac/r82600_edac.c | 3 +- drivers/edac/sb_edac.c | 5 +--- drivers/edac/tile_edac.c | 2 +- drivers/edac/x38_edac.c | 4 +- include/linux/edac.h | 10 ++++--- 28 files changed, 135 insertions(+), 117 deletions(-)
drivers/edac/amd64_edac.c +4 -8
@@ -2126,14 +2126,8 @@ static u32 amd64_csrow_nr_pages(struct amd64_pvt *pvt, u8 dct, int csrow_nr) nr_pages = pvt->ops->dbam_to_cs (pvt, dct, cs_mode) << (20 -PAGE_SHIFT ); -/* -* If dual channel then double the memory size of single channel. -* Channel count is 1 or 2 -*/ - nr_pages <<= (pvt->channel_count -1 ); -debugf0 (" (csrow=%d) DBAM map index= %d\n" , csrow_nr, cs_mode); -debugf0 (" nr_pages= %u channel-count = %d\n" , +debugf0 (" nr_pages/dimm= %u channel-count = %d\n" , nr_pages, pvt->channel_count);return nr_pages;
@@ -2174,7 +2168,7 @@ static int init_csrows(struct mem_ctl_info *mci) i, pvt->mc_node_id); empty =0 ; - csrow->nr_pages =amd64_csrow_nr_pages (pvt,0 , i); + nr_pages =amd64_csrow_nr_pages (pvt,0 , i);get_cs_base_and_mask (pvt, i,0 , &base, &mask);/* 8 bytes of resolution */
@@ -2192,6 +2186,8 @@ static int init_csrows(struct mem_ctl_info *mci)for (j =0 ; j < pvt->channel_count; j++) { csrow->channels[j].dimm->mtype = mtype; csrow->channels[j].dimm->edac_mode = edac_mode; + csrow->channels[j].dimm->n_pages = npages; + }debugf1 (" for MC node %d csrow %d:\n" , pvt->mc_node_id, i);
drivers/edac/amd76x_edac.c +3 -3
@@ -205,10 +205,10 @@ static void amd76x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, mba_mask = ((mba &0xff80 ) <<16 ) |0x7fffffUL ;pci_read_config_dword (pdev,AMD76X_DRAM_MODE_STATUS , &dms); csrow->first_page = mba_base >>PAGE_SHIFT ; - csrow->nr_pages = (mba_mask +1 ) >>PAGE_SHIFT ; - csrow->last_page = csrow->first_page + csrow->nr_pages -1 ; + dimm->nr_pages = (mba_mask +1 ) >>PAGE_SHIFT ; + csrow->last_page = csrow->first_page + dimm->nr_pages -1 ; csrow->page_mask = mba_mask >>PAGE_SHIFT ; - dimm->grain = csrow->nr_pages <<PAGE_SHIFT ; + dimm->grain = dimm->nr_pages <<PAGE_SHIFT ; dimm->mtype =MEM_RDDR ; dimm->dtype = ((dms >> index) &0x1 ) ?DEV_X4 :DEV_UNKNOWN ; dimm->edac_mode = edac_mode;
drivers/edac/cell_edac.c +5 -3
@@ -128,6 +128,7 @@ static void __devinit cell_edac_init_csrows(struct mem_ctl_info *mci)struct cell_edac_priv *priv = mci->pvt_info;struct device_node *np;int j; +u32 nr_pages;for (np =NULL ; (np =of_find_node_by_name (np,"memory" )) !=NULL ;) {
@@ -142,19 +143,20 @@ static void __devinit cell_edac_init_csrows(struct mem_ctl_info *mci)if (of_node_to_nid (np) != priv->node)continue ; csrow->first_page = r.start >>PAGE_SHIFT ; - csrow->nr_pages =resource_size (&r) >>PAGE_SHIFT ; - csrow->last_page = csrow->first_page + csrow->nr_pages -1 ; + nr_pages =resource_size (&r) >>PAGE_SHIFT ; + csrow->last_page = csrow->first_page + nr_pages -1 ;for (j =0 ; j < csrow->nr_channels; j++) { dimm = csrow->channels[j].dimm; dimm->mtype =MEM_XDR ; dimm->edac_mode =EDAC_SECDED ; + dimm->nr_pages = nr_pages / csrow->nr_channels; }dev_dbg (mci->dev,"Initialized on node %d, chanmask=0x%x," " first_page=0x%lx, nr_pages=0x%x\n" , priv->node, priv->chanmask, - csrow->first_page, csrow->nr_pages); + csrow->first_page, dimm->nr_pages);break ; } }
drivers/edac/cpc925_edac.c +5 -3
@@ -332,7 +332,7 @@ static void cpc925_init_csrows(struct mem_ctl_info *mci)struct dimm_info *dimm;int index, j;u32 mbmr, mbbar, bba; -unsigned long row_size, last_nr_pages =0 ; +unsigned long row_size, nr_pages, last_nr_pages =0 ;get_total_mem (pdata);
@@ -351,12 +351,14 @@ static void cpc925_init_csrows(struct mem_ctl_info *mci) row_size = bba * (1UL <<28 );/* 256M */ csrow->first_page = last_nr_pages; - csrow->nr_pages = row_size >>PAGE_SHIFT ; - csrow->last_page = csrow->first_page + csrow->nr_pages -1 ; + nr_pages = row_size >>PAGE_SHIFT ; + csrow->last_page = csrow->first_page + nr_pages -1 ; last_nr_pages = csrow->last_page +1 ;for (j =0 ; j < csrow->nr_channels; j++) { dimm = csrow->channels[j].dimm; + + dimm->nr_pages = nr_pages / csrow->nr_channels; dimm->mtype =MEM_RDDR ; dimm->edac_mode =EDAC_SECDED ;
drivers/edac/e752x_edac.c +4 -2
@@ -1044,7 +1044,7 @@ static void e752x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev,int drc_drbg;/* DRB granularity 0=64mb, 1=128mb */ int drc_ddim;/* DRAM Data Integrity Mode 0=none, 2=edac */ u8 value; -u32 dra, drc, cumul_size, i; +u32 dra, drc, cumul_size, i, nr_pages; dra =0 ;for (index =0 ; index <4 ; index++) {
@@ -1078,11 +1078,13 @@ static void e752x_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, csrow->first_page = last_cumul_size; csrow->last_page = cumul_size -1 ; - csrow->nr_pages = cumul_size - last_cumul_size; + nr_pages = cumul_size - last_cumul_size; last_cumul_size = cumul_size;for (i =0 ; i < drc_chan +1 ; i++) {struct dimm_info *dimm = csrow->channels[i].dimm; + + dimm->nr_pages = nr_pages / drc_chan; dimm->grain =1 <<12 ;/* 4KiB - resolution of CELOG */ dimm->mtype =MEM_RDDR ;/* only one type supported */ dimm->dtype = mem_dev ?DEV_X4 :DEV_X8 ;
drivers/edac/e7xxx_edac.c +3 -2
@@ -349,7 +349,7 @@ static void e7xxx_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev,unsigned long last_cumul_size;int index, j;u8 value; -u32 dra, cumul_size; +u32 dra, cumul_size, nr_pages;int drc_chan, drc_drbg, drc_ddim, mem_dev;struct csrow_info *csrow;struct dimm_info *dimm;
@@ -380,12 +380,13 @@ static void e7xxx_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, csrow->first_page = last_cumul_size; csrow->last_page = cumul_size -1 ; - csrow->nr_pages = cumul_size - last_cumul_size; + nr_pages = cumul_size - last_cumul_size; last_cumul_size = cumul_size;for (j =0 ; j < drc_chan +1 ; j++) { dimm = csrow->channels[j].dimm; + dimm->nr_pages = nr_pages / drc_chan; dimm->grain =1 <<12 ;/* 4KiB - resolution of CELOG */ dimm->mtype =MEM_RDDR ;/* only one type supported */ dimm->dtype = mem_dev ?DEV_X4 :DEV_X8 ;
drivers/edac/edac_mc.c +17 -12
@@ -47,22 +47,23 @@ static void edac_mc_dump_channel(struct csrow_channel_info *chan) {debugf4 ("\tchannel = %p\n" , chan);debugf4 ("\tchannel->chan_idx = %d\n" , chan->chan_idx); -debugf4 ("\tchannel->ce_count = %d\n" , chan->dimm->ce_count); -debugf4 ("\tchannel->label = '%s'\n" , chan->dimm->label);debugf4 ("\tchannel->csrow = %p\n\n" , chan->csrow); + +debugf4 ("\tdimm->ce_count = %d\n" , chan->dimm->ce_count); +debugf4 ("\tdimm->label = '%s'\n" , chan->dimm->label); +debugf4 ("\tdimm->nr_pages = 0x%x\n" , chan->dimm->nr_pages); }static void edac_mc_dump_csrow (struct csrow_info *csrow) {debugf4 ("\tcsrow = %p\n" , csrow);debugf4 ("\tcsrow->csrow_idx = %d\n" , csrow->csrow_idx); -debugf4 ("\tcsrow->first_page = 0x%lx\n" , csrow->first_page); -debugf4 ("\tcsrow->last_page = 0x%lx\n" , csrow->last_page); -debugf4 ("\tcsrow->page_mask = 0x%lx\n" , csrow->page_mask); -debugf4 ("\tcsrow->nr_pages = 0x%x\n" , csrow->nr_pages);debugf4 ("\tcsrow->nr_channels = %d\n" , csrow->nr_channels);debugf4 ("\tcsrow->channels = %p\n" , csrow->channels);debugf4 ("\tcsrow->mci = %p\n\n" , csrow->mci); +debugf4 ("\tcsrow->first_page = 0x%lx\n" , csrow->first_page); +debugf4 ("\tcsrow->last_page = 0x%lx\n" , csrow->last_page); +debugf4 ("\tcsrow->page_mask = 0x%lx\n" , csrow->page_mask); }static void edac_mc_dump_mci (struct mem_ctl_info *mci)
@@ -663,15 +664,19 @@ static void edac_mc_scrub_block(unsigned long page, unsigned long offset,int edac_mc_find_csrow_by_page (struct mem_ctl_info *mci,unsigned long page) {struct csrow_info *csrows = mci->csrows; -int row, i; +int row, i, j, n;debugf1 ("MC%d: %s(): 0x%lx\n" , mci->mc_idx, __func__, page); row =-1 ;for (i =0 ; i < mci->nr_csrows; i++) {struct csrow_info *csrow = &csrows[i]; - -if (csrow->nr_pages ==0 ) + n =0 ; +for (j =0 ; j < csrow->nr_channels; j++) { +struct dimm_info *dimm = csrow->channels[j].dimm; + n += dimm->nr_pages; + } +if (n ==0 )continue ; debugf3("MC%d: %s(): first(0x%lx) page(0x%lx) last(0x%lx) "
@@ -680,9 +685,9 @@ int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci, unsigned long page) csrow->page_mask);if ((page >= csrow->first_page) && - (page <= csrow->last_page) && - ((page & csrow->page_mask) == - (csrow->first_page & csrow->page_mask))) { + (page <= csrow->last_page) && + ((page & csrow->page_mask) == + (csrow->first_page & csrow->page_mask))) { row = i;break ; }
drivers/edac/edac_mc_sysfs.c +39 -13
105 lines not on this page · raw message
drivers/edac/i3000_edac.c +4 -2
@@ -306,7 +306,7 @@ static int i3000_probe1(struct pci_dev *pdev, int dev_idx)int rc;int i, j;struct mem_ctl_info *mci =NULL ; -unsigned long last_cumul_size; +unsigned long last_cumul_size, nr_pages;int interleaved, nr_channels;unsigned char dra[I3000_RANKS /2 ], drb[I3000_RANKS ];unsigned char *c0dra = dra, *c1dra = &dra[I3000_RANKS_PER_CHANNEL /2 ];
@@ -391,11 +391,13 @@ static int i3000_probe1(struct pci_dev *pdev, int dev_idx) csrow->first_page = last_cumul_size; csrow->last_page = cumul_size -1 ; - csrow->nr_pages = cumul_size - last_cumul_size; + nr_pages = cumul_size - last_cumul_size; last_cumul_size = cumul_size;for (j =0 ; j < nr_channels; j++) {struct dimm_info *dimm = csrow->channels[j].dimm; + + dimm->nr_pages = nr_pages / nr_channels; dimm->grain =I3000_DEAP_GRAIN ; dimm->mtype =MEM_DDR2 ; dimm->dtype =DEV_UNKNOWN ;
drivers/edac/i3200_edac.c +1 -2
@@ -387,11 +387,10 @@ static int i3200_probe1(struct pci_dev *pdev, int dev_idx)if (nr_pages ==0 )continue ; - csrow->nr_pages = nr_pages; -for (j =0 ; j < nr_channels; j++) {struct dimm_info *dimm = csrow->channels[j].dimm; + dimm->nr_pages = nr_pages / nr_channels; dimm->grain = nr_pages <<PAGE_SHIFT ; dimm->mtype =MEM_DDR2 ; dimm->dtype =DEV_UNKNOWN ;
drivers/edac/i5000_edac.c +8 -6
@@ -1236,6 +1236,7 @@ static int i5000_init_csrows(struct mem_ctl_info *mci) {struct i5000_pvt *pvt;struct csrow_info *p_csrow; +struct dimm_info *dimm;int empty, channel_count;int max_csrows;int mtr, mtr1;
@@ -1265,21 +1266,22 @@ static int i5000_init_csrows(struct mem_ctl_info *mci) csrow_megs =0 ;for (channel =0 ; channel < pvt->maxch; channel++) { + dimm = p_csrow->channels[channel].dimm; csrow_megs += pvt->dimm_info[csrow][channel].megabytes; - p_csrow->channels[channel].dimm->grain =8 ; + dimm->grain =8 ;/* Assume DDR2 for now */ - p_csrow->channels[channel].dimm->mtype =MEM_FB_DDR2 ; + dimm->mtype =MEM_FB_DDR2 ;/* ask what device type on this row */ if (MTR_DRAM_WIDTH (mtr)) - p_csrow->channels[channel].dimm->dtype =DEV_X8 ; + dimm->dtype =DEV_X8 ;else - p_csrow->channels[channel].dimm->dtype =DEV_X4 ; + dimm->dtype =DEV_X4 ; - p_csrow->channels[channel].dimm->edac_mode =EDAC_S8ECD8ED ; + dimm->edac_mode =EDAC_S8ECD8ED ; + dimm->nr_pages = (csrow_megs <<8 ) / pvt->maxch; } - p_csrow->nr_pages = csrow_megs <<8 ; empty =0 ; }
drivers/edac/i5100_edac.c +1 -9
@@ -861,18 +861,10 @@ static void __devinit i5100_init_csrows(struct mem_ctl_info *mci)if (!npages)continue ; -/* -* FIXME: these two are totally bogus -- I don't see how to -* map them correctly to this structure... -*/ - mci->csrows[i].nr_pages = npages; - mci->csrows[i].csrow_idx = i; - mci->csrows[i].mci = mci; - mci->csrows[i].nr_channels =1 ; - mci->csrows[i].channels[0 ].csrow = mci->csrows + i; total_pages += npages; mci->csrows[i].channels[0 ].dimm = dimm; + dimm->nr_pages = npages; dimm->location.mc_channel = chan; dimm->location.mc_dimm_number = rank; dimm->grain =32 ;
drivers/edac/i5400_edac.c +1 -2
@@ -1165,8 +1165,7 @@ static int i5400_init_csrows(struct mem_ctl_info *mci)for (channel =0 ; channel < pvt->maxch; channel++) csrow_megs += pvt->dimm_info[csrow][channel].megabytes; - p_csrow->nr_pages = csrow_megs <<8 ; - + dimm->nr_pages = csrow_megs <<8 ; dimm->location.mc_channel = channel; dimm->location.mc_dimm_number = csrow / pvt->maxch; dimm->grain =8 ;
drivers/edac/i7300_edac.c +3 -14
@@ -617,9 +617,7 @@ static void i7300_enable_error_reporting(struct mem_ctl_info *mci)static int decode_mtr (struct i7300_pvt *pvt,int slot,int ch,int branch,struct i7300_dimm_info *dinfo, -struct csrow_info *p_csrow, -struct dimm_info *dimm, -u32 *nr_pages) +struct dimm_info *dimm) {int mtr, ans, addrBits, channel;
@@ -651,7 +649,6 @@ static int decode_mtr(struct i7300_pvt *pvt, addrBits -=3 ;/* 8 bits per bytes */ dinfo->megabytes =1 << addrBits; - *nr_pages = dinfo->megabytes <<8 ;debugf2 ("\t\tWIDTH: x%d\n" ,MTR_DRAM_WIDTH (mtr));
@@ -664,8 +661,6 @@ static int decode_mtr(struct i7300_pvt *pvt,debugf2 ("\t\tNUMCOL: %s\n" , numcol_toString[MTR_DIMM_COLS (mtr)]);debugf2 ("\t\tSIZE: %d MB\n" , dinfo->megabytes); - p_csrow->csrow_idx = slot; -/* * The type of error detection actually depends of the * mode of operation. When it is just one single memory chip, at
@@ -675,6 +670,7 @@ static int decode_mtr(struct i7300_pvt *pvt,* See datasheet Sections 7.3.6 to 7.3.8 */ + dimm->nr_pages =MiB_TO_PAGES (dinfo->megabytes); dimm->grain =8 ; dimm->mtype =MEM_FB_DDR2 ;if (IS_SINGLE_MODE (pvt->mc_settings_a)) {
@@ -774,7 +770,6 @@ static int i7300_init_csrows(struct mem_ctl_info *mci) {struct i7300_pvt *pvt;struct i7300_dimm_info *dinfo; -struct csrow_info *p_csrow;int rc = -ENODEV ;int mtr;int ch, branch, slot, channel;
@@ -807,7 +802,6 @@ static int i7300_init_csrows(struct mem_ctl_info *mci) dimm = mci->dimms; mci->dimm_loc_type =DIMM_LOC_MC_CHANNEL ; mci->nr_dimms =0 ; - nr_pages =0 ;for (slot =0 ; slot <MAX_SLOTS ; slot++) {int where = mtr_regs[slot];for (branch =0 ; branch <MAX_BRANCHES ; branch++) {
@@ -818,21 +812,16 @@ static int i7300_init_csrows(struct mem_ctl_info *mci)int channel =to_channel (ch, branch); dinfo = &pvt->dimm_info[slot][channel]; - p_csrow = &mci->csrows[slot]; dimm->location.mc_channel = channel; dimm->location.mc_dimm_number = slot; mtr =decode_mtr (pvt, slot, ch, branch, - dinfo, p_csrow, dimm, - &nr_pages); + dinfo, dimm);/* if no DIMMS on this row, continue */ if (!MTR_DIMMS_PRESENT (mtr))continue ; -/* Update per_csrow memory count */ - p_csrow->nr_pages += nr_pages; - rc =0 ; mci->nr_dimms++;
drivers/edac/i7core_edac.c +2 -7
@@ -718,16 +718,11 @@ static int get_dimm_config(struct mem_ctl_info *mci) npages =MiB_TO_PAGES (size); csr = &mci->csrows[csrow]; - csr->nr_pages = npages; - - csr->csrow_idx = csrow; - csr->nr_channels =1 ; - - csr->channels[0 ].chan_idx = i; - csr->channels[0 ].ce_count =0 ; pvt->csrow_map[i][j] = csrow; + dimm->nr_pages = npages; +switch (banks) {case 4 : dimm->dtype =DEV_X4 ;
drivers/edac/i82443bxgx_edac.c +1 -1
@@ -220,7 +220,7 @@ static void i82443bxgx_init_csrows(struct mem_ctl_info *mci, row_base = row_high_limit_last; csrow->first_page = row_base >>PAGE_SHIFT ; csrow->last_page = (row_high_limit >>PAGE_SHIFT ) -1 ; - csrow->nr_pages = csrow->last_page - csrow->first_page +1 ; + dimm->nr_pages = csrow->last_page - csrow->first_page +1 ;/* EAP reports in 4kilobyte granularity [61] */ dimm->grain =1 <<12 ; dimm->mtype = mtype;
drivers/edac/i82860_edac.c +1 -1
@@ -167,7 +167,7 @@ static void i82860_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev) csrow->first_page = last_cumul_size; csrow->last_page = cumul_size -1 ; - csrow->nr_pages = cumul_size - last_cumul_size; + dimm->nr_pages = cumul_size - last_cumul_size; last_cumul_size = cumul_size; dimm->grain =1 <<12 ;/* I82860_EAP has 4KiB reolution */ dimm->mtype =MEM_RMBS ;
drivers/edac/i82875p_edac.c +3 -2
@@ -347,7 +347,7 @@ static void i82875p_init_csrows(struct mem_ctl_info *mci,unsigned long last_cumul_size;u8 value;u32 drc_ddim;/* DRAM Data Integrity Mode 0=none,2=edac */ -u32 cumul_size; +u32 cumul_size, nr_pages;int index, j; drc_ddim = (drc >>18 ) &0x1 ;
@@ -371,12 +371,13 @@ static void i82875p_init_csrows(struct mem_ctl_info *mci, csrow->first_page = last_cumul_size; csrow->last_page = cumul_size -1 ; - csrow->nr_pages = cumul_size - last_cumul_size; + nr_pages = cumul_size - last_cumul_size; last_cumul_size = cumul_size;for (j =0 ; j < nr_chans; j++) { dimm = csrow->channels[j].dimm; + dimm->nr_pages = nr_pages / nr_chans; dimm->grain =1 <<12 ;/* I82875P_EAP has 4KiB reolution */ dimm->mtype =MEM_DDR ; dimm->dtype =DEV_UNKNOWN ;
drivers/edac/i82975x_edac.c +4 -2
@@ -362,7 +362,7 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci,struct csrow_info *csrow;unsigned long last_cumul_size;u8 value; -u32 cumul_size; +u32 cumul_size, nr_pages;int index, chan;struct dimm_info *dimm;enum dev_type dtype;
@@ -397,6 +397,7 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci,debugf3 ("%s(): (%d) cumul_size 0x%x\n" , __func__, index, cumul_size); + nr_pages = cumul_size - last_cumul_size;/* * Initialise dram labels * index values:
@@ -406,6 +407,8 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci, dtype =i82975x_dram_type (mch_window, index);for (chan =0 ; chan < csrow->nr_channels; chan++) { mci->csrows[index].channels[chan].dimm = dimm; + + dimm->nr_pages = nr_pages / csrow->nr_channels; dimm->location.csrow = index; dimm->location.csrow_channel = chan; strncpy(csrow->channels[chan].dimm->label,
@@ -424,7 +427,6 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci, csrow->first_page = last_cumul_size; csrow->last_page = cumul_size -1 ; - csrow->nr_pages = cumul_size - last_cumul_size; last_cumul_size = cumul_size; } }
drivers/edac/mpc85xx_edac.c +2 -1
@@ -947,7 +947,8 @@ static void __devinit mpc85xx_init_csrows(struct mem_ctl_info *mci) csrow->first_page = start; csrow->last_page = end; - csrow->nr_pages = end +1 - start; + + dimm->nr_pages = end +1 - start; dimm->grain =8 ; dimm->mtype = mtype; dimm->dtype =DEV_UNKNOWN ;
drivers/edac/mv64x60_edac.c +2 -1
@@ -667,7 +667,8 @@ static void mv64x60_init_csrows(struct mem_ctl_info *mci, csrow = &mci->csrows[0 ]; dimm = csrow->channels[0 ].dimm; - csrow->nr_pages = pdata->total_mem >>PAGE_SHIFT ; + + dimm->nr_pages = pdata->total_mem >>PAGE_SHIFT ; dimm->grain =8 ; dimm->mtype = (ctl &MV64X60_SDRAM_REGISTERED ) ?MEM_RDDR :MEM_DDR ;
drivers/edac/pasemi_edac.c +7 -7
@@ -153,20 +153,20 @@ static int pasemi_edac_init_csrows(struct mem_ctl_info *mci,switch ((rankcfg &MCDRAM_RANKCFG_TYPE_SIZE_M ) >>MCDRAM_RANKCFG_TYPE_SIZE_S ) {case 0 : - csrow->nr_pages =128 << (20 -PAGE_SHIFT ); + dimm->nr_pages =128 << (20 -PAGE_SHIFT );break ;case 1 : - csrow->nr_pages =256 << (20 -PAGE_SHIFT ); + dimm->nr_pages =256 << (20 -PAGE_SHIFT );break ;case 2 :case 3 : - csrow->nr_pages =512 << (20 -PAGE_SHIFT ); + dimm->nr_pages =512 << (20 -PAGE_SHIFT );break ;case 4 : - csrow->nr_pages =1024 << (20 -PAGE_SHIFT ); + dimm->nr_pages =1024 << (20 -PAGE_SHIFT );break ;case 5 : - csrow->nr_pages =2048 << (20 -PAGE_SHIFT ); + dimm->nr_pages =2048 << (20 -PAGE_SHIFT );break ;default : edac_mc_printk(mci, KERN_ERR,
@@ -176,8 +176,8 @@ static int pasemi_edac_init_csrows(struct mem_ctl_info *mci, } csrow->first_page = last_page_in_mmc; - csrow->last_page = csrow->first_page + csrow->nr_pages -1 ; - last_page_in_mmc += csrow->nr_pages; + csrow->last_page = csrow->first_page + dimm->nr_pages -1 ; + last_page_in_mmc += dimm->nr_pages; csrow->page_mask =0 ; dimm->grain =PASEMI_EDAC_ERROR_GRAIN ; dimm->mtype =MEM_DDR ;
drivers/edac/ppc4xx_edac.c +3 -2
@@ -896,7 +896,7 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)enum dev_type dtype;enum edac_type edac_mode;int row, j; -u32 mbxcf, size; +u32 mbxcf, size, nr_pages;/* Establish the memory type and width */
@@ -947,7 +947,7 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)case SDRAM_MBCF_SZ_2GB :case SDRAM_MBCF_SZ_4GB :case SDRAM_MBCF_SZ_8GB : - csi->nr_pages =SDRAM_MBCF_SZ_TO_PAGES (size); + nr_pages =SDRAM_MBCF_SZ_TO_PAGES (size);break ;default : ppc4xx_edac_mc_printk(KERN_ERR, mci,
@@ -973,6 +973,7 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)for (j =0 ; j < csi->nr_channels; j++) {struct dimm_info *dimm = csi->channels[j].dimm; + dimm->nr_pages = nr_pages; dimm->grain =1 ; dimm->mtype = mtype;
drivers/edac/r82600_edac.c +2 -1
@@ -249,7 +249,8 @@ static void r82600_init_csrows(struct mem_ctl_info *mci, struct pci_dev *pdev, csrow->first_page = row_base >>PAGE_SHIFT ; csrow->last_page = (row_high_limit >>PAGE_SHIFT ) -1 ; - csrow->nr_pages = csrow->last_page - csrow->first_page +1 ; + + dimm->nr_pages = csrow->last_page - csrow->first_page +1 ;/* Error address is top 19 bits - so granularity is * * 14 bits */ dimm->grain =1 <<14 ;
drivers/edac/sb_edac.c +1 -4
@@ -643,15 +643,12 @@ static int get_dimm_config(struct mem_ctl_info *mci)* csrows. */ csr = &mci->csrows[csrow]; - csr->nr_pages = npages; - csr->csrow_idx = csrow; - csr->nr_channels =1 ; - csr->channels[0 ].chan_idx = i; pvt->csrow_map[i][j] = csrow; last_page += npages; csrow++; csr->channels[0 ].dimm = dimm; + dimm->nr_pages = npages; dimm->location.mc_channel = i; dimm->location.mc_dimm_number = j; dimm->grain =32 ;
drivers/edac/tile_edac.c +1 -1
@@ -110,7 +110,7 @@ static int __devinit tile_edac_init_csrows(struct mem_ctl_info *mci)return -1 ; } - csrow->nr_pages = mem_info.mem_size >>PAGE_SHIFT ; + dimm->nr_pages = mem_info.mem_size >>PAGE_SHIFT ; dimm->grain =TILE_EDAC_ERROR_GRAIN ; dimm->dtype =DEV_UNKNOWN ;
drivers/edac/x38_edac.c +2 -2
@@ -373,10 +373,10 @@ static int x38_probe1(struct pci_dev *pdev, int dev_idx)if (nr_pages ==0 )continue ; - csrow->nr_pages = nr_pages; -for (j =0 ; j < x38_channel_num; j++) {struct dimm_info *dimm = csrow->channels[j].dimm; + + dimm->nr_pages = nr_pages / x38_channel_num; dimm->grain = nr_pages <<PAGE_SHIFT ; dimm->mtype =MEM_DDR2 ; dimm->dtype =DEV_UNKNOWN ;
include/linux/edac.h +6 -4
@@ -276,6 +276,8 @@ struct dimm_info {enum mem_type mtype;/* memory dimm type */ enum edac_type edac_mode;/* EDAC mode for this dimm */ +u32 nr_pages;/* number of pages in csrow */ +u32 ce_count;/* Correctable Errors for this dimm */ };
@@ -287,13 +289,13 @@ struct csrow_channel_info { };struct csrow_info { +int csrow_idx;/* the chip-select row */ + +/* Used only by edac_mc_find_csrow_by_page() */ unsigned long first_page;/* first page number in csrow */ unsigned long last_page;/* last page number in csrow */ -u32 nr_pages;/* number of pages in csrow */ unsigned long page_mask;/* used for interleaving - -* 0UL for non intlv -*/ -int csrow_idx;/* the chip-select row */ +* 0UL for non intlv */ u32 ue_count;/* Uncorrectable Errors for this csrow */ u32 ce_count;/* Correctable Errors for this csrow */
Signature · 1 line
1.7.8
RFC PATCH v2 16/16 edac: Add an error scope logic
In reply to Mauro Carvalho ChehabThis patch is currently incomplete, but the idea here is to change the EDAC error calls to handle a scope var, that will be used when providing the error traces to userspace, and to increment a per-location counter.
--- include/linux/edac.h | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-)
include/linux/edac.h +27 -0
@@ -72,6 +72,33 @@ enum hw_event_mc_err_type { HW_EVENT_ERR_FATAL, }; +/** +* enum hw_event_error_scope - escope of a memory error +* @HW_EVENT_ERR_MC: error can be anywhere inside the MC +* @HW_EVENT_SCOPE_MC_BRANCH: error can be on any DIMM inside the branch +* @HW_EVENT_SCOPE_MC_CHANNEL: error can be on any DIMM inside the MC channel +* @HW_EVENT_SCOPE_MC_CSROW: error can be on any DIMM inside the csrow +* @HW_EVENT_SCOPE_MC_DIMM: error is on a specific DIMM +* +* Depending on the error detection algorithm, the memory topology and even +* the MC capabilities, some errors can't be attributed to just one DIMM, but +* to a group of memory sockets. Depending on where the error occurs, the +* EDAC core will increment the corresponding error count for that entity, +* and the upper entities. For example, assuming a system with 1 memory +* controller 2 branches, 2 MC channels and 4 DIMMS on it, if an error +* happens at channel 0, the error counts for channel 0, for branch 0 and +* for the memory controller 0 will be incremented. The DIMM error counts won't +* be incremented, as, in this example, the driver can't be 100% sure on what +* memory the error actually occurred. +*/ +enum hw_event_error_scope { +HW_EVENT_SCOPE_MC , +HW_EVENT_SCOPE_MC_BRANCH , +HW_EVENT_SCOPE_MC_CHANNEL , +HW_EVENT_SCOPE_MC_CSROW , +HW_EVENT_SCOPE_MC_CSROW_CHANNEL , +}; +/* memory types */ enum mem_type {MEM_EMPTY =0 ,/* Empty csrow */
Signature · 1 line
1.7.8
RFC PATCH v2 15/16 edac: DIMM location cleanup
In reply to Mauro Carvalho ChehabCleans up the DIMM location information:
- Remove it from the structure;
- make the location sysfs node code more flexible;
- cleans up the dimm code inside the drivers that fills the dimm location properties.
--- drivers/edac/edac_mc.c | 8 ++++-- drivers/edac/edac_mc_sysfs.c | 26 +++++++++++++++++------- drivers/edac/i5100_edac.c | 44 ++++++++++++++++++++--------------------- drivers/edac/i5400_edac.c | 32 ++++++++++++------------------ drivers/edac/i7300_edac.c | 15 ++++++++----- drivers/edac/i7core_edac.c | 19 +++++++---------- drivers/edac/i82975x_edac.c | 14 ++++-------- include/linux/edac.h | 27 ++++++++----------------- 8 files changed, 88 insertions(+), 97 deletions(-)
drivers/edac/edac_mc.c +5 -3
@@ -219,13 +219,15 @@ struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows,* as most drivers are based on such assumption. */ if (!mci->nr_dimms) { - mci->dimm_loc_type =DIMM_LOC_CSROW ; dimm = mci->dimms;for (row =0 ; row < mci->nr_csrows; row++) {for (chn =0 ; chn < mci->csrows[row].nr_channels; chn++) { mci->csrows[row].channels[chn].dimm = dimm; - dimm->location.csrow = row; - dimm->location.csrow_channel = chn; + dimm->mc_branch =-1 ; + dimm->mc_channel =-1 ; + dimm->mc_dimm_number =-1 ; + dimm->csrow = row; + dimm->csrow_channel = chn; dimm++; mci->nr_dimms++; }
drivers/edac/edac_mc_sysfs.c +18 -8
@@ -471,14 +471,24 @@ static const struct sysfs_ops dimmfs_ops = {/* show/store functions for DIMM Label attributes */ static ssize_t dimmdev_location_show (struct dimm_info *dimm,char *data) { -if (dimm->mci->dimm_loc_type ==DIMM_LOC_CSROW ) -return sprintf (data,"csrow %d, channel %d\n" , - dimm->location.csrow, - dimm->location.csrow_channel); -else -return sprintf (data,"channel %d, dimm %d\n" , - dimm->location.mc_channel, - dimm->location.mc_dimm_number); +char *p = data; + +if (dimm->mc_branch >=0 ) + p +=sprintf (p,"branch %d " , dimm->mc_branch); + +if (dimm->mc_channel >=0 ) + p +=sprintf (p,"channel %d " , dimm->mc_channel); + +if (dimm->csrow >=0 ) + p +=sprintf (p,"csrow %d " , dimm->csrow); + +if (dimm->csrow_channel >=0 ) + p +=sprintf (p,"cs_channel %d " , dimm->csrow_channel); + +if (dimm->mc_dimm_number >=0 ) + p +=sprintf (p,"dimm %d " , dimm->mc_dimm_number); + +return p - data; }static ssize_t dimmdev_label_show (struct dimm_info *dimm,char *data)
drivers/edac/i5100_edac.c +21 -23
56 lines not on this page · raw message
drivers/edac/i5400_edac.c +13 -19
@@ -1130,14 +1130,12 @@ static void i5400_get_mc_regs(struct mem_ctl_info *mci)static int i5400_init_csrows (struct mem_ctl_info *mci) {struct i5400_pvt *pvt; -struct csrow_info *p_csrow;int empty, channel_count;int max_csrows;int mtr; -int csrow_megs; +int size_mb;int channel; -int csrow; -struct dimm_info *dimm; +int slot; pvt = mci->pvt_info;
@@ -1146,34 +1144,30 @@ static int i5400_init_csrows(struct mem_ctl_info *mci) empty =1 ;/* Assume NO memory */ - dimm = mci->dimms; - mci->dimm_loc_type =DIMM_LOC_MC_CHANNEL ; - mci->nr_dimms =0 ; -for (csrow =0 ; csrow < max_csrows; csrow++) { - p_csrow = &mci->csrows[csrow]; +for (slot =0 ; slot < mci->nr_dimms; slot++) { +struct dimm_info *dimm = &mci->dimms[slot]; + channel = slot % pvt->maxch; - p_csrow->csrow_idx = csrow; + dimm->mc_branch = channel /2 ; + dimm->mc_channel = channel %2 ; + dimm->mc_dimm_number = slot / pvt->maxch; + dimm->csrow =-1 ; + dimm->csrow_channel =-1 ;/* use branch 0 for the basis */ - mtr =determine_mtr (pvt, csrow,0 ); + mtr =determine_mtr (pvt, slot,0 );/* if no DIMMS on this row, continue */ if (!MTR_DIMMS_PRESENT (mtr))continue ; - csrow_megs =0 ; -for (channel =0 ; channel < pvt->maxch; channel++) - csrow_megs += pvt->dimm_info[csrow][channel].megabytes; + size_mb = pvt->dimm_info[slot / pvt->maxch][channel].megabytes; - dimm->nr_pages = csrow_megs <<8 ; - dimm->location.mc_channel = channel; - dimm->location.mc_dimm_number = csrow / pvt->maxch; + dimm->nr_pages = size_mb <<8 ; dimm->grain =8 ; dimm->dtype =MTR_DRAM_WIDTH (mtr) ?DEV_X8 :DEV_X4 ; dimm->mtype =MEM_RDDR2 ; dimm->edac_mode =EDAC_SECDED ; - mci->nr_dimms++; - dimm++; empty =0 ; }
drivers/edac/i7300_edac.c +9 -6
@@ -773,7 +773,6 @@ static int i7300_init_csrows(struct mem_ctl_info *mci)int rc = -ENODEV ;int mtr;int ch, branch, slot, channel; -u32 nr_pages;struct dimm_info *dimm; pvt = mci->pvt_info;
@@ -800,7 +799,6 @@ static int i7300_init_csrows(struct mem_ctl_info *mci)/* Get the set of MTR[0-7] regs by each branch */ dimm = mci->dimms; - mci->dimm_loc_type =DIMM_LOC_MC_CHANNEL ; mci->nr_dimms =0 ;for (slot =0 ; slot <MAX_SLOTS ; slot++) {int where = mtr_regs[slot];
@@ -813,19 +811,24 @@ static int i7300_init_csrows(struct mem_ctl_info *mci) dinfo = &pvt->dimm_info[slot][channel]; - dimm->location.mc_channel = channel; - dimm->location.mc_dimm_number = slot; + dimm->mc_branch = branch; + dimm->mc_channel = ch; + dimm->mc_dimm_number = slot; + dimm->csrow =-1 ; + dimm->csrow_channel =-1 ; mtr =decode_mtr (pvt, slot, ch, branch, dinfo, dimm); + + mci->nr_dimms++; + dimm++; +/* if no DIMMS on this row, continue */ if (!MTR_DIMMS_PRESENT (mtr))continue ; rc =0 ; - mci->nr_dimms++; - dimm++; } } }
drivers/edac/i7core_edac.c +8 -11
@@ -601,7 +601,6 @@ static int get_dimm_config(struct mem_ctl_info *mci)int csrow =0 ;enum edac_type mode;enum mem_type mtype; -struct dimm_info *dimm;/* Get data from the MC register, function 0 */ pdev = pvt->pci_mcr[0 ];
@@ -638,9 +637,6 @@ static int get_dimm_config(struct mem_ctl_info *mci)numrow (pvt->info.max_dod >>6 ), numcol(pvt->info.max_dod >> 9)); - dimm = mci->dimms; - mci->dimm_loc_type =DIMM_LOC_MC_CHANNEL ; - mci->nr_dimms =0 ;for (i =0 ; i <NUM_CHANS ; i++) {u32 data, dimm_dod[3 ], value[8 ];
@@ -693,9 +689,16 @@ static int get_dimm_config(struct mem_ctl_info *mci) (data & REGISTERED_DIMM) ? 'R' : 'U');for (j =0 ; j <3 ; j++) { +struct dimm_info *dimm = &mci->dimms[i *3 + j];u32 banks, ranks, rows, cols;u32 size, npages; + dimm->mc_branch =-1 ; + dimm->mc_channel = i; + dimm->mc_dimm_number = j; + dimm->csrow =-1 ; + dimm->csrow_channel =-1 ; +if (!DIMM_PRESENT (dimm_dod[j]))continue ;
@@ -718,6 +721,7 @@ static int get_dimm_config(struct mem_ctl_info *mci) npages =MiB_TO_PAGES (size); csr = &mci->csrows[csrow]; + csr->channels[0 ].dimm = dimm; pvt->csrow_map[i][j] = csrow;
@@ -737,19 +741,12 @@ static int get_dimm_config(struct mem_ctl_info *mci) dimm->dtype =DEV_UNKNOWN ; } - csr->channels[0 ].dimm = dimm; - - dimm->location.mc_channel = i; - dimm->location.mc_dimm_number = j;snprintf (dimm->label,sizeof (dimm->label),"CPU#%uChannel#%u_DIMM#%u" , pvt->i7core_dev->socket, i, j); dimm->grain =8 ; dimm->edac_mode = mode; dimm->mtype = mtype; - - mci->nr_dimms++; - dimm++; csrow++; }
drivers/edac/i82975x_edac.c +5 -9
@@ -378,9 +378,6 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci,* */ - mci->dimm_loc_type =DIMM_LOC_CSROW ; - dimm = mci->dimms; - mci->nr_dimms =0 ;for (index =0 ; index < mci->nr_csrows; index++) { csrow = &mci->csrows[index];
@@ -406,11 +403,12 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci,*/ dtype =i82975x_dram_type (mch_window, index);for (chan =0 ; chan < csrow->nr_channels; chan++) { - mci->csrows[index].channels[chan].dimm = dimm; + dimm = mci->csrows[index].channels[chan].dimm; + +if (!nr_pages) +continue ; dimm->nr_pages = nr_pages / csrow->nr_channels; - dimm->location.csrow = index; - dimm->location.csrow_channel = chan;strncpy (csrow->channels[chan].dimm->label, labels[(index >>1 ) + (chan *2 )],EDAC_MC_LABEL_LEN );
@@ -418,11 +416,9 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci, dimm->dtype = dtype; dimm->mtype =MEM_DDR2 ;/* I82975x supports only DDR2 */ dimm->edac_mode =EDAC_SECDED ;/* only supported */ - dimm++; - mci->nr_dimms++; } -if (cumul_size == last_cumul_size) +if (!nr_pages)continue ;/* not populated */ csrow->first_page = last_cumul_size;
include/linux/edac.h +9 -18
@@ -249,25 +249,17 @@ enum scrub_type {* PS - I enjoyed writing all that about as much as you enjoyed reading it. */ -enum dimm_location_type { -DIMM_LOC_CSROW , -DIMM_LOC_MC_CHANNEL , -}; - -/* FIXME: add a per-dimm ce error count */ +/* FIXME: add the proper per-location error counts */ struct dimm_info {char label[EDAC_MC_LABEL_LEN +1 ];/* DIMM label on motherboard */ -unsigned memory_controller; -union { -struct { -unsigned mc_channel; -unsigned mc_dimm_number; - }; -struct { -unsigned csrow; -unsigned csrow_channel; - }; - } location; + +/* Memory location data */ +int mc_branch; +int mc_channel; +int csrow; +int mc_dimm_number; +int csrow_channel; +struct kobject kobj;/* sysfs kobject for this csrow */ struct mem_ctl_info *mci;/* the parent */
@@ -387,7 +379,6 @@ struct mem_ctl_info {/* * DIMM info. Will eventually remove the entire csrows_info some day */ -enum dimm_location_type dimm_loc_type;unsigned nr_dimms;struct dimm_info *dimms;
Signature · 1 line
1.7.8
v2 cover This is the version 2 of the HERM patches
This patch series is there to address some troubles with the EDAC subsystem.
There are two groups of change in this series:
a) a trace-based class of events for hardware errors is added (Hardware Events Report Mecanism - HERM);
The need of moving for a tracepoint-based approach were widely discussed already at the ML. Basically, it offers more flexibility than message dumps at the console, allowing events filtering and other sorts of improvements.
The long-term target is that memory errors will generate events like:
Corrected error: memory read error on DIMM_1A (row 1, channel 0, rank=5, cpu=0, Err=0001:0090, addr = 0x7a789f03e) Uncorrected error: memory write error on DIMM_2B (row 2, channel 3, rank=4, cpu=1, Err=0001:0091, addr = 0xdeadbeef)
E. g. putting the user-relevant information first while keeping the technical details that could help the hardware manufacturers and the ones that might want to replace a DRAM chip in parenthesis.
b) the edac core was changed to better support memory controllers that aren't able to see csrows.
The EDAC subsystem were originally written to work with memory controllers directly connected to the DIMM chips. Not all memory architectures use this concept. For example, FBDIMM memories are connected via a buffer, called AMB [1].
When an AMB is present, the memory controller only sees its communication bus, called "channel". This has nothing to do with the "csrow channel" concept, widely used at the subsystem, and mandatory. All drivers that work with such architectures currently need to fake data, lying to the edac core, in order for them to work.
Lying to the subsystem in general is not a good idea ;)
So, this series addresses it by splitting the DIMM information from the EDAC csrow_info struct, and creating a new set of DIMM-oriented sysfs nodes:
/sys/devices/system/edac/mc/mc0
├── dimm0 │ ├── dimm_dev_type │ ├── dimm_edac_mode │ ├── dimm_label │ ├── dimm_location │ ├── dimm_mem_type │ └── dimm_size ... └── dimm3 ├── dimm_dev_type ├── dimm_edac_mode ├── dimm_label ├── dimm_location ├── dimm_mem_type └── dimm_size
The DIMM description looks like:
dimm_dev_type:x8 dimm_edac_mode:S8ECD8ED dimm_label:DIMM_3A dimm_location:branch 1 channel 0 dimm 1 dimm_mem_type:Unbuffered-DDR3 dimm_size:1024
Currently, the existing struct was not touched. The next step (as indicated at the last patch on this series) is to create the error counters.
Currently, is still an RFC, as it is not complete, and some changes will require more test. Also, didn't try to compile it yet on non x86 archs.
[1] http://www.interfacebus.com/Memory_Module_DDR2_FB_DIMM.html
Please review.
Thanks!
Mauro
-
Mauro Carvalho Chehab (16):
events/hw_event: Create a Hardware Events Report Mecanism (HERM) events/hw_event: use __string() trace macros for events
hw_event: Consolidate uncorrected/corrected error msgs into one drivers/edac: rename channel_info to csrow_channel_info
edac: Create a dimm struct and move the labels into it
edac_mc_sysfs: Fix error handling
edac: Add per dimm's sysfs nodes
edac: Prepare to push down to drivers the filling of the dimm_info
i5400_edac: Convert it to report memory with the new location
i7300_edac: Convert it to report memory with the new location
edac: move dimm properties to struct dimm_info
edac: Don't initialize csrow's first_page & friends when not needed
edac: move nr_pages to dimm struct
edac: Add per-dimm sysfs show nodes
edac: DIMM location cleanup
edac: Add an error scope logic
drivers/edac/amd64_edac.c | 72 +++------- drivers/edac/amd76x_edac.c | 14 +- drivers/edac/cell_edac.c | 18 ++- drivers/edac/cpc925_edac.c | 70 +++++----- drivers/edac/e752x_edac.c | 48 ++++--- drivers/edac/e7xxx_edac.c | 49 ++++--- drivers/edac/edac_mc.c | 168 ++++++++++++++++++----- drivers/edac/edac_mc_sysfs.c | 283 ++++++++++++++++++++++++++++++++++++--- drivers/edac/i3000_edac.c | 24 ++-- drivers/edac/i3200_edac.c | 24 ++-- drivers/edac/i5000_edac.c | 31 ++--- drivers/edac/i5100_edac.c | 67 +++++----- drivers/edac/i5400_edac.c | 46 +++---- drivers/edac/i7300_edac.c | 47 ++++--- drivers/edac/i7core_edac.c | 46 +++---- drivers/edac/i82443bxgx_edac.c | 15 ++- drivers/edac/i82860_edac.c | 13 +- drivers/edac/i82875p_edac.c | 22 ++- drivers/edac/i82975x_edac.c | 28 +++-- drivers/edac/mpc85xx_edac.c | 16 ++- drivers/edac/mv64x60_edac.c | 22 ++-- drivers/edac/pasemi_edac.c | 24 ++-- drivers/edac/ppc4xx_edac.c | 25 ++-- drivers/edac/r82600_edac.c | 13 +- drivers/edac/sb_edac.c | 44 ++++--- drivers/edac/tile_edac.c | 17 +-- drivers/edac/x38_edac.c | 24 ++-- include/linux/edac.h | 90 +++++++++++-- include/trace/events/hw_event.h | 133 ++++++++++++++++++ 29 files changed, 1018 insertions(+), 475 deletions(-) create mode 100644 include/trace/events/hw_event.h
Signature · 1 line
1.7.8
RFC PATCH v2 6/16 edac_mc_sysfs: Fix error handling
Check for the current csrow's nr_pages, and not for the last csrow's nr_pages.
--- drivers/edac/edac_mc_sysfs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/edac/edac_mc_sysfs.c +1 -1
@@ -957,7 +957,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)/* CSROW error: backout what has already been registered, */ fail1:for (i--; i >=0 ; i--) { -if (csrow->nr_pages >0 ) { +if (mci->csrows[i].nr_pages >0 ) {kobject_put (&mci->csrows[i].kobj); } }
Signature · 1 line
1.7.8
RFC PATCH v2 5/16 edac: Create a dimm struct and move the labels into it
In reply to Mauro Carvalho ChehabThe way a DIMM is currently represented implies that they're linked into a per-csrow struct. However, some drivers don't see csrows, as they're ridden behind some chip like the AMB's on FBDIMM's, for example.
This forced drivers to fake a csrow struct, and to create a mess under csrow/channel original's concept.
Move the DIMM labels into a per-DIMM struct, and add there the real location of the socket, in terms of csrow/channel, on csrow-based architectures, or on channel/dimm number, on modern architectures.
On three drivers based on the modern architectures (i5100_edac, sb_edac and i7core_edac), the labels were filled inside the driver, as a way to avoid loosing the channel/dimm number. Those drivers were converted to properly fill the DIMM location properties internally.
All other drivers will use a per-csrow type of location. Some of those drivers will require a latter conversion, as they also fake the csrows internally.
--- drivers/edac/edac_mc.c | 95 ++++++++++++++++++++++++++++------------- drivers/edac/edac_mc_sysfs.c | 13 ++++-- drivers/edac/i5100_edac.c | 28 ++++++++++--- drivers/edac/i7core_edac.c | 18 ++++++-- drivers/edac/i82975x_edac.c | 13 +++++- drivers/edac/sb_edac.c | 18 ++++++-- include/linux/edac.h | 31 +++++++++++++- 7 files changed, 163 insertions(+), 53 deletions(-)
drivers/edac/edac_mc.c +65 -30
@@ -48,7 +48,8 @@ static void edac_mc_dump_channel(struct csrow_channel_info *chan)debugf4 ("\tchannel = %p\n" , chan);debugf4 ("\tchannel->chan_idx = %d\n" , chan->chan_idx);debugf4 ("\tchannel->ce_count = %d\n" , chan->ce_count); -debugf4 ("\tchannel->label = '%s'\n" , chan->label); +if (chan->dimm) +debugf4 ("\tchannel->label = '%s'\n" , chan->dimm->label);debugf4 ("\tchannel->csrow = %p\n\n" , chan->csrow); }
@@ -161,6 +162,7 @@ struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows,struct mem_ctl_info *mci;struct csrow_info *csi, *csrow;struct csrow_channel_info *chi, *chp, *chan; +struct dimm_info *dimm;void *pvt;unsigned size;int row, chn;
@@ -174,7 +176,8 @@ struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows, mci = (struct mem_ctl_info *)0 ; csi =edac_align_ptr (&mci[1 ],sizeof (*csi)); chi =edac_align_ptr (&csi[nr_csrows],sizeof (*chi)); - pvt =edac_align_ptr (&chi[nr_chans * nr_csrows], sz_pvt); + dimm =edac_align_ptr (&chi[nr_chans * nr_csrows],sizeof (*dimm)); + pvt =edac_align_ptr (&dimm[nr_chans * nr_csrows], sz_pvt); size = ((unsigned long )pvt) + sz_pvt; mci =kzalloc (size,GFP_KERNEL );
@@ -186,11 +189,13 @@ struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows,*/ csi = (struct csrow_info *)(((char *)mci) + ((unsigned long )csi)); chi = (struct csrow_channel_info *)(((char *)mci) + ((unsigned long )chi)); + dimm = (struct dimm_info *)(((char *)mci) + ((unsigned long )dimm)); pvt = sz_pvt ? (((char *)mci) + ((unsigned long )pvt)) :NULL ;/* setup index and various internal pointers */ mci->mc_idx = edac_index; mci->csrows = csi; + mci->dimms = dimm; mci->pvt_info = pvt; mci->nr_csrows = nr_csrows;
@@ -507,18 +512,37 @@ EXPORT_SYMBOL(edac_mc_find); /* FIXME - should a warning be printed if no error detection? correction? */ int edac_mc_add_mc(struct mem_ctl_info *mci) { + int i, j; + struct dimm_info *dimm; + debugf0("%s()\n", __func__); + /* + * If nr_dimms is not filled, that means that the driver itself + * were not converted to use the new struct, or that the driver + * is for a csrow-based device. + * Fill the dimms accordingly. + */ + if (!mci->nr_dimms) { + mci->dimm_loc_type = DIMM_LOC_CSROW; + dimm = mci->dimms; + for (i = 0; i < mci->nr_csrows; i++) { + for (j = 0; j < mci->csrows[i].nr_channels; j++) { + mci->csrows[i].channels[j].dimm = dimm; + dimm->location.csrow = i; + dimm->location.csrow_channel = j; + dimm++; + mci->nr_dimms++; + } + } + } #ifdef CONFIG_EDAC_DEBUG if (edac_debug_level >= 3) edac_mc_dump_mci(mci); if (edac_debug_level >= 4) { - int i; for (i = 0; i < mci->nr_csrows; i++) { - int j; - edac_mc_dump_csrow(&mci->csrows[i]); for (j = 0; j < mci->csrows[i].nr_channels; j++) edac_mc_dump_channel(&mci->csrows[i].
@@ -685,7 +709,7 @@ void edac_mc_handle_ce(struct mem_ctl_info *mci, int row, int channel, const char *msg) { unsigned long remapped_page; -char detail[80 ]; +char detail[80 ], *label =NULL ;debugf3 ("MC%d: %s()\n" , mci->mc_idx, __func__);
@@ -712,6 +736,9 @@ void edac_mc_handle_ce(struct mem_ctl_info *mci,return ; } +if (mci->csrows[row].channels[channel].dimm) + label = mci->csrows[row].channels[channel].dimm->label; +/* Memory type dependent details about the error */ snprintf (detail,sizeof (detail), " (page 0x%lx, offset 0x%lx, grain %d, "
@@ -719,8 +746,7 @@ void edac_mc_handle_ce(struct mem_ctl_info *mci, page_frame_number, offset_in_page, mci->csrows[row].grain, syndrome, row, channel);trace_mc_error (HW_EVENT_ERR_CORRECTED , mci->mc_idx, - mci->csrows[row].channels[channel].label, - msg, detail); + label, msg, detail);if (edac_mc_get_log_ce ())/* FIXME - put in DIMM location */
@@ -729,7 +755,7 @@ void edac_mc_handle_ce(struct mem_ctl_info *mci,"0x%lx, row %d, channel %d, label \"%s\": %s\n" , page_frame_number, offset_in_page, mci->csrows[row].grain, syndrome, row, channel, - mci->csrows[row].channels[channel].label, msg); + label, msg); mci->ce_count++; mci->csrows[row].ce_count++;
@@ -777,7 +803,7 @@ void edac_mc_handle_ue(struct mem_ctl_info *mci,char *pos = labels;int chan;int chars; -char detail[80 ]; +char detail[80 ], *label =NULL ;debugf3 ("MC%d: %s()\n" , mci->mc_idx, __func__);
@@ -793,17 +819,21 @@ void edac_mc_handle_ue(struct mem_ctl_info *mci,return ; } - chars =snprintf (pos, len +1 ,"%s" , - mci->csrows[row].channels[0 ].label); - len -= chars; - pos += chars; +if (mci->csrows[row].channels[0 ].dimm) { + label = mci->csrows[row].channels[0 ].dimm->label; + chars =snprintf (pos, len +1 ,"%s" , label); + len -= chars; + pos += chars; + }for (chan =1 ; (chan < mci->csrows[row].nr_channels) && (len >0 ); chan++) { - chars =snprintf (pos, len +1 ,":%s" , - mci->csrows[row].channels[chan].label); - len -= chars; - pos += chars; +if (mci->csrows[row].channels[chan].dimm) { + label = mci->csrows[row].channels[chan].dimm->label; + chars =snprintf (pos, len +1 ,":%s" , label); + len -= chars; + pos += chars; + } }/* Memory type dependent details about the error */
@@ -861,7 +891,7 @@ void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci,char labels[len +1 ];char *pos = labels;int chars; -char detail[80 ]; +char detail[80 ], *label;if (csrow >= mci->nr_csrows) {/* something is wrong */
@@ -903,12 +933,15 @@ void edac_mc_handle_fbd_ue(struct mem_ctl_info *mci, mci->csrows[csrow].ue_count++;/* Generate the DIMM labels from the specified channels */ - chars =snprintf (pos, len +1 ,"%s" , - mci->csrows[csrow].channels[channela].label); - len -= chars; - pos += chars; - chars =snprintf (pos, len +1 ,"-%s" , - mci->csrows[csrow].channels[channelb].label); +if (mci->csrows[csrow].channels[channela].dimm) { + label = mci->csrows[csrow].channels[channela].dimm->label; + chars =snprintf (pos, len +1 ,"%s" , label); + len -= chars; + pos += chars; + } +if (mci->csrows[csrow].channels[channela].dimm) + chars =snprintf (pos, len +1 ,"-%s" , + mci->csrows[csrow].channels[channelb].dimm->label);/* Memory type dependent details about the error */ snprintf(detail, sizeof(detail),
@@ -937,7 +970,7 @@ EXPORT_SYMBOL(edac_mc_handle_fbd_ue);void edac_mc_handle_fbd_ce (struct mem_ctl_info *mci,unsigned int csrow,unsigned int channel,char *msg) { -char detail[80 ]; +char detail[80 ], *label =NULL ;/* Ensure boundary values */ if (csrow >= mci->nr_csrows) {/* something is wrong */
@@ -964,16 +997,18 @@ void edac_mc_handle_fbd_ce(struct mem_ctl_info *mci,snprintf (detail,sizeof (detail),"(row %d, channel %d)\n" , csrow, channel); + +if (mci->csrows[csrow].channels[channel].dimm) + label = mci->csrows[csrow].channels[channel].dimm->label; +trace_mc_error (HW_EVENT_ERR_CORRECTED , mci->mc_idx, - mci->csrows[csrow].channels[channel].label, - msg, detail); + label, msg, detail);if (edac_mc_get_log_ce ())/* FIXME - put in DIMM location */ edac_mc_printk (mci,KERN_WARNING ,"CE row %d, channel %d, label \"%s\": %s\n" , - csrow, channel, - mci->csrows[csrow].channels[channel].label, msg); + csrow, channel, label, msg); mci->ce_count++; mci->csrows[csrow].ce_count++;
drivers/edac/edac_mc_sysfs.c +9 -4
@@ -170,11 +170,13 @@ static ssize_t channel_dimm_label_show(struct csrow_info *csrow, char *data, int channel) {/* if field has not been initialized, there is nothing to send */ -if (!csrow->channels[channel].label[0 ]) +if (!csrow->channels[channel].dimm) +return 0 ; +if (!csrow->channels[channel].dimm->label[0 ])return 0 ;return snprintf (data,EDAC_MC_LABEL_LEN ,"%s\n" , - csrow->channels[channel].label); + csrow->channels[channel].dimm->label); } static ssize_t channel_dimm_label_store(struct csrow_info *csrow,
@@ -183,9 +185,12 @@ static ssize_t channel_dimm_label_store(struct csrow_info *csrow, {ssize_t max_size =0 ; +if (!csrow->channels[channel].dimm) +return -EINVAL ; + max_size =min ((ssize_t ) count, (ssize_t )EDAC_MC_LABEL_LEN -1 ); -strncpy (csrow->channels[channel].label, data, max_size); - csrow->channels[channel].label[max_size] ='\0' ; +strncpy (csrow->channels[channel].dimm->label, data, max_size); + csrow->channels[channel].dimm->label[max_size] ='\0' ;return max_size; }
drivers/edac/i5100_edac.c +22 -6
@@ -428,12 +428,16 @@ static void i5100_handle_ce(struct mem_ctl_info *mci, const char *msg) {const int csrow =i5100_rank_to_csrow (mci, chan, rank); +char *label =NULL ; + +if (mci->csrows[csrow].channels[0 ].dimm) + label = mci->csrows[csrow].channels[0 ].dimm->label;printk (KERN_ERR "CE chan %d, bank %u, rank %u, syndrome 0x%lx, " "cas %u, ras %u, csrow %u, label \"%s\": %s\n" , chan, bank, rank, syndrome, cas, ras, - csrow, mci->csrows[csrow].channels[0 ].label, msg); + csrow, label, msg); mci->ce_count++; mci->csrows[csrow].ce_count++;
@@ -450,12 +454,16 @@ static void i5100_handle_ue(struct mem_ctl_info *mci, const char *msg) {const int csrow =i5100_rank_to_csrow (mci, chan, rank); +char *label =NULL ; + +if (mci->csrows[csrow].channels[0 ].dimm) + label = mci->csrows[csrow].channels[0 ].dimm->label;printk (KERN_ERR "UE chan %d, bank %u, rank %u, syndrome 0x%lx, " "cas %u, ras %u, csrow %u, label \"%s\": %s\n" , chan, bank, rank, syndrome, cas, ras, - csrow, mci->csrows[csrow].channels[0 ].label, msg); + csrow, label, msg); mci->ue_count++; mci->csrows[csrow].ue_count++;
@@ -840,7 +848,10 @@ static void __devinit i5100_init_csrows(struct mem_ctl_info *mci)int i;unsigned long total_pages =0UL ;struct i5100_priv *priv = mci->pvt_info; +struct dimm_info *dimm; + dimm = mci->dimms; + mci->dimm_loc_type =DIMM_LOC_MC_CHANNEL ;for (i =0 ; i < mci->nr_csrows; i++) {const unsigned long npages =i5100_npages (mci, i);const unsigned chan =i5100_csrow_to_chan (mci, i);
@@ -871,11 +882,16 @@ static void __devinit i5100_init_csrows(struct mem_ctl_info *mci) mci->csrows[i].channels[0 ].chan_idx =0 ; mci->csrows[i].channels[0 ].ce_count =0 ; mci->csrows[i].channels[0 ].csrow = mci->csrows + i; -snprintf (mci->csrows[i].channels[0 ].label, -sizeof (mci->csrows[i].channels[0 ].label), -"DIMM%u" ,i5100_rank_to_slot (mci, chan, rank)); - total_pages += npages; + + mci->csrows[i].channels[0 ].dimm = dimm; + dimm->location.mc_channel = chan; + dimm->location.mc_dimm_number = rank; +snprintf (dimm->label,sizeof (dimm->label), +"DIMM%u" , +i5100_rank_to_slot (mci, chan, rank)); + mci->nr_dimms++; + dimm++; } }
drivers/edac/i7core_edac.c +13 -5
@@ -592,7 +592,7 @@ static int i7core_get_active_channels(const u8 socket, unsigned *channels,return 0 ; } -static int get_dimm_config (const struct mem_ctl_info *mci) +static int get_dimm_config (struct mem_ctl_info *mci) {struct i7core_pvt *pvt = mci->pvt_info;struct csrow_info *csr;
@@ -602,6 +602,7 @@ static int get_dimm_config(const struct mem_ctl_info *mci)unsigned long last_page =0 ;enum edac_type mode;enum mem_type mtype; +struct dimm_info *dimm;/* Get data from the MC register, function 0 */ pdev = pvt->pci_mcr[0 ];
@@ -638,6 +639,8 @@ static int get_dimm_config(const struct mem_ctl_info *mci)numrow (pvt->info.max_dod >>6 ), numcol(pvt->info.max_dod >> 9)); + dimm = mci->dimms; + mci->dimm_loc_type =DIMM_LOC_MC_CHANNEL ;for (i =0 ; i <NUM_CHANS ; i++) {u32 data, dimm_dod[3 ], value[8 ];
@@ -744,12 +747,17 @@ static int get_dimm_config(const struct mem_ctl_info *mci) csr->dtype =DEV_UNKNOWN ; } + csr->channels[0 ].dimm = dimm; + dimm->location.mc_channel = i; + dimm->location.mc_dimm_number = j; +snprintf (dimm->label,sizeof (dimm->label), +"CPU#%uChannel#%u_DIMM#%u" , + pvt->i7core_dev->socket, i, j); + mci->nr_dimms++; + dimm++; + csr->edac_mode = mode; csr->mtype = mtype; -snprintf (csr->channels[0 ].label, -sizeof (csr->channels[0 ].label), -"CPU#%uChannel#%u_DIMM#%u" , - pvt->i7core_dev->socket, i, j); csrow++; }
drivers/edac/i82975x_edac.c +11 -2
@@ -364,6 +364,7 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci,u8 value;u32 cumul_size;int index, chan; +struct dimm_info *dimm; last_cumul_size =0 ;
@@ -376,6 +377,8 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci,* */ + mci->dimm_loc_type =DIMM_LOC_CSROW ; + dimm = mci->dimms;for (index =0 ; index < mci->nr_csrows; index++) { csrow = &mci->csrows[index];
@@ -398,10 +401,16 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci,* [0-7] for single-channel; i.e. csrow->nr_channels = 1 * [0-3] for dual-channel; i.e. csrow->nr_channels = 2 */ -for (chan =0 ; chan < csrow->nr_channels; chan++) -strncpy (csrow->channels[chan].label, +for (chan =0 ; chan < csrow->nr_channels; chan++) { + mci->csrows[index].channels[chan].dimm = dimm; + dimm->location.csrow = index; + dimm->location.csrow_channel = chan; +strncpy (csrow->channels[chan].dimm->label, labels[(index >>1 ) + (chan *2 )],EDAC_MC_LABEL_LEN ); + dimm++; + mci->nr_dimms++; + }if (cumul_size == last_cumul_size)continue ;/* not populated */
drivers/edac/sb_edac.c +13 -5
@@ -550,7 +550,7 @@ static int sbridge_get_active_channels(const u8 bus, unsigned *channels,return 0 ; } -static int get_dimm_config (const struct mem_ctl_info *mci) +static int get_dimm_config (struct mem_ctl_info *mci) {struct sbridge_pvt *pvt = mci->pvt_info;struct csrow_info *csr;
@@ -560,6 +560,7 @@ static int get_dimm_config(const struct mem_ctl_info *mci)u32 reg;enum edac_type mode;enum mem_type mtype; +struct dimm_info *dimm;pci_read_config_dword (pvt->pci_br,SAD_TARGET , ®); pvt->sbridge_dev->source_id =SOURCE_ID (reg);
@@ -611,6 +612,8 @@ static int get_dimm_config(const struct mem_ctl_info *mci)/* On all supported DDR3 DIMM types, there are 8 banks available */ banks =8 ; + dimm = mci->dimms; + mci->dimm_loc_type =DIMM_LOC_MC_CHANNEL ;for (i =0 ; i <NUM_CHANNELS ; i++) {u32 mtr;
@@ -650,12 +653,17 @@ static int get_dimm_config(const struct mem_ctl_info *mci) csr->channels[0 ].chan_idx = i; csr->channels[0 ].ce_count =0 ; pvt->csrow_map[i][j] = csrow; -snprintf (csr->channels[0 ].label, -sizeof (csr->channels[0 ].label), -"CPU_SrcID#%u_Channel#%u_DIMM#%u" , - pvt->sbridge_dev->source_id, i, j); last_page += npages; csrow++; + + csr->channels[0 ].dimm = dimm; + dimm->location.mc_channel = i; + dimm->location.mc_dimm_number = j; +snprintf (dimm->label,sizeof (dimm->label), +"CPU_SrcID#%u_Channel#%u_DIMM#%u" , + pvt->sbridge_dev->source_id, i, j); + mci->nr_dimms++; + dimm++; } } }
include/linux/edac.h +30 -1
@@ -249,10 +249,31 @@ enum scrub_type {* PS - I enjoyed writing all that about as much as you enjoyed reading it. */ +enum dimm_location_type { +DIMM_LOC_CSROW , +DIMM_LOC_MC_CHANNEL , +}; + +/* FIXME: add a per-dimm ce error count */ +struct dimm_info { +char label[EDAC_MC_LABEL_LEN +1 ];/* DIMM label on motherboard */ +unsigned memory_controller; +union { +struct { +unsigned mc_channel; +unsigned mc_dimm_number; + }; +struct { +unsigned csrow; +unsigned csrow_channel; + }; + } location; +}; +struct csrow_channel_info {int chan_idx;/* channel index */ u32 ce_count;/* Correctable Errors for this CHANNEL */ -char label[EDAC_MC_LABEL_LEN +1 ];/* DIMM label on motherboard */ +struct dimm_info *dimm;struct csrow_info *csrow;/* the parent */ };
@@ -353,6 +374,14 @@ struct mem_ctl_info {int mc_idx;int nr_csrows;struct csrow_info *csrows; + +/* +* DIMM info. Will eventually remove the entire csrows_info some day +*/ +enum dimm_location_type dimm_loc_type; +unsigned nr_dimms; +struct dimm_info *dimms; +/* * FIXME - what about controllers on other busses? - IDs must be * unique. dev pointer should be sufficiently unique, but
Signature · 1 line
1.7.8
RFC PATCH v2 7/16 edac: Add per dimm's sysfs nodes
In reply to Mauro Carvalho ChehabInstead of just exporting a per-csrow dimm directories, add a pure per-dimm attributes. This will help to better map the DIMM properties, when csrow info is not available.
--- drivers/edac/edac_mc_sysfs.c | 172 +++++++++++++++++++++++++++++++++++++++++- include/linux/edac.h | 2 + 2 files changed, 173 insertions(+), 1 deletions(-)
drivers/edac/edac_mc_sysfs.c +171 -1
@@ -415,6 +415,156 @@ err_out:return err; } +/* dimm specific attribute structure */ +struct dimmdev_attribute { +struct attribute attr; +ssize_t (*show) (struct dimm_info *,char *); +ssize_t (*store) (struct dimm_info *,const char *,size_t ); +}; + +#define DIMMDEV_ATTR (_name,_mode,_show,_store) \ +static struct dimmdev_attribute attr_##_name = { \ + .attr = {.name = __stringify(_name), .mode = _mode }, \ + .show = _show, \ + .store = _store, \ +}; + +#define to_dimm (k) container_of(k, struct dimm_info, kobj) +#define to_dimmdev_attr (a) container_of(a, struct dimmdev_attribute, attr) + +/* Set of show/store higher level functions for default dimm attributes */ +static ssize_t dimmdev_show (struct kobject *kobj, +struct attribute *attr,char *buffer) +{ +struct dimm_info *dimm =to_dimm (kobj); +struct dimmdev_attribute *dimmdev_attr =to_dimmdev_attr (attr); + +if (dimmdev_attr->show) +return dimmdev_attr->show (dimm, buffer); +return -EIO ; +} + +static ssize_t dimmdev_store (struct kobject *kobj,struct attribute *attr, +const char *buffer,size_t count) +{ +struct dimm_info *dimm =to_dimm (kobj); +struct dimmdev_attribute *dimmdev_attr =to_dimmdev_attr (attr); + +if (dimmdev_attr->store) +return dimmdev_attr->store (dimm, + buffer, + count); +return -EIO ; +} + +static const struct sysfs_ops dimmfs_ops = { + .show = dimmdev_show, + .store = dimmdev_store +}; + +/* show/store functions for DIMM Label attributes */ +static ssize_t dimmdev_location_show (struct dimm_info *dimm,char *data) +{ +if (dimm->mci->dimm_loc_type ==DIMM_LOC_CSROW ) +return sprintf (data,"csrow %d, channel %d\n" , + dimm->location.csrow, + dimm->location.csrow_channel); +else +return sprintf (data,"channel %d, dimm %d\n" , + dimm->location.mc_channel, + dimm->location.mc_dimm_number); +} + +static ssize_t dimmdev_label_show (struct dimm_info *dimm,char *data) +{ +/* if field has not been initialized, there is nothing to send */ +if (!dimm->label[0 ]) +return 0 ; + +return snprintf (data,EDAC_MC_LABEL_LEN ,"%s\n" , dimm->label); +} + +static ssize_t dimmdev_label_store (struct dimm_info *dimm, +const char *data, +size_t count) +{ +ssize_t max_size =0 ; + + max_size =min ((ssize_t ) count, (ssize_t )EDAC_MC_LABEL_LEN -1 ); +strncpy (dimm->label, data, max_size); + dimm->label[max_size] ='\0' ; + +return max_size; +} + +/* default cwrow<id>/attribute files */ +DIMMDEV_ATTR (label,S_IRUGO |S_IWUSR , dimmdev_label_show, dimmdev_label_store); +DIMMDEV_ATTR (location,S_IRUGO , dimmdev_location_show,NULL ); + +/* default attributes of the DIMM<id> object */ +static struct dimmdev_attribute *default_dimm_attr[] = { + &attr_label, + &attr_location, +NULL , +}; + +/* No memory to release for this kobj */ +static void edac_dimm_instance_release (struct kobject *kobj) +{ +struct mem_ctl_info *mci; +struct dimm_info *cs; + +debugf1 ("%s()\n" , __func__); + + cs = container_of(kobj, struct dimm_info, kobj); + mci = cs->mci; + +kobject_put (&mci->edac_mci_kobj); +} + +/* the kobj_type instance for a DIMM */ +static struct kobj_type ktype_dimm = { + .release = edac_dimm_instance_release, + .sysfs_ops = &dimmfs_ops, + .default_attrs = (struct attribute **)default_dimm_attr, +}; +/* Create a CSROW object under specifed edac_mc_device */ +static int edac_create_dimm_object (struct mem_ctl_info *mci, +struct dimm_info *dimm,int index) +{ +struct kobject *kobj_mci = &mci->edac_mci_kobj; +struct kobject *kobj; +int err; + +/* generate ..../edac/mc/mc<id>/dimm<index> */ +memset (&dimm->kobj,0 ,sizeof (dimm->kobj)); + dimm->mci = mci;/* include container up link */ + +/* bump the mci instance's kobject's ref count */ + kobj =kobject_get (&mci->edac_mci_kobj); +if (!kobj) { + err = -ENODEV ; + goto err_out; + } + +/* Instanstiate the dimm object */ + err =kobject_init_and_add (&dimm->kobj, &ktype_dimm, kobj_mci, +"dimm%d" , index); +if (err) + goto err_release_top_kobj; + +kobject_uevent (&dimm->kobj,KOBJ_ADD ); +return 0 ; + +/* error unwind stack */ +err_release_top_kobj: +kobject_put (&mci->edac_mci_kobj); + +err_out: +return err; +} + +/* default sysfs methods and data structures for the main MCI kobject */ static ssize_t mci_reset_counters_store(struct mem_ctl_info *mci,
@@ -905,7 +1055,7 @@ static void edac_remove_mci_instance_attributes(struct mem_ctl_info *mci,*/ int edac_create_sysfs_mci_device (struct mem_ctl_info *mci) { -int i; +int i, j;int err;struct csrow_info *csrow;struct kobject *kobj_mci = &mci->edac_mci_kobj;
@@ -952,8 +1102,24 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci) } } +/* +* Make directories for each DIMM object under the mc<id> kobject +*/ +for (j =0 ; j < mci->nr_dimms; j++) { + err =edac_create_dimm_object (mci, &mci->dimms[j] , j); +if (err) { +debugf1 ("%s() failure: create dimm %d obj\n" , + __func__, j); + goto fail2; + } + } +return 0 ; +fail2: +for (j--; j >=0 ; j--) +kobject_put (&mci->dimms[i].kobj); +/* CSROW error: backout what has already been registered, */ fail1:for (i--; i >=0 ; i--) {
@@ -984,6 +1150,10 @@ void edac_remove_sysfs_mci_device(struct mem_ctl_info *mci)/* remove all csrow kobjects */ debugf4 ("%s() unregister this mci kobj\n" , __func__); +for (i =0 ; i < mci->nr_dimms; i++) { +debugf0 ("%s() unreg dimm-%d\n" , __func__, i); +kobject_put (&mci->dimms[i].kobj); + }for (i =0 ; i < mci->nr_csrows; i++) {if (mci->csrows[i].nr_pages >0 ) {debugf0 ("%s() unreg csrow-%d\n" , __func__, i);
include/linux/edac.h +2 -0
@@ -268,6 +268,8 @@ struct dimm_info {unsigned csrow_channel; }; } location; +struct kobject kobj;/* sysfs kobject for this csrow */ +struct mem_ctl_info *mci;/* the parent */ };struct csrow_channel_info {
Signature · 1 line
1.7.8
RFC PATCH v2 8/16 edac: Prepare to push down to drivers the filling of the dimm_info
In reply to Mauro Carvalho ChehabSeveral data that it is currently stored per csrow will be pushed into the dimm themselves. Due to that, the mci->dimms filling will need to happen inside the drivers.
Prepare for that, by initializing the dimm fields during mci alloc. With this change, the changes at the drivers will be smaller, as they won't need to touch at the fields they don't currently initialize.
No functional changes.
--- drivers/edac/edac_mc.c | 43 ++++++++++++++++++++----------------------- drivers/edac/i5100_edac.c | 1 + drivers/edac/i7core_edac.c | 1 + drivers/edac/i82975x_edac.c | 1 + drivers/edac/sb_edac.c | 1 + 5 files changed, 24 insertions(+), 23 deletions(-)
drivers/edac/edac_mc.c +20 -23
@@ -214,6 +214,24 @@ struct mem_ctl_info *edac_mc_alloc(unsigned sz_pvt, unsigned nr_csrows, } } +/* +* By default, assumes that a per-csrow arrangement will be used, +* as most drivers are based on such assumption. +*/ +if (!mci->nr_dimms) { + mci->dimm_loc_type =DIMM_LOC_CSROW ; + dimm = mci->dimms; +for (row =0 ; row < mci->nr_csrows; row++) { +for (chn =0 ; chn < mci->csrows[row].nr_channels; chn++) { + mci->csrows[row].channels[chn].dimm = dimm; + dimm->location.csrow = row; + dimm->location.csrow_channel = chn; + dimm++; + mci->nr_dimms++; + } + } + } + mci->op_state =OP_ALLOC ;INIT_LIST_HEAD (&mci->grp_kobj_list);
@@ -512,37 +530,16 @@ EXPORT_SYMBOL(edac_mc_find); /* FIXME - should a warning be printed if no error detection? correction? */ int edac_mc_add_mc(struct mem_ctl_info *mci) { - int i, j; - struct dimm_info *dimm; - debugf0("%s()\n", __func__); - /* - * If nr_dimms is not filled, that means that the driver itself - * were not converted to use the new struct, or that the driver - * is for a csrow-based device. - * Fill the dimms accordingly. - */ - if (!mci->nr_dimms) { - mci->dimm_loc_type = DIMM_LOC_CSROW; - dimm = mci->dimms; - for (i = 0; i < mci->nr_csrows; i++) { - for (j = 0; j < mci->csrows[i].nr_channels; j++) { - mci->csrows[i].channels[j].dimm = dimm; - dimm->location.csrow = i; - dimm->location.csrow_channel = j; - dimm++; - mci->nr_dimms++; - } - } - } #ifdef CONFIG_EDAC_DEBUG if (edac_debug_level >= 3) edac_mc_dump_mci(mci); if (edac_debug_level >= 4) { - + int i; for (i = 0; i < mci->nr_csrows; i++) { + int j; edac_mc_dump_csrow(&mci->csrows[i]); for (j = 0; j < mci->csrows[i].nr_channels; j++) edac_mc_dump_channel(&mci->csrows[i].
drivers/edac/i5100_edac.c +1 -0
@@ -852,6 +852,7 @@ static void __devinit i5100_init_csrows(struct mem_ctl_info *mci) dimm = mci->dimms; mci->dimm_loc_type =DIMM_LOC_MC_CHANNEL ; + mci->nr_dimms =0 ;for (i =0 ; i < mci->nr_csrows; i++) {const unsigned long npages =i5100_npages (mci, i);const unsigned chan =i5100_csrow_to_chan (mci, i);
drivers/edac/i7core_edac.c +1 -0
@@ -641,6 +641,7 @@ static int get_dimm_config(struct mem_ctl_info *mci) dimm = mci->dimms; mci->dimm_loc_type =DIMM_LOC_MC_CHANNEL ; + mci->nr_dimms =0 ;for (i =0 ; i <NUM_CHANS ; i++) {u32 data, dimm_dod[3 ], value[8 ];
drivers/edac/i82975x_edac.c +1 -0
@@ -379,6 +379,7 @@ static void i82975x_init_csrows(struct mem_ctl_info *mci, mci->dimm_loc_type =DIMM_LOC_CSROW ; dimm = mci->dimms; + mci->nr_dimms =0 ;for (index =0 ; index < mci->nr_csrows; index++) { csrow = &mci->csrows[index];
drivers/edac/sb_edac.c +1 -0
@@ -614,6 +614,7 @@ static int get_dimm_config(struct mem_ctl_info *mci) dimm = mci->dimms; mci->dimm_loc_type =DIMM_LOC_MC_CHANNEL ; + mci->nr_dimms =0 ;for (i =0 ; i <NUM_CHANNELS ; i++) {u32 mtr;
Signature · 1 line
1.7.8
RFC PATCH v2 9/16 i5400_edac: Convert it to report memory with the new location
In reply to Mauro Carvalho ChehabOn this driver, the memory controller supports only FBDIMMs.
There are two branches, each with two channels. Each channel can address up to 4 DIMM's, via the AMB FBDIMM chip.
--- drivers/edac/i5400_edac.c | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-)
drivers/edac/i5400_edac.c +11 -10
@@ -1137,6 +1137,7 @@ static int i5400_init_csrows(struct mem_ctl_info *mci)int csrow_megs;int channel;int csrow; +struct dimm_info *dimm; pvt = mci->pvt_info;
@@ -1145,6 +1146,9 @@ static int i5400_init_csrows(struct mem_ctl_info *mci) empty =1 ;/* Assume NO memory */ + dimm = mci->dimms; + mci->dimm_loc_type =DIMM_LOC_MC_CHANNEL ; + mci->nr_dimms =0 ;for (csrow =0 ; csrow < max_csrows; csrow++) { p_csrow = &mci->csrows[csrow];
@@ -1163,6 +1167,9 @@ static int i5400_init_csrows(struct mem_ctl_info *mci) p_csrow->page_mask =0xFFF ; p_csrow->grain =8 ; + p_csrow->dtype =MTR_DRAM_WIDTH (mtr) ?DEV_X8 :DEV_X4 ; + p_csrow->mtype =MEM_RDDR2 ; + p_csrow->edac_mode =EDAC_SECDED ; csrow_megs =0 ;for (channel =0 ; channel < pvt->maxch; channel++)
@@ -1170,16 +1177,10 @@ static int i5400_init_csrows(struct mem_ctl_info *mci) p_csrow->nr_pages = csrow_megs <<8 ; -/* Assume DDR2 for now */ - p_csrow->mtype =MEM_FB_DDR2 ; - -/* ask what device type on this row */ -if (MTR_DRAM_WIDTH (mtr)) - p_csrow->dtype =DEV_X8 ; -else - p_csrow->dtype =DEV_X4 ; - - p_csrow->edac_mode =EDAC_S8ECD8ED ; + dimm->location.mc_channel = channel; + dimm->location.mc_dimm_number = csrow / pvt->maxch; + mci->nr_dimms++; + dimm++; empty =0 ; }
Signature · 1 line
1.7.8
RFC PATCH v2 10/16 i7300_edac: Convert it to report memory with the new location
In reply to Mauro Carvalho ChehabOn this driver, the memory controller supports only FBDIMMs.
There are two branches, each with two channels. Each channel can address up to 8 DIMM slots, via the AMB FBDIMM chip.
--- drivers/edac/i7300_edac.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
drivers/edac/i7300_edac.c +11 -0
@@ -779,6 +779,7 @@ static int i7300_init_csrows(struct mem_ctl_info *mci)int mtr;int ch, branch, slot, channel;u32 last_page =0 , nr_pages; +struct dimm_info *dimm; pvt = mci->pvt_info;
@@ -803,6 +804,10 @@ static int i7300_init_csrows(struct mem_ctl_info *mci) }/* Get the set of MTR[0-7] regs by each branch */ + dimm = mci->dimms; + mci->dimm_loc_type =DIMM_LOC_MC_CHANNEL ; + mci->nr_dimms =0 ; + nr_pages =0 ;for (slot =0 ; slot <MAX_SLOTS ; slot++) {int where = mtr_regs[slot];for (branch =0 ; branch <MAX_BRANCHES ; branch++) {
@@ -815,6 +820,9 @@ static int i7300_init_csrows(struct mem_ctl_info *mci) dinfo = &pvt->dimm_info[slot][channel]; p_csrow = &mci->csrows[slot]; + dimm->location.mc_channel = channel; + dimm->location.mc_dimm_number = slot; + mtr =decode_mtr (pvt, slot, ch, branch, dinfo, p_csrow, &nr_pages);/* if no DIMMS on this row, continue */
@@ -828,6 +836,9 @@ static int i7300_init_csrows(struct mem_ctl_info *mci) p_csrow->last_page = last_page; rc =0 ; + + mci->nr_dimms++; + dimm++; } } }
Signature · 1 line
1.7.8
RFC PATCH v2 12/16 edac: Don't initialize csrow's first_page & friends when not needed
In reply to Mauro Carvalho ChehabAlmost all edac drivers initialize first_page, last_page andpage_mask. Those vars are used inside the EDAC core, in order to
calculate the csrow affected by an error, by using the routineedac_mc_find_csrow_by_page().
However, very few drivers actually use it:
e752x_edac.c
e7xxx_edac.c
i3000_edac.c
i82443bxgx_edac.c
i82860_edac.c
i82875p_edac.c
i82975x_edac.c
r82600_edac.cThere also a few other drivers that have their own calculus formula internally using those vars.
All the others are just wasting time by initializing those data.
--- drivers/edac/amd64_edac.c | 38 ++------------------------------------ drivers/edac/i3200_edac.c | 5 ----- drivers/edac/i5000_edac.c | 5 ----- drivers/edac/i5100_edac.c | 2 -- drivers/edac/i5400_edac.c | 5 ----- drivers/edac/i7300_edac.c | 5 +---- drivers/edac/i7core_edac.c | 5 ----- drivers/edac/mv64x60_edac.c | 1 - drivers/edac/ppc4xx_edac.c | 7 ------- drivers/edac/sb_edac.c | 2 -- drivers/edac/tile_edac.c | 2 -- drivers/edac/x38_edac.c | 5 ----- 12 files changed, 3 insertions(+), 79 deletions(-)
drivers/edac/amd64_edac.c +2 -36
@@ -715,25 +715,6 @@ static inline u64 input_addr_to_sys_addr(struct mem_ctl_info *mci, input_addr_to_dram_addr(mci, input_addr)); } -/* -* Find the minimum and maximum InputAddr values that map to the given @csrow. -* Pass back these values in *input_addr_min and *input_addr_max. -*/ -static void find_csrow_limits (struct mem_ctl_info *mci,int csrow, -u64 *input_addr_min,u64 *input_addr_max) -{ -struct amd64_pvt *pvt; -u64 base, mask; - - pvt = mci->pvt_info; -BUG_ON ((csrow <0 ) || (csrow >= pvt->csels[0 ].b_cnt)); - -get_cs_base_and_mask (pvt, csrow,0 , &base, &mask); - - *input_addr_min = base & ~mask; - *input_addr_max = base | mask; -} -/* Map the Error address to a PAGE and PAGE OFFSET. */ static inline void error_address_to_page_and_offset (u64 error_address,u32 *page,u32 *offset)
@@ -2166,7 +2147,7 @@ static int init_csrows(struct mem_ctl_info *mci) {struct csrow_info *csrow;struct amd64_pvt *pvt = mci->pvt_info; -u64 input_addr_min, input_addr_max, sys_addr, base, mask; +u64 base, mask;u32 val;int i, j, empty =1 ;enum mem_type mtype;
@@ -2194,14 +2175,7 @@ static int init_csrows(struct mem_ctl_info *mci) empty =0 ; csrow->nr_pages =amd64_csrow_nr_pages (pvt,0 , i); -find_csrow_limits (mci, i, &input_addr_min, &input_addr_max); - sys_addr =input_addr_to_sys_addr (mci, input_addr_min); - csrow->first_page = (u32) (sys_addr >>PAGE_SHIFT ); - sys_addr =input_addr_to_sys_addr (mci, input_addr_max); - csrow->last_page = (u32) (sys_addr >>PAGE_SHIFT ); -get_cs_base_and_mask (pvt, i,0 , &base, &mask); - csrow->page_mask = ~mask;/* 8 bytes of resolution */ mtype =amd64_determine_memory_type (pvt, i);
@@ -2221,15 +2195,7 @@ static int init_csrows(struct mem_ctl_info *mci) }debugf1 (" for MC node %d csrow %d:\n" , pvt->mc_node_id, i); -debugf1 (" input_addr_min: 0x%lx input_addr_max: 0x%lx\n" , - (unsigned long )input_addr_min, - (unsigned long )input_addr_max); -debugf1 (" sys_addr: 0x%lx page_mask: 0x%lx\n" , - (unsigned long )sys_addr, csrow->page_mask); -debugf1 (" nr_pages: %u first_page: 0x%lx " -"last_page: 0x%lx\n" , - (unsigned )csrow->nr_pages, - csrow->first_page, csrow->last_page); +debugf1 (" nr_pages: %u\n" , csrow->nr_pages); }return empty;
drivers/edac/i3200_edac.c +0 -5
@@ -332,7 +332,6 @@ static int i3200_probe1(struct pci_dev *pdev, int dev_idx)int rc;int i, j;struct mem_ctl_info *mci =NULL ; -unsigned long last_page;u16 drbs[I3200_CHANNELS ][I3200_RANKS_PER_CHANNEL ];bool stacked;void __iomem *window;
@@ -377,7 +376,6 @@ static int i3200_probe1(struct pci_dev *pdev, int dev_idx)* cumulative; the last one will contain the total memory * contained in all ranks. */ - last_page =-1UL ;for (i =0 ; i < mci->nr_csrows; i++) {unsigned long nr_pages;struct csrow_info *csrow = &mci->csrows[i];
@@ -389,9 +387,6 @@ static int i3200_probe1(struct pci_dev *pdev, int dev_idx)if (nr_pages ==0 )continue ; - csrow->first_page = last_page +1 ; - last_page += nr_pages; - csrow->last_page = last_page; csrow->nr_pages = nr_pages;for (j =0 ; j < nr_channels; j++) {
drivers/edac/i5000_edac.c +0 -5
@@ -1263,11 +1263,6 @@ static int i5000_init_csrows(struct mem_ctl_info *mci)if (!MTR_DIMMS_PRESENT (mtr) && !MTR_DIMMS_PRESENT (mtr1))continue ; -/* FAKE OUT VALUES, FIXME */ - p_csrow->first_page =0 + csrow *20 ; - p_csrow->last_page =9 + csrow *20 ; - p_csrow->page_mask =0xFFF ; - csrow_megs =0 ;for (channel =0 ; channel < pvt->maxch; channel++) { csrow_megs += pvt->dimm_info[csrow][channel].megabytes;
drivers/edac/i5100_edac.c +0 -2
@@ -865,8 +865,6 @@ static void __devinit i5100_init_csrows(struct mem_ctl_info *mci)* FIXME: these two are totally bogus -- I don't see how to * map them correctly to this structure... */ - mci->csrows[i].first_page = total_pages; - mci->csrows[i].last_page = total_pages + npages -1 ; mci->csrows[i].nr_pages = npages; mci->csrows[i].csrow_idx = i; mci->csrows[i].mci = mci;
drivers/edac/i5400_edac.c +0 -5
@@ -1161,11 +1161,6 @@ static int i5400_init_csrows(struct mem_ctl_info *mci)if (!MTR_DIMMS_PRESENT (mtr))continue ; -/* FAKE OUT VALUES, FIXME */ - p_csrow->first_page =0 + csrow *20 ; - p_csrow->last_page =9 + csrow *20 ; - p_csrow->page_mask =0xFFF ; - csrow_megs =0 ;for (channel =0 ; channel < pvt->maxch; channel++) csrow_megs += pvt->dimm_info[csrow][channel].megabytes;
drivers/edac/i7300_edac.c +1 -4
@@ -778,7 +778,7 @@ static int i7300_init_csrows(struct mem_ctl_info *mci)int rc = -ENODEV ;int mtr;int ch, branch, slot, channel; -u32 last_page =0 , nr_pages; +u32 nr_pages;struct dimm_info *dimm; pvt = mci->pvt_info;
@@ -832,9 +832,6 @@ static int i7300_init_csrows(struct mem_ctl_info *mci)/* Update per_csrow memory count */ p_csrow->nr_pages += nr_pages; - p_csrow->first_page = last_page; - last_page += nr_pages; - p_csrow->last_page = last_page; rc =0 ;
drivers/edac/i7core_edac.c +0 -5
@@ -599,7 +599,6 @@ static int get_dimm_config(struct mem_ctl_info *mci)struct pci_dev *pdev;int i, j;int csrow =0 ; -unsigned long last_page =0 ;enum edac_type mode;enum mem_type mtype;struct dimm_info *dimm;
@@ -719,12 +718,8 @@ static int get_dimm_config(struct mem_ctl_info *mci) npages =MiB_TO_PAGES (size); csr = &mci->csrows[csrow]; - csr->first_page = last_page +1 ; - last_page += npages; - csr->last_page = last_page; csr->nr_pages = npages; - csr->page_mask =0 ; csr->csrow_idx = csrow; csr->nr_channels =1 ;
drivers/edac/mv64x60_edac.c +0 -1
@@ -668,7 +668,6 @@ static void mv64x60_init_csrows(struct mem_ctl_info *mci, csrow = &mci->csrows[0 ]; dimm = csrow->channels[0 ].dimm; csrow->nr_pages = pdata->total_mem >>PAGE_SHIFT ; - csrow->last_page = csrow->first_page + csrow->nr_pages -1 ; dimm->grain =8 ; dimm->mtype = (ctl &MV64X60_SDRAM_REGISTERED ) ?MEM_RDDR :MEM_DDR ;
drivers/edac/ppc4xx_edac.c +0 -7
@@ -897,7 +897,6 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1)enum edac_type edac_mode;int row, j;u32 mbxcf, size; -static u32 ppc4xx_last_page;/* Establish the memory type and width */
@@ -959,10 +958,6 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1) goto done; } - csi->first_page = ppc4xx_last_page; - csi->last_page = csi->first_page + csi->nr_pages -1 ; - csi->page_mask =0 ; -/* * It's unclear exactly what grain should be set to * here. The SDRAM_ECCES register allows resolution of
@@ -984,8 +979,6 @@ ppc4xx_edac_init_csrows(struct mem_ctl_info *mci, u32 mcopt1) dimm->dtype = dtype; dimm->edac_mode = edac_mode; - - ppc4xx_last_page += csi->nr_pages; } }
drivers/edac/sb_edac.c +0 -2
@@ -643,8 +643,6 @@ static int get_dimm_config(struct mem_ctl_info *mci)* csrows. */ csr = &mci->csrows[csrow]; - csr->first_page = last_page; - csr->last_page = last_page + npages -1 ; csr->nr_pages = npages; csr->csrow_idx = csrow; csr->nr_channels =1 ;
drivers/edac/tile_edac.c +0 -2
@@ -110,9 +110,7 @@ static int __devinit tile_edac_init_csrows(struct mem_ctl_info *mci)return -1 ; } - csrow->first_page =0 ; csrow->nr_pages = mem_info.mem_size >>PAGE_SHIFT ; - csrow->last_page = csrow->first_page + csrow->nr_pages -1 ; dimm->grain =TILE_EDAC_ERROR_GRAIN ; dimm->dtype =DEV_UNKNOWN ;
drivers/edac/x38_edac.c +0 -5
@@ -319,7 +319,6 @@ static int x38_probe1(struct pci_dev *pdev, int dev_idx)int rc;int i, j;struct mem_ctl_info *mci =NULL ; -unsigned long last_page;u16 drbs[X38_CHANNELS ][X38_RANKS_PER_CHANNEL ];bool stacked;void __iomem *window;
@@ -363,7 +362,6 @@ static int x38_probe1(struct pci_dev *pdev, int dev_idx)* cumulative; the last one will contain the total memory * contained in all ranks. */ - last_page =-1UL ;for (i =0 ; i < mci->nr_csrows; i++) {unsigned long nr_pages;struct csrow_info *csrow = &mci->csrows[i];
@@ -375,9 +373,6 @@ static int x38_probe1(struct pci_dev *pdev, int dev_idx)if (nr_pages ==0 )continue ; - csrow->first_page = last_page +1 ; - last_page += nr_pages; - csrow->last_page = last_page; csrow->nr_pages = nr_pages;for (j =0 ; j < x38_channel_num; j++) {
Signature · 1 line
1.7.8