All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Cc: andre.przywara@amd.com, aliguori@us.ibm.com, ehabkost@redhat.com,
	qemu-devel@nongnu.org, y-goto@jp.fujitsu.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH 6/7] NUMA: add hmp command set-mpol
Date: Tue, 18 Jun 2013 11:23:38 +0200	[thread overview]
Message-ID: <51C0271A.8030900@redhat.com> (raw)
In-Reply-To: <1371542991-15911-7-git-send-email-gaowanlong@cn.fujitsu.com>

Il 18/06/2013 10:09, Wanlong Gao ha scritto:
> 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 membind 0-1

I suggest something similar to what chardev-add does: Just make it
"set-mpol <nodeid> <qemuopts>", for example

 (qemu) set-mpol 0 mem-policy=membind,mem-hostnode=0-1

Similar to the command-line syntax.

Paolo

> Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
> ---
>  hmp-commands.hx | 16 ++++++++++++++++
>  hmp.c           | 22 ++++++++++++++++++++++
>  hmp.h           |  1 +
>  3 files changed, 39 insertions(+)
> 
> diff --git a/hmp-commands.hx b/hmp-commands.hx
> index 915b0d1..fd3505e 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,mpol:s?,nodemask:s?",
> +        .params     = "nodeid [mpol] [nodemask]",
> +        .help       = "set host memory policy for a guest NUMA node",
> +        .mhandler.cmd = hmp_set_mpol,
> +    },
> +
> +STEXI
> +@item set-mpol @var{nodeid} @var{mpol} @var{nodemask}
> +@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 494a9aa..2e5315e 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -1464,3 +1464,25 @@ 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_nodemask = true;
> +
> +    uint64_t nodeid = qdict_get_int(qdict, "nodeid");
> +    const char *mpol = qdict_get_try_str(qdict, "mpol");
> +    const char *nodemask = qdict_get_try_str(qdict, "nodemask");
> +
> +    if (mpol == NULL) {
> +        has_mpol = false;
> +    }
> +
> +    if (nodemask == NULL) {
> +        has_nodemask = false;
> +    }
> +
> +    qmp_set_mpol(nodeid, has_mpol, mpol, has_nodemask, nodemask, &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-06-18  9:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18  8:09 [Qemu-devel] [PATCH 0/7] Add support for binding guest numa nodes to host numa nodes Wanlong Gao
2013-06-18  8:09 ` [Qemu-devel] [PATCH 1/7] Add numa_info structure to contain numa nodes info Wanlong Gao
2013-06-18  8:09 ` [Qemu-devel] [PATCH 2/7] Add Linux libnuma detection Wanlong Gao
2013-06-18  8:09 ` [Qemu-devel] [PATCH 3/7] NUMA: parse guest numa nodes memory policy Wanlong Gao
2013-06-18  9:20   ` Paolo Bonzini
2013-06-18  9:54     ` Wanlong Gao
2013-06-18 19:00     ` Eduardo Habkost
2013-06-18 20:19       ` Bandan Das
2013-06-19  8:01         ` Wanlong Gao
2013-06-19 17:39           ` Paolo Bonzini
2013-06-20  0:01             ` Wanlong Gao
2013-06-18  8:09 ` [Qemu-devel] [PATCH 4/7] NUMA: set " Wanlong Gao
2013-06-18  8:09 ` [Qemu-devel] [PATCH 5/7] NUMA: add qmp command set-mpol to set memory policy for NUMA node Wanlong Gao
2013-06-18  9:21   ` Paolo Bonzini
2013-06-18  9:44     ` Wanlong Gao
2013-06-18  9:57       ` Paolo Bonzini
2013-06-18  8:09 ` [Qemu-devel] [PATCH 6/7] NUMA: add hmp command set-mpol Wanlong Gao
2013-06-18  9:23   ` Paolo Bonzini [this message]
2013-06-18  9:49     ` Wanlong Gao
2013-06-18  8:09 ` [Qemu-devel] [PATCH 7/7] NUMA: show host memory policy info in info numa command Wanlong Gao

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=51C0271A.8030900@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=andre.przywara@amd.com \
    --cc=ehabkost@redhat.com \
    --cc=gaowanlong@cn.fujitsu.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.