mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>,
	Linux Edac Mailing List <linux-edac@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 5/6] edac: Call the sysfs nodes as "rank" instead of "dimm" if chip select is used
Date: Wed,  7 Mar 2012 09:11:17 -0300	[thread overview]
Message-ID: <1331122278-28458-6-git-send-email-mchehab@redhat.com> (raw)
In-Reply-To: <1331122278-28458-1-git-send-email-mchehab@redhat.com>

The minimum hierarchy unit for csrows-based MC's is rank, and not dimm.

There are a few possible fixes here:

1) add a per-rank location at the dimm struct, and don't create one
   dimm_info entry per rank;

2) Convert the drivers to internally convert ranks into dimm's;

3) rename "dimm" with "rank";

A few drivers do (2) internally: some of them have per-dimm registers,
instead of per-rank ones; a few others have some routines to translate
between the two representations of the memory. Those drivers report the
memories via a DIMM slot and a channel.

While no better solution is done, let's do (2) for the drivers that work
with csrows/channel layers to represent a rank.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
---
 drivers/edac/edac_mc_sysfs.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 5b48528..dd934c2 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -567,10 +567,12 @@ static struct kobj_type ktype_dimm = {
 };
 /* 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 dimm_info *dimm, int index,
+					bool is_rank)
 {
 	struct kobject *kobj_mci = &mci->edac_mci_kobj;
 	struct kobject *kobj;
+	const char *nodename;
 	int err;
 
 	/* generate ..../edac/mc/mc<id>/dimm<index>   */
@@ -585,8 +587,12 @@ static int edac_create_dimm_object(struct mem_ctl_info *mci,
 	}
 
 	/* Instanstiate the dimm object */
+	if (!is_rank)
+		nodename = "dimm%d";
+	else
+		nodename = "rank%d";
 	err = kobject_init_and_add(&dimm->kobj, &ktype_dimm, kobj_mci,
-				   "dimm%d", index);
+				nodename, index);
 	if (err)
 		goto err_release_top_kobj;
 
@@ -1338,6 +1344,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
 	int err;
 	struct csrow_info *csrow;
 	struct kobject *kobj_mci = &mci->edac_mci_kobj;
+	bool is_rank = false;
 
 	debugf0("%s() idx=%d\n", __func__, mci->mc_idx);
 
@@ -1386,6 +1393,13 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
 		}
 	}
 
+	for (i = 0; i < mci->n_layers; i++) {
+		if (mci->layers[i].type == EDAC_MC_LAYER_CHIP_SELECT) {
+			is_rank = true;
+			break;
+		}
+	}
+
 	/*
 	 * Make directories for each DIMM object under the mc<id> kobject
 	 */
@@ -1406,7 +1420,7 @@ int edac_create_sysfs_mci_device(struct mem_ctl_info *mci)
 			printk(KERN_CONT "\n");
 		}
 #endif
-		err = edac_create_dimm_object(mci, dimm, j);
+		err = edac_create_dimm_object(mci, dimm, j, is_rank);
 		if (err) {
 			debugf1("%s() failure: create dimm %d obj\n",
 				__func__, j);
-- 
1.7.8


  parent reply	other threads:[~2012-03-07 12:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-07 12:11 [PATCH 0/6] Post EDAC core fix patches Mauro Carvalho Chehab
2012-03-07 12:11 ` [PATCH 1/6] edac: Initialize the dimm label with the known information Mauro Carvalho Chehab
2012-03-07 12:11 ` [PATCH 2/6] edac_mc_sysfs: don't create inactive errcount sysfs nodes Mauro Carvalho Chehab
2012-03-07 12:11 ` [PATCH 3/6] i5000_edac: Fix the logic that retrieves memory information Mauro Carvalho Chehab
2012-03-07 12:11 ` [PATCH 4/6] edac: add a sysfs node that stores the max possible memory location Mauro Carvalho Chehab
2012-03-07 12:11 ` Mauro Carvalho Chehab [this message]
2012-03-07 12:11 ` [PATCH 6/6] i5400_edac: improve debug messages to better represent the filled memory Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1331122278-28458-6-git-send-email-mchehab@redhat.com \
    --to=mchehab@redhat.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®