config: add four per-vm bvt parameters

Add four per-vm bvt parameters as the initial bvt parameter values for
vCPU threads.
- bvt_weight
  The time sharing of a thread on CPU.
- bvt_warp_value
  Boost value of virtual time of a thread (time borrowed from future) to
  reduce Effective Virtual Time to prioritize the thread.
- bvt_warp_limit
  Max warp time in one warp.
- bvt_unwarp_period
  Min unwarp time after a warp.

Tracked-On: #8500
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
Signed-off-by: Qiang Zhang <qiang4.zhang@intel.com>
This commit is contained in:
Qiang Zhang 2023-08-31 14:00:14 +08:00 committed by acrnsi-robot
parent 6a1d91c740
commit 04a4f31d28
3 changed files with 66 additions and 0 deletions

View File

@ -42,6 +42,12 @@ enum thread_priority {
*/
struct sched_params {
uint32_t prio; /* The priority of a thread */
/* per thread parameters for bvt scheduler */
uint8_t bvt_weight; /* the weight of a thread */
int32_t bvt_warp_value; /* the warp reduce effective VT to boost priority */
uint32_t bvt_warp_limit; /* max time in one warp */
uint32_t bvt_unwarp_period; /* min unwarp time after a warp */
};
struct thread_object;

View File

@ -442,6 +442,62 @@ These settings can only be changed at build time.</xs:documentation>
<xs:documentation>Specify the VM vCPU priority for scheduling.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="bvt_weight" default="1">
<xs:annotation acrn:views="advanced">
<xs:documentation>Specify the VM vCPU weight for scheduling.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:annotation>
<xs:documentation>Integer from 1 to 128.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:integer">
<xs:minInclusive value="1" />
<xs:maxInclusive value="128" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="bvt_warp_value" default="0">
<xs:annotation acrn:views="">
<xs:documentation>Specify the VM vCPU warp in MCU (minimum charging unit, i.e. tick period) to prioritize them.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:annotation>
<xs:documentation>Integer from -8192 to 8192.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:integer">
<xs:minInclusive value="-8192" />
<xs:maxInclusive value="8192" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="bvt_warp_limit" default="0">
<xs:annotation acrn:views="">
<xs:documentation>Specify the VM vCPU warp limit time in MCU (minimum charging unit, i.e. tick period) to prevent starving non-warpped threads.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:annotation>
<xs:documentation>Integer from 0 to 10.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0" />
<xs:maxInclusive value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="bvt_unwarp_period" default="0">
<xs:annotation acrn:views="">
<xs:documentation>Specify the VM vCPU unwarp period in MCU (minimum charging unit, i.e. tick period) after a warp.</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:annotation>
<xs:documentation>Integer from 0 to 10.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:integer">
<xs:minInclusive value="0" />
<xs:maxInclusive value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="companion_vmid" type="xs:integer" default="65535">
<xs:annotation acrn:views="">
<xs:documentation>Specify the companion VM id of this VM.</xs:documentation>

View File

@ -112,6 +112,10 @@
</xsl:if>
<xsl:value-of select="acrn:initializer('sched_params', '{', true())" />
<xsl:value-of select="acrn:initializer('prio', priority)" />
<xsl:value-of select="acrn:initializer('bvt_weight', bvt_weight)" />
<xsl:value-of select="acrn:initializer('bvt_warp_value', bvt_warp_value)" />
<xsl:value-of select="acrn:initializer('bvt_warp_limit', bvt_warp_limit)" />
<xsl:value-of select="acrn:initializer('bvt_unwarp_period', bvt_unwarp_period)" />
<xsl:text>},</xsl:text>
<xsl:value-of select="$newline" />
<xsl:value-of select="acrn:initializer('companion_vm_id', concat(companion_vmid, 'U'))" />