Skip to contentSkip to conversation

pc: unbreak vhost

PATCH In review Michael S. Tsirkin 3 participants 3 messages Jul 16, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pc: unbreak vhost

Commit 44ae28f3152138e71ccad66c201d730b93374bc2 breaks vhost on small guests as we get a zero-sized memory slot at >4G, which that code does not expect.
The removal of if (above_4g_size > 0) seems unintentional (commit log only mentions allocation memory in a single chunk) so just put it back in.

---
 hw/pc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
hw/pc.c +4 -2
index 89bd4af..77b1592 100644
@@ -920,8 +920,10 @@ void pc_memory_init(ram_addr_t ram_size,
                  below_4g_mem_size - 0x100000,
                  ram_addr + 0x100000);
 #if TARGET_PHYS_ADDR_BITS > 32
-    cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size,
-                                 ram_addr + below_4g_mem_size);
+    if (above_4g_mem_size > 0) {
+        cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size,
+                                     ram_addr + below_4g_mem_size);
+    }
 #endif
 
     /* BIOS load */
Signature · 1 line
1.7.2.rc0.14.g41c1c
#1 lore raw
Quoted 6 lines · Michael S. Tsirkin

Commit 44ae28f3152138e71ccad66c201d730b93374bc2 breaks vhost on small guests as we get a zero-sized memory slot at >4G, which that code does not expect.
The removal of if (above_4g_size > 0) seems unintentional (commit log only mentions allocation memory in a single chunk) so just put it back in.

Yep, I already submitted an identical patch too:

http://lists.nongnu.org/archive/html/qemu-devel/2010-07/msg00364.html

Alex

Quoted 22 lines
---
 hw/pc.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
hw/pc.c +4 -2
index 89bd4af..77b1592 100644
@@ -920,8 +920,10 @@ void pc_memory_init(ram_addr_t ram_size,
                  below_4g_mem_size - 0x100000,
                  ram_addr + 0x100000);
 #if TARGET_PHYS_ADDR_BITS > 32
-    cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size,
-                                 ram_addr + below_4g_mem_size);
+    if (above_4g_mem_size > 0) {
+        cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size,
+                                     ram_addr + below_4g_mem_size);
+    }
 #endif
 
     /* BIOS load */
#2 lore raw
Quoted 9 lines · Alex Williamson
Quoted 7 lines · Michael S. Tsirkin

Commit 44ae28f3152138e71ccad66c201d730b93374bc2 breaks vhost on small guests as we get a zero-sized memory slot at>4G, which that code does not expect.
The removal of if (above_4g_size> 0) seems unintentional (commit log only mentions allocation memory in a single chunk) so just put it back in.

Quoted 4 lines

Yep, I already submitted an identical patch too:

http://lists.nongnu.org/archive/html/qemu-devel/2010-07/msg00364.html

Sorry Alex, I apparently forgot to push yesterday. Let me do a quick merge and build and I'll push.

Regards,

Anthony Liguori

Quoted 29 lines

Alex

Quoted 23 lines
---
  hw/pc.c |    6 ++++--
  1 files changed, 4 insertions(+), 2 deletions(-)
hw/pc.c +4 -2
index 89bd4af..77b1592 100644
@@ -920,8 +920,10 @@ void pc_memory_init(ram_addr_t ram_size,
                   below_4g_mem_size - 0x100000,
                   ram_addr + 0x100000);
  #if TARGET_PHYS_ADDR_BITS>  32
-    cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size,
-                                 ram_addr + below_4g_mem_size);
+    if (above_4g_mem_size>  0) {
+        cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size,
+                                     ram_addr + below_4g_mem_size);
+    }
  #endif
 
      /* BIOS load */