krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone
d77db6
commit 0862a096c3a1d0f993703ab3299f1ddfadf53d7f
d77db6
Author: Shiju Jose <shiju.jose@huawei.com>
d77db6
Date:   Tue Aug 11 13:31:46 2020 +0100
d77db6
d77db6
    rasdaemon: ras-mc-ctl: Add ARM processor error information
d77db6
    
d77db6
    Add supporting ARM processor error in the ras-mc-ctl tool.
d77db6
    
d77db6
    Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
d77db6
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
d77db6
d77db6
---
d77db6
 util/ras-mc-ctl.in |   40 ++++++++++++++++++++++++++++++++++++++++
d77db6
 1 file changed, 40 insertions(+)
d77db6
d77db6
--- rasdaemon-0.6.1.orig/util/ras-mc-ctl.in	2021-10-06 14:14:25.000440090 -0400
d77db6
+++ rasdaemon-0.6.1/util/ras-mc-ctl.in	2021-10-06 14:15:59.995598590 -0400
d77db6
@@ -1124,6 +1124,7 @@ sub summary
d77db6
     my ($query, $query_handle, $out);
d77db6
     my ($err_type, $label, $mc, $top, $mid, $low, $count, $msg);
d77db6
     my ($etype, $severity, $etype_string, $severity_string);
d77db6
+    my ($affinity, $mpidr);
d77db6
 
d77db6
     my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
d77db6
 
d77db6
@@ -1159,6 +1160,22 @@ sub summary
d77db6
     }
d77db6
     $query_handle->finish;
d77db6
 
d77db6
+    # ARM processor arm_event errors
d77db6
+    $query = "select affinity, mpidr, count(*) from arm_event group by affinity, mpidr";
d77db6
+    $query_handle = $dbh->prepare($query);
d77db6
+    $query_handle->execute();
d77db6
+    $query_handle->bind_columns(\($affinity, $mpidr, $count));
d77db6
+    $out = "";
d77db6
+    while($query_handle->fetch()) {
d77db6
+        $out .= "\t$count errors\n";
d77db6
+    }
d77db6
+    if ($out ne "") {
d77db6
+        print "ARM processor events summary:\n$out\n";
d77db6
+    } else {
d77db6
+        print "No ARM processor errors.\n\n";
d77db6
+    }
d77db6
+    $query_handle->finish;
d77db6
+
d77db6
     # extlog errors
d77db6
     $query = "select etype, severity, count(*) from extlog_event group by etype, severity";
d77db6
     $query_handle = $dbh->prepare($query);
d77db6
@@ -1202,6 +1219,7 @@ sub errors
d77db6
     my ($query, $query_handle, $id, $time, $count, $type, $msg, $label, $mc, $top, $mid, $low, $addr, $grain, $syndrome, $detail, $out);
d77db6
     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);
d77db6
     my ($timestamp, $etype, $severity, $etype_string, $severity_string, $fru_id, $fru_text, $cper_data);
d77db6
+    my ($error_count, $affinity, $mpidr, $r_state, $psci_state);
d77db6
 
d77db6
     my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
d77db6
 
d77db6
@@ -1241,6 +1259,28 @@ sub errors
d77db6
     }
d77db6
     $query_handle->finish;
d77db6
 
d77db6
+    # ARM processor arm_event errors
d77db6
+    $query = "select id, timestamp, error_count, affinity, mpidr, running_state, psci_state from arm_event order by id";
d77db6
+    $query_handle = $dbh->prepare($query);
d77db6
+    $query_handle->execute();
d77db6
+    $query_handle->bind_columns(\($id, $timestamp, $error_count, $affinity, $mpidr, $r_state, $psci_state));
d77db6
+    $out = "";
d77db6
+    while($query_handle->fetch()) {
d77db6
+        $out .= "$id $timestamp error: ";
d77db6
+        $out .= "error_count=$error_count, " if ($error_count);
d77db6
+        $out .= "affinity_level=$affinity, ";
d77db6
+        $out .= sprintf "mpidr=0x%x, ", $mpidr;
d77db6
+        $out .= sprintf "running_state=0x%x, ", $r_state;
d77db6
+        $out .= sprintf "psci_state=0x%x", $psci_state;
d77db6
+        $out .= "\n";
d77db6
+    }
d77db6
+    if ($out ne "") {
d77db6
+        print "ARM processor events:\n$out\n";
d77db6
+    } else {
d77db6
+        print "No ARM processor errors.\n\n";
d77db6
+    }
d77db6
+    $query_handle->finish;
d77db6
+
d77db6
     # Extlog errors
d77db6
     $query = "select id, timestamp, etype, severity, address, fru_id, fru_text, cper_data from extlog_event order by id";
d77db6
     $query_handle = $dbh->prepare($query);