Bug 1052041 - Rubbish serial port device is generated once failed to hotplug a serial port
Summary: Rubbish serial port device is generated once failed to hotplug a serial port
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Amit Shah
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-13 07:44 UTC by Qunfang Zhang
Modified: 2015-03-05 09:43 UTC (History)
10 users (show)

Fixed In Version: qemu-kvm-rhev-2.1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 09:43:39 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:0624 normal SHIPPED_LIVE Important: qemu-kvm-rhev security, bug fix, and enhancement update 2015-03-05 14:37:36 UTC

Description Qunfang Zhang 2014-01-13 07:44:03 UTC
Description of problem:
Execute a "failed" serial port hotplug opearation, for example, hotplug a port to the chardev which is already in use. Will generate a rubbish serial port with weird name.

Version-Release number of selected component (if applicable):
kernel-3.10.0-65.el7.x86_64
qemu-kvm-rhev-1.5.3-31.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Boot up a guest with virtio serial bus and port. 
/usr/libexec/qemu-kvm ...... -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x7 -chardev socket,id=channel2,path=/tmp/helloworld2,server,nowait -device virtserialport,chardev=channel2,name=port2,bus=virtio-serial0.0,id=port2  


2. Hotplug a port2 on chardev "channel2"

{"execute":"device_add","arguments":{"driver":"virtserialport","bus":"virtio-serial0.0","chardev":"channel2","name":"port3","id":"port3"}}
{"error": {"class": "GenericError", "desc": "Property 'virtserialport.chardev' can't take value 'channel2', it's in use"}}


3.(qemu) info qtree

4. Remove port2 and re-plug port3

{"execute":"device_del","arguments":{"id":"port2"}}
{"timestamp": {"seconds": 1389598901, "microseconds": 373473}, "event": "DEVICE_DELETED", "data": {"device": "port2", "path": "/machine/peripheral/port2"}}
{"return": {}}


{"execute":"device_add","arguments":{"driver":"virtserialport","bus":"virtio-serial0.0","chardev":"channel2","name":"port3","id":"port3"}}
{"return": {}}

5. (qemu) info qtree



Actual results:
After step 3:
type virtio-pci-bus
          dev: virtio-serial-device, id ""
            max_ports = 31
            bus: virtio-serial0.0
              type virtio-serial-bus
              dev: virtserialport, id "�'B�"
                chardev = <null>
                nr = 4294967295
                name = "port3"
                port -1, guest off, host off, throttle off
              dev: virtserialport, id "channel0"
                chardev = charchannel0
                nr = 3
                name = "com.redhat.spice.0"
                port 3, guest on, host on, throttle off
              dev: virtserialport, id "port2"
                chardev = channel2
                nr = 2
                name = "port2"
                port 2, guest off, host off, throttle off
              dev: virtserialport, id "port1"
                chardev = channel1
                nr = 1
                name = "port1"
                port 1, guest off, host off, throttle off


After step 5:

  dev: virtio-serial-device, id ""
            max_ports = 31
            bus: virtio-serial0.0
              type virtio-serial-bus
              dev: virtserialport, id "port3"
                chardev = channel2
                nr = 2
                name = "port3"
                port 2, guest off, host on, throttle off
              dev: virtserialport, id "device_del port2"
                chardev = <null>
                nr = 4294967295
                name = "port3"
                port -1, guest off, host off, throttle off
              dev: virtserialport, id "channel0"
                chardev = charchannel0
                nr = 3
                name = "com.redhat.spice.0"
                port 3, guest on, host on, throttle off
              dev: virtserialport, id "port1"
                chardev = channel1
                nr = 1
                name = "port1"
                port 1, guest off, host off, throttle off


Expected results:
No incorrect port device generated. 

Additional info:

Comment 2 Amit Shah 2014-01-14 07:18:21 UTC
Please see bug 1040334.  This is a dup of that one, which is a dup of bug 1003773.  However, the fix is in 1.5.3-23, and you're using a newer version (-31).

Can you try with -23 to see if we regressed again?

Comment 3 Qunfang Zhang 2014-01-14 07:28:43 UTC
(In reply to Amit Shah from comment #2)
> Please see bug 1040334.  This is a dup of that one, which is a dup of bug
> 1003773.  However, the fix is in 1.5.3-23, and you're using a newer version
> (-31).
> 
> Can you try with -23 to see if we regressed again?

Hi, Amit

This bug could be reproduced on -23 as well.

Comment 5 Amit Shah 2014-01-27 06:52:20 UTC
In bug 1040334, which has the same problem, Mike said build qemu-kvm-rhev-1.5.3-39.el7.x86_64 works fine for him.  Can you confirm?

Comment 6 Qunfang Zhang 2014-01-27 08:06:16 UTC
Just tested on qemu-kvm-1.5.3-41.el7.x86_64, still have problem. 

CLI:

/usr/libexec/qemu-kvm ...... -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x7 -chardev socket,id=channel2,path=/tmp/helloworld2,server,nowait -device virtserialport,chardev=channel2,name=port2,bus=virtio-serial0.0,id=port2  

(1) (qemu) info qtree

     dev: virtserialport, id "port2"
                chardev = channel2
                nr = 2
                name = "port2"
                port 2, guest off, host off, throttle off

(2) Hot-plug port2 to channel2: 
{"execute":"device_add","arguments":{"driver":"virtserialport","bus":"virtio-serial0.0","chardev":"channel2","name":"port3","id":"port3"}}
{"error": {"class": "GenericError", "desc": "Property 'virtserialport.chardev' can't take value 'channel2', it's in use"}}

(qemu)info qtree

 dev: virtserialport, id ""
                chardev = <null>
                nr = 4294967295
                name = "port3"
                port -1, guest off, host off, throttle off
            
              dev: virtserialport, id "port2"
                chardev = channel2
                nr = 2
                name = "port2"
                port 2, guest off, host off, throttle off

(3) (qemu) device_del port3

(qemu) info qtree
  dev: virtserialport, id "p"
                chardev = <null>
                nr = 4294967295
                name = "port3"
                port -1, guest off, host off, throttle off

(4) re-hotplug port3 to channel2:

{"execute":"device_add","arguments":{"driver":"virtserialport","bus":"virtio-serial0.0","chardev":"channel2","name":"port3","id":"port3"}}
{"return": {}}

(qemu) info qtree:

              type virtio-serial-bus
              dev: virtserialport, id "port3"
                chardev = channel2
                nr = 2
                name = "port3"
                port 2, guest off, host off, throttle off
              dev: virtserialport, id "port>"
                chardev = <null>
                nr = 4294967295
                name = "port3"
                port -1, guest off, host off, throttle off

Comment 7 Qunfang Zhang 2014-01-27 09:04:39 UTC
Hi, Amit

I just confirmed qemu-kvm-rhev-1.5.3-39.el7.x86_64 still have the problem.  Thanks.

Comment 8 Qunfang Zhang 2014-01-27 09:23:14 UTC
The difference between this bug steps and bcao's bug 1040334:

<qzhang> amit, bcao hotplugs a virtserialport with nr=0, first time failed and "info qtree" is normal,  the second time succeeds but "info qtree" shows a weird input for that port. My issue is hot-plug a port the first time to make it fail (eg, to an in-use chardev), there's a weird data in the "info qtree" output. 

<amit> qzhang: so you're using an invalid chardev the first time itself, whereas bcao uses a valid one
<amit> qzhang: (invalid I mean one that cannot be used)
<qzhang> amit, yes~

Comment 10 Amit Shah 2014-07-14 10:32:10 UTC
Can't reproduce this upstream:

./x86_64-softmmu/qemu-system-x86_64 -m 512 -cpu host -enable-kvm -device virtio-serial-pci -chardev socket,id=channel2,path=/var/tmp/helloworld2,server,nowait -device virtserialport,chardev=channel2,name=port2,id=port2 -monitor stdio

(qemu) device_add virtserialport,id=port3,chardev=channel2,name=port3
Property 'virtserialport.chardev' can't take value 'channel2', it's in use
(qemu) info qtree

<snip>
      dev: virtio-serial-pci, id ""
        ioeventfd = true
        vectors = 2 (0x2)
        class = 1920 (0x780)
        indirect_desc = true
        event_idx = true
        max_ports = 31 (0x1f)
        addr = 04.0
        romfile = ""
        rombar = 1 (0x1)
        multifunction = false
        command_serr_enable = true
        class Class 0780, addr 00:04.0, pci id 1af4:1003 (sub 1af4:0003)
        bar 0: i/o at 0xc040 [0xc05f]
        bar 1: mem at 0xfebf1000 [0xfebf1fff]
        bus: virtio-bus
          type virtio-pci-bus
          dev: virtio-serial-device, id ""
            max_ports = 31 (0x1f)
            bus: virtio-serial-bus.0
              type virtio-serial-bus
              dev: virtserialport, id "port2"
                chardev = "channel2"
                nr = 1 (0x1)
                name = "port2"
                port 1, guest off, host off, throttle off
<snip>

(qemu) device_del port2
(qemu) device_add virtserialport,id=port3,chardev=channel2,name=port3
(qemu) info qtree

<snip>
      dev: virtio-serial-pci, id ""
        ioeventfd = true
        vectors = 2 (0x2)
        class = 1920 (0x780)
        indirect_desc = true
        event_idx = true
        max_ports = 31 (0x1f)
        addr = 04.0
        romfile = ""
        rombar = 1 (0x1)
        multifunction = false
        command_serr_enable = true
        class Class 0780, addr 00:04.0, pci id 1af4:1003 (sub 1af4:0003)
        bar 0: i/o at 0xc040 [0xc05f]
        bar 1: mem at 0xfebf1000 [0xfebf1fff]
        bus: virtio-bus
          type virtio-pci-bus
          dev: virtio-serial-device, id ""
            max_ports = 31 (0x1f)
            bus: virtio-serial-bus.0
              type virtio-serial-bus
              dev: virtserialport, id "port3"
                chardev = "channel2"
                nr = 1 (0x1)
                name = "port3"
                port 1, guest off, host off, throttle off
<snip>

Comment 15 langfang 2014-08-29 02:44:12 UTC
Reproduce this bug as follow version:

Host:
# uname -r
3.10.0-144.el7.x86_64
qemu-kvm-rhev-1.5.3-30.el7.x86_64

Steps:
1.Boot guest with 
 ...-vga std -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x7 -chardev socket,id=channel2,path=/tmp/helloworld2,server,nowait -device virtserialport,chardev=channel2,name=port2,bus=virtio-serial0.0,id=port2 ...

2. Hotplug a port2 on chardev "channel2"

{"execute":"device_add","arguments":{"driver":"virtserialport","bus":"virtio-serial0.0","chardev":"channel2","name":"port3","id":"port3"}}
{"error": {"class": "GenericError", "desc": "Property 'virtserialport.chardev' can't take value 'channel2', it's in use"}}


3.(qemu) info qtree

4. Remove port2 and re-plug port3

{"execute":"device_del","arguments":{"id":"port2"}}
{"timestamp": {"seconds": 1389598901, "microseconds": 373473}, "event": "DEVICE_DELETED", "data": {"device": "port2", "path": "/machine/peripheral/port2"}}
{"return": {}}


{"execute":"device_add","arguments":{"driver":"virtserialport","bus":"virtio-serial0.0","chardev":"channel2","name":"port3","id":"port3"}}
{"return": {}}

5. (qemu) info qtree

Results:

after step 3
bus: virtio-bus
          type virtio-pci-bus
          dev: virtio-serial-device, id ""
            max_ports = 31
            bus: virtio-serial0.0
              type virtio-serial-bus
              dev: virtserialport, id "`�_w�"
                chardev = <null>
                nr = 4294967295
                name = "port3"
                port -1, guest off, host off, throttle off
              dev: virtserialport, id "port2"
                chardev = channel2
                nr = 1
                name = "port2"
                port 1, guest off, host off, throttle off
after step 5
        bus: virtio-bus
          type virtio-pci-bus
          dev: virtio-serial-device, id ""
            max_ports = 31
            bus: virtio-serial0.0
              type virtio-serial-bus
              dev: virtserialport, id "port3"
                chardev = channel2
                nr = 1
                name = "port3"
                port 1, guest off, host off, throttle off
              dev: virtserialport, id "�������������������������������������������?"
                chardev = <null>
                nr = 4294967295
                name = "port3"
                port -1, guest off, host off, throttle off


Test on latest version:
# uname -r
3.10.0-144.el7.x86_64
# rpm -q qemu-kvm-rhev
qemu-kvm-rhev-2.1.0-3.el7.x86_64

Steps as same as reproduce

Resutls:
After step3
..
     bus: virtio-bus
          type virtio-pci-bus
          dev: virtio-serial-device, id ""
            max_ports = 31 (0x1f)
            bus: virtio-serial0.0
              type virtio-serial-bus
              dev: virtserialport, id "port2"
                chardev = "channel2"
                nr = 1 (0x1)
                name = "port2"
                port 1, guest off, host off, throttle off

..
After step5
...
 bus: virtio-bus
          type virtio-pci-bus
          dev: virtio-serial-device, id ""
            max_ports = 31 (0x1f)
            bus: virtio-serial0.0
              type virtio-serial-bus
              dev: virtserialport, id "port3"
                chardev = "channel2"
                nr = 1 (0x1)
                name = "port3"
                port 1, guest off, host off, throttle off
..


According to above test ,this bug has been fixed.

Comment 18 errata-xmlrpc 2015-03-05 09:43:39 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://rhn.redhat.com/errata/RHSA-2015-0624.html


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