diff mbox

[Question] SeaBIOS: cannot boot oracle linux if increase the maximum size of permanent high memory area

Message ID 33183CC9F5247A488A2544077AF19020DA2650C5@DGGEMA505-MBX.china.huawei.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gonglei (Arei) May 5, 2017, 10:49 a.m. UTC
Hi guys, 

Currently my workmate encountered an issues in the testing environment: 

A letter from him:

In order to boot a BIG vm (with 4T mem, 255 vCPUs, 60 virtio-scsi disk...), i have to increase the 
BUILD_MAX_HIGHTABLE to 512KB.
But, then i found i can not boot a  specific VM anymore (oracle linux 6.7 64bits with kernel 3.8.13, 2G mem).
It seems be related with the unused high ram given VM back by SeaBios (maybe also related to the memory align).
I've tested if setting giveback memory 64KB alignment other than 4KB, SeaBios with 512KB BUILD_MAX_HIGHTABLE
can boot the specific VM. But , i don't know the reason...

As far as i know, if seabios does not give back the unused ZoneHigh memory seems will not trigger any problems
but just waste only a little memory ,right?

Can you tell me what's the worst effect if i apply the following patch? 

Does it influence live migration?

Thanks!



Regards,
-Gonglei

Comments

Kevin O'Connor May 10, 2017, 7:16 p.m. UTC | #1
On Fri, May 05, 2017 at 10:49:05AM +0000, Gonglei (Arei) wrote:
> Hi guys, 
> 
> Currently my workmate encountered an issues in the testing environment: 
> 
> A letter from him:
> 
> In order to boot a BIG vm (with 4T mem, 255 vCPUs, 60 virtio-scsi
> disk...), i have to increase the BUILD_MAX_HIGHTABLE to 512KB.  But,
> then i found i can not boot a specific VM anymore (oracle linux 6.7
> 64bits with kernel 3.8.13, 2G mem).  It seems be related with the
> unused high ram given VM back by SeaBios (maybe also related to the
> memory align).  I've tested if setting giveback memory 64KB
> alignment other than 4KB, SeaBios with 512KB BUILD_MAX_HIGHTABLE can
> boot the specific VM. But , i don't know the reason...
> 
> As far as i know, if seabios does not give back the unused ZoneHigh
> memory seems will not trigger any problems but just waste only a
> little memory ,right?
> 
> Can you tell me what's the worst effect if i apply the following patch? 
> 
> Does it influence live migration?

The only downside I'm aware of is that it would waste a small amount
of ram.

I'm surprised that "oracle linux" has this issue.  I can only see a
few reasons for it to fail there - a "use after free" bug in seabios,
oracle linux expects the ram to be zero'd, or oracle linux is
expecting the e820 map to have an alignment larger than page size.
The first seems unlikely as "permanent high ram" is rarely ever free'd
in seabios.  The second also seems unlikely.

-Kevin
diff mbox

Patch

diff --git a/src/config.h b/src/config.h
index baca029..b3536f1 100644
index baca029..b3536f1 100644
--- a/src/config.h
+++ b/src/config.h
@@ -17,7 +17,7 @@ 
 // Maximum number of map entries in the e820 map
 #define BUILD_MAX_E820 32
 // Space to reserve in high-memory for tables
-#define BUILD_MAX_HIGHTABLE (256*1024)
+#define BUILD_MAX_HIGHTABLE (512*1024)

diff --git a/src/malloc.c b/src/malloc.c
index 3733855..6302525 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -549,13 +549,7 @@  malloc_prepboot(void)
     dprintf(1, "Space available for UMB: %x-%x, %x-%x\n"
             , RomEnd, base, info->range_start, info->range_end);

-    // Give back unused high ram.
-    info = alloc_find_lowest(&ZoneHigh);
-    if (info) {
-        u32 giveback = ALIGN_DOWN(info->range_end-info->range_start, PAGE_SIZE);
-        e820_add(info->range_start, giveback, E820_RAM);
-        dprintf(1, "Returned %d bytes of ZoneHigh\n", giveback);
-    }

     calcRamSize();