Bug 1256618

Summary: Chardev remains busy after hot remove vhost-user that connected to the chardev.
Product: Red Hat Enterprise Linux 7 Reporter: Qian Guo <qiguo>
Component: qemu-kvm-rhevAssignee: Marc-Andre Lureau <marcandre.lureau>
Status: CLOSED ERRATA QA Contact: Pei Zhang <pezhang>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: chayang, huding, juzhang, knoel, michen, mrezanin, pezhang, virt-maint, xfu, xiywang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.9.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 23:29:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Qian Guo 2015-08-25 06:50:44 UTC
Description of problem:
1.Can not hot remove the chardev after hot remove the vhost-user, qemu reports that the chardev is busy

2.Can not hot plug the vhost-user to the chardev which was used by an original vhost-user(not used by any vhost-uesr now.)

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.3.0-18.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Boot guest with chardev and vhost-user that user the chardev.
...
-chardev socket,id=charnet0,path=/var/run/openvswitch/vhost-user1 \
-netdev type=vhost-user,id=hostnet0,chardev=charnet0 \
-device virtio-net-pci,netdev=hostnet0,mrg_rxbuf=off,id=net0,mac=52:54:00:01:0b:11,bus=pci.0,addr=0x9
...

2.Try to remove the virtual nic and vhost-user netdev.
(qemu) device_del net0 
(qemu) netdev_del hostnet0 

3.Try to remove the chardev that the vhost-user used:


Actual results:
Failed due to chardev busy:

(qemu) chardev-remove charnet0 
Chardev 'charnet0' is busy


Expected results:
Can hot remove the chardev, and if not remove the chardev, can reuse the chardev for the new vhost-user.

Additional info:

Comment 2 Marc-Andre Lureau 2015-09-03 14:22:13 UTC
sent a RFC to qemu-devel "vhost-user: release chardev on cleanup"

Comment 5 Marc-Andre Lureau 2016-04-06 15:39:15 UTC
no comments on rfc, patches resent

Comment 8 Ademar Reis 2017-02-03 21:20:00 UTC
(In reply to Marc-Andre Lureau from comment #7)
> still under review upstream, moving to 7.5

Merged upstream:

commit e0b283e7c5b020c3e54629d8b82117db0af21cca
Author: Marc-André Lureau <marcandre.lureau>
Date:   Tue Jan 24 23:02:58 2017 +0400

    vhost-user: delete chardev on cleanup
    
    Remove the chardev implicitly when cleaning up the netdev. This
    prevents from reusing the chardev since it would be in an incorrect
    state with the slave.
    
    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1256618
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau>
    Reviewed-by: Michael S. Tsirkin <mst>
    Signed-off-by: Michael S. Tsirkin <mst>
    Reviewed-by: Eric Blake <eblake>

Comment 10 Pei Zhang 2017-05-18 14:21:04 UTC
Reproduce:
Versions:
3.10.0-666.el7.x86_64
qemu-kvm-rhev-2.3.0-21.el7.x86_64

Steps:
1. Boot guest with vhost-user client mode
# /usr/libexec/qemu-kvm \
-name guest=rhel7.4_nonrt \
-cpu host \
-m 8G \
-smp 4,sockets=1,cores=4,threads=1 \
-object memory-backend-file,id=ram-node0,prealloc=yes,mem-path=/dev/hugepages,share=yes,size=8G,host-nodes=0,policy=bind \
-numa node,nodeid=0,cpus=0-3,memdev=ram-node0 \
-drive file=/home/images_nfv-virt-rt-kvm/rhel7.4_nonrt.qcow2,format=qcow2,if=none,id=drive-virtio-disk0,cache=none,aio=threads \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-virtio-disk0,id=virtio-disk0 \
-chardev socket,id=charnet1,path=/var/run/openvswitch/vhost-user0 \
-netdev vhost-user,chardev=charnet1,id=hostnet1 \
-device virtio-net-pci,netdev=hostnet1,id=net1,mac=18:66:da:5f:dd:02 \
-msg timestamp=on \
-monitor stdio \
-vnc :2

2. Do hot-plug vhost-user chardev, fail. 
(qemu) device_del net1 
(qemu) netdev_del hostnet1 
(qemu) chardev-remove charnet1 
Chardev 'charnet1' is busy

So this bug has been reproduced.


==Verification==
Versions:
qemu-kvm-rhev-2.9.0-5.el7.x86_64
3.10.0-666.el7.x86_64

Steps:
1. Boot guest with vhost-user client mode
Same as above Step 1 in reproduce.

2. Do hot-plug vhost-user devices, after netdev_del, the chardev has been removed.
(qemu) device_del net1   
(qemu) netdev_del hostnet1 
(qemu) info chardev 
parallel0: filename=vc
serial0: filename=vc
compat_monitor0: filename=stdio

3. Check devices in guest, this vhost-user network has been removed.

So this bug has been fixed well. Thanks.


Move this bug to 'VERIFIED'.

Comment 12 errata-xmlrpc 2017-08-01 23:29:42 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 13 errata-xmlrpc 2017-08-02 01:07:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 14 errata-xmlrpc 2017-08-02 01:59:20 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 15 errata-xmlrpc 2017-08-02 02:40:06 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 16 errata-xmlrpc 2017-08-02 03:04:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 17 errata-xmlrpc 2017-08-02 03:24:58 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 18 xiywang 2017-10-09 01:14:26 UTC
*** Bug 1256619 has been marked as a duplicate of this bug. ***