krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone

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

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