Messages in this thread | | | Date | Mon, 16 Apr 2012 15:31:53 +0200 | From | Borislav Petkov <> | Subject | Re: [PATCH 02/13] edac: move dimm properties to struct memset_info |
| |
On Mon, Apr 16, 2012 at 05:56:46AM -0300, Mauro Carvalho Chehab wrote: > >> @@ -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; > > > > This looks like a useless code movement, please leave it where it is > > now and add the for-loop after it instead of pulling it up and causing > > needless churn. > > This is needed, as now mtype/edac_mode is per DIMM, and not per channel. > In the specific case of amd64 (and all per-csrow/channel memory controllers), > all channels use the same mtype/edac_mode, but this is not true for other > memory controllers. > > So, what the logic there does is to first retrieve the mtype/edac_mode, and > then fill it for each dimm struct (the for loop).
I can see that. But you don't have to move it anywhere, simply add the
for (j = 0; j < pvt->channel_count; j++) { ...
loop after the debugf1() calls and this way the patch has a smaller changes net count and it is easier to review.
-- Regards/Gruss, Boris.
Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach GM: Alberto Bozzo Reg: Dornach, Landkreis Muenchen HRB Nr. 43632 WEEE Registernr: 129 19551
| |