aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-04-30 09:24:43 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-06-11 12:23:49 -0400
commit6e84d359b2bea5ce659b3c3e5d3003fb11bd91d5 (patch)
tree80bbfc5e78b21ab82e1d89a52d3baecd09943623 /drivers/edac
parent956b9ba156dbfdb9cede2b2927ddf8be2233b3a7 (diff)
edac_mc: Cleanup per-dimm_info debug messages
The edac_mc_alloc() routine allocates one dimm_info device for all possible memories, including the non-filled ones. The debug messages there are somewhat confusing. So, cleans them, by moving the code that prints the memory location to edac_mc, and using it on both edac_mc_sysfs and edac_mc. Also, only dumps information when DIMM/ranks are actually filled. After this patch, a dimm-based memory controller will print the debug info as: [ 1011.380027] EDAC DEBUG: edac_mc_dump_csrow: csrow->csrow_idx = 0 [ 1011.380029] EDAC DEBUG: edac_mc_dump_csrow: csrow = ffff8801169be000 [ 1011.380031] EDAC DEBUG: edac_mc_dump_csrow: csrow->first_page = 0x0 [ 1011.380032] EDAC DEBUG: edac_mc_dump_csrow: csrow->last_page = 0x0 [ 1011.380034] EDAC DEBUG: edac_mc_dump_csrow: csrow->page_mask = 0x0 [ 1011.380035] EDAC DEBUG: edac_mc_dump_csrow: csrow->nr_channels = 3 [ 1011.380037] EDAC DEBUG: edac_mc_dump_csrow: csrow->channels = ffff8801149c2840 [ 1011.380039] EDAC DEBUG: edac_mc_dump_csrow: csrow->mci = ffff880117426000 [ 1011.380041] EDAC DEBUG: edac_mc_dump_channel: channel->chan_idx = 0 [ 1011.380042] EDAC DEBUG: edac_mc_dump_channel: channel = ffff8801149c2860 [ 1011.380044] EDAC DEBUG: edac_mc_dump_channel: channel->csrow = ffff8801169be000 [ 1011.380046] EDAC DEBUG: edac_mc_dump_channel: channel->dimm = ffff88010fe90400 ... [ 1011.380095] EDAC DEBUG: edac_mc_dump_dimm: dimm0: channel 0 slot 0 mapped as virtual row 0, chan 0 [ 1011.380097] EDAC DEBUG: edac_mc_dump_dimm: dimm = ffff88010fe90400 [ 1011.380099] EDAC DEBUG: edac_mc_dump_dimm: dimm->label = 'CPU#0Channel#0_DIMM#0' [ 1011.380101] EDAC DEBUG: edac_mc_dump_dimm: dimm->nr_pages = 0x40000 [ 1011.380103] EDAC DEBUG: edac_mc_dump_dimm: dimm->grain = 8 [ 1011.380104] EDAC DEBUG: edac_mc_dump_dimm: dimm->nr_pages = 0x40000 ... (a rank-based memory controller would print, instead of "dimm?", "rank?" on the above debug info) Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/edac_mc.c95
-rw-r--r--drivers/edac/edac_mc_sysfs.c11
-rw-r--r--drivers/edac/edac_module.h3
3 files changed, 62 insertions, 47 deletions
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index a39fe6f966e3..98c759dc0d5d 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -42,44 +42,63 @@
42static DEFINE_MUTEX(mem_ctls_mutex); 42static DEFINE_MUTEX(mem_ctls_mutex);
43static LIST_HEAD(mc_devices); 43static LIST_HEAD(mc_devices);
44 44
45unsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf,
46 unsigned len)
47{
48 struct mem_ctl_info *mci = dimm->mci;
49 int i, n, count = 0;
50 char *p = buf;
51
52 for (i = 0; i < mci->n_layers; i++) {
53 n = snprintf(p, len, "%s %d ",
54 edac_layer_name[mci->layers[i].type],
55 dimm->location[i]);
56 p += n;
57 len -= n;
58 count += n;
59 if (!len)
60 break;
61 }
62
63 return count;
64}
65
45#ifdef CONFIG_EDAC_DEBUG 66#ifdef CONFIG_EDAC_DEBUG
46 67
47static void edac_mc_dump_channel(struct rank_info *chan) 68static void edac_mc_dump_channel(struct rank_info *chan)
48{ 69{
49 edac_dbg(4, "\tchannel = %p\n", chan); 70 edac_dbg(4, " channel->chan_idx = %d\n", chan->chan_idx);
50 edac_dbg(4, "\tchannel->chan_idx = %d\n", chan->chan_idx); 71 edac_dbg(4, " channel = %p\n", chan);
51 edac_dbg(4, "\tchannel->csrow = %p\n", chan->csrow); 72 edac_dbg(4, " channel->csrow = %p\n", chan->csrow);
52 edac_dbg(4, "\tchannel->dimm = %p\n", chan->dimm); 73 edac_dbg(4, " channel->dimm = %p\n", chan->dimm);
53} 74}
54 75
55static void edac_mc_dump_dimm(struct dimm_info *dimm) 76static void edac_mc_dump_dimm(struct dimm_info *dimm, int number)
56{ 77{
57 int i; 78 char location[80];
58 79
59 edac_dbg(4, "\tdimm = %p\n", dimm); 80 edac_dimm_info_location(dimm, location, sizeof(location));
60 edac_dbg(4, "\tdimm->label = '%s'\n", dimm->label); 81
61 edac_dbg(4, "\tdimm->nr_pages = 0x%x\n", dimm->nr_pages); 82 edac_dbg(4, "%s%i: %smapped as virtual row %d, chan %d\n",
62 edac_dbg(4, "\tdimm location "); 83 dimm->mci->mem_is_per_rank ? "rank" : "dimm",
63 for (i = 0; i < dimm->mci->n_layers; i++) { 84 number, location, dimm->csrow, dimm->cschannel);
64 printk(KERN_CONT "%d", dimm->location[i]); 85 edac_dbg(4, " dimm = %p\n", dimm);
65 if (i < dimm->mci->n_layers - 1) 86 edac_dbg(4, " dimm->label = '%s'\n", dimm->label);
66 printk(KERN_CONT "."); 87 edac_dbg(4, " dimm->nr_pages = 0x%x\n", dimm->nr_pages);
67 } 88 edac_dbg(4, " dimm->grain = %d\n", dimm->grain);
68 printk(KERN_CONT "\n"); 89 edac_dbg(4, " dimm->nr_pages = 0x%x\n", dimm->nr_pages);
69 edac_dbg(4, "\tdimm->grain = %d\n", dimm->grain);
70 edac_dbg(4, "\tdimm->nr_pages = 0x%x\n", dimm->nr_pages);
71} 90}
72 91
73static void edac_mc_dump_csrow(struct csrow_info *csrow) 92static void edac_mc_dump_csrow(struct csrow_info *csrow)
74{ 93{
75 edac_dbg(4, "\tcsrow = %p\n", csrow); 94 edac_dbg(4, "csrow->csrow_idx = %d\n", csrow->csrow_idx);
76 edac_dbg(4, "\tcsrow->csrow_idx = %d\n", csrow->csrow_idx); 95 edac_dbg(4, " csrow = %p\n", csrow);
77 edac_dbg(4, "\tcsrow->first_page = 0x%lx\n", csrow->first_page); 96 edac_dbg(4, " csrow->first_page = 0x%lx\n", csrow->first_page);
78 edac_dbg(4, "\tcsrow->last_page = 0x%lx\n", csrow->last_page); 97 edac_dbg(4, " csrow->last_page = 0x%lx\n", csrow->last_page);
79 edac_dbg(4, "\tcsrow->page_mask = 0x%lx\n", csrow->page_mask); 98 edac_dbg(4, " csrow->page_mask = 0x%lx\n", csrow->page_mask);
80 edac_dbg(4, "\tcsrow->nr_channels = %d\n", csrow->nr_channels); 99 edac_dbg(4, " csrow->nr_channels = %d\n", csrow->nr_channels);
81 edac_dbg(4, "\tcsrow->channels = %p\n", csrow->channels); 100 edac_dbg(4, " csrow->channels = %p\n", csrow->channels);
82 edac_dbg(4, "\tcsrow->mci = %p\n", csrow->mci); 101 edac_dbg(4, " csrow->mci = %p\n", csrow->mci);
83} 102}
84 103
85static void edac_mc_dump_mci(struct mem_ctl_info *mci) 104static void edac_mc_dump_mci(struct mem_ctl_info *mci)
@@ -327,8 +346,6 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
327 memset(&pos, 0, sizeof(pos)); 346 memset(&pos, 0, sizeof(pos));
328 row = 0; 347 row = 0;
329 chn = 0; 348 chn = 0;
330 edac_dbg(4, "initializing %d %s\n",
331 tot_dimms, per_rank ? "ranks" : "dimms");
332 for (i = 0; i < tot_dimms; i++) { 349 for (i = 0; i < tot_dimms; i++) {
333 chan = mci->csrows[row]->channels[chn]; 350 chan = mci->csrows[row]->channels[chn];
334 off = EDAC_DIMM_OFF(layer, n_layers, pos[0], pos[1], pos[2]); 351 off = EDAC_DIMM_OFF(layer, n_layers, pos[0], pos[1], pos[2]);
@@ -341,10 +358,6 @@ struct mem_ctl_info *edac_mc_alloc(unsigned mc_num,
341 mci->dimms[off] = dimm; 358 mci->dimms[off] = dimm;
342 dimm->mci = mci; 359 dimm->mci = mci;
343 360
344 edac_dbg(2, "%d: %s%i (%d:%d:%d): row %d, chan %d\n",
345 i, per_rank ? "rank" : "dimm", off,
346 pos[0], pos[1], pos[2], row, chn);
347
348 /* 361 /*
349 * Copy DIMM location and initialize it. 362 * Copy DIMM location and initialize it.
350 */ 363 */
@@ -700,14 +713,22 @@ int edac_mc_add_mc(struct mem_ctl_info *mci)
700 int i; 713 int i;
701 714
702 for (i = 0; i < mci->nr_csrows; i++) { 715 for (i = 0; i < mci->nr_csrows; i++) {
716 struct csrow_info *csrow = mci->csrows[i];
717 u32 nr_pages = 0;
703 int j; 718 int j;
704 719
705 edac_mc_dump_csrow(mci->csrows[i]); 720 for (j = 0; j < csrow->nr_channels; j++)
706 for (j = 0; j < mci->csrows[i]->nr_channels; j++) 721 nr_pages += csrow->channels[j]->dimm->nr_pages;
707 edac_mc_dump_channel(mci->csrows[i]->channels[j]); 722 if (!nr_pages)
723 continue;
724 edac_mc_dump_csrow(csrow);
725 for (j = 0; j < csrow->nr_channels; j++)
726 if (csrow->channels[j]->dimm->nr_pages)
727 edac_mc_dump_channel(csrow->channels[j]);
708 } 728 }
709 for (i = 0; i < mci->tot_dimms; i++) 729 for (i = 0; i < mci->tot_dimms; i++)
710 edac_mc_dump_dimm(mci->dimms[i]); 730 if (mci->dimms[i]->nr_pages)
731 edac_mc_dump_dimm(mci->dimms[i], i);
711 } 732 }
712#endif 733#endif
713 mutex_lock(&mem_ctls_mutex); 734 mutex_lock(&mem_ctls_mutex);
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index eace646b57f0..7079a428c8ea 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -485,17 +485,8 @@ static ssize_t dimmdev_location_show(struct device *dev,
485 struct device_attribute *mattr, char *data) 485 struct device_attribute *mattr, char *data)
486{ 486{
487 struct dimm_info *dimm = to_dimm(dev); 487 struct dimm_info *dimm = to_dimm(dev);
488 struct mem_ctl_info *mci = dimm->mci;
489 int i;
490 char *p = data;
491
492 for (i = 0; i < mci->n_layers; i++) {
493 p += sprintf(p, "%s %d ",
494 edac_layer_name[mci->layers[i].type],
495 dimm->location[i]);
496 }
497 488
498 return p - data; 489 return edac_dimm_info_location(dimm, data, PAGE_SIZE);
499} 490}
500 491
501static ssize_t dimmdev_label_show(struct device *dev, 492static ssize_t dimmdev_label_show(struct device *dev,
diff --git a/drivers/edac/edac_module.h b/drivers/edac/edac_module.h
index 1af13676e857..62de640c8c8a 100644
--- a/drivers/edac/edac_module.h
+++ b/drivers/edac/edac_module.h
@@ -34,6 +34,9 @@ extern int edac_mc_get_panic_on_ue(void);
34extern int edac_get_poll_msec(void); 34extern int edac_get_poll_msec(void);
35extern int edac_mc_get_poll_msec(void); 35extern int edac_mc_get_poll_msec(void);
36 36
37unsigned edac_dimm_info_location(struct dimm_info *dimm, char *buf,
38 unsigned len);
39
37 /* on edac_device.c */ 40 /* on edac_device.c */
38extern int edac_device_register_sysfs_main_kobj( 41extern int edac_device_register_sysfs_main_kobj(
39 struct edac_device_ctl_info *edac_dev); 42 struct edac_device_ctl_info *edac_dev);