* [BUG?] vhost assert error with < 4GB of RAM
@ 2010-07-20 20:42 Cam Macdonell
2010-07-21 3:16 ` Michael S. Tsirkin
0 siblings, 1 reply; 2+ messages in thread
From: Cam Macdonell @ 2010-07-20 20:42 UTC (permalink / raw)
To: KVM General, Michael S. Tsirkin
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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [BUG?] vhost assert error with < 4GB of RAM
2010-07-20 20:42 [BUG?] vhost assert error with < 4GB of RAM Cam Macdonell
@ 2010-07-21 3:16 ` Michael S. Tsirkin
0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2010-07-21 3:16 UTC (permalink / raw)
To: Cam Macdonell; +Cc: KVM General
On Tue, Jul 20, 2010 at 02:42:19PM -0600, Cam Macdonell wrote:
> 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
Yes, the fix is in qemu already, it's a matter of merging into qemu-kvm.
> 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;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-21 3:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-20 20:42 [BUG?] vhost assert error with < 4GB of RAM Cam Macdonell
2010-07-21 3:16 ` Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox