[BUG?] vhost assert error with < 4GB of RAM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think I've found a bug when running a guest with vhost with less
than 4GB of RAM.

If a guest has less than 4GB of RAM, then above_4g_mem_size is 0 for
this call to cpu_register_physical_memory() in pc_memory_init() from
hw/pc.c:922

#if TARGET_PHYS_ADDR_BITS > 32
    cpu_register_physical_memory(0x100000000ULL, above_4g_mem_size,
                                 ram_addr + below_4g_mem_size);
#endif

this leads to vhost_client_set_memory being called with size == 0

#3  0x00000000004301f3 in vhost_client_set_memory (client=0x113b010,
start_addr=4294967296, size=0, phys_offset=3221225472)
    at /home/cam/research/KVM/qemu-kvm/hw/vhost.c:312

which trips the assert at hw/vhost.c:312

static void vhost_client_set_memory(CPUPhysMemoryClient *client,
                                    target_phys_addr_t start_addr,
                                    ram_addr_t size,
                                    ram_addr_t phys_offset)
{

...<snip>...

    assert(size);
...

something like the following fixes the problem but I'm not sure if
it's the proper way to handle it.

diff --git a/exec.c b/exec.c
index 5e9a5b7..991abfc 100644
--- a/exec.c
+++ b/exec.c
@@ -2592,7 +2592,9 @@ void
cpu_register_physical_memory_offset(target_phys_addr_t start_addr,
     ram_addr_t orig_size = size;
     subpage_t *subpage;

-    cpu_notify_set_memory(start_addr, size, phys_offset);
+    if (size > 0) {
+        cpu_notify_set_memory(start_addr, size, phys_offset);
+    }

     if (phys_offset == IO_MEM_UNASSIGNED) {
         region_offset = start_addr;
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux