From: "Michael S. Tsirkin" <mst@redhat.com>
To: Cam Macdonell <cam@cs.ualberta.ca>
Cc: KVM General <kvm@vger.kernel.org>
Subject: Re: [BUG?] vhost assert error with < 4GB of RAM
Date: Wed, 21 Jul 2010 06:16:02 +0300 [thread overview]
Message-ID: <20100721031602.GA11146@redhat.com> (raw)
In-Reply-To: <AANLkTily0gbkqX3ZajjzRwBZB8EaICA_OOBSKuvEkHU4@mail.gmail.com>
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;
prev parent reply other threads:[~2010-07-21 3:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-20 20:42 [BUG?] vhost assert error with < 4GB of RAM Cam Macdonell
2010-07-21 3:16 ` Michael S. Tsirkin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100721031602.GA11146@redhat.com \
--to=mst@redhat.com \
--cc=cam@cs.ualberta.ca \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox