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>,
	Igor Mammedov <imammedo@redhat.com>,
	qemu-devel@nongnu.org, Yasunori Goto <y-goto@jp.fujitsu.com>
Subject: Re: [Qemu-devel] [PATCH RFC 0/4] fixes for pci tree
Date: Mon, 16 Jun 2014 10:04:21 +0300	[thread overview]
Message-ID: <20140616070421.GA20496@redhat.com> (raw)
In-Reply-To: <20140616062907.GA29736@G08FNSTD100614.fnst.cn.fujitsu.com>

On Mon, Jun 16, 2014 at 02:29:08PM +0800, Hu Tao wrote:
> On Sun, Jun 15, 2014 at 01:00:56PM +0300, Michael S. Tsirkin wrote:
> > On Sat, Jun 14, 2014 at 12:48:55PM +0800, Hu Tao wrote:
> > > Michael,
> > > 
> > > This is fixes for your pci tree.
> > > 
> > > patch 1 remove signed range as requested.
> > 
> > This also fixes make check failures so I applied this.
> > 
> > Others don't look like regressions to me -
> > this is error handling in new functionality, correct?
> 
> Yes.
> 
> 
> BTW, thre are two more problems:
> 
> 1. if numa node number doesn't start from 0 then qemu will core dump.
> 
> cmd line:
> 
> ./x86_64-softmmu/qemu-system-x86_64 -hda
> /home/data/libvirt-images/f18.img  -m 128M,maxmem=2G,slots=3 -qmp
> unix:/tmp/m,server,nowait -monitor stdio -enable-kvm -object
> memory-backend-ram,id=m1,size=128M -numa node,nodeid=1,cpus=1,memdev=m1
> 
> This problem can be fixed by:
> 
> diff --git a/numa.c b/numa.c
> index ce9382d..b00c5cf 100644
> --- a/numa.c
> +++ b/numa.c
> @@ -270,10 +270,13 @@ void memory_region_allocate_system_memory(MemoryRegion *mr, Obj
>      }
>  
>      memory_region_init(mr, owner, name, ram_size);
> -    for (i = 0; i < nb_numa_nodes; i++) {
> +    for (i = 0; i < MAX_NODES; i++) {
>          Error *local_err = NULL;
>          uint64_t size = numa_info[i].node_mem;
>          HostMemoryBackend *backend = numa_info[i].node_memdev;
> +        if (!backend) {
> +            continue;
> +        }
>          MemoryRegion *seg = host_memory_backend_get_memory(backend, &local_err);
>          if (local_err) {
>              qerror_report_err(local_err);
> 
> 2. your current pci tree doesn't compile because patch 'qmp: add query-memdev' is dropped
> while commit 5b517e74ed7825(hmp: add info memdev) depends on it. 

Hmm it builds for me.
Does it only build if some library is present?

> but patch 'qmp: add query-memdev' itself has a problem: if memory-backend-ram is on the command
> line but no numa, info memdev returns nothing:
> 
> ./x86_64-softmmu/qemu-system-x86_64 -hda /home/data/libvirt-images/f18.img  -m 128M,maxmem=2G,slots=3 -qmp unix:/tmp/m,server,nowait -monitor stdio -enable-kvm -object memory-backend-ram,id=m1,size=128M 
> QEMU 2.0.50 monitor - type 'help' for more information
> (qemu) info memdev
> (nothing returned)
> 
> even worse, if with -numa mem=size then qemu will core dump:
> 
> ./x86_64-softmmu/qemu-system-x86_64 -hda /home/data/libvirt-images/f18.img  -m 128M,maxmem=2G,slots=3 -qmp unix:/tmp/m,server,nowait -monitor stdio -enable-kvm -object memory-backend-ram,id=m1,size=128M -numa node,nodeid=0,cpus=0,mem=128M
> (qemu) info memdev
> Segmentation fault (core dumped)
> 
> this is because query_memdev searchs for memdev information in numa_info[].node_memdev,
> which don't have value if there is no numa or numa isn't used with memory-backend-ram.
> 
> the solution can be gather memdevs in a list. Or query at /objects?

query QOM seems nicer.

> > Thus I'll wait for comments on these to be resolved,
> > and hopefully for some acks.
> > 
> > > There are 3 problems in current pci tree, as follows:
> > > 
> > > 1. pc-dimm specified on command line but only -m size (aka not -m size,maxmem,slots)
> > > 
> > > ./x86_64-softmmu/qemu-system-x86_64 -hda
> > > /home/data/libvirt-images/f18.img -smp 2 -object
> > > memory-backend-ram,size=512M,id=ram-node0,prealloc=y,policy=bind,host-nodes=0
> > > -device pc-dimm,id=d0,memdev=ram-node0  -m 640M  -qmp
> > > unix:/tmp/m,server,nowait -monitor stdio -enable-kvm
> > > 
> > > result:
> > > 
> > > qemu/hw/mem/pc-dimm.c:110: pc_dimm_get_free_addr: Assertion
> > > `address_space_end > address_space_size' failed.
> > > Aborted (core dumped)
> > > 
> > > patch 2 fixes this.
> > > 
> > > 2. using qemu monitor command object-add to add a memory-backend-ram
> > >    object whose's size is too big
> > > 
> > > ./x86_64-softmmu/qemu-system-x86_64 -hda
> > > /home/data/libvirt-images/f18.img -smp 2 -m 512M  -qmp
> > > unix:/tmp/m,server,nowait -monitor stdio -enable-kvm
> > > 
> > > in monitor:
> > > (qemu)object_add memory-backend-ram,size=40960G,id=mem0
> > > 
> > > result:
> > > 
> > > qemu just exits with message: Cannot set up guest memory 'mem0': Cannot allocate memory
> > > 
> > > patch 3 fixes this.
> > > 
> > > 3. specifying a non-existing directory for memory-backend-file
> > > 
> > > ./x86_64-softmmu/qemu-system-x86_64 -hda
> > > /home/data/libvirt-images/f18.img -smp 2 -m 512M,maxmem=1000G,slots=100
> > > -qmp unix:/tmp/m,server,nowait -monitor stdio -enable-kvm -object
> > > memory-backend-file,size=512M,id=mem0,mem-path=/nonexistingdir -device
> > > pc-dimm,id=d0,memdev=mem0
> > > 
> > > result:
> > > 
> > > /nonexistingdir: No such file or directory
> > > Bad ram offset fffffffffffff000
> > > Aborted (core dumped)
> > >  
> > > patch 4 fixes this.
> > > 
> > > 
> > > please review. Thanks!
> > > 
> > > 
> > > Hu Tao (4):
> > >   get rid of signed range
> > >   check if we have space left for hotplugged memory
> > >   exec: don't exit unconditionally if failed to allocate memory
> > >   memory-backend-file: error out if failed to allocate memory
> > > 
> > >  backends/hostmem-file.c            |   3 +
> > >  backends/hostmem-ram.c             |   3 +
> > >  exec.c                             |   6 +-
> > >  hw/mem/pc-dimm.c                   |   7 +-
> > >  include/qemu/range.h               | 144 ++++++++++++-------------------------
> > >  qapi/string-input-visitor.c        | 116 +++++++++++++++++-------------
> > >  qapi/string-output-visitor.c       |  97 +++++++++++++------------
> > >  tests/test-string-input-visitor.c  |   4 +-
> > >  tests/test-string-output-visitor.c |   8 +--
> > >  9 files changed, 182 insertions(+), 206 deletions(-)
> > > 
> > > -- 
> > > 1.9.3

  reply	other threads:[~2014-06-16  7:04 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10 11:15 [Qemu-devel] [PATCH v5 00/16] NUMA series v5 Hu Tao
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 01/16] fixup! NUMA: check if the total numa memory size is equal to ram_size Hu Tao
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 02/16] vl: redo -object parsing Hu Tao
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 03/16] fixup! qmp: improve error reporting for -object and object-add Hu Tao
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 04/16] pc: pass MachineState to pc_memory_init Hu Tao
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 05/16] backend:hostmem: replace hostmemory with host_memory Hu Tao
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 06/16] hostmem: separate allocation from UserCreatable complete method Hu Tao
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 07/16] fixup! numa: add -numa node, memdev= option Hu Tao
2014-06-10 11:27   ` Michael S. Tsirkin
2014-06-10 11:30   ` Michael S. Tsirkin
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 08/16] hostmem: add file-based HostMemoryBackend Hu Tao
2014-06-11  8:03   ` Michael S. Tsirkin
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 09/16] hostmem: add merge and dump properties Hu Tao
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 10/16] hostmem: allow preallocation of any memory region Hu Tao
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 11/16] hostmem: add property to map memory with MAP_SHARED Hu Tao
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 12/16] hostmem: add properties for NUMA memory policy Hu Tao
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 13/16] tests: fix memory leak in test of string input visitor Hu Tao
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 14/16] qapi: make string input visitor parse int list Hu Tao
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 15/16] qapi: make string output " Hu Tao
2014-06-10 11:15 ` [Qemu-devel] [PATCH v5 16/16] qmp: add query-memdev Hu Tao
2014-06-12  7:41 ` [Qemu-devel] [PATCH v5 00/16] NUMA series v5 Michael S. Tsirkin
2014-06-12  7:53   ` Hu Tao
2014-06-13  8:03     ` Michael S. Tsirkin
2014-06-13  8:18       ` Paolo Bonzini
2014-06-13  8:46         ` Michael S. Tsirkin
2014-06-13  8:49         ` Hu Tao
2014-06-13  8:54           ` Michael S. Tsirkin
2014-06-14  4:48             ` [Qemu-devel] [PATCH RFC 0/4] fixes for pci tree Hu Tao
2014-06-14  4:48               ` [Qemu-devel] [PATCH RFC 1/4] get rid of signed range Hu Tao
2014-06-15  9:00                 ` Michael S. Tsirkin
2014-06-16  9:47                   ` Hu Tao
2014-06-16 15:06                 ` Michael S. Tsirkin
2014-06-14  4:48               ` [Qemu-devel] [PATCH RFC 2/4] check if we have space left for hotplugged memory Hu Tao
2014-06-15  8:53                 ` Michael S. Tsirkin
2014-06-16  9:47                   ` Hu Tao
2014-06-14  4:48               ` [Qemu-devel] [PATCH RFC 3/4] exec: don't exit unconditionally if failed to allocate memory Hu Tao
2014-06-14 17:07                 ` Paolo Bonzini
2014-06-15  9:58                   ` Michael S. Tsirkin
2014-06-16  9:54                     ` Hu Tao
2014-06-16 10:07                       ` Paolo Bonzini
2014-06-14  4:48               ` [Qemu-devel] [PATCH RFC 4/4] memory-backend-file: error out " Hu Tao
2014-06-14 17:09                 ` Paolo Bonzini
2014-06-16  6:30                   ` Hu Tao
2014-06-15 10:00               ` [Qemu-devel] [PATCH RFC 0/4] fixes for pci tree Michael S. Tsirkin
2014-06-16  6:29                 ` Hu Tao
2014-06-16  7:04                   ` Michael S. Tsirkin [this message]
2014-06-16  8:28                     ` 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=20140616070421.GA20496@redhat.com \
    --to=mst@redhat.com \
    --cc=hutao@cn.fujitsu.com \
    --cc=imammedo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=y-goto@jp.fujitsu.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).