Bug 617085 - core dumped when add netdev to VM with vhost on
Summary: core dumped when add netdev to VM with vhost on
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: qemu-kvm (Show other bugs)
(Show other bugs)
Version: 6.0
Hardware: All Linux
Target Milestone: rc
: ---
Assignee: Jes Sorensen
QA Contact: Virtualization Bugs
Depends On:
TreeView+ depends on / blocked
Reported: 2010-07-22 07:18 UTC by Shirley Zhou
Modified: 2015-03-05 00:51 UTC (History)
9 users (show)

Fixed In Version: qemu-kvm-
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-11-10 21:26:47 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
coredump-analyze (12.17 KB, text/plain)
2010-07-22 07:19 UTC, Shirley Zhou
no flags Details

Description Shirley Zhou 2010-07-22 07:18:12 UTC
Description of problem:
core dumped when add netdev with vhost on for window guest

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Run windows guest with cli:
/usr/libexec/qemu-kvm -m 2G -smp 2 -cpu qemu64,+x2apic -usbdevice tablet -drive file=/home/win08R2.raw,if=none,id=drive-virtio0,boot=on,werror=stop,rerror=stop,cache=none,format=raw -device virtio-blk-pci,drive=drive-virtio0,id=virtio-blk-pci0 -netdev tap,id=hostnet0,script=/etc/qemu-ifup,vhost=on,ifname=virtio_nic_1 -device virtio-net-pci,netdev=hostnet0,mac=02:00:78:3F:20:1f,bus=pci.0 -netdev tap,id=hostnet1,script=/etc/qemu-ifup,ifname=e1000_1_1 -device e1000,netdev=hostnet1,mac=01:00:78:3F:20:1f,bus=pci.0,id=e1000-1 -uuid 1234127c-8765-4e67-95da-8dd0a8891cc4 -name winxp -qmp tcp:0:4445,server,nowait -boot c -monitor stdio -spice port=5930,disable-ticketing -vga qxl
2.Install virtio network driver from http://download.lab.bos.redhat.com/devel/RHEV/virtio-win/1.1.8-0/
3.do netdev hot add 
from qmp :
{ "execute": "netdev_add", "arguments":{"type":"tap","id":"hostnet2","script":"/etc/qemu-ifup","vhost":"on","ifname":"virtio_nic_plug"}}
or from monitor:
 netdev_add tap,id=hostnet3,script=/etc/qemu-ifup,vhost=on,ifname=virtio_nic_3

Actual results:
Core dumped and qemu aborted after step3,please see attached core dump analyze file.

Expected results:
netdev should be added.

Additional info:

This issue does not exist when not using vhost.
{ "execute": "netdev_add", "arguments":{"type":"tap","id":"hostnet2","script":"/etc/qemu-ifup","ifname":"virtio_nic_plug"}}

Comment 1 Shirley Zhou 2010-07-22 07:19:43 UTC
Created attachment 433613 [details]

Comment 3 RHEL Product and Program Management 2010-07-22 07:37:54 UTC
This issue has been proposed when we are only considering blocker
issues in the current Red Hat Enterprise Linux release.

** If you would still like this issue considered for the current
release, ask your support representative to file as a blocker on
your behalf. Otherwise ask that it be considered for the next
Red Hat Enterprise Linux release. **

Comment 4 Amos Kong 2010-07-22 10:31:39 UTC
I can reproduce this bug when adding netdev to linux guests.

qemu) netdev_add tap,id=hostnet1,script=/etc/qemu-ifup-switch,vhost=on,ifname=virtio_nic_1
qemu-kvm: /builddir/build/BUILD/qemu-kvm- vhost_dev_unassign_memory: Assertion `to >= 0' failed

Change subject to 'core dumped when add netdev to VM with vhost on'

Comment 5 Dor Laor 2010-07-22 20:57:38 UTC
What happens when vhost-off?

Comment 6 Jes Sorensen 2010-07-22 21:22:01 UTC
Not sure if this is related, but in the backtrace it has
vhost_client_set_memory() calling vhost_dev_unassign_memory(). However
the code does this:

    vhost_dev_unassign_memory(dev, start_addr, size);
    if (flags == IO_MEM_RAM) {
        /* Add given mapping, merging adjacent regions if any */
        vhost_dev_assign_memory(dev, start_addr, size,
    } else {
        /* Remove old mapping for this memory, if any. */
        vhost_dev_unassign_memory(dev, start_addr, size);

Ie. if flags != IO_MEM_RAM, we end up calling vhost_dev_unassign_memory()
twice with the exact same arguments..... Could it be the first call
to vhost_dev_unassign_memory() shouldn't be there?


Comment 7 Shirley Zhou 2010-07-23 01:50:21 UTC
(In reply to comment #5)
> What happens when vhost-off?    
When use vhost=off or without vhost parameter, netdev can be added successfully.

Comment 8 Jes Sorensen 2010-07-23 13:15:52 UTC
I can reproduce this, but I don't see it with upstream qemu or qemu-kvm.

Comment 9 Jes Sorensen 2010-07-23 13:56:05 UTC
Ok, spoke too fast, it happens with upstream qemu-kvm too, there is just a
delay from entering the command until it crashes.

Comment 13 Shirley Zhou 2010-07-28 10:15:11 UTC
Verify this bug on RHEL6 and win7 guest with qemu-kvm-, this bug does not exist when add netdev with vhost on.

Change status to verified.

Comment 14 releng-rhel@redhat.com 2010-11-10 21:26:47 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.

Note You need to log in before you can comment on or make changes to this bug.