Files
acrn-hypervisor/misc/config_tools/schema/checks/cpu_assignment.xsd
Junjie Mao 40225337d2 config-tools: fix assertions against scenario XML
This patch fixes the following issues in the existing scenario schema
assertions:

  1. The assertion that ensures the existence of pCPU affinity in all
     pre- and post-launched VMs does not count the pCPU settings under a
     VM properly.

  2. The assertion that ensures the presence of CAT settings of a defined
     VM is no longer needed as it was originally designed to capture
     configurator issues.

Tracked-On: #6690
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
2022-06-29 13:53:42 +08:00

43 lines
2.8 KiB
XML

<?xml version="1.0"?>
<!-- Copyright (C) 2022 Intel Corporation. -->
<!-- SPDX-License-Identifier: BSD-3-Clause -->
<xs:schema xml:id="root"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:acrn="https://projectacrn.org">
<xs:assert test="every $cpu in vm//cpu_affinity//pcpu_id satisfies count(processors//thread[cpu_id = $cpu]) = 1">
<xs:annotation acrn:severity="warning" acrn:report-on="$cpu">
<xs:documentation>The physical CPU {$cpu} allocated to VM "{$cpu/ancestor::vm/name}" does not exist on the target board. Remove this CPU from the CPU affinity setting.</xs:documentation>
</xs:annotation>
</xs:assert>
<xs:assert test="every $vm in /acrn-config/vm satisfies
count(distinct-values($vm//cpu_affinity//pcpu_id)) = count($vm//cpu_affinity//pcpu_id)">
<xs:annotation acrn:severity="warning" acrn:report-on="$vm/cpu_affinity">
<xs:documentation>VM "{$vm/name}" repeats a physical CPU affinity assignment: {$vm//cpu_affinity//pcpu_id}. Remove the duplicates.</xs:documentation>
</xs:annotation>
</xs:assert>
<xs:assert test="every $pcpu in /acrn-config/vm[vm_type = 'RTVM']//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 RTVM "[{$pcpu/ancestor::vm/name}]" and thus may not be shared among multiple VMs. Look for, and probably remove, any affinity assignments to CPU {$pcpu} in this VM {//vm[cpu_affinity//pcpu_id = $pcpu]/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">
<xs:documentation>Assign at least one physical CPU affinity (pCPU ID) for VM "{$vm/name}".</xs:documentation>
</xs:annotation>
</xs:assert>
<xs:assert test="every $vm in /acrn-config/vm[load_order != 'SERVICE_VM'] satisfies
count(distinct-values(processors//thread[cpu_id = $vm//cpu_affinity//pcpu_id]/core_type)) &lt;= 1">
<xs:annotation acrn:severity="error" acrn:report-on="$vm//cpu_affinity">
<xs:documentation>The physical CPUs allocated to the VM "{$vm/name}" have both performance cores {processors//thread[cpu_id = $vm//cpu_affinity//pcpu_id and core_type = 'Core']/cpu_id} and efficiency cores {processors//thread[cpu_id = $vm//cpu_affinity//pcpu_id and core_type = 'Atom']/cpu_id}, which is unsupported. Remove either all performance or all efficiency cores from the CPU affinity.</xs:documentation>
</xs:annotation>
</xs:assert>
</xs:schema>