[PATCH] config_tools: offline cpu for own_pcpu VMs


Zhao, Yuanyuan
 

When launch a VM own pcpus, offline Service VM vcpus which use
the same pcpu by launch script.

Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@...>
---
misc/config_tools/launch_config/launch_cfg_gen.py | 1 +
misc/config_tools/launch_config/launch_script_template.sh | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/misc/config_tools/launch_config/launch_cfg_gen.py b/misc/config_tools/launch_config/launch_cfg_gen.py
index 7c4668013..c1e7d6436 100755
--- a/misc/config_tools/launch_config/launch_cfg_gen.py
+++ b/misc/config_tools/launch_config/launch_cfg_gen.py
@@ -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
diff --git a/misc/config_tools/launch_config/launch_script_template.sh b/misc/config_tools/launch_config/launch_script_template.sh
index db11885f3..4db5916c1 100644
--- a/misc/config_tools/launch_config/launch_script_template.sh
+++ b/misc/config_tools/launch_config/launch_script_template.sh
@@ -90,7 +90,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

--
2.25.1


Junjie Mao
 

-----Original Message-----
From: Yuanyuan Zhao <yuanyuan.zhao@...>
Sent: Tuesday, September 27, 2022 11:35 AM
To: Mao, Junjie <junjie.mao@...>; acrn-dev@...
Cc: yuanyuan.zhao@...
Subject: [PATCH] config_tools: offline cpu for own_pcpu VMs

When launch a VM own pcpus, offline Service VM vcpus which use
the same pcpu by launch script.

Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@...>
---
misc/config_tools/launch_config/launch_cfg_gen.py | 1 +
misc/config_tools/launch_config/launch_script_template.sh | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/misc/config_tools/launch_config/launch_cfg_gen.py
b/misc/config_tools/launch_config/launch_cfg_gen.py
index 7c4668013..c1e7d6436 100755
--- a/misc/config_tools/launch_config/launch_cfg_gen.py
+++ b/misc/config_tools/launch_config/launch_cfg_gen.py
@@ -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
diff --git a/misc/config_tools/launch_config/launch_script_template.sh
b/misc/config_tools/launch_config/launch_script_template.sh
index db11885f3..4db5916c1 100644
--- a/misc/config_tools/launch_config/launch_script_template.sh
+++ b/misc/config_tools/launch_config/launch_script_template.sh
@@ -90,7 +90,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
You may want to check if the selected CPU is CPU 0, which cannot be offlined in the service VM, and print user-friendly warning on that instead.

---
Best Regards
Junjie Mao

offline_cpus $*
fi

--
2.25.1


Zhao, Yuanyuan
 

On 2022/9/27 17:02, Mao, Junjie wrote:
-----Original Message-----
From: Yuanyuan Zhao <yuanyuan.zhao@...>
Sent: Tuesday, September 27, 2022 11:35 AM
To: Mao, Junjie <junjie.mao@...>; acrn-dev@...
Cc: yuanyuan.zhao@...
Subject: [PATCH] config_tools: offline cpu for own_pcpu VMs

When launch a VM own pcpus, offline Service VM vcpus which use
the same pcpu by launch script.

Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@...>
---
misc/config_tools/launch_config/launch_cfg_gen.py | 1 +
misc/config_tools/launch_config/launch_script_template.sh | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/misc/config_tools/launch_config/launch_cfg_gen.py
b/misc/config_tools/launch_config/launch_cfg_gen.py
index 7c4668013..c1e7d6436 100755
--- a/misc/config_tools/launch_config/launch_cfg_gen.py
+++ b/misc/config_tools/launch_config/launch_cfg_gen.py
@@ -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()')}'")A

###
# CPU and memory resources
diff --git a/misc/config_tools/launch_config/launch_script_template.sh
b/misc/config_tools/launch_config/launch_script_template.sh
index db11885f3..4db5916c1 100644
--- a/misc/config_tools/launch_config/launch_script_template.sh
+++ b/misc/config_tools/launch_config/launch_script_template.sh
@@ -90,7 +90,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
You may want to check if the selected CPU is CPU 0, which cannot be offlined in the service VM, and print user-friendly warning on that instead.
Launch script check the processor and will not offline it. For the offline process is in 'add_cpus' during dm_params process, so no warning added.
---
Best Regards
Junjie Mao

offline_cpus $*
fi

--
2.25.1


Junjie Mao
 

-----Original Message-----
From: Zhao, Yuanyuan <yuanyuan.zhao@...>
Sent: Thursday, September 29, 2022 2:17 PM
To: Mao, Junjie <junjie.mao@...>; acrn-dev@...
Subject: Re: [PATCH] config_tools: offline cpu for own_pcpu VMs

On 2022/9/27 17:02, Mao, Junjie wrote:
-----Original Message-----
From: Yuanyuan Zhao <yuanyuan.zhao@...>
Sent: Tuesday, September 27, 2022 11:35 AM
To: Mao, Junjie <junjie.mao@...>; acrn-dev@...
Cc: yuanyuan.zhao@...
Subject: [PATCH] config_tools: offline cpu for own_pcpu VMs

When launch a VM own pcpus, offline Service VM vcpus which use
the same pcpu by launch script.

Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@...>
---
misc/config_tools/launch_config/launch_cfg_gen.py | 1 +
misc/config_tools/launch_config/launch_script_template.sh | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/misc/config_tools/launch_config/launch_cfg_gen.py
b/misc/config_tools/launch_config/launch_cfg_gen.py
index 7c4668013..c1e7d6436 100755
--- a/misc/config_tools/launch_config/launch_cfg_gen.py
+++ b/misc/config_tools/launch_config/launch_cfg_gen.py
@@ -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()')}'")A

###
# CPU and memory resources
diff --git a/misc/config_tools/launch_config/launch_script_template.sh
b/misc/config_tools/launch_config/launch_script_template.sh
index db11885f3..4db5916c1 100644
--- a/misc/config_tools/launch_config/launch_script_template.sh
+++ b/misc/config_tools/launch_config/launch_script_template.sh
@@ -90,7 +90,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
You may want to check if the selected CPU is CPU 0, which cannot be offlined in the
service VM, and print user-friendly warning on that instead.
Launch script check the processor and will not offline it. For the
offline process is in 'add_cpus' during dm_params process, so no warning
added.
Warnings in functions that evaluates to `dm_params` can still print warnings by echoing to /dev/stderr.

If the check is already done there, just add a warning message in the `else` branch to let users be aware of that.

---
Best Regards
Junjie Mao


---
Best Regards
Junjie Mao

offline_cpus $*
fi

--
2.25.1


Zhao, Yuanyuan
 

On 2022/9/29 14:24, Mao, Junjie wrote:
-----Original Message-----
From: Zhao, Yuanyuan <yuanyuan.zhao@...>
Sent: Thursday, September 29, 2022 2:17 PM
To: Mao, Junjie <junjie.mao@...>; acrn-dev@...
Subject: Re: [PATCH] config_tools: offline cpu for own_pcpu VMs

On 2022/9/27 17:02, Mao, Junjie wrote:
-----Original Message-----
From: Yuanyuan Zhao <yuanyuan.zhao@...>
Sent: Tuesday, September 27, 2022 11:35 AM
To: Mao, Junjie <junjie.mao@...>; acrn-dev@...
Cc: yuanyuan.zhao@...
Subject: [PATCH] config_tools: offline cpu for own_pcpu VMs

When launch a VM own pcpus, offline Service VM vcpus which use
the same pcpu by launch script.

Signed-off-by: Yuanyuan Zhao <yuanyuan.zhao@...>
---
misc/config_tools/launch_config/launch_cfg_gen.py | 1 +
misc/config_tools/launch_config/launch_script_template.sh | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/misc/config_tools/launch_config/launch_cfg_gen.py
b/misc/config_tools/launch_config/launch_cfg_gen.py
index 7c4668013..c1e7d6436 100755
--- a/misc/config_tools/launch_config/launch_cfg_gen.py
+++ b/misc/config_tools/launch_config/launch_cfg_gen.py
@@ -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()')}'")A

###
# CPU and memory resources
diff --git a/misc/config_tools/launch_config/launch_script_template.sh
b/misc/config_tools/launch_config/launch_script_template.sh
index db11885f3..4db5916c1 100644
--- a/misc/config_tools/launch_config/launch_script_template.sh
+++ b/misc/config_tools/launch_config/launch_script_template.sh
@@ -90,7 +90,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
You may want to check if the selected CPU is CPU 0, which cannot be offlined in the
service VM, and print user-friendly warning on that instead.
Launch script check the processor and will not offline it. For the
offline process is in 'add_cpus' during dm_params process, so no warning
added.
Warnings in functions that evaluates to `dm_params` can still print warnings by echoing to /dev/stderr.
If the check is already done there, just add a warning message in the `else` branch to let users be aware of that.
OK, will add in v2.
---
Best Regards
Junjie Mao


---
Best Regards
Junjie Mao

offline_cpus $*
fi

--
2.25.1