config_tools: add own_pcpu widget

Add "exclusively owns physical CPUs" checkbox to pre-launched VMs
and post-launched VMs. RTVM will not display this checkbox.
If this checkbox is set, the VM will use all the pCPUs assigned to
it alone.

Tracked-On: #8253
Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@linux.intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Yuanyuan Zhao 2022-08-31 16:36:45 +08:00 committed by acrnsi-robot
parent ea7e9540a0
commit 138499f886
3 changed files with 42 additions and 0 deletions

View File

@ -3,6 +3,26 @@
<b>{{ uiOptions.title }}</b>
<div class="p-4">
<div v-if="defaultVal.pcpu && defaultVal.pcpu.length>0">
<b-row v-if="is_std_vm">
<label>
<n-popover trigger="hover" placement="top-start" style="width: 500px">
<template #trigger>
<IconInfo/>
</template>
<span> Enable a VM exclusively owns the physical CPUs assigned to it. </span>
</n-popover>
Exclusively owns physical CPUs: </label>
<b-col>own_pcpu</b-col>
<b-col>
<b-form-checkbox v-model="pcpu_owned" :value="'y'" :uncheckedValue="'n'"
@click="click_own_pcpu"
>
</b-form-checkbox>
</b-col>
<b-col></b-col>
<b-col></b-col>
<b-col></b-col>
</b-row>
<b-row>
<b-col></b-col>
<b-col></b-col>
@ -119,9 +139,15 @@ export default {
isRTVM() {
return vueUtils.getPathVal(this.rootFormData, 'vm_type') === 'RTVM'
},
is_std_vm() {
return vueUtils.getPathVal(this.rootFormData, 'vm_type') === 'STANDARD_VM'
},
pcpuid_enum() {
return window.getCurrentFormSchemaData().BasicConfigType.definitions.CPUAffinityConfiguration.properties.pcpu_id
},
pcpu_owned() {
return vueUtils.getPathVal(this.rootFormData, 'own_pcpu')
},
uiOptions() {
return formUtils.getUiOptions({
schema: this.schema,
@ -151,6 +177,10 @@ export default {
addPCPU(index) {
this.defaultVal.pcpu.splice(index + 1, 0, {pcpu_id: null, real_time_vcpu: "n"})
},
click_own_pcpu() {
let newValue = this.pcpu_owned === 'y' ? 'n' : 'y';
vueUtils.setPathVal(this.rootFormData, 'own_pcpu', newValue)
},
removePCPU(index) {
if (this.defaultVal.pcpu.length === 1) {
// prevent delete for the last one

View File

@ -25,6 +25,13 @@
</xs:annotation>
</xs:assert>
<xs:assert test="every $pcpu in /acrn-config/vm[own_pcpu = 'y']//cpu_affinity//pcpu_id satisfies
count(/acrn-config/vm[@id != $pcpu/ancestor::vm//companion_vmid]//cpu_affinity[.//pcpu_id = $pcpu]) &lt;= 1">
<xs:annotation acrn:severity="error" acrn:report-on="//vm//cpu_affinity[.//pcpu_id = $pcpu]">
<xs:documentation>Physical CPU {$pcpu} is assigned to a VM "[{$pcpu/ancestor::vm/name}]" exclusively owns the physical CPUs assigned to it. Look for, and probably remove, any affinity assignments to CPU {$pcpu} in these VMs {//vm[cpu_affinity//pcpu_id = $pcpu and name != $pcpu/ancestor::vm/name]/name} settings.</xs:documentation>
</xs:annotation>
</xs:assert>
<xs:assert test="every $vm in /acrn-config/vm[load_order != 'SERVICE_VM'] satisfies
count($vm/cpu_affinity/pcpu[pcpu_id != '']) > 0">
<xs:annotation acrn:severity="error" acrn:report-on="$vm/cpu_affinity">

View File

@ -370,6 +370,11 @@ These settings can only be changed at build time.</xs:documentation>
<xs:annotation acrn:title="" acrn:views="basic, advanced" acrn:applicable-vms="pre-launched, post-launched">
</xs:annotation>
</xs:element>
<xs:element name="own_pcpu" type="Boolean" default="n">
<xs:annotation acrn:title="Exclusively owns physical CPUs" acrn:views="">
<xs:documentation>Enable a VM exclusively owns the physical CPUs assigned to it.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="cpu_affinity" type="CPUAffinityConfigurations" minOccurs="0">
<xs:annotation acrn:title="Physical CPU affinity" acrn:views="basic" acrn:applicable-vms="pre-launched, post-launched">
<xs:documentation>Select a subset of physical CPUs that this VM can use. More than one can be selected.</xs:documentation>