All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Cc: aliguori@us.ibm.com, ehabkost@redhat.com, qemu-devel@nongnu.org,
	bsd@redhat.com, y-goto@jp.fujitsu.com, pbonzini@redhat.com,
	afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH V4 09/10] NUMA: add hmp command set-mpol
Date: Mon, 8 Jul 2013 14:32:05 -0400	[thread overview]
Message-ID: <20130708143205.23e30dcc@redhat.com> (raw)
In-Reply-To: <1372931597-28115-10-git-send-email-gaowanlong@cn.fujitsu.com>

On Thu, 4 Jul 2013 17:53:16 +0800
Wanlong Gao <gaowanlong@cn.fujitsu.com> wrote:

> Add hmp command set-mpol to set host memory policy for a guest
> NUMA node. Then we can also set node's memory policy using
> the monitor command like:
>     (qemu) set-mpol 0 mem-policy=membind,mem-hostnode=0-1
> 
> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> ---
>  hmp-commands.hx | 16 ++++++++++++++++
>  hmp.c           | 35 +++++++++++++++++++++++++++++++++++
>  hmp.h           |  1 +
>  3 files changed, 52 insertions(+)
> 
> diff --git a/hmp-commands.hx b/hmp-commands.hx
> index 915b0d1..417b69f 100644
> --- a/hmp-commands.hx
> +++ b/hmp-commands.hx
> @@ -1567,6 +1567,22 @@ Executes a qemu-io command on the given block device.
>  ETEXI
>  
>      {
> +        .name       = "set-mpol",
> +        .args_type  = "nodeid:i,args:s?",
> +        .params     = "nodeid [args]",
> +        .help       = "set host memory policy for a guest NUMA node",
> +        .mhandler.cmd = hmp_set_mpol,
> +    },
> +
> +STEXI
> +@item set-mpol @var{nodeid} @var{args}
> +@findex set-mpol
> +
> +Set host memory policy for a guest NUMA node
> +
> +ETEXI
> +
> +    {
>          .name       = "info",
>          .args_type  = "item:s?",
>          .params     = "[subcommand]",
> diff --git a/hmp.c b/hmp.c
> index 2daed43..57a5730 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -1482,3 +1482,38 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)
>  
>      hmp_handle_error(mon, &err);
>  }
> +
> +void hmp_set_mpol(Monitor *mon, const QDict *qdict)
> +{
> +    Error *local_err = NULL;
> +    bool has_mpol = true;
> +    bool has_hostnode = true;
> +    const char *mpol = NULL;
> +    const char *hostnode = NULL;
> +    QemuOpts *opts;
> +
> +    uint64_t nodeid = qdict_get_int(qdict, "nodeid");
> +    const char *args = qdict_get_try_str(qdict, "args");
> +
> +    if (args == NULL) {
> +        has_mpol = false;
> +        has_hostnode = false;
> +    } else {
> +        opts = qemu_opts_parse(qemu_find_opts("numa"), args, 1);
> +        if (opts == NULL) {
> +            error_setg(&local_err, "Parsing memory policy args failed");

You're still going to call qmp_set_mpol() if this fails. You can replace
error_setg() to a monitor_printf() call and return.

> +        } else {
> +            mpol = qemu_opt_get(opts, "mem-policy");
> +            if (mpol == NULL) {
> +                has_mpol = false;
> +            }
> +            hostnode = qemu_opt_get(opts, "mem-hostnode");
> +            if (hostnode == NULL) {
> +                has_hostnode = false;
> +            }
> +        }
> +    }
> +
> +    qmp_set_mpol(nodeid, has_mpol, mpol, has_hostnode, hostnode, &local_err);
> +    hmp_handle_error(mon, &local_err);
> +}
> diff --git a/hmp.h b/hmp.h
> index 56d2e92..81f631b 100644
> --- a/hmp.h
> +++ b/hmp.h
> @@ -86,5 +86,6 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict);
>  void hmp_chardev_add(Monitor *mon, const QDict *qdict);
>  void hmp_chardev_remove(Monitor *mon, const QDict *qdict);
>  void hmp_qemu_io(Monitor *mon, const QDict *qdict);
> +void hmp_set_mpol(Monitor *mon, const QDict *qdict);
>  
>  #endif

  reply	other threads:[~2013-07-08 18:39 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-04  9:53 [Qemu-devel] [PATCH V4 00/10] Add support for binding guest numa nodes to host numa nodes Wanlong Gao
2013-07-04  9:53 ` [Qemu-devel] [PATCH V4 01/10] NUMA: Support multiple CPU ranges on -numa option Wanlong Gao
2013-07-05 18:41   ` Eduardo Habkost
2013-07-08 19:02     ` Eric Blake
2013-07-08 19:25       ` Eduardo Habkost
2013-07-08 19:25       ` Anthony Liguori
2013-07-09  3:28         ` Wanlong Gao
2013-07-09  3:34           ` Eric Blake
2013-07-14 11:34       ` Paolo Bonzini
2013-07-15 21:33         ` Eric Blake
2013-07-16  6:24           ` Paolo Bonzini
2013-07-04  9:53 ` [Qemu-devel] [PATCH V4 02/10] NUMA: Add numa_info structure to contain numa nodes info Wanlong Gao
2013-07-05 19:32   ` Eduardo Habkost
2013-07-05 20:09     ` Andreas Färber
2013-07-04  9:53 ` [Qemu-devel] [PATCH V4 03/10] NUMA: Add Linux libnuma detection Wanlong Gao
2013-07-04  9:53 ` [Qemu-devel] [PATCH V4 04/10] NUMA: parse guest numa nodes memory policy Wanlong Gao
2013-07-04  9:53 ` [Qemu-devel] [PATCH V4 05/10] NUMA: handle Error in cpus, mpol and hostnode parser Wanlong Gao
2013-07-04  9:53 ` [Qemu-devel] [PATCH V4 06/10] NUMA: split out the common range parser Wanlong Gao
2013-07-04  9:53 ` [Qemu-devel] [PATCH V4 07/10] NUMA: set guest numa nodes memory policy Wanlong Gao
2013-07-04  9:53 ` [Qemu-devel] [PATCH V4 08/10] NUMA: add qmp command set-mpol to set memory policy for NUMA node Wanlong Gao
2013-07-08 18:25   ` Luiz Capitulino
2013-07-08 18:34     ` Luiz Capitulino
2013-07-08 18:50       ` Andreas Färber
2013-07-08 19:03         ` Luiz Capitulino
2013-07-15 11:18     ` Wanlong Gao
2013-07-08 19:16   ` Eric Blake
2013-07-04  9:53 ` [Qemu-devel] [PATCH V4 09/10] NUMA: add hmp command set-mpol Wanlong Gao
2013-07-08 18:32   ` Luiz Capitulino [this message]
2013-07-04  9:53 ` [Qemu-devel] [PATCH V4 10/10] NUMA: show host memory policy info in info numa command Wanlong Gao
2013-07-05 18:49   ` Eduardo Habkost
2013-07-08 18:36   ` Luiz Capitulino
2013-07-04 19:49 ` [Qemu-devel] [PATCH V4 00/10] Add support for binding guest numa nodes to host numa nodes Paolo Bonzini
2013-07-04 21:15   ` Laszlo Ersek
2013-07-05  0:55     ` Wanlong Gao
2013-07-05  0:54   ` Wanlong Gao
2013-07-05 19:18 ` Eduardo Habkost
2013-07-11 10:32 ` Peter Huang(Peng)
2013-07-11 13:10   ` Eduardo Habkost

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=20130708143205.23e30dcc@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=bsd@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=gaowanlong@cn.fujitsu.com \
    --cc=pbonzini@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.