From: Shiju Jose Date: Thu, 16 May 2024 14:23:44 +0000 (+0100) Subject: rasdaemon: ras-mc-ctl: Log hpa and region info from cxl_general_media and cxl_dram... X-Git-Tag: v0.8.2~25 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=c9572757a558d77aa11246e5f187e18557d57665;p=users%2Fmchehab%2Frasdaemon.git rasdaemon: ras-mc-ctl: Log hpa and region info from cxl_general_media and cxl_dram tables Add support for read and log hpa and region info from cxl_general_media and cxl_dram tables. Note: This change does not have backward compatability, because the select command with newly added columns would fail with previous CXL tables where newly added columns are not present. The issue can be solved with updating the CXL table's name to v2, but again no backward compatability in ras-mc-ctl for listing errors which fails when previous version of CXL table only present in the database as it cannot find v2 of the table. Signed-off-by: Shiju Jose Signed-off-by: Mauro Carvalho Chehab --- diff --git a/util/ras-mc-ctl.in b/util/ras-mc-ctl.in index c5166ea..c24941f 100755 --- a/util/ras-mc-ctl.in +++ b/util/ras-mc-ctl.in @@ -1957,10 +1957,10 @@ sub errors # CXL general media errors use constant CXL_EVENT_GEN_MED_COMP_ID_SIZE => 0x10; - $query = "select id, timestamp, memdev, host, serial, log_type, hdr_uuid, hdr_flags, hdr_handle, hdr_related_handle, hdr_ts, hdr_length, hdr_maint_op_class, dpa, dpa_flags, descriptor, type, transaction_type, channel, rank, device, comp_id from cxl_general_media_event$conf{opt}{since} order by id"; + $query = "select id, timestamp, memdev, host, serial, log_type, hdr_uuid, hdr_flags, hdr_handle, hdr_related_handle, hdr_ts, hdr_length, hdr_maint_op_class, dpa, dpa_flags, descriptor, type, transaction_type, channel, rank, device, comp_id, hpa, region, region_uuid from cxl_general_media_event$conf{opt}{since} order by id"; $query_handle = $dbh->prepare($query); $query_handle->execute(); - $query_handle->bind_columns(\($id, $timestamp, $memdev, $host, $serial, $log_type, $hdr_uuid, $hdr_flags, $hdr_handle, $hdr_related_handle, $hdr_ts, $hdr_length, $hdr_maint_op_class, $dpa, $dpa_flags, $descriptor, $mem_event_type, $transaction_type, $channel, $rank, $device, $comp_id)); + $query_handle->bind_columns(\($id, $timestamp, $memdev, $host, $serial, $log_type, $hdr_uuid, $hdr_flags, $hdr_handle, $hdr_related_handle, $hdr_ts, $hdr_length, $hdr_maint_op_class, $dpa, $dpa_flags, $descriptor, $mem_event_type, $transaction_type, $channel, $rank, $device, $comp_id, $hpa, $region, $region_uuid)); $out = ""; while($query_handle->fetch()) { $out .= "$id $timestamp error: "; @@ -1990,6 +1990,9 @@ sub errors $out .= sprintf "%02x ", $bytes[$i]; } } + $out .= sprintf "hpa=0x%llx, ", $hpa if (defined $hpa && length $hpa); + $out .= "region=$region, " if (defined $region && length $region); + $out .= "region_uuid=$region_uuid, " if (defined $region_uuid && length $region_uuid); $out .= "\n"; } if ($out ne "") { @@ -2000,10 +2003,10 @@ sub errors # CXL DRAM errors use constant CXL_EVENT_DER_CORRECTION_MASK_SIZE => 0x20; - $query = "select id, timestamp, memdev, host, serial, log_type, hdr_uuid, hdr_flags, hdr_handle, hdr_related_handle, hdr_ts, hdr_length, hdr_maint_op_class, dpa, dpa_flags, descriptor, type, transaction_type, channel, rank, nibble_mask, bank_group, bank, row, column, cor_mask from cxl_dram_event$conf{opt}{since} order by id"; + $query = "select id, timestamp, memdev, host, serial, log_type, hdr_uuid, hdr_flags, hdr_handle, hdr_related_handle, hdr_ts, hdr_length, hdr_maint_op_class, dpa, dpa_flags, descriptor, type, transaction_type, channel, rank, nibble_mask, bank_group, bank, row, column, cor_mask, hpa, region, region_uuid from cxl_dram_event$conf{opt}{since} order by id"; $query_handle = $dbh->prepare($query); $query_handle->execute(); - $query_handle->bind_columns(\($id, $timestamp, $memdev, $host, $serial, $log_type, $hdr_uuid, $hdr_flags, $hdr_handle, $hdr_related_handle, $hdr_ts, $hdr_length, $hdr_maint_op_class, $dpa, $dpa_flags, $descriptor, $type, $transaction_type, $channel, $rank, $nibble_mask, $bank_group, $bank, $row, $column, $cor_mask)); + $query_handle->bind_columns(\($id, $timestamp, $memdev, $host, $serial, $log_type, $hdr_uuid, $hdr_flags, $hdr_handle, $hdr_related_handle, $hdr_ts, $hdr_length, $hdr_maint_op_class, $dpa, $dpa_flags, $descriptor, $type, $transaction_type, $channel, $rank, $nibble_mask, $bank_group, $bank, $row, $column, $cor_mask, $hpa, $region, $region_uuid)); $out = ""; while($query_handle->fetch()) { $out .= "$id $timestamp error: "; @@ -2037,6 +2040,9 @@ sub errors $out .= sprintf "%02x ", $bytes[$i]; } } + $out .= sprintf "hpa=0x%llx, ", $hpa if (defined $hpa && length $hpa); + $out .= "region=$region, " if (defined $region && length $region); + $out .= "region_uuid=$region_uuid, " if (defined $region_uuid && length $region_uuid); $out .= "\n"; } if ($out ne "") {