Blame SOURCES/0008-ras-mc-ctl-add-summary-for-MCE-and-PCIe-AER-errors.patch

d9e469
From 2925cc92d73065dab3bbf7de83404d6e0e141dc6 Mon Sep 17 00:00:00 2001
d9e469
From: Mauro Carvalho Chehab <mchehab@redhat.com>
d9e469
Date: Fri, 31 May 2013 14:57:54 -0300
d9e469
Subject: [PATCH 08/32] ras-mc-ctl: add summary for MCE and PCIe AER errors
d9e469
d9e469
Report the summary also for MCE and PCIe errors.
d9e469
d9e469
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
d9e469
---
d9e469
 util/ras-mc-ctl.in |   50 ++++++++++++++++++++++++++++++++++++++++++++------
d9e469
 1 files changed, 44 insertions(+), 6 deletions(-)
d9e469
d9e469
diff --git a/util/ras-mc-ctl.in b/util/ras-mc-ctl.in
d9e469
index 5b1ca4d..118af7b 100755
d9e469
--- a/util/ras-mc-ctl.in
d9e469
+++ b/util/ras-mc-ctl.in
d9e469
@@ -824,21 +824,59 @@ sub find_prog
d9e469
 sub summary
d9e469
 {
d9e469
     require DBI;
d9e469
+    my ($query, $query_handle, $out);
d9e469
+    my ($err_type, $label, $mc, $top, $mid, $low, $count, $msg);
d9e469
 
d9e469
     my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
d9e469
 
d9e469
-    my $query = "select label, mc, top_layer,middle_layer,lower_layer, count(*) from mc_event group by label,mc,top_layer,middle_layer,lower_layer";
d9e469
-    my $query_handle = $dbh->prepare($query);
d9e469
+    # Memory controller mc_event errors
d9e469
+    $query = "select err_type, label, mc, top_layer,middle_layer,lower_layer, count(*) from mc_event group by err_type, label, mc, top_layer, middle_layer, lower_layer";
d9e469
+    $query_handle = $dbh->prepare($query);
d9e469
     $query_handle->execute();
d9e469
+    $query_handle->bind_columns(\($err_type, $label, $mc, $top, $mid, $low, $count));
d9e469
+    $out = "";
d9e469
+    while($query_handle->fetch()) {
d9e469
+        $out .= "\t$err_type on DIMM Label(s): '$label' location: $mc:$top:$mid:$low errors: $count\n";
d9e469
+    }
d9e469
+    if ($out ne "") {
d9e469
+        print "Memory controller events summary:\n$out\n";
d9e469
+    } else {
d9e469
+        print "No Memory errors.\n\n";
d9e469
+    }
d9e469
+    $query_handle->finish;
d9e469
 
d9e469
-    $query_handle->bind_columns(\my($label, $mc, $top, $mid, $low, $count));
d9e469
-
d9e469
-    print "Memory controller events summary:\n";
d9e469
+    # PCIe AER aer_event errors
d9e469
+    $query = "select err_type, err_msg, count(*) from aer_event group by err_type, err_msg";
d9e469
+    $query_handle = $dbh->prepare($query);
d9e469
+    $query_handle->execute();
d9e469
+    $query_handle->bind_columns(\($err_type, $msg, $count));
d9e469
+    $out = "";
d9e469
     while($query_handle->fetch()) {
d9e469
-        print "DIMM Label(s): '$label' location: $mc:$top:$mid:$low errors: $count\n";
d9e469
+        $out .= "\t$count $err_type errors: $msg\n";
d9e469
     }
d9e469
+    if ($out ne "") {
d9e469
+        print "PCIe AER events summary:\n$out\n";
d9e469
+    } else {
d9e469
+        print "No PCIe AER errors.\n\n";
d9e469
+    }
d9e469
+    $query_handle->finish;
d9e469
 
d9e469
+    # MCE mce_record errors
d9e469
+    $query = "select error_msg, count(*) from mce_record group by error_msg";
d9e469
+    $query_handle = $dbh->prepare($query);
d9e469
+    $query_handle->execute();
d9e469
+    $query_handle->bind_columns(\($msg, $count));
d9e469
+    $out = "";
d9e469
+    while($query_handle->fetch()) {
d9e469
+        $out .= "\t$count $msg errors\n";
d9e469
+    }
d9e469
+    if ($out ne "") {
d9e469
+        print "MCE records summary:\n$out";
d9e469
+    } else {
d9e469
+        print "No MCE errors.\n";
d9e469
+    }
d9e469
     $query_handle->finish;
d9e469
+
d9e469
     undef($dbh);
d9e469
 }
d9e469
 
d9e469
-- 
d9e469
1.7.1
d9e469