config_tools: offline CPUs owned by User VMs

When launch a User VM own pCPUs, offline Service VM vCPUs which use
the same pCPUs by launch script.

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-09-27 11:37:20 +08:00 committed by acrnsi-robot
parent 138499f886
commit 4083da9470
2 changed files with 7 additions and 2 deletions

View File

@ -260,6 +260,7 @@ def generate_for_one_vm(board_etree, hv_scenario_etree, vm_scenario_etree, vm_id
script.add_plain_dm_parameter("--windows")
script.add_vm_descriptor("vm_type", f"'{eval_xpath(vm_scenario_etree, './/vm_type/text()', 'STANDARD_VM')}'")
script.add_vm_descriptor("scheduler", f"'{eval_xpath(hv_scenario_etree, './/SCHEDULER/text()')}'")
script.add_vm_descriptor("own_pcpu", f"'{eval_xpath(vm_scenario_etree, './/own_pcpu/text()')}'")
###
# CPU and memory resources

View File

@ -19,11 +19,15 @@ function offline_cpus() {
if [ -z ${processor_id} ]; then
continue
fi
if [ "${processor_id}" = "0" ]; then
echo "Warning: processor 0 can't be offline, there may be unexpect error!" >> /dev/stderr
continue
fi
cpu_path="/sys/devices/system/cpu/cpu${processor_id}"
if [ -f ${cpu_path}/online ]; then
online=`cat ${cpu_path}/online`
echo cpu${processor_id} online=${online} >> /dev/stderr
if [ "${online}" = "1" ] && [ "${processor_id}" != "0" ]; then
if [ "${online}" = "1" ]; then
echo 0 > ${cpu_path}/online
online=`cat ${cpu_path}/online`
# during boot time, cpu hotplug may be disabled by pci_device_probe during a pci module insmod
@ -90,7 +94,7 @@ function add_cpus() {
# Each parameter of this function is considered the apicid of processor (as is reported in /proc/cpuinfo) of
# a CPU assigned to a post-launched RTVM.
if [ "${vm_type}" = "RTVM" ] || [ "${scheduler}" = "SCHED_NOOP" ]; then
if [ "${vm_type}" = "RTVM" ] || [ "${scheduler}" = "SCHED_NOOP" ] || [ "${own_pcpu}" = "y" ]; then
offline_cpus $*
fi