[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>
This commit is contained in:
Saeed, Oosman authored and GitHub committed 2025-07-07 11:11:13 -05:00
1 parent f559075a81
commit 5b95d227bc
4 files changed
+25 -18

No files matched your search

+9 -3
View File
@@ -1279,7 +1279,7 @@ Input parameters:
* `buffer_size` pointer to a variable that specifies the size of the cper_data
* `cursor` pointer to a variable that will contain the cursor for the next call
Output: Dictionary with fields, updated cursor, and a dictionary of the cper_data
Output: Dictionary with fields, updated cursor, a dictionary of the cper_data, and API status_code
Field | Description
---|---
@@ -1297,16 +1297,22 @@ Field | Description
`flags` | Reserved flags related to the CPER entry. |
`persistence_info` | Reserved information related to persistence. |
* `status_code` | Upon successful retrieval of data, status_code will be AMDSMI_STATUS_SUCCESS (0) or AMDSMI_STATUS_MORE_DATA (39) if more data can be retrieve by subsequent call to the `amdsmi_get_gpu_cper_entries` function. In the later case, the input parameter `cursor` should be set to the updated `cursor` that was returned from the previous call.
Exceptions that can be thrown by `amdsmi_get_gpu_cper_entries` function:
* `AmdSmiLibraryException`
* `AmdSmiLibraryException` with these possible error codes:
AMDSMI_STATUS_INVAL
AMDSMI_STATUS_UNEXPECTED_SIZE
AMDSMI_STATUS_UNEXPECTED_DATA
AMDSMI_STATUS_NOT_SUPPORTED
* `AmdSmiParameterException`
Example:
```python
for device in devices:
entries, new_cursor, cper_data = amdsmi_get_gpu_cper_entries(device, severity_mask, buffer_size, initial_cursor)
entries, new_cursor, cper_data, status_code = amdsmi_get_gpu_cper_entries(device, severity_mask, buffer_size, initial_cursor)
print("CPER entries for device", device)
for key, entry in entries.items():
print("Entry", key)