Blame SOURCES/0009-ras-mc-ctl-report-errors-also-for-PCIe-AER-and-MCE.patch

97e186
From 4b64649eb5740027f58377f6c29d1554d9792b97 Mon Sep 17 00:00:00 2001
97e186
From: Mauro Carvalho Chehab <mchehab@redhat.com>
97e186
Date: Fri, 31 May 2013 16:16:44 -0300
97e186
Subject: [PATCH 09/32] ras-mc-ctl: report errors also for PCIe AER and MCE
97e186
97e186
Show also PCIe AER and MCE when used with --errors parameter.
97e186
97e186
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
97e186
---
97e186
 util/ras-mc-ctl.in |   73 +++++++++++++++++++++++++++++++++++++++++++++++-----
97e186
 1 files changed, 66 insertions(+), 7 deletions(-)
97e186
97e186
diff --git a/util/ras-mc-ctl.in b/util/ras-mc-ctl.in
97e186
index 118af7b..30d3078 100755
97e186
--- a/util/ras-mc-ctl.in
97e186
+++ b/util/ras-mc-ctl.in
97e186
@@ -883,22 +883,81 @@ sub summary
97e186
 sub errors
97e186
 {
97e186
     require DBI;
97e186
+    my ($query, $query_handle, $id, $time, $count, $type, $msg, $label, $mc, $top, $mid, $low, $addr, $grain, $syndrome, $detail, $out);
97e186
+    my ($mcgcap,$mcgstatus, $status, $misc, $ip, $tsc, $walltime, $cpu, $cpuid, $apicid, $socketid, $cs, $bank, $cpuvendor, $bank_name, $mcgstatus_msg, $mcistatus_msg, $user_action, $mc_location);
97e186
 
97e186
     my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
97e186
 
97e186
-    my $query = "select id, timestamp, err_count, err_type, err_msg, label, mc, top_layer,middle_layer,lower_layer, address, grain, syndrome, driver_detail from mc_event order by id";
97e186
-
97e186
-    my $query_handle = $dbh->prepare($query);
97e186
+    # Memory controller mc_event errors
97e186
+    $query = "select id, timestamp, err_count, err_type, err_msg, label, mc, top_layer,middle_layer,lower_layer, address, grain, syndrome, driver_detail from mc_event order by id";
97e186
+    $query_handle = $dbh->prepare($query);
97e186
     $query_handle->execute();
97e186
+    $query_handle->bind_columns(\($id, $time, $count, $type, $msg, $label, $mc, $top, $mid, $low, $addr, $grain, $syndrome, $detail));
97e186
+    $out = "";
97e186
+    while($query_handle->fetch()) {
97e186
+        $out .= "$id $time $count $type error(s): $msg at $label location: $mc:$top:$mid:$low, addr $addr, grain $grain, syndrome $syndrome $detail\n";
97e186
+    }
97e186
+    if ($out ne "") {
97e186
+        print "PCIe AER events:\n$out\n";
97e186
+    } else {
97e186
+        print "No PCIe AER errors.\n\n";
97e186
+    }
97e186
+    $query_handle->finish;
97e186
 
97e186
-    $query_handle->bind_columns(\my($id, $time, $count, $type, $msg, $label, $mc, $top, $mid, $low, $addr, $grain, $syndrome, $detail));
97e186
-
97e186
-    print "Memory controller events:\n";
97e186
+    # PCIe AER aer_event errors
97e186
+    $query = "select id, timestamp, err_type, err_msg from aer_event order by id";
97e186
+    $query_handle = $dbh->prepare($query);
97e186
+    $query_handle->execute();
97e186
+    $query_handle->bind_columns(\($id, $time, $type, $msg));
97e186
+    $out = "";
97e186
     while($query_handle->fetch()) {
97e186
-        print "$id $time $count $type error(s): $msg at $label location: $mc:$top:$mid:$low, addr $addr, grain $grain, syndrome $syndrome $detail\n";
97e186
+        $out .= "$id $time $type error: $msg\n";
97e186
     }
97e186
+    if ($out ne "") {
97e186
+        print "MCE events:\n$out\n";
97e186
+    } else {
97e186
+        print "No MCE errors.\n\n";
97e186
+    }
97e186
+    $query_handle->finish;
97e186
 
97e186
+    # MCE mce_record errors
97e186
+    $query = "select id, timestamp, mcgcap, mcgstatus, status, addr, misc, ip, tsc, walltime, cpu, cpuid, apicid, socketid, cs, bank, cpuvendor, bank_name, error_msg, mcgstatus_msg, mcistatus_msg, user_action, mc_location from mce_record order by id";
97e186
+    $query_handle = $dbh->prepare($query);
97e186
+    $query_handle->execute();
97e186
+    $query_handle->bind_columns(\($id, $time, $mcgcap,$mcgstatus, $status, $addr, $misc, $ip, $tsc, $walltime, $cpu, $cpuid, $apicid, $socketid, $cs, $bank, $cpuvendor, $bank_name, $msg, $mcgstatus_msg, $mcistatus_msg, $user_action, $mc_location));
97e186
+    $out = "";
97e186
+    while($query_handle->fetch()) {
97e186
+        $out .= "$id $time error: $msg";
97e186
+	$out .= ", CPU $cpuvendor" if ($cpuvendor);
97e186
+	$out .= ", bank $bank_name" if ($bank_name);
97e186
+	$out .= ", mcg $mcgstatus_msg" if ($mcgstatus_msg);
97e186
+	$out .= ", mci $mcistatus_msg" if ($mcistatus_msg);
97e186
+	$out .= ", $mc_location" if ($mc_location);
97e186
+	$out .= ", $user_action" if ($user_action);
97e186
+	$out .= sprintf ", mcgcap=0x%08x", $mcgcap if ($mcgcap);
97e186
+	$out .= sprintf ", mcgstatus=0x%08x", $mcgstatus if ($mcgstatus);
97e186
+	$out .= sprintf ", status=0x%08x", $status if ($status);
97e186
+	$out .= sprintf ", addr=0x%08x", $addr if ($addr);
97e186
+	$out .= sprintf ", misc=0x%08x", $misc if ($misc);
97e186
+	$out .= sprintf ", ip=0x%08x", $ip if ($ip);
97e186
+	$out .= sprintf ", tsc=0x%08x", $tsc if ($tsc);
97e186
+	$out .= sprintf ", walltime=0x%08x", $walltime if ($walltime);
97e186
+	$out .= sprintf ", cpu=0x%08x", $cpu if ($cpu);
97e186
+	$out .= sprintf ", cpuid=0x%08x", $cpuid if ($cpuid);
97e186
+	$out .= sprintf ", apicid=0x%08x", $apicid if ($apicid);
97e186
+	$out .= sprintf ", socketid=0x%08x", $socketid if ($socketid);
97e186
+	$out .= sprintf ", cs=0x%08x", $cs if ($cs);
97e186
+	$out .= sprintf ", bank=0x%08x", $bank if ($bank);
97e186
+
97e186
+	$out .= "\n";
97e186
+    }
97e186
+    if ($out ne "") {
97e186
+        print "Memory controller events:\n$out\n";
97e186
+    } else {
97e186
+        print "No Memory errors.\n\n";
97e186
+    }
97e186
     $query_handle->finish;
97e186
+
97e186
     undef($dbh);
97e186
 }
97e186
 
97e186
-- 
97e186
1.7.1
97e186