mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-09 20:18:19 +00:00
acrn-config: add maxcpus to sos kernel cmdline in hybrid scenario
We use sos kernel cmdline maxcpus to limit the pCPU number of SOS for hybrid or hybrid_rt scenarios by vcpu numbers calculation. v2: add SOS CPU affinity calculation by total pCPU plus pCPUs occupied by pre-launched VMs when no pcpuid configured in SOS. Tracked-On: #5216 Signed-off-by: Shuang Zheng <shuang.zheng@intel.com> Reviewed-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
f945fe27ab
commit
ae6e107d9c
@ -173,6 +173,28 @@ def generate_file(config):
|
|||||||
# sos command lines information
|
# sos command lines information
|
||||||
sos_cmdlines = [i for i in sos_cmdlines[0].split() if i != '']
|
sos_cmdlines = [i for i in sos_cmdlines[0].split() if i != '']
|
||||||
|
|
||||||
|
# add maxcpus parameter into sos cmdlines if there are pre-launched VMs
|
||||||
|
pcpu_list = board_cfg_lib.get_processor_info()
|
||||||
|
cpu_affinity = common.get_leaf_tag_map(common.SCENARIO_INFO_FILE, "cpu_affinity", "pcpu_id")
|
||||||
|
pre_cpu_list = []
|
||||||
|
sos_cpu_num = 0
|
||||||
|
for vmid, cpu_list in cpu_affinity.items():
|
||||||
|
if vmid in common.VM_TYPES and cpu_list != [None]:
|
||||||
|
vm_type = common.VM_TYPES[vmid]
|
||||||
|
load_type = ''
|
||||||
|
if vm_type in scenario_cfg_lib.VM_DB:
|
||||||
|
load_type = scenario_cfg_lib.VM_DB[vm_type]['load_type']
|
||||||
|
if load_type == "PRE_LAUNCHED_VM":
|
||||||
|
pre_cpu_list += cpu_list
|
||||||
|
elif load_type == "SOS_VM":
|
||||||
|
sos_cpu_num += len(cpu_list)
|
||||||
|
if sos_cpu_num == 0:
|
||||||
|
sos_cpu_num_max = len(list(set(pcpu_list) - set(pre_cpu_list)))
|
||||||
|
else:
|
||||||
|
sos_cpu_num_max = sos_cpu_num
|
||||||
|
if sos_cpu_num_max > 0:
|
||||||
|
sos_cmdlines.append('maxcpus='+str(sos_cpu_num_max))
|
||||||
|
|
||||||
# get native rootfs list from board_info.xml
|
# get native rootfs list from board_info.xml
|
||||||
(root_devs, root_dev_num) = board_cfg_lib.get_rootfs(common.BOARD_INFO_FILE)
|
(root_devs, root_dev_num) = board_cfg_lib.get_rootfs(common.BOARD_INFO_FILE)
|
||||||
|
|
||||||
|
@ -159,6 +159,8 @@ def save_scenario():
|
|||||||
old_scenario_name = scenario_config_data['old_scenario_name']
|
old_scenario_name = scenario_config_data['old_scenario_name']
|
||||||
scenario_config.set_curr(old_scenario_name)
|
scenario_config.set_curr(old_scenario_name)
|
||||||
for key in scenario_config_data:
|
for key in scenario_config_data:
|
||||||
|
if scenario_config_data[key] in [None, 'None']:
|
||||||
|
scenario_config_data[key] = ''
|
||||||
if key not in ['old_scenario_name', 'new_scenario_name', 'generator', 'add_vm_type']:
|
if key not in ['old_scenario_name', 'new_scenario_name', 'generator', 'add_vm_type']:
|
||||||
if isinstance(scenario_config_data[key], list):
|
if isinstance(scenario_config_data[key], list):
|
||||||
scenario_config.set_curr_list(scenario_config_data[key], *tuple(key.split(',')))
|
scenario_config.set_curr_list(scenario_config_data[key], *tuple(key.split(',')))
|
||||||
@ -285,6 +287,8 @@ def save_launch():
|
|||||||
'user_defined', scenario_name + '.xml')
|
'user_defined', scenario_name + '.xml')
|
||||||
|
|
||||||
for key in launch_config_data:
|
for key in launch_config_data:
|
||||||
|
if launch_config_data[key] in [None, 'None']:
|
||||||
|
launch_config_data[key] = ''
|
||||||
if key not in ['old_launch_name', 'new_launch_name', 'generator', 'add_launch_type', 'scenario_name']:
|
if key not in ['old_launch_name', 'new_launch_name', 'generator', 'add_launch_type', 'scenario_name']:
|
||||||
if isinstance(launch_config_data[key], list):
|
if isinstance(launch_config_data[key], list):
|
||||||
launch_config.set_curr_list(launch_config_data[key], *tuple(key.split(',')))
|
launch_config.set_curr_list(launch_config_data[key], *tuple(key.split(',')))
|
||||||
|
@ -517,9 +517,18 @@ def cpus_assignment(cpus_per_vm, index):
|
|||||||
"""
|
"""
|
||||||
vm_cpu_bmp = {}
|
vm_cpu_bmp = {}
|
||||||
if "SOS_VM" == common.VM_TYPES[index]:
|
if "SOS_VM" == common.VM_TYPES[index]:
|
||||||
if index not in cpus_per_vm:
|
if index not in cpus_per_vm or cpus_per_vm[index] == [None]:
|
||||||
sos_extend_all_cpus = board_cfg_lib.get_processor_info()
|
sos_extend_all_cpus = board_cfg_lib.get_processor_info()
|
||||||
cpus_per_vm[index] = sos_extend_all_cpus
|
pre_all_cpus = []
|
||||||
|
for vmid, cpu_list in cpus_per_vm.items():
|
||||||
|
if vmid in common.VM_TYPES:
|
||||||
|
vm_type = common.VM_TYPES[vmid]
|
||||||
|
load_type = ''
|
||||||
|
if vm_type in VM_DB:
|
||||||
|
load_type = VM_DB[vm_type]['load_type']
|
||||||
|
if load_type == "PRE_LAUNCHED_VM":
|
||||||
|
pre_all_cpus += cpu_list
|
||||||
|
cpus_per_vm[index] = list(set(sos_extend_all_cpus) - set(pre_all_cpus))
|
||||||
|
|
||||||
for i in range(len(cpus_per_vm[index])):
|
for i in range(len(cpus_per_vm[index])):
|
||||||
if i == 0:
|
if i == 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user