qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Hu Tao <hutao@cn.fujitsu.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	qemu-devel@nongnu.org, Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3.2 31/31] hmp: add info memdev
Date: Sun, 8 Jun 2014 13:10:37 +0300	[thread overview]
Message-ID: <20140608101037.GE21677@redhat.com> (raw)
In-Reply-To: <5f64b90d8707869fa622c0c1b26106ae96895d82.1400049817.git.hutao@cn.fujitsu.com>

On Wed, May 14, 2014 at 05:43:35PM +0800, Hu Tao wrote:
> This is the hmp counterpart of qmp query-memdev.
> 
> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
> ---
>  hmp.c     | 36 ++++++++++++++++++++++++++++++++++++
>  hmp.h     |  1 +
>  monitor.c |  7 +++++++
>  3 files changed, 44 insertions(+)
> 
> diff --git a/hmp.c b/hmp.c
> index 5c4d612..1d5bf2d 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -22,6 +22,8 @@
>  #include "qemu/sockets.h"
>  #include "monitor/monitor.h"
>  #include "qapi/opts-visitor.h"
> +#include "qapi/string-output-visitor.h"
> +#include "qapi-visit.h"
>  #include "ui/console.h"
>  #include "block/qapi.h"
>  #include "qemu-io.h"
> @@ -1671,3 +1673,37 @@ void hmp_object_del(Monitor *mon, const QDict *qdict)
>      qmp_object_del(id, &err);
>      hmp_handle_error(mon, &err);
>  }
> +
> +void hmp_info_memdev(Monitor *mon, const QDict *qdict)
> +{
> +    Error *err = NULL;
> +    MemdevList *memdev_list = qmp_query_memdev(&err);
> +    MemdevList *m = memdev_list;
> +    StringOutputVisitor *ov;
> +    int i = 0;
> +
> +
> +    while (m) {
> +        ov = string_output_visitor_new(false);
> +        visit_type_uint16List(string_output_get_visitor(ov),
> +                              &m->value->host_nodes, NULL, NULL);
> +        monitor_printf(mon, "memory device %d\n", i);
> +        monitor_printf(mon, "  size: %ld\n", m->value->size);

Fails build on 32 bit:

hmp.c:1696:9: error: format ‘%ld’ expects argument of type ‘long int’,
but argument 3 has type ‘uint64_t’ [-Werror=format=]
         monitor_printf(mon, "  size: %ld\n", m->value->size);

this must use PRId64.

> +        monitor_printf(mon, "  merge: %s\n",
> +                       m->value->merge ? "true" : "false");
> +        monitor_printf(mon, "  dump: %s\n",
> +                       m->value->dump ? "true" : "false");
> +        monitor_printf(mon, "  prealloc: %s\n",
> +                       m->value->prealloc ? "true" : "false");
> +        monitor_printf(mon, "  policy: %s\n",
> +                       HostMemPolicy_lookup[m->value->policy]);
> +        monitor_printf(mon, "  host nodes: %s\n",
> +                       string_output_get_string(ov));
> +
> +        string_output_visitor_cleanup(ov);
> +        m = m->next;
> +        i++;
> +    }
> +
> +    monitor_printf(mon, "\n");
> +}
> diff --git a/hmp.h b/hmp.h
> index 20ef454..bc13aae 100644
> --- a/hmp.h
> +++ b/hmp.h
> @@ -97,5 +97,6 @@ void object_add_completion(ReadLineState *rs, int nb_args, const char *str);
>  void object_del_completion(ReadLineState *rs, int nb_args, const char *str);
>  void device_add_completion(ReadLineState *rs, int nb_args, const char *str);
>  void device_del_completion(ReadLineState *rs, int nb_args, const char *str);
> +void hmp_info_memdev(Monitor *mon, const QDict *qdict);
>  
>  #endif
> diff --git a/monitor.c b/monitor.c
> index 4a3d3dd..4c24696 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -2958,6 +2958,13 @@ static mon_cmd_t info_cmds[] = {
>          .mhandler.cmd = hmp_info_tpm,
>      },
>      {
> +        .name       = "memdev",
> +        .args_type  = "",
> +        .params     = "",
> +        .help       = "show the memory device",
> +        .mhandler.cmd = hmp_info_memdev,
> +    },
> +    {
>          .name       = NULL,
>      },
>  };
> -- 
> 1.8.5.2.229.g4448466
> 

  reply	other threads:[~2014-06-08 10:10 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14  9:43 [Qemu-devel] [PATCH v3.2 00/31] NUMA series, and hostmem improvements Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 01/31] NUMA: move numa related code to new file numa.c Hu Tao
2014-06-08 10:09   ` Michael S. Tsirkin
2014-06-09  2:22     ` Hu Tao
2014-06-09  6:26       ` Michael S. Tsirkin
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 02/31] NUMA: check if the total numa memory size is equal to ram_size Hu Tao
2014-06-08 10:09   ` Michael S. Tsirkin
2014-06-09  2:23     ` Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 03/31] NUMA: Add numa_info structure to contain numa nodes info Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 04/31] NUMA: convert -numa option to use OptsVisitor Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 05/31] NUMA: expand MAX_NODES from 64 to 128 Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 06/31] man: improve -numa doc Hu Tao
2014-05-14 20:11   ` Eduardo Habkost
2014-06-08 10:09   ` Michael S. Tsirkin
2014-06-09  2:23     ` Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 07/31] vl: redo -object parsing Hu Tao
2014-06-08  9:05   ` Michael S. Tsirkin
2014-06-09  2:13     ` Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 08/31] qmp: allow object-add completion handler to get canonical path Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 09/31] qmp: improve error reporting for -object and object-add Hu Tao
2014-05-14 20:13   ` Eduardo Habkost
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 10/31] pc: pass QEMUMachineInitArgs to pc_memory_init Hu Tao
2014-05-14 20:14   ` Eduardo Habkost
2014-06-08  9:40   ` Michael S. Tsirkin
2014-06-09  2:13     ` Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 11/31] numa: introduce memory_region_allocate_system_memory Hu Tao
2014-05-14 20:30   ` Eduardo Habkost
2014-06-09  2:24     ` Hu Tao
2014-06-08 10:10   ` Michael S. Tsirkin
2014-06-09  2:27     ` Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 12/31] add memdev backend infrastructure Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 13/31] numa: add -numa node, memdev= option Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 14/31] memory: reorganize file-based allocation Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 15/31] memory: move mem_path handling to memory_region_allocate_system_memory Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 16/31] memory: add error propagation to file-based RAM allocation Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 17/31] memory: move preallocation code out of exec.c Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 18/31] memory: move RAM_PREALLOC_MASK to exec.c, rename Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 19/31] hostmem: add file-based HostMemoryBackend Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 20/31] hostmem: separate allocation from UserCreatable complete method Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 21/31] hostmem: add merge and dump properties Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 22/31] hostmem: allow preallocation of any memory region Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 23/31] hostmem: add property to map memory with MAP_SHARED Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 24/31] configure: add Linux libnuma detection Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 25/31] hostmem: add properties for NUMA memory policy Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 26/31] Introduce signed range Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 27/31] qapi: make string input visitor parse int list Hu Tao
2014-06-08 10:11   ` Michael S. Tsirkin
2014-06-09  2:28     ` Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 28/31] qapi: make string output " Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 29/31] qom: introduce object_property_get_enum and object_property_get_uint16List Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 30/31] qmp: add query-memdev Hu Tao
2014-05-14  9:43 ` [Qemu-devel] [PATCH v3.2 31/31] hmp: add info memdev Hu Tao
2014-06-08 10:10   ` Michael S. Tsirkin [this message]
2014-06-09  2:28     ` Hu Tao
2014-06-08 10:11 ` [Qemu-devel] [PATCH v3.2 00/31] NUMA series, and hostmem improvements Michael S. Tsirkin
2014-06-09  2:30   ` Hu Tao

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=20140608101037.GE21677@redhat.com \
    --to=mst@redhat.com \
    --cc=hutao@cn.fujitsu.com \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).