Skip to content

Commit

Permalink
rasdaemon: ras-mc-ctl: Log hpa and region info from cxl_general_media…
Browse files Browse the repository at this point in the history
… 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 <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
shijujose4 authored and mchehab committed Nov 18, 2024
1 parent ea224ad commit c957275
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions util/ras-mc-ctl.in
Original file line number Diff line number Diff line change
Expand Up @@ -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: ";
Expand Down Expand Up @@ -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 "") {
Expand All @@ -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: ";
Expand Down Expand Up @@ -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 "") {
Expand Down

0 comments on commit c957275

Please sign in to comment.