Skip to content

Commit 082a7c7

Browse files
committed
hw-mgmt: scripts: Add ASIC state check on temperature reading
When the ASIC SX driver is not available due to the ISSU state, temperature reading is not available. This commit adds a check for the asic{}_ready flag to determine if temperature reading is available: /var/run/hw-management/config/asic{}_ready 1 - ASIC sx driver ready to temperature read 0 - ASIC driver not loaded of temperature is not avalible Signed-off-by: Oleksandr Shamray <oleksandrs@nvidia.com>
1 parent b6e5b75 commit 082a7c7

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

usr/usr/bin/hw_management_sync.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -534,18 +534,26 @@ def asic_temp_populate(arg_list, arg):
534534
"""
535535
@summary: Update asic attributes
536536
"""
537+
f_asic_ready = "/var/run/hw-management/config/{}_ready".format(arg_list[0])
537538
try:
538-
val = sdk_temp2degree(int(arg))
539-
temp_norm = "75000\n"
540-
temp_crit = "85000\n"
541-
temp_emergency = "105000\n"
542-
temp_fault = "120000\n"
543-
except:
544-
val = ""
545-
temp_crit = ""
546-
temp_emergency = ""
547-
temp_fault = ""
548-
temp_norm = ""
539+
with open(f_asic_reay, 'r') as f:
540+
asic_ready = int(f.read().strip())
541+
except (FileNotFoundError, ValueError):
542+
asic_ready = 1
543+
544+
if asic_ready:
545+
try:
546+
val = sdk_temp2degree(int(arg))
547+
temp_norm = "75000\n"
548+
temp_crit = "85000\n"
549+
temp_emergency = "105000\n"
550+
temp_fault = "120000\n"
551+
except:
552+
val = "0"
553+
temp_crit = ""
554+
temp_emergency = ""
555+
temp_fault = ""
556+
temp_norm = ""
549557

550558
f_name = "/var/run/hw-management/thermal/{}".format(arg_list[0])
551559
with open(f_name, 'w', encoding="utf-8") as f:

0 commit comments

Comments
 (0)