acrn-config: parse cpu_affinity from launch config xmls

Parse cpu_affinity from launch config xmls and generate '--cpu_affinity' as
acrn-dm args.

Tracked-On: #4641
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
Acked-by: Terry Zou <terry.zou@intel.com>
This commit is contained in:
Wei Liu
2020-04-23 12:21:33 +08:00
committed by wenlingz
parent 233f2deb4b
commit a43b42b2a0
6 changed files with 70 additions and 59 deletions

View File

@@ -13,7 +13,6 @@ ERR_LIST = {}
BOOT_TYPE = ['no', 'vsbl', 'ovmf']
RTOS_TYPE = ['no', 'Soft RT', 'Hard RT']
DM_VUART0 = ['Disable', 'Enable']
CPU_SHARING = ['Disabled', 'Enabled']
UOS_TYPES = ['CLEARLINUX', 'ANDROID', 'ALIOS', 'PREEMPT-RT LINUX', 'VXWORKS', 'WINDOWS', 'ZEPHYR', 'GENERIC LINUX']
PT_SUB_PCI = {}
@@ -487,45 +486,6 @@ def check_block_mount(virtio_blk_dic):
MOUNT_FLAG_DIC[vmid] = mount_flags
def cpu_sharing_check(cpu_sharing, item):
"""
Check cpu sharing status with cpu affinity setting
:param cpu_share_status:
:param item:
:return: None
"""
use_cpus = []
use_same_cpu = False
vm_cpu_share = []
vm_cpu_share_consistent = True
cpu_affinity = common.get_leaf_tag_map(common.SCENARIO_INFO_FILE, "cpu_affinity", "pcpu_id")
for vm_i in cpu_affinity.keys():
for cpu in cpu_affinity[vm_i]:
if cpu in use_cpus:
use_same_cpu = True
else:
use_cpus.append(cpu)
for vm_i in cpu_sharing.keys():
cpu_share = cpu_sharing[vm_i]
stat_len = len(vm_cpu_share)
if stat_len != 0 and cpu_share not in vm_cpu_share:
vm_cpu_share_consistent = False
else:
vm_cpu_share.append(cpu_share)
if not vm_cpu_share_consistent:
key = "uos:id={},{}".format(vm_i, item)
ERR_LIST[key] = "CPU sharing for all VMs should be consistent to 'Disabled' or 'Enabled'"
return
if cpu_sharing[vm_i] == "Disabled" and use_same_cpu:
key = "uos:id={},{}".format(vm_i, item)
ERR_LIST[key] = "The same pcpu was configurated in scenario config, and not allow to set the cpu_sharing to 'Disabled'!"
return
def bdf_duplicate_check(bdf_dic):
"""
Check if exist duplicate slot