qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Marcel Apfelbaum" <mapfelba@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Igor Kotrasinski" <i.kotrasinsk@partner.samsung.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org, "Peter Xu" <peterx@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"Greg Kurz" <groug@kaod.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Murilo Opsfelder Araujo" <muriloo@linux.ibm.com>,
	"Igor Mammedov" <imammedo@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: [PATCH v4 13/14] qmp: Include "reserve" property of memory backends
Date: Fri, 19 Mar 2021 16:49:01 +0100	[thread overview]
Message-ID: <84f961a5-6292-8364-9491-f8330b401a65@redhat.com> (raw)
In-Reply-To: <87ft0ri23r.fsf@dusky.pond.sub.org>

On 19.03.21 16:40, Markus Armbruster wrote:
> David Hildenbrand <david@redhat.com> writes:
> 
>> Let's include the new property.
>>
>> Cc: Eric Blake <eblake@redhat.com>
>> Cc: Markus Armbruster <armbru@redhat.com>
>> Signed-off-by: David Hildenbrand <david@redhat.com>
>> ---
>>   hw/core/machine-qmp-cmds.c | 1 +
>>   qapi/machine.json          | 6 ++++++
>>   2 files changed, 7 insertions(+)
>>
>> diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
>> index 68a942595a..bd2a7f2dd0 100644
>> --- a/hw/core/machine-qmp-cmds.c
>> +++ b/hw/core/machine-qmp-cmds.c
>> @@ -174,6 +174,7 @@ static int query_memdev(Object *obj, void *opaque)
>>           m->merge = object_property_get_bool(obj, "merge", &error_abort);
>>           m->dump = object_property_get_bool(obj, "dump", &error_abort);
>>           m->prealloc = object_property_get_bool(obj, "prealloc", &error_abort);
>> +        m->reserve = object_property_get_bool(obj, "reserve", &error_abort);
>>           m->policy = object_property_get_enum(obj, "policy", "HostMemPolicy",
>>                                                &error_abort);
>>           host_nodes = object_property_get_qobject(obj,
>> diff --git a/qapi/machine.json b/qapi/machine.json
>> index c0c52aef10..12860a1f79 100644
>> --- a/qapi/machine.json
>> +++ b/qapi/machine.json
>> @@ -814,6 +814,11 @@
>>   #
>>   # @prealloc: enables or disables memory preallocation
>>   #
>> +# @reserve: enables or disables reservation of swap space (or huge pages
>> +#           if applicable). If reservation is enabled (default), actual
>> +#           reservation depends on underlying OS support. In contrast,
>> +#           disabling reservation without OS support will bail out. (since 6.1)
>> +#
> 
> Provides two settings: "enable reservation if possible", and "disable
> reservation or else fail".
> 
> Does "enable reservation or else fail" make no sense, or is it merely
> unimplemented?

The default for now used to be "enable reservation if possible". For 
example, Windows always reserves/commits the whole region. Under Linux, 
reservation is always done for private memory mappings, however, 
especially for basically all (with one exception) shared memory there is 
no reservation of any kind (with another exception).

For example, it does not make sense to reserve swap space for a 
file-backed mapping; we can just writeback to the file in case we run 
out of memory. Therefore, Linux will never reserve swap space in that case.

So if we were to implement a "enable reservation or else fail", the 
default ("true") would no longer work for existing setups.

Usually we want "enable reservation if possible" unless in spacial cases 
("definitely avoid the reservation")

-- 
Thanks,

David / dhildenb



  reply	other threads:[~2021-03-19 15:50 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-19 10:12 [PATCH v4 00/14] RAM_NORESERVE, MAP_NORESERVE and hostmem "reserve" property David Hildenbrand
2021-03-19 10:12 ` [PATCH v4 01/14] softmmu/physmem: Mark shared anonymous memory RAM_SHARED David Hildenbrand
2021-03-19 10:12 ` [PATCH v4 02/14] softmmu/physmem: Fix ram_block_discard_range() to handle shared anonymous memory David Hildenbrand
2021-03-19 10:12 ` [PATCH v4 03/14] softmmu/physmem: Fix qemu_ram_remap() " David Hildenbrand
2021-03-23 20:40   ` Peter Xu
2021-03-19 10:12 ` [PATCH v4 04/14] util/mmap-alloc: Factor out calculation of the pagesize for the guard page David Hildenbrand
2021-03-19 10:12 ` [PATCH v4 05/14] util/mmap-alloc: Factor out reserving of a memory region to mmap_reserve() David Hildenbrand
2021-03-19 10:12 ` [PATCH v4 06/14] util/mmap-alloc: Factor out activating of memory to mmap_activate() David Hildenbrand
2021-03-19 10:12 ` [PATCH v4 07/14] softmmu/memory: Pass ram_flags to qemu_ram_alloc_from_fd() David Hildenbrand
2021-03-19 10:12 ` [PATCH v4 08/14] softmmu/memory: Pass ram_flags to memory_region_init_ram_shared_nomigrate() David Hildenbrand
2021-03-19 10:12 ` [PATCH v4 09/14] util/mmap-alloc: Pass flags instead of separate bools to qemu_ram_mmap() David Hildenbrand
2021-03-23 20:49   ` Peter Xu
2021-03-25  9:40     ` David Hildenbrand
2021-03-19 10:12 ` [PATCH v4 10/14] memory: Introduce RAM_NORESERVE and wire it up in qemu_ram_mmap() David Hildenbrand
2021-03-23 20:51   ` Peter Xu
2021-03-19 10:12 ` [PATCH v4 11/14] util/mmap-alloc: Support RAM_NORESERVE via MAP_NORESERVE under Linux David Hildenbrand
2021-03-23 20:56   ` Peter Xu
2021-03-19 10:12 ` [PATCH v4 12/14] hostmem: Wire up RAM_NORESERVE via "reserve" property David Hildenbrand
2021-03-19 10:12 ` [PATCH v4 13/14] qmp: Include "reserve" property of memory backends David Hildenbrand
2021-03-19 15:40   ` Markus Armbruster
2021-03-19 15:49     ` David Hildenbrand [this message]
2021-03-19 16:32       ` Markus Armbruster
2021-03-19 16:40         ` David Hildenbrand
2021-03-19 10:12 ` [PATCH v4 14/14] hmp: Print "reserve" property of memory backends with "info memdev" David Hildenbrand
2021-03-25 19:00   ` Dr. David Alan Gilbert

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=84f961a5-6292-8364-9491-f8330b401a65@redhat.com \
    --to=david@redhat.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=groug@kaod.org \
    --cc=i.kotrasinsk@partner.samsung.com \
    --cc=imammedo@redhat.com \
    --cc=mapfelba@redhat.com \
    --cc=mst@redhat.com \
    --cc=muriloo@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --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).