[MINI-OS PATCH 08/19] e820: don't count lapic page as initially reserved

Juergen Gross posted 19 patches 4 months ago
There is a newer version of this series
[MINI-OS PATCH 08/19] e820: don't count lapic page as initially reserved
Posted by Juergen Gross 4 months ago
The number of pages marked initially as reserved in the memory map
are counted to be allocated, as they are normally populated by Xen
tools for e.g. xenbus and console ring pages.

This is wrong in case the lapic page is marked as reserved in the
memory map, as there is never memory allocated for a lapic.

So when finding the lapic page to be marked as reserved, don't add
it to the number of reserved pages.

Fixes: 9b87429d2864 ("mini-os: fix number of pages for PVH")
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 e820.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/e820.c b/e820.c
index 49b16878..876d55b1 100644
--- a/e820.c
+++ b/e820.c
@@ -275,7 +275,10 @@ static void e820_sanitize(void)
             e820_initial_reserved_pfns += e820_map[i].size / PAGE_SIZE;
             if ( e820_map[i].addr <= LAPIC_ADDRESS &&
                  e820_map[i].addr + e820_map[i].size > LAPIC_ADDRESS )
+            {
                 found_lapic = true;
+                e820_initial_reserved_pfns--;
+            }
         }
     }
 
-- 
2.43.0
Re: [MINI-OS PATCH 08/19] e820: don't count lapic page as initially reserved
Posted by Jason Andryuk 3 months, 3 weeks ago
On 2025-07-02 04:12, Juergen Gross wrote:
> The number of pages marked initially as reserved in the memory map
> are counted to be allocated, as they are normally populated by Xen
> tools for e.g. xenbus and console ring pages.
> 
> This is wrong in case the lapic page is marked as reserved in the
> memory map, as there is never memory allocated for a lapic.
> 
> So when finding the lapic page to be marked as reserved, don't add
> it to the number of reserved pages.
> 
> Fixes: 9b87429d2864 ("mini-os: fix number of pages for PVH")
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>