SWDEV-453493 - Fix Null pointer reference in amd-smi bad-pages
Signed-off-by: Maisam Arif <maisarif@amd.com> Change-Id: I10a1278b68cbb464dd0fb38a2de50413f6f43959
This commit is contained in:
@@ -1015,14 +1015,19 @@ class AMDSMICommands():
|
||||
# Get gpu_id for logging
|
||||
gpu_id = self.helpers.get_gpu_id_from_device_handle(args.gpu)
|
||||
|
||||
bad_pages_not_found = "No bad pages found."
|
||||
try:
|
||||
bad_page_info = amdsmi_interface.amdsmi_get_gpu_bad_page_info(args.gpu)
|
||||
# If bad_page_info is an empty list overwrite with not found error statement
|
||||
if bad_page_info == []:
|
||||
bad_page_info = bad_pages_not_found
|
||||
bad_page_error = True
|
||||
else:
|
||||
bad_page_error = False
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
bad_page_info = "N/A"
|
||||
logging.debug("Failed to get bad page info for gpu %s | %s", gpu_id, e.get_error_info())
|
||||
|
||||
if bad_page_info == "N/A" or bad_page_info == "No bad pages found.":
|
||||
bad_page_error = True
|
||||
logging.debug("Failed to get bad page info for gpu %s | %s", gpu_id, e.get_error_info())
|
||||
|
||||
if args.retired:
|
||||
if bad_page_error:
|
||||
@@ -1034,13 +1039,17 @@ class AMDSMICommands():
|
||||
bad_page_info_entry = {}
|
||||
bad_page_info_entry["page_address"] = bad_page["page_address"]
|
||||
bad_page_info_entry["page_size"] = bad_page["page_size"]
|
||||
bad_page_info_entry["status"] = bad_page["status"].name
|
||||
status_string = amdsmi_interface.amdsmi_wrapper.amdsmi_memory_page_status_t__enumvalues[bad_page["status"]]
|
||||
bad_page_info_entry["status"] = status_string.replace("AMDSMI_MEM_PAGE_STATUS_", "")
|
||||
bad_page_info_output.append(bad_page_info_entry)
|
||||
# Remove brackets if there is only one value
|
||||
if len(bad_page_info_output) == 1:
|
||||
bad_page_info_output = bad_page_info_output[0]
|
||||
|
||||
values_dict['retired'] = bad_page_info_output
|
||||
if bad_page_info_output == []:
|
||||
values_dict['retired'] = bad_pages_not_found
|
||||
else:
|
||||
values_dict['retired'] = bad_page_info_output
|
||||
|
||||
if args.pending:
|
||||
if bad_page_error:
|
||||
@@ -1052,13 +1061,17 @@ class AMDSMICommands():
|
||||
bad_page_info_entry = {}
|
||||
bad_page_info_entry["page_address"] = bad_page["page_address"]
|
||||
bad_page_info_entry["page_size"] = bad_page["page_size"]
|
||||
bad_page_info_entry["status"] = bad_page["status"].name
|
||||
status_string = amdsmi_interface.amdsmi_wrapper.amdsmi_memory_page_status_t__enumvalues[bad_page["status"]]
|
||||
bad_page_info_entry["status"] = status_string.replace("AMDSMI_MEM_PAGE_STATUS_", "")
|
||||
bad_page_info_output.append(bad_page_info_entry)
|
||||
# Remove brackets if there is only one value
|
||||
if len(bad_page_info_output) == 1:
|
||||
bad_page_info_output = bad_page_info_output[0]
|
||||
|
||||
values_dict['pending'] = bad_page_info_output
|
||||
if bad_page_info_output == []:
|
||||
values_dict['pending'] = bad_pages_not_found
|
||||
else:
|
||||
values_dict['pending'] = bad_page_info_output
|
||||
|
||||
if args.un_res:
|
||||
if bad_page_error:
|
||||
@@ -1070,13 +1083,17 @@ class AMDSMICommands():
|
||||
bad_page_info_entry = {}
|
||||
bad_page_info_entry["page_address"] = bad_page["page_address"]
|
||||
bad_page_info_entry["page_size"] = bad_page["page_size"]
|
||||
bad_page_info_entry["status"] = bad_page["status"].name
|
||||
status_string = amdsmi_interface.amdsmi_wrapper.amdsmi_memory_page_status_t__enumvalues[bad_page["status"]]
|
||||
bad_page_info_entry["status"] = status_string.replace("AMDSMI_MEM_PAGE_STATUS_", "")
|
||||
bad_page_info_output.append(bad_page_info_entry)
|
||||
# Remove brackets if there is only one value
|
||||
if len(bad_page_info_output) == 1:
|
||||
bad_page_info_output = bad_page_info_output[0]
|
||||
|
||||
values_dict['un_res'] = bad_page_info_output
|
||||
if bad_page_info_output == []:
|
||||
values_dict['un_res'] = bad_pages_not_found
|
||||
else:
|
||||
values_dict['un_res'] = bad_page_info_output
|
||||
|
||||
# Store values in logger.output
|
||||
self.logger.store_output(args.gpu, 'values', values_dict)
|
||||
|
||||
مرجع در شماره جدید
Block a user