[PATCH] misc: refine the allocate logic of offline tool


chenli.wei
 

From: Chenli Wei <chenli.wei@...>

The current code use VM number to count HV_RAM_SIZE, this is not match
the HV logic.

This patch use the max number of post launched VMs to count the ram
size of ACRN and assume 20M ram / vm.

Tracked-On: #6690
Signed-off-by: Chenli Wei <chenli.wei@...>
---
misc/config_tools/library/common.py | 2 +-
misc/config_tools/static_allocators/hv_ram.py | 8 +++-----
2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/misc/config_tools/library/common.py b/misc/config_tools/library/common.py
index 9c9d9c62e..5e1a58507 100644
--- a/misc/config_tools/library/common.py
+++ b/misc/config_tools/library/common.py
@@ -45,7 +45,7 @@ MAX_VM_NUM = 16
MAX_VUART_NUM = 8

HV_BASE_RAM_SIZE = 0x1400000
-VM_RAM_SIZE = 0x2800000
+VM_RAM_SIZE = 0x1400000

class MultiItem():

diff --git a/misc/config_tools/static_allocators/hv_ram.py b/misc/config_tools/static_allocators/hv_ram.py
index eed41e472..57225255b 100644
--- a/misc/config_tools/static_allocators/hv_ram.py
+++ b/misc/config_tools/static_allocators/hv_ram.py
@@ -17,11 +17,9 @@ def fn(board_etree, scenario_etree, allocation_etree):
# this dictonary mapped with 'address start':'mem range'
ram_range = {}

- vm_num = 0
- vm_list = scenario_etree.xpath("//vm")
- if vm_list is not None:
- vm_num = len(vm_list)
- hv_ram_size = common.HV_BASE_RAM_SIZE + common.VM_RAM_SIZE * vm_num
+ max_vm_num = int(common.get_node(f"//hv/CAPACITIES/MAX_VM_NUM/text()", scenario_etree))
+ max_post_vm = max_vm_num - len(scenario_etree.xpath(f"//vm[load_order != 'POST_LAUNCHED_VM']"))
+ hv_ram_size = common.HV_BASE_RAM_SIZE + common.VM_RAM_SIZE * max_post_vm
ivshmem_list = scenario_etree.xpath("//IVSHMEM_SIZE/text()")
total_shm_size = 0
for ram_size in ivshmem_list:
--
2.25.1


Junjie Mao
 

-----Original Message-----
From: Chenli Wei <chenli.wei@...>
Sent: Saturday, September 24, 2022 3:31 AM
To: Mao, Junjie <junjie.mao@...>; Sun, Victor <victor.sun@...>; acrn-
dev@...
Cc: Wei, Chenli <chenli.wei@...>
Subject: [PATCH] misc: refine the allocate logic of offline tool

From: Chenli Wei <chenli.wei@...>

The current code use VM number to count HV_RAM_SIZE, this is not match
the HV logic.

This patch use the max number of post launched VMs to count the ram
size of ACRN and assume 20M ram / vm.

Tracked-On: #6690
Signed-off-by: Chenli Wei <chenli.wei@...>
---
misc/config_tools/library/common.py | 2 +-
misc/config_tools/static_allocators/hv_ram.py | 8 +++-----
2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/misc/config_tools/library/common.py b/misc/config_tools/library/common.py
index 9c9d9c62e..5e1a58507 100644
--- a/misc/config_tools/library/common.py
+++ b/misc/config_tools/library/common.py
@@ -45,7 +45,7 @@ MAX_VM_NUM = 16
MAX_VUART_NUM = 8

HV_BASE_RAM_SIZE = 0x1400000
-VM_RAM_SIZE = 0x2800000
+VM_RAM_SIZE = 0x1400000
What's the rationale of reducing the RAM/VM from 40MB to 20MB? I would recommend to record the rationale here as a comment so that we do not lose track of them in the future.

---
Best Regards
Junjie Mao


class MultiItem():

diff --git a/misc/config_tools/static_allocators/hv_ram.py
b/misc/config_tools/static_allocators/hv_ram.py
index eed41e472..57225255b 100644
--- a/misc/config_tools/static_allocators/hv_ram.py
+++ b/misc/config_tools/static_allocators/hv_ram.py
@@ -17,11 +17,9 @@ def fn(board_etree, scenario_etree, allocation_etree):
# this dictonary mapped with 'address start':'mem range'
ram_range = {}

- vm_num = 0
- vm_list = scenario_etree.xpath("//vm")
- if vm_list is not None:
- vm_num = len(vm_list)
- hv_ram_size = common.HV_BASE_RAM_SIZE + common.VM_RAM_SIZE * vm_num
+ max_vm_num = int(common.get_node(f"//hv/CAPACITIES/MAX_VM_NUM/text()",
scenario_etree))
+ max_post_vm = max_vm_num - len(scenario_etree.xpath(f"//vm[load_order !=
'POST_LAUNCHED_VM']"))
+ hv_ram_size = common.HV_BASE_RAM_SIZE + common.VM_RAM_SIZE * max_post_vm
ivshmem_list = scenario_etree.xpath("//IVSHMEM_SIZE/text()")
total_shm_size = 0
for ram_size in ivshmem_list:
--
2.25.1


chenli.wei
 


On 9/26/2022 10:40 AM, Mao, Junjie wrote:
-----Original Message-----
From: Chenli Wei <chenli.wei@...>
Sent: Saturday, September 24, 2022 3:31 AM
To: Mao, Junjie <junjie.mao@...>; Sun, Victor <victor.sun@...>; acrn-
dev@...
Cc: Wei, Chenli <chenli.wei@...>
Subject: [PATCH] misc: refine the allocate logic of offline tool

From: Chenli Wei <chenli.wei@...>

The current code use VM number to count HV_RAM_SIZE, this is not match
the HV logic.

This patch use the max number of post launched VMs to count the ram
size of ACRN and assume 20M ram / vm.

Tracked-On: #6690
Signed-off-by: Chenli Wei <chenli.wei@...>
---
 misc/config_tools/library/common.py           | 2 +-
 misc/config_tools/static_allocators/hv_ram.py | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/misc/config_tools/library/common.py b/misc/config_tools/library/common.py
index 9c9d9c62e..5e1a58507 100644
--- a/misc/config_tools/library/common.py
+++ b/misc/config_tools/library/common.py
@@ -45,7 +45,7 @@ MAX_VM_NUM = 16
 MAX_VUART_NUM = 8

 HV_BASE_RAM_SIZE = 0x1400000
-VM_RAM_SIZE = 0x2800000
+VM_RAM_SIZE = 0x1400000
What's the rationale of reducing the RAM/VM from 40MB to 20MB? I would recommend to record the rationale here as a comment so that we do not lose track of them in the future.

---
Best Regards
Junjie Mao

What about the comment "We allocate 16M sworld memory per post launched VM, so use a little more memory(20M) to calculation".


Previously, we used the method of 40M * VM number.

It is found that this calculation is not accurate.

The ACRN memory is mainly related to sworld memory and MAX post launched VM number:

static struct page post_user_vm_sworld_memory[MAX_POST_VM_NUM][TRUSTY_RAM_SIZE >> PAGE_SHIFT] __aligned(MEM_2M);

      
 class MultiItem():

diff --git a/misc/config_tools/static_allocators/hv_ram.py
b/misc/config_tools/static_allocators/hv_ram.py
index eed41e472..57225255b 100644
--- a/misc/config_tools/static_allocators/hv_ram.py
+++ b/misc/config_tools/static_allocators/hv_ram.py
@@ -17,11 +17,9 @@ def fn(board_etree, scenario_etree, allocation_etree):
     # this dictonary mapped with 'address start':'mem range'
     ram_range = {}

-    vm_num = 0
-    vm_list = scenario_etree.xpath("//vm")
-    if vm_list is not None:
-        vm_num = len(vm_list)
-    hv_ram_size = common.HV_BASE_RAM_SIZE + common.VM_RAM_SIZE * vm_num
+    max_vm_num = int(common.get_node(f"//hv/CAPACITIES/MAX_VM_NUM/text()",
scenario_etree))
+    max_post_vm = max_vm_num - len(scenario_etree.xpath(f"//vm[load_order !=
'POST_LAUNCHED_VM']"))
+    hv_ram_size = common.HV_BASE_RAM_SIZE + common.VM_RAM_SIZE * max_post_vm
     ivshmem_list = scenario_etree.xpath("//IVSHMEM_SIZE/text()")
     total_shm_size = 0
     for ram_size in ivshmem_list:
--
2.25.1

    


Junjie Mao
 

From: Wei, Chenli <chenli.wei@...>
Sent: Monday, September 26, 2022 11:02 AM
To: Mao, Junjie <junjie.mao@...>; Sun, Victor <victor.sun@...>; acrn-dev@...
Cc: Wei, Chenli <chenli.wei@...>
Subject: Re: [PATCH] misc: refine the allocate logic of offline tool


On 9/26/2022 10:40 AM, Mao, Junjie wrote:
-----Original Message-----
From: Chenli Wei mailto:chenli.wei@...
Sent: Saturday, September 24, 2022 3:31 AM
To: Mao, Junjie mailto:junjie.mao@...; Sun, Victor mailto:victor.sun@...; acrn-
mailto:dev@...
Cc: Wei, Chenli mailto:chenli.wei@...
Subject: [PATCH] misc: refine the allocate logic of offline tool

From: Chenli Wei mailto:chenli.wei@...

The current code use VM number to count HV_RAM_SIZE, this is not match
the HV logic.

This patch use the max number of post launched VMs to count the ram
size of ACRN and assume 20M ram / vm.

Tracked-On: #6690
Signed-off-by: Chenli Wei mailto:chenli.wei@...
---
misc/config_tools/library/common.py | 2 +-
misc/config_tools/static_allocators/hv_ram.py | 8 +++-----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/misc/config_tools/library/common.py b/misc/config_tools/library/common.py
index 9c9d9c62e..5e1a58507 100644
--- a/misc/config_tools/library/common.py
+++ b/misc/config_tools/library/common.py
@@ -45,7 +45,7 @@ MAX_VM_NUM = 16
MAX_VUART_NUM = 8

HV_BASE_RAM_SIZE = 0x1400000
-VM_RAM_SIZE = 0x2800000
+VM_RAM_SIZE = 0x1400000

What's the rationale of reducing the RAM/VM from 40MB to 20MB? I would recommend to record the rationale here as a comment so that we do not lose track of them in the future.

---
Best Regards
Junjie Mao
What about the comment "We allocate 16M sworld memory per post launched VM, so use a little more memory(20M) to calculation".

Previously, we used the method of 40M * VM number.
It is found that this calculation is not accurate.
The ACRN memory is mainly related to sworld memory and MAX post launched VM number:
static struct page post_user_vm_sworld_memory[MAX_POST_VM_NUM][TRUSTY_RAM_SIZE >> PAGE_SHIFT] __aligned(MEM_2M);
"sworld" is a concept that only makes sense in the context of trusty.

Is it because of the dynamic allocation of guest page tables that makes the number here smaller than what it was when those are statically reserved?

Also please use plain text format for mails sent to a mailing list.

---
Best Regards
Junjie Mao




class MultiItem():

diff --git a/misc/config_tools/static_allocators/hv_ram.py
b/misc/config_tools/static_allocators/hv_ram.py
index eed41e472..57225255b 100644
--- a/misc/config_tools/static_allocators/hv_ram.py
+++ b/misc/config_tools/static_allocators/hv_ram.py
@@ -17,11 +17,9 @@ def fn(board_etree, scenario_etree, allocation_etree):
# this dictonary mapped with 'address start':'mem range'
ram_range = {}

- vm_num = 0
- vm_list = scenario_etree.xpath("//vm")
- if vm_list is not None:
- vm_num = len(vm_list)
- hv_ram_size = common.HV_BASE_RAM_SIZE + common.VM_RAM_SIZE * vm_num
+ max_vm_num = int(common.get_node(f"//hv/CAPACITIES/MAX_VM_NUM/text()",
scenario_etree))
+ max_post_vm = max_vm_num - len(scenario_etree.xpath(f"//vm[load_order !=
'POST_LAUNCHED_VM']"))
+ hv_ram_size = common.HV_BASE_RAM_SIZE + common.VM_RAM_SIZE * max_post_vm
ivshmem_list = scenario_etree.xpath("//IVSHMEM_SIZE/text()")
total_shm_size = 0
for ram_size in ivshmem_list:
--
2.25.1


Victor Sun
 

-----Original Message-----
From: Mao, Junjie <junjie.mao@...>
Sent: Monday, September 26, 2022 11:23 AM
To: chenli.wei@...; Sun, Victor <victor.sun@...>; acrn-
dev@...
Cc: Wei, Chenli <chenli.wei@...>
Subject: RE: [PATCH] misc: refine the allocate logic of offline tool

From: Wei, Chenli <chenli.wei@...>
Sent: Monday, September 26, 2022 11:02 AM
To: Mao, Junjie <junjie.mao@...>; Sun, Victor
<victor.sun@...>; acrn-dev@...
Cc: Wei, Chenli <chenli.wei@...>
Subject: Re: [PATCH] misc: refine the allocate logic of offline tool


On 9/26/2022 10:40 AM, Mao, Junjie wrote:
-----Original Message-----
From: Chenli Wei mailto:chenli.wei@...
Sent: Saturday, September 24, 2022 3:31 AM
To: Mao, Junjie mailto:junjie.mao@...; Sun, Victor
mailto:victor.sun@...; acrn- mailto:dev@...
Cc: Wei, Chenli mailto:chenli.wei@...
Subject: [PATCH] misc: refine the allocate logic of offline tool

From: Chenli Wei mailto:chenli.wei@...

The current code use VM number to count HV_RAM_SIZE, this is not match
the HV logic.

This patch use the max number of post launched VMs to count the ram
size of ACRN and assume 20M ram / vm.

Tracked-On: #6690
Signed-off-by: Chenli Wei mailto:chenli.wei@...
---
misc/config_tools/library/common.py | 2 +-
misc/config_tools/static_allocators/hv_ram.py | 8 +++-----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/misc/config_tools/library/common.py
b/misc/config_tools/library/common.py
index 9c9d9c62e..5e1a58507 100644
--- a/misc/config_tools/library/common.py
+++ b/misc/config_tools/library/common.py
@@ -45,7 +45,7 @@ MAX_VM_NUM = 16
MAX_VUART_NUM = 8

HV_BASE_RAM_SIZE = 0x1400000
-VM_RAM_SIZE = 0x2800000
+VM_RAM_SIZE = 0x1400000

What's the rationale of reducing the RAM/VM from 40MB to 20MB? I
would recommend to record the rationale here as a comment so that we do
not lose track of them in the future.

---
Best Regards
Junjie Mao
What about the comment "We allocate 16M sworld memory per post
launched VM, so use a little more memory(20M) to calculation".

Previously, we used the method of 40M * VM number.
It is found that this calculation is not accurate.
The ACRN memory is mainly related to sworld memory and MAX post
launched VM number:
static struct page
post_user_vm_sworld_memory[MAX_POST_VM_NUM][TRUSTY_RAM_SIZE >>
PAGE_SHIFT] __aligned(MEM_2M);
"sworld" is a concept that only makes sense in the context of trusty.

Is it because of the dynamic allocation of guest page tables that makes the
number here smaller than what it was when those are statically reserved?
Shall we treat trusty VM num as a configurable value? It doesn't make sense to reserved sworld for every post launched VM.

BR,
Victor

Also please use plain text format for mails sent to a mailing list.

---
Best Regards
Junjie Mao




class MultiItem():

diff --git a/misc/config_tools/static_allocators/hv_ram.py
b/misc/config_tools/static_allocators/hv_ram.py
index eed41e472..57225255b 100644
--- a/misc/config_tools/static_allocators/hv_ram.py
+++ b/misc/config_tools/static_allocators/hv_ram.py
@@ -17,11 +17,9 @@ def fn(board_etree, scenario_etree,
allocation_etree):
# this dictonary mapped with 'address start':'mem range'
ram_range = {}

- vm_num = 0
- vm_list = scenario_etree.xpath("//vm")
- if vm_list is not None:
- vm_num = len(vm_list)
- hv_ram_size = common.HV_BASE_RAM_SIZE + common.VM_RAM_SIZE
* vm_num
+ max_vm_num =
+ int(common.get_node(f"//hv/CAPACITIES/MAX_VM_NUM/text()",
scenario_etree))
+ max_post_vm = max_vm_num -
+ len(scenario_etree.xpath(f"//vm[load_order !=
'POST_LAUNCHED_VM']"))
+ hv_ram_size = common.HV_BASE_RAM_SIZE + common.VM_RAM_SIZE
*
+ max_post_vm
ivshmem_list = scenario_etree.xpath("//IVSHMEM_SIZE/text()")
total_shm_size = 0
for ram_size in ivshmem_list:
--
2.25.1


Junjie Mao
 

-----Original Message-----
From: Sun, Victor <victor.sun@...>
Sent: Monday, September 26, 2022 11:27 AM
To: Mao, Junjie <junjie.mao@...>; chenli.wei@...; acrn-
dev@...
Cc: Wei, Chenli <chenli.wei@...>
Subject: RE: [PATCH] misc: refine the allocate logic of offline tool



-----Original Message-----
From: Mao, Junjie <junjie.mao@...>
Sent: Monday, September 26, 2022 11:23 AM
To: chenli.wei@...; Sun, Victor <victor.sun@...>; acrn-
dev@...
Cc: Wei, Chenli <chenli.wei@...>
Subject: RE: [PATCH] misc: refine the allocate logic of offline tool

From: Wei, Chenli <chenli.wei@...>
Sent: Monday, September 26, 2022 11:02 AM
To: Mao, Junjie <junjie.mao@...>; Sun, Victor
<victor.sun@...>; acrn-dev@...
Cc: Wei, Chenli <chenli.wei@...>
Subject: Re: [PATCH] misc: refine the allocate logic of offline tool


On 9/26/2022 10:40 AM, Mao, Junjie wrote:
-----Original Message-----
From: Chenli Wei mailto:chenli.wei@...
Sent: Saturday, September 24, 2022 3:31 AM
To: Mao, Junjie mailto:junjie.mao@...; Sun, Victor
mailto:victor.sun@...; acrn- mailto:dev@...
Cc: Wei, Chenli mailto:chenli.wei@...
Subject: [PATCH] misc: refine the allocate logic of offline tool

From: Chenli Wei mailto:chenli.wei@...

The current code use VM number to count HV_RAM_SIZE, this is not match
the HV logic.

This patch use the max number of post launched VMs to count the ram
size of ACRN and assume 20M ram / vm.

Tracked-On: #6690
Signed-off-by: Chenli Wei mailto:chenli.wei@...
---
misc/config_tools/library/common.py | 2 +-
misc/config_tools/static_allocators/hv_ram.py | 8 +++-----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/misc/config_tools/library/common.py
b/misc/config_tools/library/common.py
index 9c9d9c62e..5e1a58507 100644
--- a/misc/config_tools/library/common.py
+++ b/misc/config_tools/library/common.py
@@ -45,7 +45,7 @@ MAX_VM_NUM = 16
MAX_VUART_NUM = 8

HV_BASE_RAM_SIZE = 0x1400000
-VM_RAM_SIZE = 0x2800000
+VM_RAM_SIZE = 0x1400000

What's the rationale of reducing the RAM/VM from 40MB to 20MB? I
would recommend to record the rationale here as a comment so that we do
not lose track of them in the future.

---
Best Regards
Junjie Mao
What about the comment "We allocate 16M sworld memory per post
launched VM, so use a little more memory(20M) to calculation".

Previously, we used the method of 40M * VM number.
It is found that this calculation is not accurate.
The ACRN memory is mainly related to sworld memory and MAX post
launched VM number:
static struct page
post_user_vm_sworld_memory[MAX_POST_VM_NUM][TRUSTY_RAM_SIZE >>
PAGE_SHIFT] __aligned(MEM_2M);
"sworld" is a concept that only makes sense in the context of trusty.

Is it because of the dynamic allocation of guest page tables that makes the
number here smaller than what it was when those are statically reserved?
Shall we treat trusty VM num as a configurable value? It doesn't make sense to reserved
sworld for every post launched VM.
That makes sense to me, but perhaps will be the topic of a separate patch as some HV changes are required to cooperate with this new config item.

---
Best Regards
Junjie Mao

BR,
Victor

Also please use plain text format for mails sent to a mailing list.

---
Best Regards
Junjie Mao




class MultiItem():

diff --git a/misc/config_tools/static_allocators/hv_ram.py
b/misc/config_tools/static_allocators/hv_ram.py
index eed41e472..57225255b 100644
--- a/misc/config_tools/static_allocators/hv_ram.py
+++ b/misc/config_tools/static_allocators/hv_ram.py
@@ -17,11 +17,9 @@ def fn(board_etree, scenario_etree,
allocation_etree):
# this dictonary mapped with 'address start':'mem range'
ram_range = {}

- vm_num = 0
- vm_list = scenario_etree.xpath("//vm")
- if vm_list is not None:
- vm_num = len(vm_list)
- hv_ram_size = common.HV_BASE_RAM_SIZE + common.VM_RAM_SIZE
* vm_num
+ max_vm_num =
+ int(common.get_node(f"//hv/CAPACITIES/MAX_VM_NUM/text()",
scenario_etree))
+ max_post_vm = max_vm_num -
+ len(scenario_etree.xpath(f"//vm[load_order !=
'POST_LAUNCHED_VM']"))
+ hv_ram_size = common.HV_BASE_RAM_SIZE + common.VM_RAM_SIZE
*
+ max_post_vm
ivshmem_list = scenario_etree.xpath("//IVSHMEM_SIZE/text()")
total_shm_size = 0
for ram_size in ivshmem_list:
--
2.25.1


chenli.wei
 

On 9/26/2022 11:23 AM, Junjie Mao wrote:
From: Wei, Chenli <chenli.wei@...>
Sent: Monday, September 26, 2022 11:02 AM
To: Mao, Junjie <junjie.mao@...>; Sun, Victor <victor.sun@...>; acrn-dev@...
Cc: Wei, Chenli <chenli.wei@...>
Subject: Re: [PATCH] misc: refine the allocate logic of offline tool


On 9/26/2022 10:40 AM, Mao, Junjie wrote:
-----Original Message-----
From: Chenli Wei mailto:chenli.wei@...
Sent: Saturday, September 24, 2022 3:31 AM
To: Mao, Junjie mailto:junjie.mao@...; Sun, Victor mailto:victor.sun@...; acrn-
mailto:dev@...
Cc: Wei, Chenli mailto:chenli.wei@...
Subject: [PATCH] misc: refine the allocate logic of offline tool

From: Chenli Wei mailto:chenli.wei@...

The current code use VM number to count HV_RAM_SIZE, this is not match
the HV logic.

This patch use the max number of post launched VMs to count the ram
size of ACRN and assume 20M ram / vm.

Tracked-On: #6690
Signed-off-by: Chenli Wei mailto:chenli.wei@...
---
misc/config_tools/library/common.py | 2 +-
misc/config_tools/static_allocators/hv_ram.py | 8 +++-----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/misc/config_tools/library/common.py b/misc/config_tools/library/common.py
index 9c9d9c62e..5e1a58507 100644
--- a/misc/config_tools/library/common.py
+++ b/misc/config_tools/library/common.py
@@ -45,7 +45,7 @@ MAX_VM_NUM = 16
MAX_VUART_NUM = 8

HV_BASE_RAM_SIZE = 0x1400000
-VM_RAM_SIZE = 0x2800000
+VM_RAM_SIZE = 0x1400000

What's the rationale of reducing the RAM/VM from 40MB to 20MB? I would recommend to record the rationale here as a comment so that we do not lose track of them in the future.

---
Best Regards
Junjie Mao
What about the comment "We allocate 16M sworld memory per post launched VM, so use a little more memory(20M) to calculation".

Previously, we used the method of 40M * VM number.
It is found that this calculation is not accurate.
The ACRN memory is mainly related to sworld memory and MAX post launched VM number:
static struct page post_user_vm_sworld_memory[MAX_POST_VM_NUM][TRUSTY_RAM_SIZE >> PAGE_SHIFT] __aligned(MEM_2M);
"sworld" is a concept that only makes sense in the context of trusty.
Yes, so the current predefined waste some memory, not all post launched VM need these memory, we could refine it.

Is it because of the dynamic allocation of guest page tables that makes the number here smaller than what it was when those are statically reserved
Also please use plain text format for mails sent to a mailing list.

---
Best Regards
Junjie Mao
If we redesign and use a complex proposal, we could define the "post_user_vm_sworld_memory" by offline tool which could get the trusty VM by scenario.

This will significantly reduce the ACRN memory.



class MultiItem():

diff --git a/misc/config_tools/static_allocators/hv_ram.py
b/misc/config_tools/static_allocators/hv_ram.py
index eed41e472..57225255b 100644
--- a/misc/config_tools/static_allocators/hv_ram.py
+++ b/misc/config_tools/static_allocators/hv_ram.py
@@ -17,11 +17,9 @@ def fn(board_etree, scenario_etree, allocation_etree):
# this dictonary mapped with 'address start':'mem range'
ram_range = {}

- vm_num = 0
- vm_list = scenario_etree.xpath("//vm")
- if vm_list is not None:
- vm_num = len(vm_list)
- hv_ram_size = common.HV_BASE_RAM_SIZE + common.VM_RAM_SIZE * vm_num
+ max_vm_num = int(common.get_node(f"//hv/CAPACITIES/MAX_VM_NUM/text()",
scenario_etree))
+ max_post_vm = max_vm_num - len(scenario_etree.xpath(f"//vm[load_order !=
'POST_LAUNCHED_VM']"))
+ hv_ram_size = common.HV_BASE_RAM_SIZE + common.VM_RAM_SIZE * max_post_vm
ivshmem_list = scenario_etree.xpath("//IVSHMEM_SIZE/text()")
total_shm_size = 0
for ram_size in ivshmem_list:
--
2.25.1