[Qemu-devel] [PATCH 0/3] cpu: numa: Fix the mapping initialization of VCPUs and NUMA nodes

2017-01-18 Thread Dou Liyang
As we fixed a bug(Bug 1) in below links, Named "Method-A":

https://lists.nongnu.org/archive/html/qemu-devel/2017-01/msg03354.html

Then, Eduardo gave us many suggests. Thanks very much!
when we try them, we also find another bugs named "Bug 2".

[Problem]
-

As I use this command:

./x86_64-softmmu/qemu-system-x86_64 \
-hda /image/fedora.img \
-m 1G,slots=4,maxmem=4G \
-enable-kvm \
-smp 2,maxcpus=16,sockets=4,cores=2,threads=2 \
-device qemu64-x86_64-cpu,id=cpu1,socket-id=0,core-id=1,thread-id=0 \
-device qemu64-x86_64-cpu,id=cpu2,socket-id=0,core-id=1,thread-id=1 \
-device qemu64-x86_64-cpu,id=cpu3,socket-id=1,core-id=0,thread-id=0 \
-device qemu64-x86_64-cpu,id=cpu4,socket-id=1,core-id=0,thread-id=1 \
-device qemu64-x86_64-cpu,id=cpu5,socket-id=1,core-id=1,thread-id=0 \
-device qemu64-x86_64-cpu,id=cpu6,socket-id=1,core-id=1,thread-id=1 \
-numa node,nodeid=0,cpus=0-3 \
-numa node,nodeid=1,cpus=4-7 \
-numa node,nodeid=2,cpus=8-11 \
-numa node,nodeid=3,cpus=12-15 \
-monitor stdio \

1. Bug 1

In Qemu monitor:

(qemu) info numa 
4 nodes
node 0 cpus: 0 1 2 3 4 5 6 7
node 0 size: 256 MB
node 1 cpus:
node 1 size: 256 MB
node 2 cpus:
node 2 size: 256 MB
node 3 cpus:
node 3 size: 256 MB

2. Bug 2

(qemu) device_add qemu64-x86_64-cpu,id=cpu7,socket-id=2,core-id=0,thread-id=0

(qemu) info numa
4 nodes
node 0 cpus: 0 1 2 3 4 5 6 7 8
node 0 size: 256 MB
node 1 cpus:
node 1 size: 256 MB
node 2 cpus:
node 2 size: 256 MB
node 3 cpus:
node 3 size: 256 MB

[Method-A]
--

1. Method-A that we provided above: 
  * Ensure the numa_post_machine_init func in the appropriate location in
vl.c::main().

It can fix Bug 1, but, can't work for Bug 2.

1.1. For Bug 1: fixed

(qemu) info numa
4 nodes
node 0 cpus: 0 1 2 3
node 0 size: 256 MB
node 1 cpus: 4 5 6 7
node 1 size: 256 MB
node 2 cpus:
node 2 size: 256 MB
node 3 cpus:
node 3 size: 256 MB

1.2. For Bug 2: can not fixed

(qemu) device_add qemu64-x86_64-cpu,id=cpu7,socket-id=2,core-id=0,thread-id=0

(qemu) info numa
node 0 cpus: 0 1 2 3 8
node 0 size: 256 MB
node 1 cpus: 4 5 6 7
node 1 size: 256 MB
node 2 cpus:
node 2 size: 256 MB
node 3 cpus:
node 3 size: 256 MB

[Solution]
--

Move the CPUState::numa_node initialization to qom/cpu.c:cpu_common_realizefn(),
and remove numa_post_machine_init() completely.

It can fix Bug 1 and Bug 2. The result shows that:

(qemu) info numa
4 nodes
node 0 cpus: 0 1 2 3
node 0 size: 256 MB
node 1 cpus: 4 5 6 7
node 1 size: 256 MB
node 2 cpus:
node 2 size: 256 MB
node 3 cpus:
node 3 size: 256 MB

(qemu) device_add qemu64-x86_64-cpu,id=cpu7,socket-id=2,core-id=0,thread-id=0
(qemu) info numa
4 nodes
node 0 cpus: 0 1 2 3
node 0 size: 256 MB
node 1 cpus: 4 5 6 7
node 1 size: 256 MB
node 2 cpus: 8
node 2 size: 256 MB
node 3 cpus:
node 3 size: 256 MB

(qemu) device_add qemu64-x86_64-cpu,id=cpu8,socket-id=3,core-id=0,thread-id=0
(qemu) info numa
4 nodes
node 0 cpus: 0 1 2 3
node 0 size: 256 MB
node 1 cpus: 4 5 6 7
node 1 size: 256 MB
node 2 cpus: 8
node 2 size: 256 MB
node 3 cpus: 12
node 3 size: 256 MB

(qemu) device_del cpu5
(qemu) info numa
4 nodes
node 0 cpus: 0 1 2 3
node 0 size: 256 MB
node 1 cpus: 4 5 7
node 1 size: 256 MB
node 2 cpus: 8
node 2 size: 256 MB
node 3 cpus: 12
node 3 size: 256 MB

Dou Liyang (3):
  cpu: Make the mapping of CPUs and NUMA nodes in cpu_common_realizefn
  numa: Remove the numa_post_machine_init function
  cpu: make the function of cpu_common_map_numa_node more efficiently

 include/sysemu/numa.h |  1 -
 numa.c| 15 ---
 qom/cpu.c | 16 
 vl.c  |  2 --
 4 files changed, 16 insertions(+), 18 deletions(-)

-- 
2.5.5






Re: [Qemu-devel] [PATCH 0/3] cpu: numa: Fix the mapping initialization of VCPUs and NUMA nodes

2017-01-18 Thread no-reply
Hi,

Your series failed automatic build test. Please find the testing commands and
their output below. If you have docker installed, you can probably reproduce it
locally.

Message-id: 1484743207-10721-1-git-send-email-douly.f...@cn.fujitsu.com
Subject: [Qemu-devel] [PATCH 0/3] cpu: numa: Fix the mapping initialization of 
VCPUs and NUMA nodes
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
# Let docker tests dump environment info
export SHOW_ENV=1
export J=16
make docker-test-quick@centos6
make docker-test-mingw@fedora
make docker-test-build@min-glib
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
Switched to a new branch 'test'
fdce9a1 cpu: make the function of cpu_common_map_numa_node more efficiently
d79e94c numa: Remove the numa_post_machine_init function
8afaf15 cpu: Make the mapping of CPUs and NUMA nodes in cpu_common_realizefn

=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc'
Cloning into 'dtc'...
Submodule path 'dtc': checked out '65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf'
  BUILD   centos6
make[1]: Entering directory `/var/tmp/patchew-tester-tmp-3q9yfmbs/src'
  ARCHIVE qemu.tgz
  ARCHIVE dtc.tgz
  COPYRUNNER
RUN test-quick in qemu:centos6 
Packages installed:
SDL-devel-1.2.14-7.el6_7.1.x86_64
ccache-3.1.6-2.el6.x86_64
epel-release-6-8.noarch
gcc-4.4.7-17.el6.x86_64
git-1.7.1-4.el6_7.1.x86_64
glib2-devel-2.28.8-5.el6.x86_64
libfdt-devel-1.4.0-1.el6.x86_64
make-3.81-23.el6.x86_64
package g++ is not installed
pixman-devel-0.32.8-1.el6.x86_64
tar-1.23-15.el6_8.x86_64
zlib-devel-1.2.3-29.el6.x86_64

Environment variables:
PACKAGES=libfdt-devel ccache tar git make gcc g++ zlib-devel 
glib2-devel SDL-devel pixman-devel epel-release
HOSTNAME=4d6f6388bcc5
TERM=xterm
MAKEFLAGS= -j16
HISTSIZE=1000
J=16
USER=root
CCACHE_DIR=/var/tmp/ccache
EXTRA_CONFIGURE_OPTS=
V=
SHOW_ENV=1
MAIL=/var/spool/mail/root
PATH=/usr/lib/ccache:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PWD=/
LANG=en_US.UTF-8
TARGET_LIST=
HISTCONTROL=ignoredups
SHLVL=1
HOME=/root
TEST_DIR=/tmp/qemu-test
LOGNAME=root
LESSOPEN=||/usr/bin/lesspipe.sh %s
FEATURES= dtc
DEBUG=
G_BROKEN_FILENAMES=1
CCACHE_HASHDIR=
_=/usr/bin/env

Configure options:
--enable-werror --target-list=x86_64-softmmu,aarch64-softmmu 
--prefix=/var/tmp/qemu-build/install
No C++ compiler available; disabling C++ specific optional code
Install prefix/var/tmp/qemu-build/install
BIOS directory/var/tmp/qemu-build/install/share/qemu
binary directory  /var/tmp/qemu-build/install/bin
library directory /var/tmp/qemu-build/install/lib
module directory  /var/tmp/qemu-build/install/lib/qemu
libexec directory /var/tmp/qemu-build/install/libexec
include directory /var/tmp/qemu-build/install/include
config directory  /var/tmp/qemu-build/install/etc
local state directory   /var/tmp/qemu-build/install/var
Manual directory  /var/tmp/qemu-build/install/share/man
ELF interp prefix /usr/gnemul/qemu-%M
Source path   /tmp/qemu-test/src
C compilercc
Host C compiler   cc
C++ compiler  
Objective-C compiler cc
ARFLAGS   rv
CFLAGS-O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -g 
QEMU_CFLAGS   -I/usr/include/pixman-1-pthread -I/usr/include/glib-2.0 
-I/usr/lib64/glib-2.0/include   -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE 
-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes 
-Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes 
-fno-strict-aliasing -fno-common -fwrapv  -Wendif-labels -Wmissing-include-dirs 
-Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self 
-Wignored-qualifiers -Wold-style-declaration -Wold-style-definition 
-Wtype-limits -fstack-protector-all
LDFLAGS   -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g 
make  make
install   install
pythonpython -B
smbd  /usr/sbin/smbd
module supportno
host CPU  x86_64
host big endian   no
target list   x86_64-softmmu aarch64-softmmu
tcg debug enabled no
gprof enabled no
sparse enabledno
strip binariesyes
profiler  no
static build  no
pixmansystem
SDL support   yes (1.2.14)
GTK support   no 
GTK GL supportno
VTE support   no 
TLS priority  NORMAL
GNUTLS supportno
GNUTLS rndno
libgcrypt no
libgcrypt kdf no
nettleno 
nettle kdfno
libtasn1  no
curses supportno
virgl support no
curl support  no
mingw32 support   no
Audio drivers oss
Block whitelist (rw) 
Block whitelist (ro) 
VirtFS supportno
VNC support   yes
VNC SASL support  no
VNC JPEG support  no
VNC PNG support   no
xen support   no
brlapi supportno
bluez  supportno
Documentation no
PIE   yes
vde support   no
netmap supportno
Linux AIO su

Re: [Qemu-devel] [PATCH 0/3] cpu: numa: Fix the mapping initialization of VCPUs and NUMA nodes

2017-01-18 Thread Dou Liyang

Hi, All


**
ERROR:/tmp/qemu-test/src/tests/vhost-user-test.c:668:test_migrate: assertion failed: 
(qdict_haskey(rsp, "return"))
GTester: last random seed: R02Sf52546c4daff8087416f43fa7c146db8
ftruncate: Permission denied
ftruncate: Permission denied
qemu-system-aarch64: /tmp/qemu-test/src/qom/cpu.c:346: cpu_common_map_numa_node: 
Assertion `cpu->cpu_index < max_cpus' failed.
Broken pipe


I don't know What's the meaning of this log ?

Is the qemu-system-aarch64 can't recognize the
qom/cpu.c:346: assert(cpu->cpu_index < max_cpus);

Thanks,
Liyang



GTester: last random seed: R02Sa39aa674143b4b48a89276d59eee19b3
qemu-system-aarch64: /tmp/qemu-test/src/qom/cpu.c:346: cpu_common_map_numa_node: 
Assertion `cpu->cpu_index < max_cpus' failed.
Broken pipe
GTester: last random seed: R02Sbd557f67296de3764183db6b2105d88b
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
qemu-system-aarch64: /tmp/qemu-test/src/qom/cpu.c:346: cpu_common_map_numa_node: 
Assertion `cpu->cpu_index < max_cpus' failed.
Broken pipe
GTester: last random seed: R02S79c36cf5f50e19956d11fbc925f86df0
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
qemu-system-aarch64: /tmp/qemu-test/src/qom/cpu.c:346: cpu_common_map_numa_node: 
Assertion `cpu->cpu_index < max_cpus' failed.
Broken pipe
GTester: last random seed: R02S1186d0871ff44bed258ec179722caf91
qemu-system-aarch64: /tmp/qemu-test/src/qom/cpu.c:346: cpu_common_map_numa_node: 
Assertion `cpu->cpu_index < max_cpus' failed.
Broken pipe
GTester: last random seed: R02S3429594491b10489f9abab73dcc15151
make: *** [check-qtest-aarch64] Error 1
make: *** Waiting for unfinished jobs
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
make[1]: *** [docker-run] Error 2
make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-3q9yfmbs/src'
make: *** [docker-run-test-quick@centos6] Error 2
=== OUTPUT END ===

Test command exited with code: 2


---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to patchew-de...@freelists.org







Re: [Qemu-devel] [PATCH 0/3] cpu: numa: Fix the mapping initialization of VCPUs and NUMA nodes

2017-01-18 Thread Igor Mammedov
On Wed, 18 Jan 2017 20:40:04 +0800
Dou Liyang  wrote:

> As we fixed a bug(Bug 1) in below links, Named "Method-A":
> 
> https://lists.nongnu.org/archive/html/qemu-devel/2017-01/msg03354.html
> 
> Then, Eduardo gave us many suggests. Thanks very much!
> when we try them, we also find another bugs named "Bug 2".
I have an alternative fix for both issues for which
I've been writing cover letter when I saw this series.

My fix series more intrusive though as it's goal isn't
just to fix 'info numa' but rather switch away from
cpu-index based mapping to socket/core/thread based mapping
and stop using bitmaps for mapping. And as 'info numa' was
getting in the way, I fixed both issues in a slightly
different way.

So pls wait a bit, once travis build is completed,
I'll post series here.

> [Problem]
> -
> 
> As I use this command:
> 
> ./x86_64-softmmu/qemu-system-x86_64 \
>   -hda /image/fedora.img \
>   -m 1G,slots=4,maxmem=4G \
>   -enable-kvm \
>   -smp 2,maxcpus=16,sockets=4,cores=2,threads=2 \
>   -device qemu64-x86_64-cpu,id=cpu1,socket-id=0,core-id=1,thread-id=0 \
>   -device qemu64-x86_64-cpu,id=cpu2,socket-id=0,core-id=1,thread-id=1 \
>   -device qemu64-x86_64-cpu,id=cpu3,socket-id=1,core-id=0,thread-id=0 \
>   -device qemu64-x86_64-cpu,id=cpu4,socket-id=1,core-id=0,thread-id=1 \
>   -device qemu64-x86_64-cpu,id=cpu5,socket-id=1,core-id=1,thread-id=0 \
>   -device qemu64-x86_64-cpu,id=cpu6,socket-id=1,core-id=1,thread-id=1 \
>   -numa node,nodeid=0,cpus=0-3 \
>   -numa node,nodeid=1,cpus=4-7 \
>   -numa node,nodeid=2,cpus=8-11 \
>   -numa node,nodeid=3,cpus=12-15 \
>   -monitor stdio \
> 
> 1. Bug 1
> 
> In Qemu monitor:
> 
> (qemu) info numa 
> 4 nodes
> node 0 cpus: 0 1 2 3 4 5 6 7
> node 0 size: 256 MB
> node 1 cpus:
> node 1 size: 256 MB
> node 2 cpus:
> node 2 size: 256 MB
> node 3 cpus:
> node 3 size: 256 MB
> 
> 2. Bug 2
> 
> (qemu) device_add qemu64-x86_64-cpu,id=cpu7,socket-id=2,core-id=0,thread-id=0
> 
> (qemu) info numa
> 4 nodes
> node 0 cpus: 0 1 2 3 4 5 6 7 8
> node 0 size: 256 MB
> node 1 cpus:
> node 1 size: 256 MB
> node 2 cpus:
> node 2 size: 256 MB
> node 3 cpus:
> node 3 size: 256 MB
> 
> [Method-A]
> --
> 
> 1. Method-A that we provided above: 
>   * Ensure the numa_post_machine_init func in the appropriate location in
> vl.c::main().
> 
> It can fix Bug 1, but, can't work for Bug 2.
> 
> 1.1. For Bug 1: fixed
> 
> (qemu) info numa
> 4 nodes
> node 0 cpus: 0 1 2 3
> node 0 size: 256 MB
> node 1 cpus: 4 5 6 7
> node 1 size: 256 MB
> node 2 cpus:
> node 2 size: 256 MB
> node 3 cpus:
> node 3 size: 256 MB
> 
> 1.2. For Bug 2: can not fixed
> 
> (qemu) device_add qemu64-x86_64-cpu,id=cpu7,socket-id=2,core-id=0,thread-id=0
> 
> (qemu) info numa
> node 0 cpus: 0 1 2 3 8
> node 0 size: 256 MB
> node 1 cpus: 4 5 6 7
> node 1 size: 256 MB
> node 2 cpus:
> node 2 size: 256 MB
> node 3 cpus:
> node 3 size: 256 MB
> 
> [Solution]
> --
> 
> Move the CPUState::numa_node initialization to 
> qom/cpu.c:cpu_common_realizefn(),
> and remove numa_post_machine_init() completely.
> 
> It can fix Bug 1 and Bug 2. The result shows that:
> 
> (qemu) info numa
> 4 nodes
> node 0 cpus: 0 1 2 3
> node 0 size: 256 MB
> node 1 cpus: 4 5 6 7
> node 1 size: 256 MB
> node 2 cpus:
> node 2 size: 256 MB
> node 3 cpus:
> node 3 size: 256 MB
> 
> (qemu) device_add qemu64-x86_64-cpu,id=cpu7,socket-id=2,core-id=0,thread-id=0
> (qemu) info numa
> 4 nodes
> node 0 cpus: 0 1 2 3
> node 0 size: 256 MB
> node 1 cpus: 4 5 6 7
> node 1 size: 256 MB
> node 2 cpus: 8
> node 2 size: 256 MB
> node 3 cpus:
> node 3 size: 256 MB
> 
> (qemu) device_add qemu64-x86_64-cpu,id=cpu8,socket-id=3,core-id=0,thread-id=0
> (qemu) info numa
> 4 nodes
> node 0 cpus: 0 1 2 3
> node 0 size: 256 MB
> node 1 cpus: 4 5 6 7
> node 1 size: 256 MB
> node 2 cpus: 8
> node 2 size: 256 MB
> node 3 cpus: 12
> node 3 size: 256 MB
> 
> (qemu) device_del cpu5
> (qemu) info numa
> 4 nodes
> node 0 cpus: 0 1 2 3
> node 0 size: 256 MB
> node 1 cpus: 4 5 7
> node 1 size: 256 MB
> node 2 cpus: 8
> node 2 size: 256 MB
> node 3 cpus: 12
> node 3 size: 256 MB
> 
> Dou Liyang (3):
>   cpu: Make the mapping of CPUs and NUMA nodes in cpu_common_realizefn
>   numa: Remove the numa_post_machine_init function
>   cpu: make the function of cpu_common_map_numa_node more efficiently
> 
>  include/sysemu/numa.h |  1 -
>  numa.c| 15 ---
>  qom/cpu.c | 16 
>  vl.c  |  2 --
>  4 files changed, 16 insertions(+), 18 deletions(-)
> 




Re: [Qemu-devel] [PATCH 0/3] cpu: numa: Fix the mapping initialization of VCPUs and NUMA nodes

2017-01-18 Thread Eduardo Habkost
On Wed, Jan 18, 2017 at 09:26:36PM +0800, Dou Liyang wrote:
> Hi, All
> 
> > **
> > ERROR:/tmp/qemu-test/src/tests/vhost-user-test.c:668:test_migrate: 
> > assertion failed: (qdict_haskey(rsp, "return"))
> > GTester: last random seed: R02Sf52546c4daff8087416f43fa7c146db8
> > ftruncate: Permission denied
> > ftruncate: Permission denied
> > qemu-system-aarch64: /tmp/qemu-test/src/qom/cpu.c:346: 
> > cpu_common_map_numa_node: Assertion `cpu->cpu_index < max_cpus' failed.
> > Broken pipe
> 
> I don't know What's the meaning of this log ?
> 
> Is the qemu-system-aarch64 can't recognize the
> qom/cpu.c:346: assert(cpu->cpu_index < max_cpus);

This means the assert() line is being triggered for some reason,
and cpu_index is >= max_cpus when we cpu_common_map_numa_node()
gets called. We need to investigate why.

-- 
Eduardo



Re: [Qemu-devel] [PATCH 0/3] cpu: numa: Fix the mapping initialization of VCPUs and NUMA nodes

2017-01-19 Thread Dou Liyang

Hi, Igor,

At 01/18/2017 09:46 PM, Igor Mammedov wrote:

On Wed, 18 Jan 2017 20:40:04 +0800
Dou Liyang  wrote:


As we fixed a bug(Bug 1) in below links, Named "Method-A":

https://lists.nongnu.org/archive/html/qemu-devel/2017-01/msg03354.html

Then, Eduardo gave us many suggests. Thanks very much!
when we try them, we also find another bugs named "Bug 2".

I have an alternative fix for both issues for which
I've been writing cover letter when I saw this series.

My fix series more intrusive though as it's goal isn't
just to fix 'info numa' but rather switch away from
cpu-index based mapping to socket/core/thread based mapping
and stop using bitmaps for mapping. And as 'info numa' was
getting in the way, I fixed both issues in a slightly
different way.

So pls wait a bit, once travis build is completed,
I'll post series here.


It doesn't matter. I am learning about your patches.
I think my method is temporary. your fix is better than me.

Thanks,
Liyang.





Re: [Qemu-devel] [PATCH 0/3] cpu: numa: Fix the mapping initialization of VCPUs and NUMA nodes

2017-01-19 Thread Dou Liyang

Hi, Eduardo

At 01/19/2017 01:06 AM, Eduardo Habkost wrote:

On Wed, Jan 18, 2017 at 09:26:36PM +0800, Dou Liyang wrote:

Hi, All


**
ERROR:/tmp/qemu-test/src/tests/vhost-user-test.c:668:test_migrate: assertion failed: 
(qdict_haskey(rsp, "return"))
GTester: last random seed: R02Sf52546c4daff8087416f43fa7c146db8
ftruncate: Permission denied
ftruncate: Permission denied
qemu-system-aarch64: /tmp/qemu-test/src/qom/cpu.c:346: cpu_common_map_numa_node: 
Assertion `cpu->cpu_index < max_cpus' failed.
Broken pipe


I don't know What's the meaning of this log ?

Is the qemu-system-aarch64 can't recognize the
qom/cpu.c:346: assert(cpu->cpu_index < max_cpus);


This means the assert() line is being triggered for some reason,
and cpu_index is >= max_cpus when we cpu_common_map_numa_node()
gets called. We need to investigate why.



I have investigated the reason why it is failed.

Because not all targets(aarch64-linux-user, x86_64-linux-user ...)
need to compile the vl.c(include the max_cpus) and numa.c, but the all
may compile the ./qom/cpu.c.
So, when we Link those targets, we may can't find the vl.o or numa.o
that we want.

Add "#ifdef CONFIG_NUMA" to fix it.

+static void cpu_common_map_numa_node(CPUState *cpu)
+{
+#ifdef CONFIG_NUMA
+int i;
+
+assert(cpu->cpu_index < max_cpus);
+for (i = 0; i < nb_numa_nodes; i++) {
+if (test_bit(cpu->cpu_index, numa_info[i].node_cpu)) {
+cpu->numa_node = i;
+return;
+}
+}
+#endif
+}
+

And I am not sure if it is necessary to resend this patch for
fixing the bug before Igor's patches is OK completely?

Thanks,
Liyang.






Re: [Qemu-devel] [PATCH 0/3] cpu: numa: Fix the mapping initialization of VCPUs and NUMA nodes

2017-01-19 Thread Eduardo Habkost
On Thu, Jan 19, 2017 at 08:17:02PM +0800, Dou Liyang wrote:
> Hi, Eduardo
> 
> At 01/19/2017 01:06 AM, Eduardo Habkost wrote:
> > On Wed, Jan 18, 2017 at 09:26:36PM +0800, Dou Liyang wrote:
> > > Hi, All
> > > 
> > > > **
> > > > ERROR:/tmp/qemu-test/src/tests/vhost-user-test.c:668:test_migrate: 
> > > > assertion failed: (qdict_haskey(rsp, "return"))
> > > > GTester: last random seed: R02Sf52546c4daff8087416f43fa7c146db8
> > > > ftruncate: Permission denied
> > > > ftruncate: Permission denied
> > > > qemu-system-aarch64: /tmp/qemu-test/src/qom/cpu.c:346: 
> > > > cpu_common_map_numa_node: Assertion `cpu->cpu_index < max_cpus' failed.
> > > > Broken pipe
> > > 
> > > I don't know What's the meaning of this log ?
> > > 
> > > Is the qemu-system-aarch64 can't recognize the
> > > qom/cpu.c:346: assert(cpu->cpu_index < max_cpus);
> > 
> > This means the assert() line is being triggered for some reason,
> > and cpu_index is >= max_cpus when we cpu_common_map_numa_node()
> > gets called. We need to investigate why.
> > 
> 
> I have investigated the reason why it is failed.
> 
> Because not all targets(aarch64-linux-user, x86_64-linux-user ...)
> need to compile the vl.c(include the max_cpus) and numa.c, but the all
> may compile the ./qom/cpu.c.
> So, when we Link those targets, we may can't find the vl.o or numa.o
> that we want.
> 
> Add "#ifdef CONFIG_NUMA" to fix it.
> 
> +static void cpu_common_map_numa_node(CPUState *cpu)
> +{
> +#ifdef CONFIG_NUMA
> +int i;
> +
> +assert(cpu->cpu_index < max_cpus);
> +for (i = 0; i < nb_numa_nodes; i++) {
> +if (test_bit(cpu->cpu_index, numa_info[i].node_cpu)) {
> +cpu->numa_node = i;
> +return;
> +}
> +}
> +#endif
> +}
> +
> 
> And I am not sure if it is necessary to resend this patch for
> fixing the bug before Igor's patches is OK completely?

No need to resend this patch: I have already applied your
previous patch that moved the numa_post_machine_init() call, and
Igor is taking care of removing numa_post_machine_init() in a
different way.

Thanks!

-- 
Eduardo