* qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
@ 2011-08-01 17:44 ` David Ahern
0 siblings, 0 replies; 23+ messages in thread
From: David Ahern @ 2011-08-01 17:44 UTC (permalink / raw)
To: Avi Kivity, aliguori; +Cc: qemu-devel, KVM mailing list
qemu-kvm.git as of:
commit dacdc4b10bafbb21120e1c24a9665444768ef999
Merge: 7b69d4f 0af4922
Author: Avi Kivity <avi@redhat.com>
Date: Sun Jul 31 11:42:26 2011 +0300
Merge branch 'upstream-merge' into next
is aborting with the error:
qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
Assertion `to >= 0' failed.
Aborted
$ git bisect bad
00cb2a99f5e7f73c4fff54ae16c7b6acf463ab5c is the first bad commit
commit 00cb2a99f5e7f73c4fff54ae16c7b6acf463ab5c
Author: Avi Kivity <avi@redhat.com>
Date: Tue Jul 26 14:26:17 2011 +0300
pc: convert pc_memory_init() to memory API
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
:040000 040000 3d709c2cab75b934030fb9fbdfa99024c855b2a6
720d362f9702f15d16519093555182169d0b09bd M hw
^ permalink raw reply [flat|nested] 23+ messages in thread
* [Qemu-devel] qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
@ 2011-08-01 17:44 ` David Ahern
0 siblings, 0 replies; 23+ messages in thread
From: David Ahern @ 2011-08-01 17:44 UTC (permalink / raw)
To: Avi Kivity, aliguori; +Cc: qemu-devel, KVM mailing list
qemu-kvm.git as of:
commit dacdc4b10bafbb21120e1c24a9665444768ef999
Merge: 7b69d4f 0af4922
Author: Avi Kivity <avi@redhat.com>
Date: Sun Jul 31 11:42:26 2011 +0300
Merge branch 'upstream-merge' into next
is aborting with the error:
qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
Assertion `to >= 0' failed.
Aborted
$ git bisect bad
00cb2a99f5e7f73c4fff54ae16c7b6acf463ab5c is the first bad commit
commit 00cb2a99f5e7f73c4fff54ae16c7b6acf463ab5c
Author: Avi Kivity <avi@redhat.com>
Date: Tue Jul 26 14:26:17 2011 +0300
pc: convert pc_memory_init() to memory API
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
:040000 040000 3d709c2cab75b934030fb9fbdfa99024c855b2a6
720d362f9702f15d16519093555182169d0b09bd M hw
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
2011-08-01 17:44 ` [Qemu-devel] " David Ahern
@ 2011-08-01 18:04 ` David Ahern
-1 siblings, 0 replies; 23+ messages in thread
From: David Ahern @ 2011-08-01 18:04 UTC (permalink / raw)
To: Avi Kivity, aliguori; +Cc: qemu-devel, KVM mailing list
On 08/01/2011 11:44 AM, David Ahern wrote:
> qemu-kvm.git as of:
>
> commit dacdc4b10bafbb21120e1c24a9665444768ef999
> Merge: 7b69d4f 0af4922
> Author: Avi Kivity <avi@redhat.com>
> Date: Sun Jul 31 11:42:26 2011 +0300
>
> Merge branch 'upstream-merge' into next
>
> is aborting with the error:
>
> qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
> Assertion `to >= 0' failed.
> Aborted
BTW, happens when I pass a kernel and initrd on the command line.
qemu-kvm -kernel vmlinuz -initrd initrd.img ...
David
>
> $ git bisect bad
> 00cb2a99f5e7f73c4fff54ae16c7b6acf463ab5c is the first bad commit
> commit 00cb2a99f5e7f73c4fff54ae16c7b6acf463ab5c
> Author: Avi Kivity <avi@redhat.com>
> Date: Tue Jul 26 14:26:17 2011 +0300
>
> pc: convert pc_memory_init() to memory API
>
> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
> :040000 040000 3d709c2cab75b934030fb9fbdfa99024c855b2a6
> 720d362f9702f15d16519093555182169d0b09bd M hw
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
@ 2011-08-01 18:04 ` David Ahern
0 siblings, 0 replies; 23+ messages in thread
From: David Ahern @ 2011-08-01 18:04 UTC (permalink / raw)
To: Avi Kivity, aliguori; +Cc: qemu-devel, KVM mailing list
On 08/01/2011 11:44 AM, David Ahern wrote:
> qemu-kvm.git as of:
>
> commit dacdc4b10bafbb21120e1c24a9665444768ef999
> Merge: 7b69d4f 0af4922
> Author: Avi Kivity <avi@redhat.com>
> Date: Sun Jul 31 11:42:26 2011 +0300
>
> Merge branch 'upstream-merge' into next
>
> is aborting with the error:
>
> qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
> Assertion `to >= 0' failed.
> Aborted
BTW, happens when I pass a kernel and initrd on the command line.
qemu-kvm -kernel vmlinuz -initrd initrd.img ...
David
>
> $ git bisect bad
> 00cb2a99f5e7f73c4fff54ae16c7b6acf463ab5c is the first bad commit
> commit 00cb2a99f5e7f73c4fff54ae16c7b6acf463ab5c
> Author: Avi Kivity <avi@redhat.com>
> Date: Tue Jul 26 14:26:17 2011 +0300
>
> pc: convert pc_memory_init() to memory API
>
> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
> :040000 040000 3d709c2cab75b934030fb9fbdfa99024c855b2a6
> 720d362f9702f15d16519093555182169d0b09bd M hw
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
2011-08-01 17:44 ` [Qemu-devel] " David Ahern
@ 2011-08-03 9:01 ` Avi Kivity
-1 siblings, 0 replies; 23+ messages in thread
From: Avi Kivity @ 2011-08-03 9:01 UTC (permalink / raw)
To: David Ahern; +Cc: aliguori, qemu-devel, KVM mailing list
On 08/01/2011 08:44 PM, David Ahern wrote:
> qemu-kvm.git as of:
>
> commit dacdc4b10bafbb21120e1c24a9665444768ef999
> Merge: 7b69d4f 0af4922
> Author: Avi Kivity<avi@redhat.com>
> Date: Sun Jul 31 11:42:26 2011 +0300
>
> Merge branch 'upstream-merge' into next
>
> is aborting with the error:
>
> qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
> Assertion `to>= 0' failed.
> Aborted
Full command line please?
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
@ 2011-08-03 9:01 ` Avi Kivity
0 siblings, 0 replies; 23+ messages in thread
From: Avi Kivity @ 2011-08-03 9:01 UTC (permalink / raw)
To: David Ahern; +Cc: aliguori, qemu-devel, KVM mailing list
On 08/01/2011 08:44 PM, David Ahern wrote:
> qemu-kvm.git as of:
>
> commit dacdc4b10bafbb21120e1c24a9665444768ef999
> Merge: 7b69d4f 0af4922
> Author: Avi Kivity<avi@redhat.com>
> Date: Sun Jul 31 11:42:26 2011 +0300
>
> Merge branch 'upstream-merge' into next
>
> is aborting with the error:
>
> qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
> Assertion `to>= 0' failed.
> Aborted
Full command line please?
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
2011-08-03 9:01 ` [Qemu-devel] " Avi Kivity
(?)
@ 2011-08-03 9:33 ` Wen Congyang
-1 siblings, 0 replies; 23+ messages in thread
From: Wen Congyang @ 2011-08-03 9:33 UTC (permalink / raw)
To: Avi Kivity, David Ahern, aliguori, qemu-devel
At 08/03/2011 05:01 PM, Avi Kivity Write:
> On 08/01/2011 08:44 PM, David Ahern wrote:
>> qemu-kvm.git as of:
>>
>> commit dacdc4b10bafbb21120e1c24a9665444768ef999
>> Merge: 7b69d4f 0af4922
>> Author: Avi Kivity<avi@redhat.com>
>> Date: Sun Jul 31 11:42:26 2011 +0300
>>
>> Merge branch 'upstream-merge' into next
>>
>> is aborting with the error:
>>
>> qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
>> Assertion `to>= 0' failed.
>> Aborted
>
> Full command line please?
I use the upstream qemu, and meet the same problem.
I use libvirt to start vm. Here is the command line:
2011-08-03 13:58:21.157: starting up
LC_ALL=C PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin HOME=/root USER=root LOGNAME=root QEMU_AUDIO_DRV=none /usr/local2/bin/
qemu-system-x86_64 -S -M pc-0.14 -enable-kvm -m 512 -smp 4,sockets=4,cores=1,threads=1 -name vm1 -uuid a1cd0309-72a3-48b7-835d-212c86de407f -nodefconfig -nodefaults -chardev soc
ket,id=charmonitor,path=/var/lib/libvirt/qemu/vm1.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime -no-shutdown -device lsi,id=scsi0,bu
s=pci.0,multifunction=on,addr=0x5.0x0 -drive file=/var/lib/libvirt/images/vm1.img,if=none,id=drive-ide0-0-0,format=qcow2,cache=writethrough -device ide-drive,bus=ide.0,unit=0,dr
ive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -drive file=/var/lib/libvirt/images/test.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw -device ide-drive,bus=ide.1,
unit=0,drive=drive-ide0-1-0,id=ide0-1-0 -drive file=/var/lib/libvirt/images/test.img,if=none,id=drive-virtio-disk0,format=qcow2,serial=Fujitsu-virtio-0001 -device virtio-blk-pci
,bus=pci.0,multifunction=on,addr=0x7.0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=2 -netdev tap,fd=25,id=hostnet0,vhost=on,vhostfd=26 -device virtio-net-pci,netdev=hos
tnet0,id=net0,mac=52:54:00:04:72:f2,bus=pci.0,multifunction=on,addr=0x3.0x0 -netdev tap,fd=27,id=hostnet1 -device rtl8139,netdev=hostnet1,id=net1,mac=52:54:00:04:72:f3,bus=pci.0
,multifunction=on,addr=0x6.0x0 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -usb -vnc 0.0.0.0:1 -vga cirrus -device virtio-balloon-pci,id=balloo
n0,bus=pci.0,multifunction=on,addr=0x4.0x0
char device redirected to /dev/pts/7
qemu-system-x86_64: /home/wency/source/qemu/hw/vhost.c:123: vhost_dev_unassign_memory: Assertion `to >= 0' failed.
2011-08-03 13:58:21.400: shutting down
If I do not use vhost(command line does not include vhost=on,vhostfd=26), the vm can start succefully.
Thanks
Wen Congyang
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
2011-08-01 17:44 ` [Qemu-devel] " David Ahern
@ 2011-08-03 11:48 ` Avi Kivity
-1 siblings, 0 replies; 23+ messages in thread
From: Avi Kivity @ 2011-08-03 11:48 UTC (permalink / raw)
To: David Ahern, Michael S. Tsirkin; +Cc: aliguori, qemu-devel, KVM mailing list
On 08/01/2011 08:44 PM, David Ahern wrote:
> qemu-kvm.git as of:
>
> commit dacdc4b10bafbb21120e1c24a9665444768ef999
> Merge: 7b69d4f 0af4922
> Author: Avi Kivity<avi@redhat.com>
> Date: Sun Jul 31 11:42:26 2011 +0300
>
> Merge branch 'upstream-merge' into next
>
> is aborting with the error:
>
> qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
> Assertion `to>= 0' failed.
> Aborted
>
It's a bug in vhost:
/* Assign/unassign. Keep an unsorted array of non-overlapping
* memory regions in dev->mem. */
static void vhost_dev_unassign_memory(struct vhost_dev *dev,
uint64_t start_addr,
uint64_t size)
{
int from, to, n = dev->mem->nregions;
/* Track overlapping/split regions for sanity checking. */
int overlap_start = 0, overlap_end = 0, overlap_middle = 0, split = 0;
for (from = 0, to = 0; from < n; ++from, ++to) {
struct vhost_memory_region *reg = dev->mem->regions + to;
uint64_t reglast;
uint64_t memlast;
uint64_t change;
/* clone old region */
if (to != from) {
memcpy(reg, dev->mem->regions + from, sizeof *reg);
}
/* No overlap is simple */
if (!ranges_overlap(reg->guest_phys_addr, reg->memory_size,
start_addr, size)) {
continue;
}
/* Split only happens if supplied region
* is in the middle of an existing one. Thus it can not
* overlap with any other existing region. */
assert(!split);
reglast = range_get_last(reg->guest_phys_addr, reg->memory_size);
memlast = range_get_last(start_addr, size);
/* Remove whole region */
if (start_addr <= reg->guest_phys_addr && memlast >= reglast) {
--dev->mem->nregions;
--to;
assert(to >= 0);
++overlap_middle;
continue;
}
We're removing the first region, and 'to' goes negative. Michael?
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
@ 2011-08-03 11:48 ` Avi Kivity
0 siblings, 0 replies; 23+ messages in thread
From: Avi Kivity @ 2011-08-03 11:48 UTC (permalink / raw)
To: David Ahern, Michael S. Tsirkin; +Cc: aliguori, qemu-devel, KVM mailing list
On 08/01/2011 08:44 PM, David Ahern wrote:
> qemu-kvm.git as of:
>
> commit dacdc4b10bafbb21120e1c24a9665444768ef999
> Merge: 7b69d4f 0af4922
> Author: Avi Kivity<avi@redhat.com>
> Date: Sun Jul 31 11:42:26 2011 +0300
>
> Merge branch 'upstream-merge' into next
>
> is aborting with the error:
>
> qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
> Assertion `to>= 0' failed.
> Aborted
>
It's a bug in vhost:
/* Assign/unassign. Keep an unsorted array of non-overlapping
* memory regions in dev->mem. */
static void vhost_dev_unassign_memory(struct vhost_dev *dev,
uint64_t start_addr,
uint64_t size)
{
int from, to, n = dev->mem->nregions;
/* Track overlapping/split regions for sanity checking. */
int overlap_start = 0, overlap_end = 0, overlap_middle = 0, split = 0;
for (from = 0, to = 0; from < n; ++from, ++to) {
struct vhost_memory_region *reg = dev->mem->regions + to;
uint64_t reglast;
uint64_t memlast;
uint64_t change;
/* clone old region */
if (to != from) {
memcpy(reg, dev->mem->regions + from, sizeof *reg);
}
/* No overlap is simple */
if (!ranges_overlap(reg->guest_phys_addr, reg->memory_size,
start_addr, size)) {
continue;
}
/* Split only happens if supplied region
* is in the middle of an existing one. Thus it can not
* overlap with any other existing region. */
assert(!split);
reglast = range_get_last(reg->guest_phys_addr, reg->memory_size);
memlast = range_get_last(start_addr, size);
/* Remove whole region */
if (start_addr <= reg->guest_phys_addr && memlast >= reglast) {
--dev->mem->nregions;
--to;
assert(to >= 0);
++overlap_middle;
continue;
}
We're removing the first region, and 'to' goes negative. Michael?
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
2011-08-03 11:48 ` [Qemu-devel] " Avi Kivity
@ 2011-08-03 12:24 ` Michael S. Tsirkin
-1 siblings, 0 replies; 23+ messages in thread
From: Michael S. Tsirkin @ 2011-08-03 12:24 UTC (permalink / raw)
To: Avi Kivity; +Cc: aliguori, qemu-devel, David Ahern, KVM mailing list
On Wed, Aug 03, 2011 at 02:48:05PM +0300, Avi Kivity wrote:
> On 08/01/2011 08:44 PM, David Ahern wrote:
> >qemu-kvm.git as of:
> >
> >commit dacdc4b10bafbb21120e1c24a9665444768ef999
> >Merge: 7b69d4f 0af4922
> >Author: Avi Kivity<avi@redhat.com>
> >Date: Sun Jul 31 11:42:26 2011 +0300
> >
> > Merge branch 'upstream-merge' into next
> >
> >is aborting with the error:
> >
> >qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
> >Assertion `to>= 0' failed.
> >Aborted
> >
>
> It's a bug in vhost:
>
> /* Assign/unassign. Keep an unsorted array of non-overlapping
> * memory regions in dev->mem. */
> static void vhost_dev_unassign_memory(struct vhost_dev *dev,
> uint64_t start_addr,
> uint64_t size)
> {
> int from, to, n = dev->mem->nregions;
> /* Track overlapping/split regions for sanity checking. */
> int overlap_start = 0, overlap_end = 0, overlap_middle = 0, split = 0;
>
> for (from = 0, to = 0; from < n; ++from, ++to) {
> struct vhost_memory_region *reg = dev->mem->regions + to;
> uint64_t reglast;
> uint64_t memlast;
> uint64_t change;
>
> /* clone old region */
> if (to != from) {
> memcpy(reg, dev->mem->regions + from, sizeof *reg);
> }
>
> /* No overlap is simple */
> if (!ranges_overlap(reg->guest_phys_addr, reg->memory_size,
> start_addr, size)) {
> continue;
> }
>
> /* Split only happens if supplied region
> * is in the middle of an existing one. Thus it can not
> * overlap with any other existing region. */
> assert(!split);
>
> reglast = range_get_last(reg->guest_phys_addr, reg->memory_size);
> memlast = range_get_last(start_addr, size);
>
> /* Remove whole region */
> if (start_addr <= reg->guest_phys_addr && memlast >= reglast) {
> --dev->mem->nregions;
> --to;
> assert(to >= 0);
> ++overlap_middle;
> continue;
> }
>
>
> We're removing the first region, and 'to' goes negative. Michael?
Yes, that assert is wrong.
--->
Subject: vhost: remove an incorrect assert
The 'to' can go negative when the first region gets removed
(it gets incremented by to 0 immediately afterward), which
makes the assertion fail. Nothing breaks if
to < 0 here so just remove the assert.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
----
diff --git a/hw/vhost.c b/hw/vhost.c
index c3d8821..19e7255 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -120,7 +120,6 @@ static void vhost_dev_unassign_memory(struct vhost_dev *dev,
if (start_addr <= reg->guest_phys_addr && memlast >= reglast) {
--dev->mem->nregions;
--to;
- assert(to >= 0);
++overlap_middle;
continue;
}
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
@ 2011-08-03 12:24 ` Michael S. Tsirkin
0 siblings, 0 replies; 23+ messages in thread
From: Michael S. Tsirkin @ 2011-08-03 12:24 UTC (permalink / raw)
To: Avi Kivity; +Cc: aliguori, qemu-devel, David Ahern, KVM mailing list
On Wed, Aug 03, 2011 at 02:48:05PM +0300, Avi Kivity wrote:
> On 08/01/2011 08:44 PM, David Ahern wrote:
> >qemu-kvm.git as of:
> >
> >commit dacdc4b10bafbb21120e1c24a9665444768ef999
> >Merge: 7b69d4f 0af4922
> >Author: Avi Kivity<avi@redhat.com>
> >Date: Sun Jul 31 11:42:26 2011 +0300
> >
> > Merge branch 'upstream-merge' into next
> >
> >is aborting with the error:
> >
> >qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
> >Assertion `to>= 0' failed.
> >Aborted
> >
>
> It's a bug in vhost:
>
> /* Assign/unassign. Keep an unsorted array of non-overlapping
> * memory regions in dev->mem. */
> static void vhost_dev_unassign_memory(struct vhost_dev *dev,
> uint64_t start_addr,
> uint64_t size)
> {
> int from, to, n = dev->mem->nregions;
> /* Track overlapping/split regions for sanity checking. */
> int overlap_start = 0, overlap_end = 0, overlap_middle = 0, split = 0;
>
> for (from = 0, to = 0; from < n; ++from, ++to) {
> struct vhost_memory_region *reg = dev->mem->regions + to;
> uint64_t reglast;
> uint64_t memlast;
> uint64_t change;
>
> /* clone old region */
> if (to != from) {
> memcpy(reg, dev->mem->regions + from, sizeof *reg);
> }
>
> /* No overlap is simple */
> if (!ranges_overlap(reg->guest_phys_addr, reg->memory_size,
> start_addr, size)) {
> continue;
> }
>
> /* Split only happens if supplied region
> * is in the middle of an existing one. Thus it can not
> * overlap with any other existing region. */
> assert(!split);
>
> reglast = range_get_last(reg->guest_phys_addr, reg->memory_size);
> memlast = range_get_last(start_addr, size);
>
> /* Remove whole region */
> if (start_addr <= reg->guest_phys_addr && memlast >= reglast) {
> --dev->mem->nregions;
> --to;
> assert(to >= 0);
> ++overlap_middle;
> continue;
> }
>
>
> We're removing the first region, and 'to' goes negative. Michael?
Yes, that assert is wrong.
--->
Subject: vhost: remove an incorrect assert
The 'to' can go negative when the first region gets removed
(it gets incremented by to 0 immediately afterward), which
makes the assertion fail. Nothing breaks if
to < 0 here so just remove the assert.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
----
diff --git a/hw/vhost.c b/hw/vhost.c
index c3d8821..19e7255 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -120,7 +120,6 @@ static void vhost_dev_unassign_memory(struct vhost_dev *dev,
if (start_addr <= reg->guest_phys_addr && memlast >= reglast) {
--dev->mem->nregions;
--to;
- assert(to >= 0);
++overlap_middle;
continue;
}
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
2011-08-01 17:44 ` [Qemu-devel] " David Ahern
@ 2011-08-03 13:07 ` Michael S. Tsirkin
-1 siblings, 0 replies; 23+ messages in thread
From: Michael S. Tsirkin @ 2011-08-03 13:07 UTC (permalink / raw)
To: David Ahern; +Cc: Avi Kivity, aliguori, qemu-devel, KVM mailing list
On Mon, Aug 01, 2011 at 11:44:23AM -0600, David Ahern wrote:
> qemu-kvm.git as of:
>
> commit dacdc4b10bafbb21120e1c24a9665444768ef999
> Merge: 7b69d4f 0af4922
> Author: Avi Kivity <avi@redhat.com>
> Date: Sun Jul 31 11:42:26 2011 +0300
>
> Merge branch 'upstream-merge' into next
>
> is aborting with the error:
>
> qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
> Assertion `to >= 0' failed.
> Aborted
>
> $ git bisect bad
> 00cb2a99f5e7f73c4fff54ae16c7b6acf463ab5c is the first bad commit
> commit 00cb2a99f5e7f73c4fff54ae16c7b6acf463ab5c
> Author: Avi Kivity <avi@redhat.com>
> Date: Tue Jul 26 14:26:17 2011 +0300
>
> pc: convert pc_memory_init() to memory API
>
> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
> :040000 040000 3d709c2cab75b934030fb9fbdfa99024c855b2a6
> 720d362f9702f15d16519093555182169d0b09bd M hw
>
Thanks for the report.
As Avi pointed out it's a vhost bug that got exposed
by a memory API change.
I have posted a patch which should fix that problem -
could you please try it and let me know?
Thanks!
--
MST
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
@ 2011-08-03 13:07 ` Michael S. Tsirkin
0 siblings, 0 replies; 23+ messages in thread
From: Michael S. Tsirkin @ 2011-08-03 13:07 UTC (permalink / raw)
To: David Ahern; +Cc: aliguori, Avi Kivity, KVM mailing list, qemu-devel
On Mon, Aug 01, 2011 at 11:44:23AM -0600, David Ahern wrote:
> qemu-kvm.git as of:
>
> commit dacdc4b10bafbb21120e1c24a9665444768ef999
> Merge: 7b69d4f 0af4922
> Author: Avi Kivity <avi@redhat.com>
> Date: Sun Jul 31 11:42:26 2011 +0300
>
> Merge branch 'upstream-merge' into next
>
> is aborting with the error:
>
> qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
> Assertion `to >= 0' failed.
> Aborted
>
> $ git bisect bad
> 00cb2a99f5e7f73c4fff54ae16c7b6acf463ab5c is the first bad commit
> commit 00cb2a99f5e7f73c4fff54ae16c7b6acf463ab5c
> Author: Avi Kivity <avi@redhat.com>
> Date: Tue Jul 26 14:26:17 2011 +0300
>
> pc: convert pc_memory_init() to memory API
>
> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>
> :040000 040000 3d709c2cab75b934030fb9fbdfa99024c855b2a6
> 720d362f9702f15d16519093555182169d0b09bd M hw
>
Thanks for the report.
As Avi pointed out it's a vhost bug that got exposed
by a memory API change.
I have posted a patch which should fix that problem -
could you please try it and let me know?
Thanks!
--
MST
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
2011-08-03 12:24 ` [Qemu-devel] " Michael S. Tsirkin
@ 2011-08-03 13:55 ` David Ahern
-1 siblings, 0 replies; 23+ messages in thread
From: David Ahern @ 2011-08-03 13:55 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Avi Kivity, aliguori, qemu-devel, KVM mailing list
On 08/03/2011 06:24 AM, Michael S. Tsirkin wrote:
> On Wed, Aug 03, 2011 at 02:48:05PM +0300, Avi Kivity wrote:
>> On 08/01/2011 08:44 PM, David Ahern wrote:
>>> qemu-kvm.git as of:
>>>
>>> commit dacdc4b10bafbb21120e1c24a9665444768ef999
>>> Merge: 7b69d4f 0af4922
>>> Author: Avi Kivity<avi@redhat.com>
>>> Date: Sun Jul 31 11:42:26 2011 +0300
>>>
>>> Merge branch 'upstream-merge' into next
>>>
>>> is aborting with the error:
>>>
>>> qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
>>> Assertion `to>= 0' failed.
>>> Aborted
>>>
>>
>> It's a bug in vhost:
>>
>> /* Assign/unassign. Keep an unsorted array of non-overlapping
>> * memory regions in dev->mem. */
>> static void vhost_dev_unassign_memory(struct vhost_dev *dev,
>> uint64_t start_addr,
>> uint64_t size)
>> {
>> int from, to, n = dev->mem->nregions;
>> /* Track overlapping/split regions for sanity checking. */
>> int overlap_start = 0, overlap_end = 0, overlap_middle = 0, split = 0;
>>
>> for (from = 0, to = 0; from < n; ++from, ++to) {
>> struct vhost_memory_region *reg = dev->mem->regions + to;
>> uint64_t reglast;
>> uint64_t memlast;
>> uint64_t change;
>>
>> /* clone old region */
>> if (to != from) {
>> memcpy(reg, dev->mem->regions + from, sizeof *reg);
>> }
>>
>> /* No overlap is simple */
>> if (!ranges_overlap(reg->guest_phys_addr, reg->memory_size,
>> start_addr, size)) {
>> continue;
>> }
>>
>> /* Split only happens if supplied region
>> * is in the middle of an existing one. Thus it can not
>> * overlap with any other existing region. */
>> assert(!split);
>>
>> reglast = range_get_last(reg->guest_phys_addr, reg->memory_size);
>> memlast = range_get_last(start_addr, size);
>>
>> /* Remove whole region */
>> if (start_addr <= reg->guest_phys_addr && memlast >= reglast) {
>> --dev->mem->nregions;
>> --to;
>> assert(to >= 0);
>> ++overlap_middle;
>> continue;
>> }
>>
>>
>> We're removing the first region, and 'to' goes negative. Michael?
>
> Yes, that assert is wrong.
>
> --->
> Subject: vhost: remove an incorrect assert
>
> The 'to' can go negative when the first region gets removed
> (it gets incremented by to 0 immediately afterward), which
> makes the assertion fail. Nothing breaks if
> to < 0 here so just remove the assert.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> ----
>
> diff --git a/hw/vhost.c b/hw/vhost.c
> index c3d8821..19e7255 100644
> --- a/hw/vhost.c
> +++ b/hw/vhost.c
> @@ -120,7 +120,6 @@ static void vhost_dev_unassign_memory(struct vhost_dev *dev,
> if (start_addr <= reg->guest_phys_addr && memlast >= reglast) {
> --dev->mem->nregions;
> --to;
> - assert(to >= 0);
> ++overlap_middle;
> continue;
> }
>
Removing the assert appears to work fine.
Tested-by: David Ahern <daahern@cisco.com>
David
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
@ 2011-08-03 13:55 ` David Ahern
0 siblings, 0 replies; 23+ messages in thread
From: David Ahern @ 2011-08-03 13:55 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: aliguori, Avi Kivity, KVM mailing list, qemu-devel
On 08/03/2011 06:24 AM, Michael S. Tsirkin wrote:
> On Wed, Aug 03, 2011 at 02:48:05PM +0300, Avi Kivity wrote:
>> On 08/01/2011 08:44 PM, David Ahern wrote:
>>> qemu-kvm.git as of:
>>>
>>> commit dacdc4b10bafbb21120e1c24a9665444768ef999
>>> Merge: 7b69d4f 0af4922
>>> Author: Avi Kivity<avi@redhat.com>
>>> Date: Sun Jul 31 11:42:26 2011 +0300
>>>
>>> Merge branch 'upstream-merge' into next
>>>
>>> is aborting with the error:
>>>
>>> qemu-kvm: qemu-kvm.git/hw/vhost.c:123: vhost_dev_unassign_memory:
>>> Assertion `to>= 0' failed.
>>> Aborted
>>>
>>
>> It's a bug in vhost:
>>
>> /* Assign/unassign. Keep an unsorted array of non-overlapping
>> * memory regions in dev->mem. */
>> static void vhost_dev_unassign_memory(struct vhost_dev *dev,
>> uint64_t start_addr,
>> uint64_t size)
>> {
>> int from, to, n = dev->mem->nregions;
>> /* Track overlapping/split regions for sanity checking. */
>> int overlap_start = 0, overlap_end = 0, overlap_middle = 0, split = 0;
>>
>> for (from = 0, to = 0; from < n; ++from, ++to) {
>> struct vhost_memory_region *reg = dev->mem->regions + to;
>> uint64_t reglast;
>> uint64_t memlast;
>> uint64_t change;
>>
>> /* clone old region */
>> if (to != from) {
>> memcpy(reg, dev->mem->regions + from, sizeof *reg);
>> }
>>
>> /* No overlap is simple */
>> if (!ranges_overlap(reg->guest_phys_addr, reg->memory_size,
>> start_addr, size)) {
>> continue;
>> }
>>
>> /* Split only happens if supplied region
>> * is in the middle of an existing one. Thus it can not
>> * overlap with any other existing region. */
>> assert(!split);
>>
>> reglast = range_get_last(reg->guest_phys_addr, reg->memory_size);
>> memlast = range_get_last(start_addr, size);
>>
>> /* Remove whole region */
>> if (start_addr <= reg->guest_phys_addr && memlast >= reglast) {
>> --dev->mem->nregions;
>> --to;
>> assert(to >= 0);
>> ++overlap_middle;
>> continue;
>> }
>>
>>
>> We're removing the first region, and 'to' goes negative. Michael?
>
> Yes, that assert is wrong.
>
> --->
> Subject: vhost: remove an incorrect assert
>
> The 'to' can go negative when the first region gets removed
> (it gets incremented by to 0 immediately afterward), which
> makes the assertion fail. Nothing breaks if
> to < 0 here so just remove the assert.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>
> ----
>
> diff --git a/hw/vhost.c b/hw/vhost.c
> index c3d8821..19e7255 100644
> --- a/hw/vhost.c
> +++ b/hw/vhost.c
> @@ -120,7 +120,6 @@ static void vhost_dev_unassign_memory(struct vhost_dev *dev,
> if (start_addr <= reg->guest_phys_addr && memlast >= reglast) {
> --dev->mem->nregions;
> --to;
> - assert(to >= 0);
> ++overlap_middle;
> continue;
> }
>
Removing the assert appears to work fine.
Tested-by: David Ahern <daahern@cisco.com>
David
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
2011-08-03 13:55 ` [Qemu-devel] " David Ahern
@ 2011-08-03 15:00 ` Michael S. Tsirkin
-1 siblings, 0 replies; 23+ messages in thread
From: Michael S. Tsirkin @ 2011-08-03 15:00 UTC (permalink / raw)
To: David Ahern; +Cc: Avi Kivity, aliguori, qemu-devel, KVM mailing list
On Wed, Aug 03, 2011 at 07:55:47AM -0600, David Ahern wrote:
> Tested-by: David Ahern <daahern@cisco.com>
>
> David
Applied, thanks very much.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
@ 2011-08-03 15:00 ` Michael S. Tsirkin
0 siblings, 0 replies; 23+ messages in thread
From: Michael S. Tsirkin @ 2011-08-03 15:00 UTC (permalink / raw)
To: David Ahern; +Cc: aliguori, Avi Kivity, KVM mailing list, qemu-devel
On Wed, Aug 03, 2011 at 07:55:47AM -0600, David Ahern wrote:
> Tested-by: David Ahern <daahern@cisco.com>
>
> David
Applied, thanks very much.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
2011-08-03 15:00 ` [Qemu-devel] " Michael S. Tsirkin
@ 2011-08-04 18:48 ` David Ahern
-1 siblings, 0 replies; 23+ messages in thread
From: David Ahern @ 2011-08-04 18:48 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: Avi Kivity, aliguori, qemu-devel, KVM mailing list
On 08/03/2011 09:00 AM, Michael S. Tsirkin wrote:
> On Wed, Aug 03, 2011 at 07:55:47AM -0600, David Ahern wrote:
>> Tested-by: David Ahern <daahern@cisco.com>
>>
>> David
>
> Applied, thanks very much.
>
I assume this will make 0.15 since it is a regression? haven't seen the
patch applied to that branch yet.
David
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
@ 2011-08-04 18:48 ` David Ahern
0 siblings, 0 replies; 23+ messages in thread
From: David Ahern @ 2011-08-04 18:48 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: aliguori, Avi Kivity, KVM mailing list, qemu-devel
On 08/03/2011 09:00 AM, Michael S. Tsirkin wrote:
> On Wed, Aug 03, 2011 at 07:55:47AM -0600, David Ahern wrote:
>> Tested-by: David Ahern <daahern@cisco.com>
>>
>> David
>
> Applied, thanks very much.
>
I assume this will make 0.15 since it is a regression? haven't seen the
patch applied to that branch yet.
David
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
2011-08-04 18:48 ` [Qemu-devel] " David Ahern
@ 2011-08-04 19:17 ` Michael S. Tsirkin
-1 siblings, 0 replies; 23+ messages in thread
From: Michael S. Tsirkin @ 2011-08-04 19:17 UTC (permalink / raw)
To: David Ahern; +Cc: aliguori, Avi Kivity, KVM mailing list, qemu-devel
On Thu, Aug 04, 2011 at 12:48:49PM -0600, David Ahern wrote:
>
>
> On 08/03/2011 09:00 AM, Michael S. Tsirkin wrote:
> > On Wed, Aug 03, 2011 at 07:55:47AM -0600, David Ahern wrote:
> >> Tested-by: David Ahern <daahern@cisco.com>
> >>
> >> David
> >
> > Applied, thanks very much.
> >
>
> I assume this will make 0.15 since it is a regression?
How is this a regression in 0.15? I thought it's an old bug
exposed by the memory API which I expect is not going into 0.15.
> haven't seen the
> patch applied to that branch yet.
>
> David
My branch will have to get merged in trunk first.
--
MST
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
@ 2011-08-04 19:17 ` Michael S. Tsirkin
0 siblings, 0 replies; 23+ messages in thread
From: Michael S. Tsirkin @ 2011-08-04 19:17 UTC (permalink / raw)
To: David Ahern; +Cc: aliguori, Avi Kivity, KVM mailing list, qemu-devel
On Thu, Aug 04, 2011 at 12:48:49PM -0600, David Ahern wrote:
>
>
> On 08/03/2011 09:00 AM, Michael S. Tsirkin wrote:
> > On Wed, Aug 03, 2011 at 07:55:47AM -0600, David Ahern wrote:
> >> Tested-by: David Ahern <daahern@cisco.com>
> >>
> >> David
> >
> > Applied, thanks very much.
> >
>
> I assume this will make 0.15 since it is a regression?
How is this a regression in 0.15? I thought it's an old bug
exposed by the memory API which I expect is not going into 0.15.
> haven't seen the
> patch applied to that branch yet.
>
> David
My branch will have to get merged in trunk first.
--
MST
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
2011-08-04 19:17 ` [Qemu-devel] " Michael S. Tsirkin
@ 2011-08-04 19:23 ` David Ahern
-1 siblings, 0 replies; 23+ messages in thread
From: David Ahern @ 2011-08-04 19:23 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: aliguori, Avi Kivity, KVM mailing list, qemu-devel
On 08/04/2011 01:17 PM, Michael S. Tsirkin wrote:
> On Thu, Aug 04, 2011 at 12:48:49PM -0600, David Ahern wrote:
>>
>>
>> On 08/03/2011 09:00 AM, Michael S. Tsirkin wrote:
>>> On Wed, Aug 03, 2011 at 07:55:47AM -0600, David Ahern wrote:
>>>> Tested-by: David Ahern <daahern@cisco.com>
>>>>
>>>> David
>>>
>>> Applied, thanks very much.
>>>
>>
>> I assume this will make 0.15 since it is a regression?
>
> How is this a regression in 0.15? I thought it's an old bug
> exposed by the memory API which I expect is not going into 0.15.
Is qemu-kvm.git not tagged as 0.15 rc?
David
>
>> haven't seen the
>> patch applied to that branch yet.
>>
>> David
>
> My branch will have to get merged in trunk first.
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [Qemu-devel] qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed.
@ 2011-08-04 19:23 ` David Ahern
0 siblings, 0 replies; 23+ messages in thread
From: David Ahern @ 2011-08-04 19:23 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: aliguori, Avi Kivity, KVM mailing list, qemu-devel
On 08/04/2011 01:17 PM, Michael S. Tsirkin wrote:
> On Thu, Aug 04, 2011 at 12:48:49PM -0600, David Ahern wrote:
>>
>>
>> On 08/03/2011 09:00 AM, Michael S. Tsirkin wrote:
>>> On Wed, Aug 03, 2011 at 07:55:47AM -0600, David Ahern wrote:
>>>> Tested-by: David Ahern <daahern@cisco.com>
>>>>
>>>> David
>>>
>>> Applied, thanks very much.
>>>
>>
>> I assume this will make 0.15 since it is a regression?
>
> How is this a regression in 0.15? I thought it's an old bug
> exposed by the memory API which I expect is not going into 0.15.
Is qemu-kvm.git not tagged as 0.15 rc?
David
>
>> haven't seen the
>> patch applied to that branch yet.
>>
>> David
>
> My branch will have to get merged in trunk first.
>
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2011-08-04 19:23 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-01 17:44 qemu-kvm aborts - vhost_dev_unassign_memory: Assertion `to >= 0' failed David Ahern
2011-08-01 17:44 ` [Qemu-devel] " David Ahern
2011-08-01 18:04 ` David Ahern
2011-08-01 18:04 ` [Qemu-devel] " David Ahern
2011-08-03 9:01 ` Avi Kivity
2011-08-03 9:01 ` [Qemu-devel] " Avi Kivity
2011-08-03 9:33 ` Wen Congyang
2011-08-03 11:48 ` Avi Kivity
2011-08-03 11:48 ` [Qemu-devel] " Avi Kivity
2011-08-03 12:24 ` Michael S. Tsirkin
2011-08-03 12:24 ` [Qemu-devel] " Michael S. Tsirkin
2011-08-03 13:55 ` David Ahern
2011-08-03 13:55 ` [Qemu-devel] " David Ahern
2011-08-03 15:00 ` Michael S. Tsirkin
2011-08-03 15:00 ` [Qemu-devel] " Michael S. Tsirkin
2011-08-04 18:48 ` David Ahern
2011-08-04 18:48 ` [Qemu-devel] " David Ahern
2011-08-04 19:17 ` Michael S. Tsirkin
2011-08-04 19:17 ` [Qemu-devel] " Michael S. Tsirkin
2011-08-04 19:23 ` David Ahern
2011-08-04 19:23 ` [Qemu-devel] " David Ahern
2011-08-03 13:07 ` Michael S. Tsirkin
2011-08-03 13:07 ` Michael S. Tsirkin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.