qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] [query-memory-size-summary] Report page size


From: Markus Armbruster
Subject: Re: [PATCH] [query-memory-size-summary] Report page size
Date: Thu, 25 May 2023 16:55:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)

Andrei Gudkov <gudkov.andrei@huawei.com> writes:

> Some commands (query-migrate and calc-dirty-rate) report values
> in units of pages. However, currently the only place where we can
> get page size is through query-migrate and only after migration
> has started. query-memory-size-summary seems like an appropritate
> place where it should be reported instead.
>
> Signed-off-by: Andrei Gudkov <gudkov.andrei@huawei.com>
> ---
>  qapi/machine.json          | 8 ++++++--
>  hw/core/machine-qmp-cmds.c | 3 +++
>  2 files changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/qapi/machine.json b/qapi/machine.json
> index 37660d8f2a..10b2d686da 100644
> --- a/qapi/machine.json
> +++ b/qapi/machine.json
> @@ -1125,10 +1125,13 @@
   ##
   # @MemoryInfo:
   #
   # Actual memory information in bytes.
   #
   # @base-memory: size of "base" memory specified with command line
   #     option -m.
   #
   # @plugged-memory: size of memory that can be hot-unplugged.  This
>  #     field is omitted if target doesn't support memory hotplug (i.e.
>  #     CONFIG_MEM_DEVICE not defined at build time).
>  #
> +# @page-size: the number of bytes per target page (since 8.1)

Recommend "size of target page in bytes" for consistency with the other
two sizes.

Machines may have multiple page sizes.  Should we discuss that here?

> +#
>  # Since: 2.11
>  ##
>  { 'struct': 'MemoryInfo',
> -  'data'  : { 'base-memory': 'size', '*plugged-memory': 'size' } }
> +  'data'  : { 'base-memory': 'size', '*plugged-memory': 'size',
> +              'page-size': 'size' } }
>  
>  ##
>  # @query-memory-size-summary:
> @@ -1139,7 +1142,8 @@
>  # Example:
>  #
>  # -> { "execute": "query-memory-size-summary" }
> -# <- { "return": { "base-memory": 4294967296, "plugged-memory": 0 } }
> +# <- { "return": { "page-size": 4096, "base-memory": 34359738368,
> +#      "plugged-memory": 0 } }
>  #
>  # Since: 2.11
>  ##
> diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
> index 3860a50c3b..b768ff372f 100644
> --- a/hw/core/machine-qmp-cmds.c
> +++ b/hw/core/machine-qmp-cmds.c
> @@ -27,6 +27,7 @@
>  #include "sysemu/numa.h"
>  #include "sysemu/runstate.h"
>  #include "sysemu/sysemu.h"
> +#include "exec/target_page.h"
>  
>  /*
>   * fast means: we NEVER interrupt vCPU threads to retrieve
> @@ -289,6 +290,8 @@ MemoryInfo *qmp_query_memory_size_summary(Error **errp)
>      mem_info->has_plugged_memory =
>          mem_info->plugged_memory != (uint64_t)-1;
>  
> +    mem_info->page_size = qemu_target_page_size();
> +
>      return mem_info;
>  }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]