krishnanadh / rpms / rasdaemon

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