qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Cc: stefanha@redhat.com, gleb@redhat.com, qemu-devel@nongnu.org,
	agraf@suse.de, borntraeger@de.ibm.com, aliguori@amazon.com,
	cornelia.huck@de.ibm.com, pbonzini@redhat.com, rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH v2 2/5] vl.c: extend -m option to support options for memory hotplug
Date: Wed, 26 Feb 2014 16:39:54 +0100	[thread overview]
Message-ID: <20140226163954.57a7a4f1@nial.usersys.redhat.com> (raw)
In-Reply-To: <1393277453-13942-3-git-send-email-mjrosato@linux.vnet.ibm.com>

On Mon, 24 Feb 2014 16:30:50 -0500
Matthew Rosato <mjrosato@linux.vnet.ibm.com> wrote:

> From: Igor Mammedov <imammedo@redhat.com>
> 
> Add following parameters:
>   "slots" - total number of hotplug memory slots
>   "maxmem" - maximum possible memory
> 
> "slots" and "maxmem" should go in pair and "maxmem" should be greater
> than "mem" for memory hotplug to be enabled.
it's outdated version which does not apply,
I'll push a new one to memory-hotplug-v8 tree soon, so it could be picked up from there.

> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  qemu-options.hx |    7 +++++--
>  vl.c            |   45 +++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 50 insertions(+), 2 deletions(-)
> 
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 4d7ef52..ff60504 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -210,10 +210,13 @@ use is discouraged as it may be removed from future versions.
>  ETEXI
>  
>  DEF("m", HAS_ARG, QEMU_OPTION_m,
> -    "-m [mem=]megs\n"
> +    "-m [mem=]megs[,slots=n,maxmem=size]\n"
>      "                configure guest RAM\n"
>      "                mem: initial amount of guest memory (default: "
> -    stringify(DEFAULT_RAM_SIZE) "Mb)\n",
> +    stringify(DEFAULT_RAM_SIZE) "Mb)\n"
> +    "                slots=number of hotplug slots (default: none)\n"
> +    "                maxmem=maximum amount of guest memory (default: none)\n"
> +    "                slots and maxmem must be used together\n",
>      QEMU_ARCH_ALL)
>  STEXI
>  @item -m @var{megs}
> diff --git a/vl.c b/vl.c
> index a3e43d6..d8ff51f 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -542,6 +542,14 @@ static QemuOptsList qemu_mem_opts = {
>              .name = "mem",
>              .type = QEMU_OPT_SIZE,
>          },
> +        {
> +            .name = "slots",
> +            .type = QEMU_OPT_NUMBER,
> +        },
> +        {
> +            .name = "maxmem",
> +            .type = QEMU_OPT_SIZE,
> +        },
>          { /* end of list */ }
>      },
>  };
> @@ -3226,6 +3234,7 @@ int main(int argc, char **argv, char **envp)
>              case QEMU_OPTION_m: {
>                  uint64_t sz;
>                  const char *mem_str;
> +                const char *maxmem_str, *slots_str;
>  
>                  opts = qemu_opts_parse(qemu_find_opts("memory-opts"),
>                                         optarg, 1);
> @@ -3255,6 +3264,42 @@ int main(int argc, char **argv, char **envp)
>                      fprintf(stderr, "qemu: ram size too large\n");
>                      exit(1);
>                  }
> +
> +                maxmem_str = qemu_opt_get(opts, "maxmem");
> +                slots_str = qemu_opt_get(opts, "slots");
> +                if (maxmem_str && slots_str) {
> +                    uint64_t slots;
> +
> +                    sz = qemu_opt_get_size(opts, "maxmem", 0);
> +                    if (sz < ram_size) {
> +                        fprintf(stderr, "qemu: invalid -m option value: maxmem "
> +                                "(%" PRIu64 ") <= initial memory (%"
> +                                PRIu64 ")\n", sz, ram_size);
> +                        exit(1);
> +                    }
> +
> +                    slots = qemu_opt_get_number(opts, "slots", 0);
> +                    if ((sz > ram_size) && !slots) {
> +                        fprintf(stderr, "qemu: invalid -m option value: maxmem "
> +                                "(%" PRIu64 ") more than initial memory (%"
> +                                PRIu64 ") but no hotplug slots where "
> +                                "specified\n", sz, ram_size);
> +                        exit(1);
> +                    }
> +
> +                    if ((sz <= ram_size) && slots) {
> +                        fprintf(stderr, "qemu: invalid -m option value:  %"
> +                                PRIu64 " hotplug slots where specified but "
> +                                "maxmem (%" PRIu64 ") <= initial memory (%"
> +                                PRIu64 ")\n", slots, sz, ram_size);
> +                        exit(1);
> +                    }
> +                } else if ((!maxmem_str && slots_str) ||
> +                           (maxmem_str && !slots_str)) {
> +                    fprintf(stderr, "qemu: invalid -m option value: missing "
> +                            "'%s' option\n", slots_str ? "maxmem" : "slots");
> +                    exit(1);
> +                }
>                  break;
>              }
>  #ifdef CONFIG_TPM

  reply	other threads:[~2014-02-26 17:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-24 21:30 [Qemu-devel] [PATCH v2 0/5] s390: Support for Hotplug of Standby Memory Matthew Rosato
2014-02-24 21:30 ` [Qemu-devel] [PATCH v2 1/5] vl: convert -m to QemuOpts Matthew Rosato
2014-02-24 21:30 ` [Qemu-devel] [PATCH v2 2/5] vl.c: extend -m option to support options for memory hotplug Matthew Rosato
2014-02-26 15:39   ` Igor Mammedov [this message]
2014-02-24 21:30 ` [Qemu-devel] [PATCH v2 3/5] sclp-s390: Add device to manage s390 " Matthew Rosato
2014-02-24 21:30 ` [Qemu-devel] [PATCH v2 4/5] virtio-ccw: Include standby memory when calculating storage increment Matthew Rosato
2014-02-24 21:30 ` [Qemu-devel] [PATCH v2 5/5] sclp-s390: Add memory hotplug SCLPs Matthew Rosato
2014-02-26 14:42 ` [Qemu-devel] [PATCH v2 0/5] s390: Support for Hotplug of Standby Memory Christian Borntraeger
2014-02-26 14:45   ` Paolo Bonzini
2014-02-26 14:55     ` Christian Borntraeger
2014-03-10 14:39 ` Matthew Rosato
2014-03-19 12:50   ` Matthew Rosato

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=20140226163954.57a7a4f1@nial.usersys.redhat.com \
    --to=imammedo@redhat.com \
    --cc=agraf@suse.de \
    --cc=aliguori@amazon.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=gleb@redhat.com \
    --cc=mjrosato@linux.vnet.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=stefanha@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).