acrn-config: add cpu_affinity for SOS VM
Add cpu_affinity setup for SOS VM. Cpu affinity must be set in scenario XML, except if no pre-launched VM on the scenario and all pCPUs will be assigned to SOS VM in that case; Tracked-On: #5077 Signed-off-by: Wei Liu <weix.w.liu@intel.com>
This commit is contained in:
parent
2d53bb7123
commit
36732d4797
|
@ -240,6 +240,7 @@ def vm_cpu_affinity_check(config_file, id_cpus_per_vm_dic, item):
|
||||||
else:
|
else:
|
||||||
use_cpus.append(cpu)
|
use_cpus.append(cpu)
|
||||||
|
|
||||||
|
sos_vm_cpus = []
|
||||||
pre_launch_cpus = []
|
pre_launch_cpus = []
|
||||||
post_launch_cpus = []
|
post_launch_cpus = []
|
||||||
for vm_i, vm_type in common.VM_TYPES.items():
|
for vm_i, vm_type in common.VM_TYPES.items():
|
||||||
|
@ -251,6 +252,9 @@ def vm_cpu_affinity_check(config_file, id_cpus_per_vm_dic, item):
|
||||||
elif VM_DB[vm_type]['load_type'] == "POST_LAUNCHED_VM":
|
elif VM_DB[vm_type]['load_type'] == "POST_LAUNCHED_VM":
|
||||||
cpus = [x for x in id_cpus_per_vm_dic[vm_i] if not None]
|
cpus = [x for x in id_cpus_per_vm_dic[vm_i] if not None]
|
||||||
post_launch_cpus.extend(cpus)
|
post_launch_cpus.extend(cpus)
|
||||||
|
elif VM_DB[vm_type]['load_type'] == "SOS_VM":
|
||||||
|
cpus = [x for x in id_cpus_per_vm_dic[vm_i] if not None]
|
||||||
|
sos_vm_cpus.extend(cpus)
|
||||||
|
|
||||||
# duplicate cpus assign the same VM check
|
# duplicate cpus assign the same VM check
|
||||||
cpus_vm_i = id_cpus_per_vm_dic[vm_i]
|
cpus_vm_i = id_cpus_per_vm_dic[vm_i]
|
||||||
|
@ -261,6 +265,10 @@ def vm_cpu_affinity_check(config_file, id_cpus_per_vm_dic, item):
|
||||||
return err_dic
|
return err_dic
|
||||||
|
|
||||||
if pre_launch_cpus:
|
if pre_launch_cpus:
|
||||||
|
if "SOS_VM" in common.VM_TYPES and not sos_vm_cpus:
|
||||||
|
key = "SOS VM cpu_affinity"
|
||||||
|
err_dic[key] = "Should assign CPU id for SOS VM"
|
||||||
|
|
||||||
for pcpu in pre_launch_cpus:
|
for pcpu in pre_launch_cpus:
|
||||||
if pre_launch_cpus.count(pcpu) >= 2:
|
if pre_launch_cpus.count(pcpu) >= 2:
|
||||||
key = "Pre launched VM cpu_affinity"
|
key = "Pre launched VM cpu_affinity"
|
||||||
|
@ -475,6 +483,10 @@ def cpus_assignment(cpus_per_vm, index):
|
||||||
:return: cpu assignment string
|
:return: cpu assignment string
|
||||||
"""
|
"""
|
||||||
vm_cpu_bmp = {}
|
vm_cpu_bmp = {}
|
||||||
|
if "SOS_VM" == common.VM_TYPES[index]:
|
||||||
|
if index not in cpus_per_vm:
|
||||||
|
sos_extend_all_cpus = board_cfg_lib.get_processor_info()
|
||||||
|
cpus_per_vm[index] = sos_extend_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:
|
||||||
|
|
|
@ -193,10 +193,10 @@ def cpu_affinity_output(vm_info, i, config):
|
||||||
:param i: the index of vm id
|
:param i: the index of vm id
|
||||||
:param config: file pointor to store the information
|
:param config: file pointor to store the information
|
||||||
"""
|
"""
|
||||||
if "SOS_VM" == scenario_cfg_lib.VM_DB[vm_info.load_vm[i]]['load_type']:
|
|
||||||
return
|
|
||||||
|
|
||||||
cpu_bits = vm_info.get_cpu_bitmap(i)
|
if "SOS_VM" == common.VM_TYPES[i]:
|
||||||
|
print("\t\t.cpu_affinity = SOS_VM_CONFIG_CPU_AFFINITY,", file=config)
|
||||||
|
else:
|
||||||
print("\t\t.cpu_affinity = VM{}_CONFIG_CPU_AFFINITY,".format(i), file=config)
|
print("\t\t.cpu_affinity = VM{}_CONFIG_CPU_AFFINITY,".format(i), file=config)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,13 @@ def cpu_affinity_output(vm_info, i, config):
|
||||||
:param i: the index of vm id
|
:param i: the index of vm id
|
||||||
:param config: file pointor to store the information
|
:param config: file pointor to store the information
|
||||||
"""
|
"""
|
||||||
if "SOS_VM" == scenario_cfg_lib.VM_DB[vm_info.load_vm[i]]['load_type']:
|
|
||||||
return
|
|
||||||
|
|
||||||
cpu_bits = vm_info.get_cpu_bitmap(i)
|
cpu_bits = vm_info.get_cpu_bitmap(i)
|
||||||
|
if "SOS_VM" == common.VM_TYPES[i]:
|
||||||
|
print("", file=config)
|
||||||
|
print("#define SOS_VM_CONFIG_CPU_AFFINITY {0}".format(
|
||||||
|
cpu_bits['cpu_map']), file=config)
|
||||||
|
else:
|
||||||
print("#define VM{0}_CONFIG_CPU_AFFINITY {1}".format(
|
print("#define VM{0}_CONFIG_CPU_AFFINITY {1}".format(
|
||||||
i, cpu_bits['cpu_map']), file=config)
|
i, cpu_bits['cpu_map']), file=config)
|
||||||
|
|
||||||
|
@ -120,8 +123,10 @@ def gen_sos_header(scenario_items, config):
|
||||||
print("\t\t\t\t\tSOS_IDLE\t\\", file=config)
|
print("\t\t\t\t\tSOS_IDLE\t\\", file=config)
|
||||||
print("\t\t\t\t\tSOS_BOOTARGS_DIFF", file=config)
|
print("\t\t\t\t\tSOS_BOOTARGS_DIFF", file=config)
|
||||||
|
|
||||||
|
vm_info = scenario_items['vm']
|
||||||
for vm_i,vm_type in common.VM_TYPES.items():
|
for vm_i,vm_type in common.VM_TYPES.items():
|
||||||
if vm_type == 'SOS_VM':
|
if vm_type == 'SOS_VM':
|
||||||
|
cpu_affinity_output(vm_info, vm_i, config)
|
||||||
clos_config_output(scenario_items, vm_i, config)
|
clos_config_output(scenario_items, vm_i, config)
|
||||||
print("", file=config)
|
print("", file=config)
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,11 @@
|
||||||
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
||||||
<guest_flag>0</guest_flag>
|
<guest_flag>0</guest_flag>
|
||||||
</guest_flags>
|
</guest_flags>
|
||||||
|
<cpu_affinity desc="List of pCPU that this VM's vCPUs are pinned to.">
|
||||||
|
<pcpu_id>0</pcpu_id>
|
||||||
|
<pcpu_id>1</pcpu_id>
|
||||||
|
<pcpu_id>2</pcpu_id>
|
||||||
|
</cpu_affinity>
|
||||||
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
||||||
<vcpu_clos>0</vcpu_clos>
|
<vcpu_clos>0</vcpu_clos>
|
||||||
</clos>
|
</clos>
|
||||||
|
|
|
@ -109,6 +109,11 @@
|
||||||
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
||||||
<guest_flag>0</guest_flag>
|
<guest_flag>0</guest_flag>
|
||||||
</guest_flags>
|
</guest_flags>
|
||||||
|
<cpu_affinity desc="List of pCPU that this VM's vCPUs are pinned to.">
|
||||||
|
<pcpu_id>0</pcpu_id>
|
||||||
|
<pcpu_id>1</pcpu_id>
|
||||||
|
<pcpu_id>2</pcpu_id>
|
||||||
|
</cpu_affinity>
|
||||||
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
||||||
<vcpu_clos>0</vcpu_clos>
|
<vcpu_clos>0</vcpu_clos>
|
||||||
</clos>
|
</clos>
|
||||||
|
|
|
@ -117,6 +117,11 @@
|
||||||
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
||||||
<guest_flag>0</guest_flag>
|
<guest_flag>0</guest_flag>
|
||||||
</guest_flags>
|
</guest_flags>
|
||||||
|
<cpu_affinity desc="List of pCPU that this VM's vCPUs are pinned to.">
|
||||||
|
<pcpu_id>0</pcpu_id>
|
||||||
|
<pcpu_id>1</pcpu_id>
|
||||||
|
<pcpu_id>2</pcpu_id>
|
||||||
|
</cpu_affinity>
|
||||||
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
||||||
<vcpu_clos>0</vcpu_clos>
|
<vcpu_clos>0</vcpu_clos>
|
||||||
</clos>
|
</clos>
|
||||||
|
|
|
@ -107,6 +107,11 @@
|
||||||
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
||||||
<guest_flag>0</guest_flag>
|
<guest_flag>0</guest_flag>
|
||||||
</guest_flags>
|
</guest_flags>
|
||||||
|
<cpu_affinity desc="List of pCPU that this VM's vCPUs are pinned to.">
|
||||||
|
<pcpu_id>0</pcpu_id>
|
||||||
|
<pcpu_id>1</pcpu_id>
|
||||||
|
<pcpu_id>2</pcpu_id>
|
||||||
|
</cpu_affinity>
|
||||||
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
||||||
<vcpu_clos>0</vcpu_clos>
|
<vcpu_clos>0</vcpu_clos>
|
||||||
</clos>
|
</clos>
|
||||||
|
|
|
@ -105,6 +105,10 @@
|
||||||
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
||||||
<guest_flag>0</guest_flag>
|
<guest_flag>0</guest_flag>
|
||||||
</guest_flags>
|
</guest_flags>
|
||||||
|
<cpu_affinity desc="List of pCPU that this VM's vCPUs are pinned to.">
|
||||||
|
<pcpu_id>0</pcpu_id>
|
||||||
|
<pcpu_id>1</pcpu_id>
|
||||||
|
</cpu_affinity>
|
||||||
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
||||||
<vcpu_clos>0</vcpu_clos>
|
<vcpu_clos>0</vcpu_clos>
|
||||||
</clos>
|
</clos>
|
||||||
|
|
|
@ -109,6 +109,11 @@
|
||||||
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
||||||
<guest_flag>0</guest_flag>
|
<guest_flag>0</guest_flag>
|
||||||
</guest_flags>
|
</guest_flags>
|
||||||
|
<cpu_affinity desc="List of pCPU that this VM's vCPUs are pinned to.">
|
||||||
|
<pcpu_id>0</pcpu_id>
|
||||||
|
<pcpu_id>1</pcpu_id>
|
||||||
|
<pcpu_id>2</pcpu_id>
|
||||||
|
</cpu_affinity>
|
||||||
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
||||||
<vcpu_clos>0</vcpu_clos>
|
<vcpu_clos>0</vcpu_clos>
|
||||||
</clos>
|
</clos>
|
||||||
|
|
|
@ -105,6 +105,11 @@
|
||||||
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
||||||
<guest_flag>0</guest_flag>
|
<guest_flag>0</guest_flag>
|
||||||
</guest_flags>
|
</guest_flags>
|
||||||
|
<cpu_affinity desc="List of pCPU that this VM's vCPUs are pinned to.">
|
||||||
|
<pcpu_id>0</pcpu_id>
|
||||||
|
<pcpu_id>1</pcpu_id>
|
||||||
|
<pcpu_id>2</pcpu_id>
|
||||||
|
</cpu_affinity>
|
||||||
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
||||||
<vcpu_clos>0</vcpu_clos>
|
<vcpu_clos>0</vcpu_clos>
|
||||||
</clos>
|
</clos>
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
||||||
<guest_flag></guest_flag>
|
<guest_flag></guest_flag>
|
||||||
</guest_flags>
|
</guest_flags>
|
||||||
|
<cpu_affinity desc="List of pCPU that this VM's vCPUs are pinned to.">
|
||||||
|
<pcpu_id></pcpu_id>
|
||||||
|
</cpu_affinity>
|
||||||
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
||||||
<vcpu_clos>0</vcpu_clos>
|
<vcpu_clos>0</vcpu_clos>
|
||||||
</clos>
|
</clos>
|
||||||
|
|
|
@ -105,6 +105,11 @@
|
||||||
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
||||||
<guest_flag>0</guest_flag>
|
<guest_flag>0</guest_flag>
|
||||||
</guest_flags>
|
</guest_flags>
|
||||||
|
<cpu_affinity desc="List of pCPU that this VM's vCPUs are pinned to.">
|
||||||
|
<pcpu_id>0</pcpu_id>
|
||||||
|
<pcpu_id>1</pcpu_id>
|
||||||
|
<pcpu_id>2</pcpu_id>
|
||||||
|
</cpu_affinity>
|
||||||
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
||||||
<vcpu_clos>0</vcpu_clos>
|
<vcpu_clos>0</vcpu_clos>
|
||||||
</clos>
|
</clos>
|
||||||
|
|
|
@ -105,6 +105,11 @@
|
||||||
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
||||||
<guest_flag>0</guest_flag>
|
<guest_flag>0</guest_flag>
|
||||||
</guest_flags>
|
</guest_flags>
|
||||||
|
<cpu_affinity desc="List of pCPU that this VM's vCPUs are pinned to.">
|
||||||
|
<pcpu_id>0</pcpu_id>
|
||||||
|
<pcpu_id>1</pcpu_id>
|
||||||
|
<pcpu_id>2</pcpu_id>
|
||||||
|
</cpu_affinity>
|
||||||
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
||||||
<vcpu_clos>0</vcpu_clos>
|
<vcpu_clos>0</vcpu_clos>
|
||||||
</clos>
|
</clos>
|
||||||
|
|
|
@ -106,6 +106,10 @@
|
||||||
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
||||||
<guest_flag>0</guest_flag>
|
<guest_flag>0</guest_flag>
|
||||||
</guest_flags>
|
</guest_flags>
|
||||||
|
<cpu_affinity desc="List of pCPU that this VM's vCPUs are pinned to.">
|
||||||
|
<pcpu_id>0</pcpu_id>
|
||||||
|
<pcpu_id>1</pcpu_id>
|
||||||
|
</cpu_affinity>
|
||||||
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
||||||
<vcpu_clos>0</vcpu_clos>
|
<vcpu_clos>0</vcpu_clos>
|
||||||
</clos>
|
</clos>
|
||||||
|
|
|
@ -105,6 +105,11 @@
|
||||||
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
||||||
<guest_flag>0</guest_flag>
|
<guest_flag>0</guest_flag>
|
||||||
</guest_flags>
|
</guest_flags>
|
||||||
|
<cpu_affinity desc="List of pCPU that this VM's vCPUs are pinned to.">
|
||||||
|
<pcpu_id>0</pcpu_id>
|
||||||
|
<pcpu_id>1</pcpu_id>
|
||||||
|
<pcpu_id>2</pcpu_id>
|
||||||
|
</cpu_affinity>
|
||||||
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
||||||
<vcpu_clos>0</vcpu_clos>
|
<vcpu_clos>0</vcpu_clos>
|
||||||
</clos>
|
</clos>
|
||||||
|
|
|
@ -106,6 +106,10 @@
|
||||||
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
<guest_flags desc="Select all applicable flags for the VM" multiselect="true">
|
||||||
<guest_flag>0</guest_flag>
|
<guest_flag>0</guest_flag>
|
||||||
</guest_flags>
|
</guest_flags>
|
||||||
|
<cpu_affinity desc="List of pCPU that this VM's vCPUs are pinned to.">
|
||||||
|
<pcpu_id>0</pcpu_id>
|
||||||
|
<pcpu_id>1</pcpu_id>
|
||||||
|
</cpu_affinity>
|
||||||
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
<clos configurable="0" desc="Class of Service for Cache Allocation Technology. Please refer SDM 17.19.2 for details and use with caution.">
|
||||||
<vcpu_clos>0</vcpu_clos>
|
<vcpu_clos>0</vcpu_clos>
|
||||||
</clos>
|
</clos>
|
||||||
|
|
Loading…
Reference in New Issue