[SWDEV-538308] CPER CLI 20 limit bug (#499)
The bug was reproduced like this. In terminal #1, run command: sudo amd-smi ras --cper --gpu 6 --severity all --folder /tmp/cper_dump --follow In terminal #2, inject errors: while true; do sudo amdgpuras -b 7 -s 1 -m 6 -t 2; sleep 2; done The terminal #1 starts dumping cper entry information that it captures. After 20 entries have been captured, open terminal #3 and run same command as terminal #1: sudo amd-smi ras --cper --gpu 6 --severity all --folder /tmp/cper_dump --follow From terminal #3, there will be no output, even when terminal #1 continues capturing and printing information. The fix: Since we already have more than 20 CPER entries available in the GPU buffer, when we run the command from terminal #3 to start capturing from the beginning and pass 20 buffers to copy entries to, the C++ API returns a code saying there is more data available. The Python CLI should not treat this as an error, but should continue to print what the API returned. --------- Signed-off-by: Oosman Saeed <oossaeed@amd.com>
Esse commit está contido em:
@@ -2435,7 +2435,7 @@ def amdsmi_get_gpu_cper_entries(
|
||||
severity_mask: int,
|
||||
buffer_size: int = 4 * 1048576,
|
||||
cursor: int = 0
|
||||
) -> Tuple[Dict[str, Any], int, List[Dict[str, Any]]]:
|
||||
) -> Tuple[Dict[str, Any], int, List[Dict[str, Any]], int]:
|
||||
|
||||
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
|
||||
raise AmdSmiParameterException(
|
||||
@@ -2445,15 +2445,16 @@ def amdsmi_get_gpu_cper_entries(
|
||||
# Allocate a buffer for CPER data.
|
||||
buf = ctypes.create_string_buffer(buffer_size)
|
||||
buf_size = ctypes.c_uint64(buffer_size)
|
||||
entry_count = ctypes.c_uint64(20)
|
||||
num_cper_hdrs = 20
|
||||
entry_count = ctypes.c_uint64(num_cper_hdrs)
|
||||
cur = ctypes.c_uint64(cursor)
|
||||
|
||||
# Allocate a pointer for the CPER header array.
|
||||
cper_hdrs_array = (POINTER(amdsmi_wrapper.amdsmi_cper_hdr_t) * 20)()
|
||||
cper_hdrs = ctypes.cast(cper_hdrs_array, POINTER(POINTER(amdsmi_wrapper.amdsmi_cper_hdr_t)))
|
||||
cper_hdrs_array = (ctypes.POINTER(amdsmi_wrapper.amdsmi_cper_hdr_t) * num_cper_hdrs)()
|
||||
cper_hdrs = ctypes.cast(cper_hdrs_array, ctypes.POINTER(ctypes.POINTER(amdsmi_wrapper.amdsmi_cper_hdr_t)))
|
||||
|
||||
# Call the underlying AMD-SMI API.
|
||||
ret = amdsmi_wrapper.amdsmi_get_gpu_cper_entries(
|
||||
status_code = amdsmi_wrapper.amdsmi_get_gpu_cper_entries(
|
||||
processor_handle,
|
||||
ctypes.c_uint32(severity_mask),
|
||||
buf,
|
||||
@@ -2462,8 +2463,8 @@ def amdsmi_get_gpu_cper_entries(
|
||||
ctypes.byref(entry_count),
|
||||
ctypes.byref(cur)
|
||||
)
|
||||
if ret != amdsmi_wrapper.AMDSMI_STATUS_SUCCESS:
|
||||
raise AmdSmiLibraryException(ret)
|
||||
if status_code not in {amdsmi_wrapper.AMDSMI_STATUS_SUCCESS, amdsmi_wrapper.AMDSMI_STATUS_MORE_DATA}:
|
||||
raise AmdSmiLibraryException(status_code)
|
||||
|
||||
entries = {}
|
||||
cper_data = []
|
||||
@@ -2518,7 +2519,7 @@ def amdsmi_get_gpu_cper_entries(
|
||||
entries[i] = cper_entry.copy()
|
||||
offset += entry_ptr.contents.record_length # Use the actual record length to advance the offset.
|
||||
|
||||
return entries, cur.value, cper_data
|
||||
return entries, cur.value, cper_data, status_code
|
||||
|
||||
|
||||
def amdsmi_get_afids_from_cper(
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário