[Mellanox] Adjust dynamic minimum fan speed algorithm (#4476)
* remove air flow direction from dynamic minimum algorithm * adjust minimum table according to thermal data
This commit is contained in:
parent
e363293ac0
commit
b26814f643
@ -2,34 +2,22 @@ DEVICE_DATA = {
|
|||||||
'x86_64-mlnx_msn2700-r0': {
|
'x86_64-mlnx_msn2700-r0': {
|
||||||
'thermal': {
|
'thermal': {
|
||||||
'minimum_table': {
|
'minimum_table': {
|
||||||
"p2c_trust": {"-127:40":13, "41:120":15},
|
"unk_trust": {"-127:30":13, "31:40":14 , "41:120":15},
|
||||||
"p2c_untrust": {"-127:25":13, "26:30":14 , "31:35":15, "36:120":16},
|
"unk_untrust": {"-127:25":13, "26:30":14 , "31:35":15, "36:120":16}
|
||||||
"c2p_trust": {"-127:20":13, "21:25":14 , "26:30":15, "31:120":16},
|
|
||||||
"c2p_untrust": {"-127:20":13, "21:25":14 , "26:30":15, "31:120":16},
|
|
||||||
"unk_trust": {"-127:20":13, "21:25":14 , "26:30":15, "31:120":16},
|
|
||||||
"unk_untrust": {"-127:20":13, "21:25":14 , "26:30":15, "31:120":16}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'x86_64-mlnx_msn2740-r0': {
|
'x86_64-mlnx_msn2740-r0': {
|
||||||
'thermal': {
|
'thermal': {
|
||||||
'minimum_table': {
|
'minimum_table': {
|
||||||
"p2c_trust": {"-127:120":13},
|
|
||||||
"p2c_untrust": {"-127:35":13, "36:40":14 , "41:120":15},
|
|
||||||
"c2p_trust": {"-127:120":13},
|
|
||||||
"c2p_untrust": {"-127:15":13, "16:30":14 , "31:35":15, "36:120":17},
|
|
||||||
"unk_trust": {"-127:120":13},
|
"unk_trust": {"-127:120":13},
|
||||||
"unk_untrust": {"-127:15":13, "16:30":14 , "31:35":15, "36:120":17},
|
"unk_untrust": {"-127:15":13, "16:25":14 , "26:30":15, "31:120":17},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'x86_64-mlnx_msn2100-r0': {
|
'x86_64-mlnx_msn2100-r0': {
|
||||||
'thermal': {
|
'thermal': {
|
||||||
'minimum_table': {
|
'minimum_table': {
|
||||||
"p2c_trust": {"-127:120":12},
|
|
||||||
"p2c_untrust": {"-127:15":12, "16:25":13, "26:30":14, "31:35":15, "36:120":16},
|
|
||||||
"c2p_trust": {"-127:40":12, "41:120":13},
|
|
||||||
"c2p_untrust": {"-127:40":12, "41:120":13},
|
|
||||||
"unk_trust": {"-127:40":12, "41:120":13},
|
"unk_trust": {"-127:40":12, "41:120":13},
|
||||||
"unk_untrust": {"-127:15":12, "16:25":13, "26:30":14, "31:35":15, "36:120":16}
|
"unk_untrust": {"-127:15":12, "16:25":13, "26:30":14, "31:35":15, "36:120":16}
|
||||||
}
|
}
|
||||||
@ -38,22 +26,14 @@ DEVICE_DATA = {
|
|||||||
'x86_64-mlnx_msn2410-r0': {
|
'x86_64-mlnx_msn2410-r0': {
|
||||||
'thermal': {
|
'thermal': {
|
||||||
'minimum_table': {
|
'minimum_table': {
|
||||||
"p2c_trust": {"-127:40":13, "41:120":15},
|
"unk_trust": {"-127:30":13, "31:40":14 , "41:120":15},
|
||||||
"p2c_untrust": {"-127:25":13, "26:30":14 , "31:35":15, "36:120":16},
|
"unk_untrust": {"-127:25":13, "26:30":14 , "31:35":15, "36:120":16}
|
||||||
"c2p_trust": {"-127:20":13, "21:25":14 , "26:30":15, "31:120":16},
|
|
||||||
"c2p_untrust": {"-127:20":13, "21:25":14 , "26:30":15, "31:120":16},
|
|
||||||
"unk_trust": {"-127:20":13, "21:25":14 , "26:30":15, "31:120":16},
|
|
||||||
"unk_untrust": {"-127:20":13, "21:25":14 , "26:30":15, "31:120":16}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'x86_64-mlnx_msn2010-r0': {
|
'x86_64-mlnx_msn2010-r0': {
|
||||||
'thermal': {
|
'thermal': {
|
||||||
'minimum_table': {
|
'minimum_table': {
|
||||||
"p2c_trust": {"-127:120":12},
|
|
||||||
"p2c_untrust": {"-127:15":12, "16:20":13, "21:30":14, "31:35":15, "36:120":16},
|
|
||||||
"c2p_trust": {"-127:120":12},
|
|
||||||
"c2p_untrust": {"-127:20":12, "21:25":13 , "26:30":14, "31:35":15, "36:120":16},
|
|
||||||
"unk_trust": {"-127:120":12},
|
"unk_trust": {"-127:120":12},
|
||||||
"unk_untrust": {"-127:15":12, "16:20":13 , "21:30":14, "31:35":15, "36:120":16}
|
"unk_untrust": {"-127:15":12, "16:20":13 , "21:30":14, "31:35":15, "36:120":16}
|
||||||
}
|
}
|
||||||
@ -62,10 +42,6 @@ DEVICE_DATA = {
|
|||||||
'x86_64-mlnx_msn3700-r0': {
|
'x86_64-mlnx_msn3700-r0': {
|
||||||
'thermal': {
|
'thermal': {
|
||||||
'minimum_table': {
|
'minimum_table': {
|
||||||
"p2c_trust": {"-127:25":12, "26:40":13 , "41:120":14},
|
|
||||||
"p2c_untrust": {"-127:15":12, "16:30":13 , "31:35":14, "36:40":15, "41:120":16},
|
|
||||||
"c2p_trust": {"-127:25":12, "26:40":13 , "41:120":14},
|
|
||||||
"c2p_untrust": {"-127:25":12, "26:40":13 , "41:120":14},
|
|
||||||
"unk_trust": {"-127:25":12, "26:40":13 , "41:120":14},
|
"unk_trust": {"-127:25":12, "26:40":13 , "41:120":14},
|
||||||
"unk_untrust": {"-127:15":12, "16:30":13 , "31:35":14, "36:40":15, "41:120":16},
|
"unk_untrust": {"-127:15":12, "16:30":13 , "31:35":14, "36:40":15, "41:120":16},
|
||||||
}
|
}
|
||||||
@ -74,28 +50,25 @@ DEVICE_DATA = {
|
|||||||
'x86_64-mlnx_msn3700c-r0': {
|
'x86_64-mlnx_msn3700c-r0': {
|
||||||
'thermal': {
|
'thermal': {
|
||||||
'minimum_table': {
|
'minimum_table': {
|
||||||
"p2c_trust": {"-127:25":12, "26:40":13 , "41:120":14},
|
"unk_trust": {"-127:40":12, "41:120":13},
|
||||||
"p2c_untrust": {"-127:15":12, "16:30":13 , "31:35":14, "36:40":15, "41:120":16},
|
"unk_untrust": {"-127:10":12, "11:20":13 , "21:30":14, "31:35":15, "36:120":16},
|
||||||
"c2p_trust": {"-127:25":12, "26:40":13 , "41:120":14},
|
|
||||||
"c2p_untrust": {"-127:25":12, "26:40":13 , "41:120":14},
|
|
||||||
"unk_trust": {"-127:25":12, "26:40":13 , "41:120":14},
|
|
||||||
"unk_untrust": {"-127:15":12, "16:30":13 , "31:35":14, "36:40":15, "41:120":16},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'x86_64-mlnx_msn3800-r0': {
|
'x86_64-mlnx_msn3800-r0': {
|
||||||
'thermal': {
|
'thermal': {
|
||||||
'minimum_table': {
|
'minimum_table': {
|
||||||
"p2c_trust": {"-127:35":12, "36:120":13},
|
|
||||||
"p2c_untrust": {"-127:0":12, "1:10":13 , "11:15":14, "16:20":15, "21:35":16, "36:120":17},
|
|
||||||
"c2p_trust": {"-127:30":12, "31:40":13 , "41:120":14},
|
|
||||||
"c2p_untrust": {"-127:20":12, "21:30":13 , "31:35":14, "36:40":15, "41:120":16},
|
|
||||||
"unk_trust": {"-127:30":12, "31:40":13 , "41:120":14},
|
"unk_trust": {"-127:30":12, "31:40":13 , "41:120":14},
|
||||||
"unk_untrust": {"-127:0":12, "1:10":13 , "11:15":14, "16:20":15, "21:35":16, "36:120":17},
|
"unk_untrust": {"-127:0":12, "1:10":13 , "11:15":14, "16:20":15, "21:35":16, "36:120":17},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'x86_64-mlnx_msn4700-r0': {
|
'x86_64-mlnx_msn4700-r0': {
|
||||||
|
'thermal': {
|
||||||
|
'minimum_table': {
|
||||||
|
"unk_trust": {"-127:120":16},
|
||||||
|
"unk_untrust": {"-127:120":16},
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -567,16 +567,11 @@ class Thermal(ThermalBase):
|
|||||||
return 'trust'
|
return 'trust'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_air_flow_direction(cls):
|
def get_min_amb_temperature(cls):
|
||||||
fan_ambient_path = join(HW_MGMT_THERMAL_ROOT, THERMAL_DEV_FAN_AMBIENT)
|
fan_ambient_path = join(HW_MGMT_THERMAL_ROOT, THERMAL_DEV_FAN_AMBIENT)
|
||||||
port_ambient_path = join(HW_MGMT_THERMAL_ROOT, THERMAL_DEV_PORT_AMBIENT)
|
port_ambient_path = join(HW_MGMT_THERMAL_ROOT, THERMAL_DEV_PORT_AMBIENT)
|
||||||
|
|
||||||
# if there is any exception, let it raise
|
# if there is any exception, let it raise
|
||||||
fan_ambient_temp = int(cls._read_generic_file(fan_ambient_path, 0))
|
fan_ambient_temp = int(cls._read_generic_file(fan_ambient_path, 0))
|
||||||
port_ambient_temp = int(cls._read_generic_file(port_ambient_path, 0))
|
port_ambient_temp = int(cls._read_generic_file(port_ambient_path, 0))
|
||||||
if fan_ambient_temp > port_ambient_temp:
|
return fan_ambient_temp if fan_ambient_temp < port_ambient_temp else port_ambient_temp
|
||||||
return 'p2c', fan_ambient_temp
|
|
||||||
elif fan_ambient_temp < port_ambient_temp:
|
|
||||||
return 'c2p', port_ambient_temp
|
|
||||||
else:
|
|
||||||
return 'unk', fan_ambient_temp
|
|
||||||
|
@ -154,10 +154,9 @@ class ChangeMinCoolingLevelAction(ThermalPolicyActionBase):
|
|||||||
if chassis.platform_name not in DEVICE_DATA or 'thermal' not in DEVICE_DATA[chassis.platform_name] or 'minimum_table' not in DEVICE_DATA[chassis.platform_name]['thermal']:
|
if chassis.platform_name not in DEVICE_DATA or 'thermal' not in DEVICE_DATA[chassis.platform_name] or 'minimum_table' not in DEVICE_DATA[chassis.platform_name]['thermal']:
|
||||||
Fan.min_cooling_level = ChangeMinCoolingLevelAction.UNKNOWN_SKU_COOLING_LEVEL
|
Fan.min_cooling_level = ChangeMinCoolingLevelAction.UNKNOWN_SKU_COOLING_LEVEL
|
||||||
else:
|
else:
|
||||||
air_flow_dir = MinCoolingLevelChangeCondition.air_flow_dir
|
|
||||||
trust_state = MinCoolingLevelChangeCondition.trust_state
|
trust_state = MinCoolingLevelChangeCondition.trust_state
|
||||||
temperature = MinCoolingLevelChangeCondition.temperature
|
temperature = MinCoolingLevelChangeCondition.temperature
|
||||||
minimum_table = DEVICE_DATA[chassis.platform_name]['thermal']['minimum_table']['{}_{}'.format(air_flow_dir, trust_state)]
|
minimum_table = DEVICE_DATA[chassis.platform_name]['thermal']['minimum_table']['unk_{}'.format(trust_state)]
|
||||||
|
|
||||||
for key, cooling_level in minimum_table.items():
|
for key, cooling_level in minimum_table.items():
|
||||||
temp_range = key.split(':')
|
temp_range = key.split(':')
|
||||||
|
@ -78,14 +78,13 @@ class AllPsuPresenceCondition(PsuCondition):
|
|||||||
|
|
||||||
class MinCoolingLevelChangeCondition(ThermalPolicyConditionBase):
|
class MinCoolingLevelChangeCondition(ThermalPolicyConditionBase):
|
||||||
trust_state = None
|
trust_state = None
|
||||||
air_flow_dir = None
|
|
||||||
temperature = None
|
temperature = None
|
||||||
|
|
||||||
def is_match(self, thermal_info_dict):
|
def is_match(self, thermal_info_dict):
|
||||||
from .thermal import Thermal
|
from .thermal import Thermal
|
||||||
|
|
||||||
trust_state = Thermal.check_module_temperature_trustable()
|
trust_state = Thermal.check_module_temperature_trustable()
|
||||||
air_flow_dir, temperature = Thermal.get_air_flow_direction()
|
temperature = Thermal.get_min_amb_temperature()
|
||||||
temperature = temperature / 1000
|
temperature = temperature / 1000
|
||||||
|
|
||||||
change_cooling_level = False
|
change_cooling_level = False
|
||||||
@ -93,10 +92,6 @@ class MinCoolingLevelChangeCondition(ThermalPolicyConditionBase):
|
|||||||
MinCoolingLevelChangeCondition.trust_state = trust_state
|
MinCoolingLevelChangeCondition.trust_state = trust_state
|
||||||
change_cooling_level = True
|
change_cooling_level = True
|
||||||
|
|
||||||
if air_flow_dir != MinCoolingLevelChangeCondition.air_flow_dir:
|
|
||||||
MinCoolingLevelChangeCondition.air_flow_dir = air_flow_dir
|
|
||||||
change_cooling_level = True
|
|
||||||
|
|
||||||
if temperature != MinCoolingLevelChangeCondition.temperature:
|
if temperature != MinCoolingLevelChangeCondition.temperature:
|
||||||
MinCoolingLevelChangeCondition.temperature = temperature
|
MinCoolingLevelChangeCondition.temperature = temperature
|
||||||
change_cooling_level = True
|
change_cooling_level = True
|
||||||
|
@ -482,10 +482,9 @@ def test_dynamic_minimum_policy(thermal_manager):
|
|||||||
condition = policy.conditions[MinCoolingLevelChangeCondition]
|
condition = policy.conditions[MinCoolingLevelChangeCondition]
|
||||||
action = policy.actions[ChangeMinCoolingLevelAction]
|
action = policy.actions[ChangeMinCoolingLevelAction]
|
||||||
Thermal.check_module_temperature_trustable = MagicMock(return_value='trust')
|
Thermal.check_module_temperature_trustable = MagicMock(return_value='trust')
|
||||||
Thermal.get_air_flow_direction = MagicMock(return_value=('p2c', 35000))
|
Thermal.get_min_amb_temperature = MagicMock(return_value=35000)
|
||||||
assert condition.is_match(None)
|
assert condition.is_match(None)
|
||||||
assert MinCoolingLevelChangeCondition.trust_state == 'trust'
|
assert MinCoolingLevelChangeCondition.trust_state == 'trust'
|
||||||
assert MinCoolingLevelChangeCondition.air_flow_dir == 'p2c'
|
|
||||||
assert MinCoolingLevelChangeCondition.temperature == 35
|
assert MinCoolingLevelChangeCondition.temperature == 35
|
||||||
assert not condition.is_match(None)
|
assert not condition.is_match(None)
|
||||||
|
|
||||||
@ -493,11 +492,7 @@ def test_dynamic_minimum_policy(thermal_manager):
|
|||||||
assert condition.is_match(None)
|
assert condition.is_match(None)
|
||||||
assert MinCoolingLevelChangeCondition.trust_state == 'untrust'
|
assert MinCoolingLevelChangeCondition.trust_state == 'untrust'
|
||||||
|
|
||||||
Thermal.get_air_flow_direction = MagicMock(return_value=('c2p', 35000))
|
Thermal.get_min_amb_temperature = MagicMock(return_value=25000)
|
||||||
assert condition.is_match(None)
|
|
||||||
assert MinCoolingLevelChangeCondition.air_flow_dir == 'c2p'
|
|
||||||
|
|
||||||
Thermal.get_air_flow_direction = MagicMock(return_value=('c2p', 25000))
|
|
||||||
assert condition.is_match(None)
|
assert condition.is_match(None)
|
||||||
assert MinCoolingLevelChangeCondition.temperature == 25
|
assert MinCoolingLevelChangeCondition.temperature == 25
|
||||||
|
|
||||||
@ -515,5 +510,5 @@ def test_dynamic_minimum_policy(thermal_manager):
|
|||||||
|
|
||||||
chassis.platform_name = 'x86_64-mlnx_msn2700-r0'
|
chassis.platform_name = 'x86_64-mlnx_msn2700-r0'
|
||||||
action.execute(thermal_info_dict)
|
action.execute(thermal_info_dict)
|
||||||
assert Fan.min_cooling_level == 4
|
assert Fan.min_cooling_level == 3
|
||||||
Fan.set_cooling_level.assert_called_with(4, 5)
|
Fan.set_cooling_level.assert_called_with(3, 5)
|
||||||
|
Loading…
Reference in New Issue
Block a user