hv: sched: Add sched_params struct for thread parameters

Abstract out schedulers config data for vCPU threads and other hypervisor
threads to sched_params structure. And it's used to initialize per
thread scheduler private data. The sched_params for vCPU threads come
from vm_config generated by config tools while other hypervisor threads
need give them explicitly.

Tracked-On: #8500
Signed-off-by: Qiang Zhang <qiang4.zhang@intel.com>
This commit is contained in:
Qiang Zhang
2023-09-06 13:39:29 +08:00
committed by acrnsi-robot
parent c000a3f70b
commit 6a1d91c740
12 changed files with 68 additions and 27 deletions

View File

@@ -22,7 +22,10 @@ struct acrn_vm_config
/* Static configured VM0 */
CONFIG_PRE_STD_VM,
.name = "SAFETY_VM0",
.vm_prio = PRIO_LOW,
.sched_params =
{
.prio = PRIO_LOW,
},
.companion_vm_id = 65535U,
.guest_flags = (GUEST_FLAG_STATIC_VM),
.cpu_affinity = VM0_CONFIG_CPU_AFFINITY,
@@ -106,7 +109,10 @@ struct acrn_vm_config
CONFIG_SERVICE_VM,
.name = "ACRN_Service_VM",
/* Allow Service VM to reboot the system since it is the highest priority VM. */
.vm_prio = PRIO_LOW,
.sched_params =
{
.prio = PRIO_LOW,
},
.companion_vm_id = 65535U,
.guest_flags = (GUEST_FLAG_STATIC_VM),
.cpu_affinity = SERVICE_VM_CONFIG_CPU_AFFINITY,
@@ -163,7 +169,10 @@ struct acrn_vm_config
/* Static configured VM2 */
CONFIG_POST_STD_VM,
.name = "POST_STD_VM1",
.vm_prio = PRIO_LOW,
.sched_params =
{
.prio = PRIO_LOW,
},
.companion_vm_id = 65535U,
.guest_flags = (GUEST_FLAG_STATIC_VM),
.cpu_affinity = VM2_CONFIG_CPU_AFFINITY,
@@ -186,7 +195,10 @@ struct acrn_vm_config
/* Static configured VM3 */
CONFIG_POST_STD_VM,
.name = "POST_STD_VM2",
.vm_prio = PRIO_LOW,
.sched_params =
{
.prio = PRIO_LOW,
},
.companion_vm_id = 65535U,
.guest_flags = (GUEST_FLAG_STATIC_VM),
.cpu_affinity = VM3_CONFIG_CPU_AFFINITY,

View File

@@ -25,7 +25,10 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
/* Static configured VM0 */
CONFIG_PRE_STD_VM,
.name = "PRE_STD_VM0",
.vm_prio = PRIO_LOW,
.sched_params =
{
.prio = PRIO_LOW,
},
.companion_vm_id = 65535U,
.guest_flags = (GUEST_FLAG_STATIC_VM),
.cpu_affinity = VM0_CONFIG_CPU_AFFINITY,
@@ -102,7 +105,10 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
/* Static configured VM1 */
CONFIG_PRE_STD_VM,
.name = "PRE_STD_VM1",
.vm_prio = PRIO_LOW,
.sched_params =
{
.prio = PRIO_LOW,
},
.companion_vm_id = 65535U,
.guest_flags = (GUEST_FLAG_STATIC_VM),
.cpu_affinity = VM1_CONFIG_CPU_AFFINITY,

View File

@@ -17,7 +17,10 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
CONFIG_SERVICE_VM,
.name = "ACRN_Service_VM",
/* Allow Service VM to reboot the system since it is the highest priority VM. */
.vm_prio = PRIO_LOW,
.sched_params =
{
.prio = PRIO_LOW,
},
.companion_vm_id = 65535U,
.guest_flags = (GUEST_FLAG_STATIC_VM),
.cpu_affinity = SERVICE_VM_CONFIG_CPU_AFFINITY,
@@ -74,7 +77,10 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
/* Static configured VM1 */
CONFIG_POST_STD_VM,
.name = "POST_STD_VM1",
.vm_prio = PRIO_LOW,
.sched_params =
{
.prio = PRIO_LOW,
},
.companion_vm_id = 65535U,
.guest_flags = (GUEST_FLAG_STATIC_VM),
.cpu_affinity = VM1_CONFIG_CPU_AFFINITY,
@@ -105,7 +111,10 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = {
/* Static configured VM2 */
CONFIG_POST_RT_VM,
.name = "POST_RT_VM1",
.vm_prio = PRIO_LOW,
.sched_params =
{
.prio = PRIO_LOW,
},
.companion_vm_id = 65535U,
.guest_flags = (GUEST_FLAG_LAPIC_PASSTHROUGH | GUEST_FLAG_RT | GUEST_FLAG_STATIC_VM),
.cpu_affinity = VM2_CONFIG_CPU_AFFINITY,

View File

@@ -110,7 +110,10 @@
<xsl:value-of select="acrn:comment('Allow Service VM to reboot the system since it is the highest priority VM.')" />
<xsl:value-of select="$newline" />
</xsl:if>
<xsl:value-of select="acrn:initializer('vm_prio', priority)" />
<xsl:value-of select="acrn:initializer('sched_params', '{', true())" />
<xsl:value-of select="acrn:initializer('prio', priority)" />
<xsl:text>},</xsl:text>
<xsl:value-of select="$newline" />
<xsl:value-of select="acrn:initializer('companion_vm_id', concat(companion_vmid, 'U'))" />
<xsl:call-template name="guest_flags" />