Commit 16a528ee3975c860dc93fbfc718fe9aa25ed92bc

Authored by Borislav Petkov
Committed by Borislav Petkov
1 parent 921a689965

EDAC: Fix csrow size reported in sysfs

On csrow-based memory controllers, we combine the csrow size from both
channels and there's no need to do that again in csrow_size_show which
leads to double the size of a csrow.

Fix it.

Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>

Showing 3 changed files with 5 additions and 0 deletions Side-by-side Diff

drivers/edac/amd64_edac.c
... ... @@ -2174,6 +2174,7 @@
2174 2174 dimm->edac_mode = edac_mode;
2175 2175 dimm->nr_pages = nr_pages;
2176 2176 }
  2177 + csrow->nr_pages = nr_pages;
2177 2178 }
2178 2179  
2179 2180 return empty;
drivers/edac/edac_mc_sysfs.c
... ... @@ -180,6 +180,9 @@
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 +
183 186 for (i = 0; i < csrow->nr_channels; i++)
184 187 nr_pages += csrow->channels[i]->dimm->nr_pages;
185 188 return sprintf(data, "%u\n", PAGES_TO_MiB(nr_pages));
include/linux/edac.h
... ... @@ -533,6 +533,7 @@
533 533  
534 534 u32 ue_count; /* Uncorrectable Errors for this csrow */
535 535 u32 ce_count; /* Correctable Errors for this csrow */
  536 + u32 nr_pages; /* combined pages count of all channels */
536 537  
537 538 struct mem_ctl_info *mci; /* the parent */
538 539