[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3.1 00/31] NUMA series, and hostmem improvement
From: |
Hu Tao |
Subject: |
Re: [Qemu-devel] [PATCH v3.1 00/31] NUMA series, and hostmem improvements |
Date: |
Fri, 9 May 2014 16:29:49 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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.
> + */
> + if (find_first_bit(backend->host_nodes, MAX_NODES) != MAX_NODES &&
> + policy == MPOL_DEFAULT) {
> + policy = MPOL_BIND;
> + }
This only changes the policy applied to memory. But info memdev still
shows the policy as 'default'(the 'default' here is interpreted as
'MPOL_DEFAULT', right?).
So this is related to how we deal with cases where 'policy' is not
specified in qemu:
1. if possible, the policy is set to MPOL_DEFAULT.
2. if host-nodes is not zero, the policy is set to MPOL_BIND.(set
backend->policy too, other than just apply it)
Opinions?
>
> /* This is a workaround for a long standing bug in Linux'
> * mbind implementation, which cuts off the last specified
> * node.
> */
> - if (mbind(ptr, sz, backend->policy, backend->host_nodes, maxnode + 2,
> 0)) {
> + if (mbind(ptr, sz, policy, backend->host_nodes, maxnode + 2, 0)) {
> error_setg_errno(errp, errno,
> "cannot bind memory to host NUMA nodes");
- [Qemu-devel] [PATCH v3.1 31/31] hmp: add info memdev, (continued)
- [Qemu-devel] [PATCH v3.1 31/31] hmp: add info memdev, Hu Tao, 2014/05/06
- [Qemu-devel] [PATCH v3.1 22/31] hostmem: allow preallocation of any memory region, Hu Tao, 2014/05/06
- [Qemu-devel] [PATCH v3.1 29/31] qom: introduce object_property_get_enum and object_property_get_uint16List, Hu Tao, 2014/05/06
- [Qemu-devel] [PATCH v3.1 27/31] qapi: make string input visitor parse int list, Hu Tao, 2014/05/06
- [Qemu-devel] [PATCH v3.1 26/31] Introduce signed range., Hu Tao, 2014/05/06
- [Qemu-devel] [PATCH v3.1 23/31] hostmem: add property to map memory with MAP_SHARED, Hu Tao, 2014/05/06
- [Qemu-devel] [PATCH v3.1 30/31] qmp: add query-memdev, Hu Tao, 2014/05/06
- [Qemu-devel] [PATCH v3.1 28/31] qapi: make string output visitor parse int list, Hu Tao, 2014/05/06
- Re: [Qemu-devel] [PATCH v3.1 00/31] NUMA series, and hostmem improvements, Paolo Bonzini, 2014/05/08
[Qemu-devel] [PATCH] preallocate memory after NUMA policy configuration, Marcelo Tosatti, 2014/05/09