Commit 1eef1282549d7accdd33ee36d409b039b1f911fb

Authored by Mauro Carvalho Chehab
Committed by Borislav Petkov
1 parent fbe2d3616c

amd64_edac: Correct DIMM sizes

We were filling the csrow size with a wrong value. 16a528ee3975 ("EDAC:
Fix csrow size reported in sysfs") tried to address the issue. It fixed
the report with the old API but not with the new one. Correct it for the
new API too.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
[ make it a per-csrow accounting regardless of ->channel_count ]
Signed-off-by: Borislav Petkov <bp@suse.de>

Showing 3 changed files with 12 additions and 16 deletions Side-by-side Diff

drivers/edac/amd64_edac.c
... ... @@ -2048,13 +2048,19 @@
2048 2048 edac_dbg(1, "MC node: %d, csrow: %d\n",
2049 2049 pvt->mc_node_id, i);
2050 2050  
2051   - if (row_dct0)
  2051 + if (row_dct0) {
2052 2052 nr_pages = amd64_csrow_nr_pages(pvt, 0, i);
  2053 + csrow->channels[0]->dimm->nr_pages = nr_pages;
  2054 + }
2053 2055  
2054 2056 /* K8 has only one DCT */
2055   - if (boot_cpu_data.x86 != 0xf && row_dct1)
2056   - nr_pages += amd64_csrow_nr_pages(pvt, 1, i);
  2057 + if (boot_cpu_data.x86 != 0xf && row_dct1) {
  2058 + int row_dct1_pages = amd64_csrow_nr_pages(pvt, 1, i);
2057 2059  
  2060 + csrow->channels[1]->dimm->nr_pages = row_dct1_pages;
  2061 + nr_pages += row_dct1_pages;
  2062 + }
  2063 +
2058 2064 mtype = amd64_determine_memory_type(pvt, i);
2059 2065  
2060 2066 edac_dbg(1, "Total csrow%d pages: %u\n", i, nr_pages);
2061 2067  
... ... @@ -2072,9 +2078,7 @@
2072 2078 dimm = csrow->channels[j]->dimm;
2073 2079 dimm->mtype = mtype;
2074 2080 dimm->edac_mode = edac_mode;
2075   - dimm->nr_pages = nr_pages;
2076 2081 }
2077   - csrow->nr_pages = nr_pages;
2078 2082 }
2079 2083  
2080 2084 return empty;
drivers/edac/edac_mc_sysfs.c
... ... @@ -180,9 +180,6 @@
180 180 int i;
181 181 u32 nr_pages = 0;
182 182  
183   - if (csrow->mci->csbased)
184   - return sprintf(data, "%u\n", PAGES_TO_MiB(csrow->nr_pages));
185   -
186 183 for (i = 0; i < csrow->nr_channels; i++)
187 184 nr_pages += csrow->channels[i]->dimm->nr_pages;
188 185 return sprintf(data, "%u\n", PAGES_TO_MiB(nr_pages));
189 186  
... ... @@ -778,14 +775,10 @@
778 775 for (csrow_idx = 0; csrow_idx < mci->nr_csrows; csrow_idx++) {
779 776 struct csrow_info *csrow = mci->csrows[csrow_idx];
780 777  
781   - if (csrow->mci->csbased) {
782   - total_pages += csrow->nr_pages;
783   - } else {
784   - for (j = 0; j < csrow->nr_channels; j++) {
785   - struct dimm_info *dimm = csrow->channels[j]->dimm;
  778 + for (j = 0; j < csrow->nr_channels; j++) {
  779 + struct dimm_info *dimm = csrow->channels[j]->dimm;
786 780  
787   - total_pages += dimm->nr_pages;
788   - }
  781 + total_pages += dimm->nr_pages;
789 782 }
790 783 }
791 784  
include/linux/edac.h
... ... @@ -561,7 +561,6 @@
561 561  
562 562 u32 ue_count; /* Uncorrectable Errors for this csrow */
563 563 u32 ce_count; /* Correctable Errors for this csrow */
564   - u32 nr_pages; /* combined pages count of all channels */
565 564  
566 565 struct mem_ctl_info *mci; /* the parent */
567 566