+ edac-mc-numbers-refactor-2-of-2.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     EDAC: mc numbers refactor 2-of-2

has been added to the -mm tree.  Its filename is

     edac-mc-numbers-refactor-2-of-2.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: EDAC: mc numbers refactor 2-of-2
From: Doug Thompson <norsk5@xxxxxxxxx>


This is part 2 of a 2-part patch set.

1 Reimplement add_mc_to_global_list() with semantics that allow the caller
  to determine the ID number for a mem_ctl_info structure.  Then modify
  edac_mc_add_mc() so that the caller specifies the ID number for the new
  mem_ctl_info structure.  Platform-specific code should be able to assign the
  ID numbers in a platform-specific manner.  For instance, on Opteron it makes
  sense to have the ID of the mem_ctl_info structure match the ID of the node
  that the memory controller belongs to.

2 Modify callers of edac_mc_add_mc() so they use the new semantics.

Signed-off-by: Doug Thompson <norsk5@xxxxxxxxxxxx>
Cc: Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/edac/amd76x_edac.c  |    5 ++-
 drivers/edac/e752x_edac.c   |    5 ++-
 drivers/edac/e7xxx_edac.c   |    5 ++-
 drivers/edac/edac_mc.c      |   46 +++++++++++++++++++++++++++++++++-
 drivers/edac/edac_mc.h      |    2 -
 drivers/edac/i82860_edac.c  |    5 ++-
 drivers/edac/i82875p_edac.c |    5 ++-
 drivers/edac/r82600_edac.c  |    5 ++-
 8 files changed, 70 insertions(+), 8 deletions(-)

diff -puN drivers/edac/amd76x_edac.c~edac-mc-numbers-refactor-2-of-2 drivers/edac/amd76x_edac.c
--- 25/drivers/edac/amd76x_edac.c~edac-mc-numbers-refactor-2-of-2	Wed May 24 16:31:49 2006
+++ 25-akpm/drivers/edac/amd76x_edac.c	Wed May 24 16:31:49 2006
@@ -257,7 +257,10 @@ static int amd76x_probe1(struct pci_dev 
 
 	amd76x_get_error_info(mci, &discard);  /* clear counters */
 
-	if (edac_mc_add_mc(mci)) {
+	/* Here we assume that we will never see multiple instances of this
+	 * type of memory controller.  The ID is therefore hardcoded to 0.
+	 */
+	if (edac_mc_add_mc(mci,0)) {
 		debugf3("%s(): failed edac_mc_add_mc()\n", __func__);
 		goto fail;
 	}
diff -puN drivers/edac/e752x_edac.c~edac-mc-numbers-refactor-2-of-2 drivers/edac/e752x_edac.c
--- 25/drivers/edac/e752x_edac.c~edac-mc-numbers-refactor-2-of-2	Wed May 24 16:31:49 2006
+++ 25-akpm/drivers/edac/e752x_edac.c	Wed May 24 16:31:49 2006
@@ -953,7 +953,10 @@ static int e752x_probe1(struct pci_dev *
 		"tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm,
 		pvt->remapbase, pvt->remaplimit);
 
-	if (edac_mc_add_mc(mci)) {
+	/* Here we assume that we will never see multiple instances of this
+	 * type of memory controller.  The ID is therefore hardcoded to 0.
+	 */
+	if (edac_mc_add_mc(mci,0)) {
 		debugf3("%s(): failed edac_mc_add_mc()\n", __func__);
 		goto fail;
 	}
diff -puN drivers/edac/e7xxx_edac.c~edac-mc-numbers-refactor-2-of-2 drivers/edac/e7xxx_edac.c
--- 25/drivers/edac/e7xxx_edac.c~edac-mc-numbers-refactor-2-of-2	Wed May 24 16:31:49 2006
+++ 25-akpm/drivers/edac/e7xxx_edac.c	Wed May 24 16:31:49 2006
@@ -463,7 +463,10 @@ static int e7xxx_probe1(struct pci_dev *
 	/* clear any pending errors, or initial state bits */
 	e7xxx_get_error_info(mci, &discard);
 
-	if (edac_mc_add_mc(mci) != 0) {
+	/* Here we assume that we will never see multiple instances of this
+	 * type of memory controller.  The ID is therefore hardcoded to 0.
+	 */
+	if (edac_mc_add_mc(mci,0)) {
 		debugf3("%s(): failed edac_mc_add_mc()\n", __func__);
 		goto fail;
 	}
diff -puN drivers/edac/edac_mc.c~edac-mc-numbers-refactor-2-of-2 drivers/edac/edac_mc.c
--- 25/drivers/edac/edac_mc.c~edac-mc-numbers-refactor-2-of-2	Wed May 24 16:31:49 2006
+++ 25-akpm/drivers/edac/edac_mc.c	Wed May 24 16:31:49 2006
@@ -1390,6 +1390,48 @@ static struct mem_ctl_info *find_mci_by_
 	return NULL;
 }
 
+/* Return 0 on success, 1 on failure.
+ * Before calling this function, caller must
+ * assign a unique value to mci->mc_idx.
+ */
+static int add_mc_to_global_list (struct mem_ctl_info *mci)
+{
+	struct list_head *item, *insert_before;
+	struct mem_ctl_info *p;
+
+	insert_before = &mc_devices;
+
+	if (unlikely((p = find_mci_by_dev(mci->dev)) != NULL))
+		goto fail0;
+
+	list_for_each(item, &mc_devices) {
+		p = list_entry(item, struct mem_ctl_info, link);
+
+		if (p->mc_idx >= mci->mc_idx) {
+			if (unlikely(p->mc_idx == mci->mc_idx))
+				goto fail1;
+
+			insert_before = item;
+			break;
+		}
+	}
+
+	list_add_tail_rcu(&mci->link, insert_before);
+	return 0;
+
+fail0:
+	edac_printk(KERN_WARNING, EDAC_MC,
+		    "%s (%s) %s %s already assigned %d\n", p->dev->bus_id,
+		    dev_name(p->dev), p->mod_name, p->ctl_name, p->mc_idx);
+	return 1;
+
+fail1:
+	edac_printk(KERN_WARNING, EDAC_MC,
+		    "bug in low-level driver: attempt to assign\n"
+		    "    duplicate mc_idx %d in %s()\n", p->mc_idx, __func__);
+	return 1;
+}
+
 static void complete_mc_list_del(struct rcu_head *head)
 {
 	struct mem_ctl_info *mci;
@@ -1411,6 +1453,7 @@ static void del_mc_from_global_list(stru
  * edac_mc_add_mc: Insert the 'mci' structure into the mci global list and
  *                 create sysfs entries associated with mci structure
  * @mci: pointer to the mci structure to be added to the list
+ * @mc_idx: A unique numeric identifier to be assigned to the 'mci' structure.
  *
  * Return:
  *	0	Success
@@ -1418,9 +1461,10 @@ static void del_mc_from_global_list(stru
  */
 
 /* FIXME - should a warning be printed if no error detection? correction? */
-int edac_mc_add_mc(struct mem_ctl_info *mci)
+int edac_mc_add_mc(struct mem_ctl_info *mci, int mc_idx)
 {
 	debugf0("%s()\n", __func__);
+	mci->mc_idx = mc_idx;
 #ifdef CONFIG_EDAC_DEBUG
 	if (edac_debug_level >= 3)
 		edac_mc_dump_mci(mci);
diff -puN drivers/edac/edac_mc.h~edac-mc-numbers-refactor-2-of-2 drivers/edac/edac_mc.h
--- 25/drivers/edac/edac_mc.h~edac-mc-numbers-refactor-2-of-2	Wed May 24 16:31:49 2006
+++ 25-akpm/drivers/edac/edac_mc.h	Wed May 24 16:31:49 2006
@@ -421,7 +421,7 @@ void edac_mc_dump_mci(struct mem_ctl_inf
 void edac_mc_dump_csrow(struct csrow_info *csrow);
 #endif  /* CONFIG_EDAC_DEBUG */
 
-extern int edac_mc_add_mc(struct mem_ctl_info *mci);
+extern int edac_mc_add_mc(struct mem_ctl_info *mci,int mc_idx);
 extern struct mem_ctl_info * edac_mc_del_mc(struct device *dev);
 extern int edac_mc_find_csrow_by_page(struct mem_ctl_info *mci,
 					unsigned long page);
diff -puN drivers/edac/i82860_edac.c~edac-mc-numbers-refactor-2-of-2 drivers/edac/i82860_edac.c
--- 25/drivers/edac/i82860_edac.c~edac-mc-numbers-refactor-2-of-2	Wed May 24 16:31:49 2006
+++ 25-akpm/drivers/edac/i82860_edac.c	Wed May 24 16:31:49 2006
@@ -208,7 +208,10 @@ static int i82860_probe1(struct pci_dev 
 
 	i82860_get_error_info(mci, &discard);  /* clear counters */
 
-	if (edac_mc_add_mc(mci)) {
+	/* Here we assume that we will never see multiple instances of this
+	 * type of memory controller.  The ID is therefore hardcoded to 0.
+	 */
+	if (edac_mc_add_mc(mci,0)) {
 		debugf3("%s(): failed edac_mc_add_mc()\n", __func__);
 		edac_mc_free(mci);
 	} else {
diff -puN drivers/edac/i82875p_edac.c~edac-mc-numbers-refactor-2-of-2 drivers/edac/i82875p_edac.c
--- 25/drivers/edac/i82875p_edac.c~edac-mc-numbers-refactor-2-of-2	Wed May 24 16:31:49 2006
+++ 25-akpm/drivers/edac/i82875p_edac.c	Wed May 24 16:31:49 2006
@@ -390,7 +390,10 @@ static int i82875p_probe1(struct pci_dev
 
 	i82875p_get_error_info(mci, &discard);  /* clear counters */
 
-	if (edac_mc_add_mc(mci)) {
+	/* Here we assume that we will never see multiple instances of this
+	 * type of memory controller.  The ID is therefore hardcoded to 0.
+	 */
+	if (edac_mc_add_mc(mci,0)) {
 		debugf3("%s(): failed edac_mc_add_mc()\n", __func__);
 		goto fail3;
 	}
diff -puN drivers/edac/r82600_edac.c~edac-mc-numbers-refactor-2-of-2 drivers/edac/r82600_edac.c
--- 25/drivers/edac/r82600_edac.c~edac-mc-numbers-refactor-2-of-2	Wed May 24 16:31:49 2006
+++ 25-akpm/drivers/edac/r82600_edac.c	Wed May 24 16:31:49 2006
@@ -304,7 +304,10 @@ static int r82600_probe1(struct pci_dev 
 
 	r82600_get_error_info(mci, &discard);  /* clear counters */
 
-	if (edac_mc_add_mc(mci)) {
+	/* Here we assume that we will never see multiple instances of this
+	 * type of memory controller.  The ID is therefore hardcoded to 0.
+	 */
+	if (edac_mc_add_mc(mci,0)) {
 		debugf3("%s(): failed edac_mc_add_mc()\n", __func__);
 		goto fail;
 	}
_

Patches currently in -mm which might be from norsk5@xxxxxxxxx are

edac-pci-device-to-device-cleanup.patch
edac-mc-numbers-refactor-1-of-2.patch
edac-mc-numbers-refactor-2-of-2.patch
edac-probe1-cleanup-1-of-2.patch
edac-probe1-cleanup-2-of-2.patch
edac-maintainers-update.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux