Blame SOURCES/0037-rasdaemon-sqlite-truncates-some-MCE-fields-to-32-bit.patch

97e186
commit 52e60e3050105a55e1ff2382979d5f370f398200
97e186
Author: Luck, Tony <tony.luck@intel.com>
97e186
Date:   Mon Apr 7 11:27:47 2014 -0700
97e186
97e186
    rasdaemon: sqlite truncates some MCE fields to 32-bit
97e186
    
97e186
    The sqlite3_bind_int() function takes an "int" as the argument value to
97e186
    save to the database. But some fields are wider than 32-bits.  Use
97e186
    sqlite3_bind_int64() for the fields where we know values can exceed
97e186
    4G.
97e186
    
97e186
    Before:
97e186
    
97e186
    # ./rasdaemon/util/ras-mc-ctl --errors
97e186
     ...
97e186
    MCE events:
97e186
    1 2014-04-04 08:50:32 -0700 error: MEMORY CONTROLLER RD_CHANNEL0_ERR Transaction: Memory read error, mcg mcgstatus= 0, mci Corrected_error, mcgcap=0x07000c16, status=0x00010090, addr=0x35fcb9c0, misc=0x5026a686, walltime=0x5342e4f9, cpu=0x0000000e, cpuid=0x000306f1, apicid=0x00000020, socketid=0x00000001, bank=0x00000008
97e186
    2 2014-04-04 08:50:35 -0700 error: MEMORY CONTROLLER RD_CHANNEL0_ERR Transaction: Memory read error, mcg mcgstatus= 0, mci Corrected_error, mcgcap=0x07000c16, status=0x00010090, addr=0x4187adc0, misc=0x4274f486, walltime=0x5342e4fc, cpu=0x0000000e, cpuid=0x000306f1, apicid=0x00000020, socketid=0x00000001, bank=0x00000007
97e186
    3 2014-04-04 08:50:37 -0700 error: MEMORY CONTROLLER RD_CHANNEL0_ERR Transaction: Memory read error, mcg mcgstatus= 0, mci Corrected_error, mcgcap=0x07000c16, status=0x00010090, addr=0x52efc600, misc=0x50028286, walltime=0x5342e4fd, cpu=0x0000000e, cpuid=0x000306f1, apicid=0x00000020, socketid=0x00000001, bank=0x00000008
97e186
    
97e186
    After:
97e186
    ./rasdaemon/util/ras-mc-ctl --errors
97e186
     ...
97e186
    1 2014-04-04 09:00:07 -0700 error: MEMORY CONTROLLER RD_CHANNEL0_ERR Transaction: Memory read error, mcg mcgstatus= 0, mci Corrected_error, mcgcap=0x07000c16, status=0x8c00004000010090, addr=0x45340a180, misc=0x140686886, walltime=0x5342e736, cpuid=0x000306f1, bank=0x00000008
97e186
    2 2014-04-04 09:00:08 -0700 error: MEMORY CONTROLLER RD_CHANNEL0_ERR Transaction: Memory read error, mcg mcgstatus= 0, mci Corrected_error, mcgcap=0x07000c16, status=0x8c00004000010090, addr=0x44d6e4780, misc=0x15060e086, walltime=0x5342e737, cpuid=0x000306f1, bank=0x00000007
97e186
    3 2014-04-04 09:00:10 -0700 error: MEMORY CONTROLLER RD_CHANNEL0_ERR Transaction: Memory read error, mcg mcgstatus= 0, mci Corrected_error, mcgcap=0x07000c16, status=0x8c00004000010090, addr=0x44cb64640, misc=0x140505086, walltime=0x5342e739, cpuid=0x000306f1, bank=0x00000008
97e186
    
97e186
    Signed-off-by: Tony Luck <tony.luck@intel.com>
97e186
    Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
97e186
97e186
diff --git a/ras-record.c b/ras-record.c
97e186
index e602edb..e5150ad 100644
97e186
--- a/ras-record.c
97e186
+++ b/ras-record.c
97e186
@@ -209,22 +209,22 @@ int ras_store_mce_record(struct ras_events *ras, struct mce_event *ev)
97e186
 		return 0;
97e186
 	log(TERM, LOG_INFO, "mce_record store: %p\n", priv->stmt_mce_record);
97e186
 
97e186
-	sqlite3_bind_text(priv->stmt_mce_record,  1, ev->timestamp, -1, NULL);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record,  2, ev->mcgcap);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record,  3, ev->mcgstatus);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record,  4, ev->status);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record,  5, ev->addr);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record,  6, ev->misc);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record,  7, ev->ip);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record,  8, ev->tsc);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record,  9, ev->walltime);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record, 10, ev->cpu);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record, 11, ev->cpuid);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record, 12, ev->apicid);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record, 13, ev->socketid);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record, 14, ev->cs);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record, 15, ev->bank);
97e186
-	sqlite3_bind_int (priv->stmt_mce_record, 16, ev->cpuvendor);
97e186
+	sqlite3_bind_text  (priv->stmt_mce_record,  1, ev->timestamp, -1, NULL);
97e186
+	sqlite3_bind_int   (priv->stmt_mce_record,  2, ev->mcgcap);
97e186
+	sqlite3_bind_int   (priv->stmt_mce_record,  3, ev->mcgstatus);
97e186
+	sqlite3_bind_int64 (priv->stmt_mce_record,  4, ev->status);
97e186
+	sqlite3_bind_int64 (priv->stmt_mce_record,  5, ev->addr);
97e186
+	sqlite3_bind_int64 (priv->stmt_mce_record,  6, ev->misc);
97e186
+	sqlite3_bind_int64 (priv->stmt_mce_record,  7, ev->ip);
97e186
+	sqlite3_bind_int64 (priv->stmt_mce_record,  8, ev->tsc);
97e186
+	sqlite3_bind_int64 (priv->stmt_mce_record,  9, ev->walltime);
97e186
+	sqlite3_bind_int   (priv->stmt_mce_record, 10, ev->cpu);
97e186
+	sqlite3_bind_int   (priv->stmt_mce_record, 11, ev->cpuid);
97e186
+	sqlite3_bind_int   (priv->stmt_mce_record, 12, ev->apicid);
97e186
+	sqlite3_bind_int   (priv->stmt_mce_record, 13, ev->socketid);
97e186
+	sqlite3_bind_int   (priv->stmt_mce_record, 14, ev->cs);
97e186
+	sqlite3_bind_int   (priv->stmt_mce_record, 15, ev->bank);
97e186
+	sqlite3_bind_int   (priv->stmt_mce_record, 16, ev->cpuvendor);
97e186
 
97e186
 	sqlite3_bind_text(priv->stmt_mce_record, 17, ev->bank_name, -1, NULL);
97e186
 	sqlite3_bind_text(priv->stmt_mce_record, 18, ev->error_msg, -1, NULL);