From: "Michael S. Tsirkin" <mst@redhat.com>
To: Hu Tao <hutao@cn.fujitsu.com>
Cc: Igor Mammedov <imammedo@redhat.com>,
qemu-devel@nongnu.org, Yasunori Goto <y-goto@jp.fujitsu.com>
Subject: Re: [Qemu-devel] [PATCH] check if we have space left for hotplugged memory
Date: Wed, 25 Jun 2014 12:17:57 +0300 [thread overview]
Message-ID: <20140625091757.GK32652@redhat.com> (raw)
In-Reply-To: <1403686864-13567-1-git-send-email-hutao@cn.fujitsu.com>
On Wed, Jun 25, 2014 at 05:01:04PM +0800, Hu Tao wrote:
> If pc-dimm is specified on qemu command line, but only with
> -m size (aka not -m size,maxmem,slots) then qemu will core dump.
>
> This patch fixes the problem.
>
> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> ---
> hw/i386/pc.c | 5 +++++
> hw/mem/pc-dimm.c | 5 +++++
> 2 files changed, 10 insertions(+)
>
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 2cf22b1..1a0d96e 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -1566,6 +1566,11 @@ static void pc_dimm_plug(HotplugHandler *hotplug_dev,
> goto out;
> }
>
> + if (memory_region_size(&pcms->hotplug_memory) == 0) {
> + error_setg(&local_err, "no space left for hotplugged memory.");
> + goto out;
> + }
> +
> addr = pc_dimm_get_free_addr(pcms->hotplug_memory_base,
> memory_region_size(&pcms->hotplug_memory),
> !addr ? NULL : &addr,
Why two errors in two places?
> diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c
> index ad176b7..59ed9c0 100644
> --- a/hw/mem/pc-dimm.c
> +++ b/hw/mem/pc-dimm.c
> @@ -146,6 +146,11 @@ uint64_t pc_dimm_get_free_addr(uint64_t address_space_start,
> uint64_t new_addr, ret = 0;
> uint64_t address_space_end = address_space_start + address_space_size;
>
> + if (address_space_size == 0) {
> + error_setg(errp, "no space left for hotplugged memory.");
> + goto out;
> + }
> +
> assert(address_space_end > address_space_size);
> object_child_foreach(qdev_get_machine(), pc_dimm_built_list, &list);
>
Didn't we want a more specific message?
> --
> 1.9.3
next prev parent reply other threads:[~2014-06-25 9:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-25 9:01 [Qemu-devel] [PATCH] check if we have space left for hotplugged memory Hu Tao
2014-06-25 9:17 ` Michael S. Tsirkin [this message]
2014-06-25 9:33 ` Hu Tao
2014-06-25 9:46 ` Michael S. Tsirkin
2014-06-25 9:56 ` Igor Mammedov
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=20140625091757.GK32652@redhat.com \
--to=mst@redhat.com \
--cc=hutao@cn.fujitsu.com \
--cc=imammedo@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=y-goto@jp.fujitsu.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.