krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone

Blame SOURCES/0862a096c3a1d0f993703ab3299f1ddfadf53d7f.patch

David Johansen 447ac5
commit 0862a096c3a1d0f993703ab3299f1ddfadf53d7f
David Johansen 45192c
Author: Shiju Jose <shiju.jose@huawei.com>
David Johansen 45192c
Date:   Tue Aug 11 13:31:46 2020 +0100
David Johansen 45192c
David Johansen 45192c
    rasdaemon: ras-mc-ctl: Add ARM processor error information
David Johansen 45192c
    
David Johansen 45192c
    Add supporting ARM processor error in the ras-mc-ctl tool.
David Johansen 45192c
    
David Johansen 45192c
    Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
David Johansen 45192c
    Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
David Johansen 45192c
David Johansen 45192c
diff --git a/util/ras-mc-ctl.in b/util/ras-mc-ctl.in
David Johansen 447ac5
index ff38143..dd7d56f 100755
David Johansen 45192c
--- a/util/ras-mc-ctl.in
David Johansen 45192c
+++ b/util/ras-mc-ctl.in
David Johansen 45192c
@@ -1123,6 +1123,7 @@ sub summary
David Johansen 45192c
     my ($err_type, $label, $mc, $top, $mid, $low, $count, $msg);
David Johansen 45192c
     my ($etype, $severity, $etype_string, $severity_string);
David Johansen 45192c
     my ($dev_name, $dev);
David Johansen 45192c
+    my ($affinity, $mpidr);
David Johansen 45192c
 
David Johansen 45192c
     my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
David Johansen 45192c
 
David Johansen 45192c
@@ -1158,6 +1159,22 @@ sub summary
David Johansen 45192c
     }
David Johansen 45192c
     $query_handle->finish;
David Johansen 45192c
 
David Johansen 45192c
+    # ARM processor arm_event errors
David Johansen 45192c
+    $query = "select affinity, mpidr, count(*) from arm_event group by affinity, mpidr";
David Johansen 45192c
+    $query_handle = $dbh->prepare($query);
David Johansen 45192c
+    $query_handle->execute();
David Johansen 45192c
+    $query_handle->bind_columns(\($affinity, $mpidr, $count));
David Johansen 45192c
+    $out = "";
David Johansen 45192c
+    while($query_handle->fetch()) {
David Johansen 45192c
+        $out .= "\t$count errors\n";
David Johansen 45192c
+    }
David Johansen 45192c
+    if ($out ne "") {
David Johansen 45192c
+        print "ARM processor events summary:\n$out\n";
David Johansen 45192c
+    } else {
David Johansen 45192c
+        print "No ARM processor errors.\n\n";
David Johansen 45192c
+    }
David Johansen 45192c
+    $query_handle->finish;
David Johansen 45192c
+
David Johansen 45192c
     # extlog errors
David Johansen 45192c
     $query = "select etype, severity, count(*) from extlog_event group by etype, severity";
David Johansen 45192c
     $query_handle = $dbh->prepare($query);
David Johansen 45192c
@@ -1235,6 +1252,7 @@ sub errors
David Johansen 45192c
     my ($timestamp, $etype, $severity, $etype_string, $severity_string, $fru_id, $fru_text, $cper_data);
David Johansen 45192c
     my ($bus_name, $dev_name, $driver_name, $reporter_name);
David Johansen 45192c
     my ($dev, $sector, $nr_sector, $error, $rwbs, $cmd);
David Johansen 45192c
+    my ($error_count, $affinity, $mpidr, $r_state, $psci_state);
David Johansen 45192c
 
David Johansen 45192c
     my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {});
David Johansen 45192c
 
David Johansen 45192c
@@ -1274,6 +1292,28 @@ sub errors
David Johansen 45192c
     }
David Johansen 45192c
     $query_handle->finish;
David Johansen 45192c
 
David Johansen 45192c
+    # ARM processor arm_event errors
David Johansen 45192c
+    $query = "select id, timestamp, error_count, affinity, mpidr, running_state, psci_state from arm_event order by id";
David Johansen 45192c
+    $query_handle = $dbh->prepare($query);
David Johansen 45192c
+    $query_handle->execute();
David Johansen 45192c
+    $query_handle->bind_columns(\($id, $timestamp, $error_count, $affinity, $mpidr, $r_state, $psci_state));
David Johansen 45192c
+    $out = "";
David Johansen 45192c
+    while($query_handle->fetch()) {
David Johansen 45192c
+        $out .= "$id $timestamp error: ";
David Johansen 45192c
+        $out .= "error_count=$error_count, " if ($error_count);
David Johansen 45192c
+        $out .= "affinity_level=$affinity, ";
David Johansen 45192c
+        $out .= sprintf "mpidr=0x%x, ", $mpidr;
David Johansen 45192c
+        $out .= sprintf "running_state=0x%x, ", $r_state;
David Johansen 45192c
+        $out .= sprintf "psci_state=0x%x", $psci_state;
David Johansen 45192c
+        $out .= "\n";
David Johansen 45192c
+    }
David Johansen 45192c
+    if ($out ne "") {
David Johansen 45192c
+        print "ARM processor events:\n$out\n";
David Johansen 45192c
+    } else {
David Johansen 45192c
+        print "No ARM processor errors.\n\n";
David Johansen 45192c
+    }
David Johansen 45192c
+    $query_handle->finish;
David Johansen 45192c
+
David Johansen 45192c
     # Extlog errors
David Johansen 45192c
     $query = "select id, timestamp, etype, severity, address, fru_id, fru_text, cper_data from extlog_event order by id";
David Johansen 45192c
     $query_handle = $dbh->prepare($query);