krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone

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

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