[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC 0/4] fixes for pci tree
From: |
Hu Tao |
Subject: |
Re: [Qemu-devel] [PATCH RFC 0/4] fixes for pci tree |
Date: |
Mon, 16 Jun 2014 14:29:08 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
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.
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?
> 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
- Re: [Qemu-devel] [PATCH RFC 1/4] get rid of signed range, (continued)
- [Qemu-devel] [PATCH RFC 2/4] check if we have space left for hotplugged memory, Hu Tao, 2014/06/14
- Re: [Qemu-devel] [PATCH RFC 2/4] check if we have space left for hotplugged memory, Michael S. Tsirkin, 2014/06/15
- [Qemu-devel] [PATCH RFC 4/4] memory-backend-file: error out if failed to allocate memory, Hu Tao, 2014/06/14
- Re: [Qemu-devel] [PATCH RFC 4/4] memory-backend-file: error out if failed to allocate memory, Paolo Bonzini, 2014/06/14
- Re: [Qemu-devel] [PATCH RFC 4/4] memory-backend-file: error out if failed to allocate memory, Hu Tao, 2014/06/16
- Re: [Qemu-devel] [PATCH RFC 0/4] fixes for pci tree, Michael S. Tsirkin, 2014/06/15
- Re: [Qemu-devel] [PATCH RFC 0/4] fixes for pci tree,
Hu Tao <=
- Re: [Qemu-devel] [PATCH RFC 0/4] fixes for pci tree, Michael S. Tsirkin, 2014/06/16
- Re: [Qemu-devel] [PATCH RFC 0/4] fixes for pci tree, Hu Tao, 2014/06/16