From: Paolo Bonzini <pbonzini@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>, Hu Tao <hutao@cn.fujitsu.com>
Cc: Igor Mammedov <imammedo@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v3.1 00/31] NUMA series, and hostmem improvements
Date: Fri, 09 May 2014 23:13:50 +0200 [thread overview]
Message-ID: <536D450E.80103@redhat.com> (raw)
In-Reply-To: <20140509175415.GA9730@otherpad.lan.raisama.net>
Il 09/05/2014 19:54, Eduardo Habkost ha scritto:
> On Fri, May 09, 2014 at 04:29:49PM +0800, Hu Tao wrote:
>> On Thu, May 08, 2014 at 04:51:56PM +0200, Paolo Bonzini wrote:
>>> Il 06/05/2014 11:27, Hu Tao ha scritto:
>>>> This series includes work on QOMifying the memory backends.
>>>> the idea is to delegate all properties of the memory backend to
>>>> a new QOM class hierarchy, in which the concrete classes
>>>> are hostmem-ram and hostmem-file. The backend is passed to the
>>>> machine via "-numa node,memdev=foo" where "foo" is the id of the
>>>> backend object.
>>>
>>> Hello,
>>>
>>> I noticed now that if you have the host-nodes property set Linux
>>> requires you to set a policy other than "default" too. If you don't,
>>> the mbind system call fails.
>>>
>>> What about squashing something like this?
>>>
>>> Paolo
>>>
>>> diff --git a/backends/hostmem.c b/backends/hostmem.c
>>> index d3f8476..a0a3111 100644
>>> --- a/backends/hostmem.c
>>> +++ b/backends/hostmem.c
>>> @@ -299,12 +299,23 @@ host_memory_backend_memory_init(UserCreatable *uc, Error **errp)
>>>
>>> #ifdef CONFIG_NUMA
>>> unsigned long maxnode = find_last_bit(backend->host_nodes, MAX_NODES);
>>> + unsigned policy = backend->policy;
>>> +
>>> + /* Linux does not accept MPOL_DEFAULT with nonzero bitmap, but
>>> + * "-object memory-ram,size=128M,hostnodes=0,policy=bind" is a
>>> + * bit of a mouthful. So if the host_nodes bitmap is nonzero,
>>> + * pick the BIND policy.
>
> Are we sure MPOL_BIND is a better default than MPOL_INTERLEAVE or
> MPOL_PREFERRED?
Better than MPOL_PREFERRED, yes. Better than MPOL_INTERLEAVE, I am not
sure.
> * If policy=default is set, it is always going to be MPOL_DEFAULT.
> * If policy=bind is set, it is always going to be MPOL_BIND.
> * if policy=preferred is set, it is always going to be MPOL_PREFERRED.
> * If policy is omitted, it will be be MPOL_DEFAULT is host-nodes is
> unset, and MPOL_BIND if host_nodes is set.
That's possible. Or we can just detect the case in
host_memory_backend_memory_init and provide a better error message than
just "Invalid argument" (aka EINVAL). We're always free to take an
error situation and make it non-error in the future, but the reverse
would be hard to do.
Paolo
next prev parent reply other threads:[~2014-05-09 21:13 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-06 9:27 [Qemu-devel] [PATCH v3.1 00/31] NUMA series, and hostmem improvements Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 01/31] NUMA: move numa related code to new file numa.c Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 02/31] NUMA: check if the total numa memory size is equal to ram_size Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 03/31] NUMA: Add numa_info structure to contain numa nodes info Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 04/31] NUMA: convert -numa option to use OptsVisitor Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 05/31] NUMA: expand MAX_NODES from 64 to 128 Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 06/31] man: improve -numa doc Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 07/31] vl: redo -object parsing Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 08/31] qmp: allow object-add completion handler to get canonical path Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 09/31] qmp: improve error reporting for -object and object-add Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 10/31] pc: pass QEMUMachineInitArgs to pc_memory_init Hu Tao
2014-05-07 14:50 ` Michael S. Tsirkin
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 11/31] numa: introduce memory_region_allocate_system_memory Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 12/31] add memdev backend infrastructure Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 13/31] numa: add -numa node, memdev= option Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 14/31] memory: reorganize file-based allocation Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 15/31] memory: move mem_path handling to memory_region_allocate_system_memory Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 16/31] memory: add error propagation to file-based RAM allocation Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 17/31] memory: move preallocation code out of exec.c Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 18/31] memory: move RAM_PREALLOC_MASK to exec.c, rename Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 19/31] hostmem: add file-based HostMemoryBackend Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 20/31] hostmem: separate allocation from UserCreatable complete method Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 21/31] hostmem: add merge and dump properties Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 22/31] hostmem: allow preallocation of any memory region Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 23/31] hostmem: add property to map memory with MAP_SHARED Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 24/31] configure: add Linux libnuma detection Hu Tao
2014-05-07 14:57 ` Michael S. Tsirkin
2014-05-08 8:34 ` Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 25/31] hostmem: add properties for NUMA memory policy Hu Tao
2014-05-19 23:34 ` Eduardo Habkost
2014-06-06 3:37 ` Hu Tao
2014-06-06 16:15 ` Eduardo Habkost
2014-06-09 2:12 ` Hu Tao
2014-06-10 18:44 ` [Qemu-devel] MPOL_MF_STRICT & hugetlbfs (was Re: [PATCH v3.1 25/31] hostmem: add properties for NUMAS memory policy) Eduardo Habkost
2014-05-19 23:45 ` [Qemu-devel] [PATCH v3.1 25/31] hostmem: add properties for NUMA memory policy Eduardo Habkost
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 26/31] Introduce signed range Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 27/31] qapi: make string input visitor parse int list Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 28/31] qapi: make string output " Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 29/31] qom: introduce object_property_get_enum and object_property_get_uint16List Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 30/31] qmp: add query-memdev Hu Tao
2014-05-06 9:27 ` [Qemu-devel] [PATCH v3.1 31/31] hmp: add info memdev Hu Tao
2014-05-08 14:51 ` [Qemu-devel] [PATCH v3.1 00/31] NUMA series, and hostmem improvements Paolo Bonzini
2014-05-09 2:57 ` Hu Tao
2014-05-09 8:29 ` Hu Tao
2014-05-09 17:54 ` Eduardo Habkost
2014-05-09 21:13 ` Paolo Bonzini [this message]
2014-05-13 2:28 ` Hu Tao
2014-05-13 2:12 ` Hu Tao
2014-05-09 6:24 ` [Qemu-devel] [PATCH] preallocate memory after NUMA policy configuration Marcelo Tosatti
2014-05-09 6:42 ` 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=536D450E.80103@redhat.com \
--to=pbonzini@redhat.com \
--cc=ehabkost@redhat.com \
--cc=hutao@cn.fujitsu.com \
--cc=imammedo@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).