aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-10-05 08:40:09 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-10 10:49:31 -0400
commit6e103be1c7c4adb50f25aaf1f1e8f828833c1719 (patch)
tree77d1ada687f996be4f7cce07b47d46e13fe09413 /drivers/edac
parent4f87fad1d32fcdda448f9eb430c9c234a1939ece (diff)
i7core_edac: First store, then increment
Fix ringbuffer store logic. While here, add a few comments to the code and remove the undesired printk that could otherwise be called during NMI time. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/i7core_edac.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index 477b62a74dbf..59ec44175560 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1678,6 +1678,8 @@ static void i7core_check_error(struct mem_ctl_info *mci)
1678 * This routine simply queues mcelog errors, and 1678 * This routine simply queues mcelog errors, and
1679 * return. The error itself should be handled later 1679 * return. The error itself should be handled later
1680 * by i7core_check_error. 1680 * by i7core_check_error.
1681 * WARNING: As this routine should be called at NMI time, extra care should
1682 * be taken to avoid deadlocks, and to be as fast as possible.
1681 */ 1683 */
1682static int i7core_mce_check_error(void *priv, struct mce *mce) 1684static int i7core_mce_check_error(void *priv, struct mce *mce)
1683{ 1685{
@@ -1696,13 +1698,8 @@ static int i7core_mce_check_error(void *priv, struct mce *mce)
1696 return 0; 1698 return 0;
1697 1699
1698 /* Only handle if it is the right mc controller */ 1700 /* Only handle if it is the right mc controller */
1699 if (cpu_data(mce->cpu).phys_proc_id != pvt->i7core_dev->socket) { 1701 if (cpu_data(mce->cpu).phys_proc_id != pvt->i7core_dev->socket)
1700 debugf0("mc%d: ignoring mce log for socket %d. "
1701 "Another mc should get it.\n",
1702 pvt->i7core_dev->socket,
1703 cpu_data(mce->cpu).phys_proc_id);
1704 return 0; 1702 return 0;
1705 }
1706 1703
1707 smp_rmb(); 1704 smp_rmb();
1708 if ((pvt->mce_out + 1) % sizeof(mce_entry) == pvt->mce_in) { 1705 if ((pvt->mce_out + 1) % sizeof(mce_entry) == pvt->mce_in) {
@@ -1710,9 +1707,11 @@ static int i7core_mce_check_error(void *priv, struct mce *mce)
1710 pvt->mce_overrun++; 1707 pvt->mce_overrun++;
1711 return 0; 1708 return 0;
1712 } 1709 }
1710
1711 /* Copy memory error at the ringbuffer */
1712 memcpy(&pvt->mce_entry[pvt->mce_out], mce, sizeof(*mce));
1713 smp_wmb(); 1713 smp_wmb();
1714 pvt->mce_out = (pvt->mce_out + 1) % sizeof(mce_entry); 1714 pvt->mce_out = (pvt->mce_out + 1) % sizeof(mce_entry);
1715 memcpy(&pvt->mce_entry[pvt->mce_out], mce, sizeof(*mce));
1716 1715
1717 /* Handle fatal errors immediately */ 1716 /* Handle fatal errors immediately */
1718 if (mce->mcgstatus & 1) 1717 if (mce->mcgstatus & 1)