RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 957328 - win7-32 guest can not hotunplug virtio-serial-pci when one virtserialport is transferring data and the other has finished data transfer
Summary: win7-32 guest can not hotunplug virtio-serial-pci when one virtserialport is ...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: virtio-win
Version: 6.5
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Gal Hammer
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-04-27 07:59 UTC by lijin
Modified: 2014-01-01 16:39 UTC (History)
11 users (show)

Fixed In Version: virtio-win-prewhql-0.1-68
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-01 16:39:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
screenshoot while guest promt can not delete virtio-serial driver (8.46 KB, image/png)
2013-04-27 07:59 UTC, lijin
no flags Details

Description lijin 2013-04-27 07:59:20 UTC
Created attachment 740737 [details]
screenshoot while guest promt can not delete virtio-serial driver

Description of problem:
when do hotunplug virtio-serial-pci,win7-32 guest prompt "Problem Ejecting Virtio-serial Driver"(as the attachment shows)

When only use one port(both vport0p1&vport0p2) transferring data from host to guest or from guest to host,not hit this issue;
When two ports are both transferring data at the hotunplug time,not hit this issue;
Only when two ports are both being used,and one port have finished the transferring and the other is doing the transfer,doing the hotunplug,guest hit this issue.

Version-Release number of selected component (if applicable):
kernel-2.6.32-278.el6.x86_64
qemu-kvm-0.12.1.2-2.295.el6.x86_64
virtio-win-prewhql-0.1-29

How reproducible:
3/10

Steps to Reproduce:
1.boot a win7-32 guest with one virtio-serial-pci and two virtserialport2:
/usr/libexec/qemu-kvm -drive file=win7-32-serail-59,if=none,cache=writethrough,media=disk,format=qcow2,id=disk1 -device ide-drive,id=ide0-0-0,drive=disk1,bootindex=0 -device virtio-serial-pci,id=virtio-serial0,max_ports=31,bus=pci.0 -chardev socket,path=/tmp/tt0,server,nowait,id=chardev0 -device virtserialport,chardev=chardev0,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port0 -chardev socket,path=/tmp/tt1,server,nowait,id=chardev1 -device virtserialport,chardev=chardev1,name=com.redhat.rhevm.vdsm1,bus=virtio-serial0.0,id=port1 -monitor stdio -netdev tap,id=hostnet0 -device e1000,netdev=hostnet0,id=net0,mac=52:54:06:7f:f9:56,bus=pci.0,addr=0x4 -boot menu=on -spice port=5900,disable-ticketing -vga qxl -chardev file,path=/root/console.log,id=serial1 -device isa-serial,chardev=serial1,id=s1 -usb -device usb-tablet,id=tablet1 -M rhel6.4.0 -smp 2,cores=2,threads=1,sockets=1 -m 3G -enable-kvm -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0

2.Transferring data form host to guest via port0 in a loop
eg:
in the guest # for ((;;)) ;do python VirtIOChannel_guest_reieve.py
com.redhat.rhevm.vdsm; done
on the host # for ((;;)) ;do python serial-host-send.py /tmp/tt0 ; done

3.Transferring data from guest to host via port1 in a loop
eg: 
on the host # for ((;;)) ; do python serial-host-receive.py /tmp/tt1; done
in the guest #for ((;;)) ; do python VirtIOChannel_guest_send.py com.redhat.rhevm.vdsm1;done


4.hotunplug the virtio-serial-pci
eg:(qemu)device_del virtio-serial0

Actual results:
guest prompts a window as "Problem ejecting virtio-serial Driver:windows can not stop your 'vport0p2' device because a programme is still using it.Close any programmes that might be using the device,and then try again later".
And in device manager the virtio-serial Driver still exist.

Expected result:
virtio-serial-pci can be delete successfully.

Additional info:

Comment 2 Gal Hammer 2013-06-16 14:35:54 UTC
virtio-win-prewhql-0.1-29 is quite old and I was unable to reproduce with virtio-win-prewhql-0.1-64. It was possible to unplug the device.

Comment 3 lijin 2013-06-17 03:17:46 UTC
(In reply to Gal Hammer from comment #2)
> virtio-win-prewhql-0.1-29 is quite old and I was unable to reproduce with
> virtio-win-prewhql-0.1-64. It was possible to unplug the device.

Sorry,my mistake,the version is virtio-win-prewhql-0.1-59,instead of virtio-win-prewhql-0.1-29.

And retest this issue in build 59 && build 64,this issue still exist;
But if I modify the host send script:let host sleep 1 second to execute next date transfer,the virtio-serial-pci can be removed successfully both in build59 and build 64.

Sounds it seems like bug949897:comment3 and comment4,https://bugzilla.redhat.com/show_bug.cgi?id=949897,is this behavior also by design?

Comment 4 Mike Cao 2013-06-17 07:01:43 UTC
Based on comment #3 ,Move status to assigned

Comment 5 Gal Hammer 2013-07-02 08:44:38 UTC
(In reply to lijin from comment #3)

> Sounds it seems like bug949897:comment3 and
> comment4,https://bugzilla.redhat.com/show_bug.cgi?id=949897,is this behavior
> also by design?

No. If you remove a device from the guest the driver should handle the removal and exit.

Comment 6 Mike Cao 2013-07-05 03:23:46 UTC
lijin,pls retest it according to comment #5

Comment 7 lijin 2013-07-05 09:22:38 UTC
Reproduced this issue on virtio-win-prewhql59 
verified this issue on virtio-win-1.6.5-5

Steps:
1.boot a win7-32 guest:
/usr/libexec/qemu-kvm -drive file=win7-32.qcow2,if=none,cache=writethrough,media=disk,format=qcow2,id=disk1 -device ide-drive,id=ide0-0-0,drive=disk1,bootindex=0 -device virtio-serial-pci,id=virtio-serial0,max_ports=31,bus=pci.0 -chardev socket,path=/tmp/tt0,server,nowait,id=chardev0 -device virtserialport,chardev=chardev0,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port0 -chardev socket,path=/tmp/tt1,server,nowait,id=chardev1 -device virtserialport,chardev=chardev1,name=com.redhat.rhevm.vdsm1,bus=virtio-serial0.0,id=port1 -monitor stdio -netdev tap,id=hostnet0 -device e1000,netdev=hostnet0,id=net0,mac=52:54:06:7f:f9:56,bus=pci.0,addr=0x4 -boot menu=on -spice port=5900,disable-ticketing -vga qxl -chardev file,path=/root/console.log,id=serial1 -device isa-serial,chardev=serial1,id=s1 -usb -device usb-tablet,id=tablet1 -M rhel6.4.0 -smp 2,cores=2,threads=1,sockets=1 -m 3G -enable-kvm -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -cdrom /usr/share/virtio-win/virtio-win-1.6.5.iso

2.transfer data between host and guest in different loops at the same time:
2.1)transfer data from host to guest in a loop(200);
guest:
cmd:for /l %i in (1,1,200) do python VirtIoChannel_guest_recieve.py com.redhat.rhevm.vdsm

host:sh host-to-guest.sh 
cat host-to-guest.sh 
for ((j=1;j<=200;j++));
do
python serial-host-send.py /tmp/tt0;
done;


2.2)transfer data from host to guest in a loop(1000);
host:sh guest-to-host.sh
cat guest-to-host.sh 
for ((i=1;i<=1000;i++));
d0
python serial-host-receive.py /tmp/tt1;
done

guest:cmd:for /l %i in (1,1,200) do python VirtIoChannel_Guest_send.py com.redhat.rhevm.vdsm1


3.when host-to-guest.sh script finished,hotunplug virtio-serial-pci:
(qemu) device_del virtio-serial0 
or 
click “Safely remove Hardware and Eject Media” in the lower right corner,then click "Eject Virtio-serial Driver"

Actual Results:
on both build 59 and virito-win-1.6.5-5,windows prompt an error window as the attachment.

Based on above ,this issue has not been fixed.

Note:
if I add sleep 1 command to script host-to-guest.sh,neither build59 nor virtio-win-1.6.5-5 hit this issue.
cat host-to-guest-new.sh 
for ((j=1;j<=200;j++));
do
python serial-host-send.py /tmp/tt0;
sleep 1;
done;

Comment 8 Gal Hammer 2013-08-08 11:24:26 UTC
Commit 3d6db65653029bba3c56f480397929d3517a4d22 seems to handle this bug as well.

Comment 9 Gal Hammer 2013-08-08 11:42:01 UTC
*** Bug 967400 has been marked as a duplicate of this bug. ***

Comment 10 lijin 2013-08-14 06:35:14 UTC
Reproduced this issue on virtio-win-prewhql-0.1-59
Verified this issue on virtio-win-prewhql-0.1-67

steps same as comment #0

Actual Results:
both on virtio-win-prewhql-0.1-59 and virtio-win-prewhql-0.1-67,cannot hotunplug virtio-serial-pci while one port is transferring data and the other has finished transfering.guest still prompt the same warning as the attachment displays.

Based on above ,this issue has not been fixed.

Comment 11 guo jiang 2013-08-14 07:28:16 UTC
Hi, Gal

QE retested this issue in win7-32 with virtio-win-prewhql-0.1-67 on rhel6.5 host. There is no problem for "continuous hotunplug serial-bus/hotplug serial-bus&virtserialport in a loop during virtio serial in use". "continuous hotunplug/plug virtserialport in a loop during transferring data from guest to host" is also pass without error, But "continuous hotunplug/plug virtserialport in a loop during transferring data from host to guest" still hit this issue. QE found some other issue about "hibernate during virtio-serial in use", The following is my test and summary.

Package version:
  kernel-2.6.32-411.el6.x86_64
  qemu-kvm-rhev-0.12.1.2-2.386.el6.x86_64
  virtio-win-prewhql-0.1.67
  spice-server-0.12.4-2.el6.x86_64  
  seabios-0.6.1.2-28.el6.x86_64
  vgabios-0.6b-3.7.el6.noarch

Steps:

1.Boot guest with CLI:
/usr/libexec/qemu-kvm -M rhel6.5.0 -m 2G -smp 2,cores=2 -cpu cpu64-rhel6,+x2apic,family=0xf -usb -device usb-tablet -drive file=win7-32.qcow2,if=none,id=drive-ide0-0-0,format=qcow2,rerror=stop,werror=stop,cache=none -device ide-drive,drive=drive-ide0-0-0,id=ide0-0-0-0,bootindex=1 -netdev tap,sndbuf=0,id=hostnet0,script=/etc/qemu-ifup,downscript=no -device e1000,netdev=hostnet0,mac=00:43:42:a1:22:31,id=net0 -uuid a8b4c1e5-3634-4426-a23d-c7b6288faa48 -no-kvm-pit-reinjection -chardev socket,id=111a,path=/tmp/monitor-win7-32-serial-67,server,nowait -mon chardev=111a,mode=readline -name win7-32-serial-67 -spice port=5931,disable-ticketing -vga qxl -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16 -chardev socket,id=channel0,path=/tmp/port0,server,nowait -chardev socket,id=channel1,path=/tmp/port1,server,nowait -device virtserialport,chardev=channel0,name=com.redhat.rhevm.vdsm0,bus=virtio-serial0.0,id=port0,nr=1 -device virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm1,bus=virtio-serial0.0,id=port1,nr=2 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -monitor stdio

2 transfer date:
 2.1 transferring date from guest to host for port0
  on host:running loop-guest-send.sh
   for((i=1;i<=30000000;i++))
   do
     python serial-host-receive.py  /tmp/port0;
   done
  on guest:running script
   for /l %i in (1,1,30000000)do python VirtIoChannel_Guest_send.py com.redhat.rhevm.vdsm0
 2.2 transferring data from host to guest for port1
  on guest: running script
   for  /l %i in (1,1,1000)do python VirtIoChannel_guest_recieve.py com.redhat.rhevm.vdsm1
  on host:running loop-guest-recieve.sh
   for((i=1;i<=100;i++))
   do
     python serial-host-send.py /tmp/port1;
     sleep 3;
   done

3 Hotunplug/plug and hibernate test: 
 3.1 Continuous hotunplug/plug virtserialport in a loop during transferring data from guest to host
 3.2 Continuous hotunplug serial-bus/hotplug serial-bus&virtserialport in a loop during transferring data from guest to host
 3.3 Continuous hotunplug/plug virtserialport in a loop during transferring data from host to guest
 3.4 Continuous hotunplug serial-bus/hotplug serial-bus&virtserialport in a loop during transferring data from host to guest
 3.5 hibernate guest(s4)& resume during transferring data from guest to host
 3.6 hibernate guest(s4)& resume during transferring data from host to guest

Test results:
 
 Test 3.1&3.2
    result:The original scripts of both sides could still work. we could see del/add of port0 in "Devices and Printers". Guest and qemu monitor did not report any error.
 
 Test 3.3
   (1).Doing hotunplug virtserialport: (qemu)device_del port1 
   The host qemu monitor show error "(qemu) qemu-kvm: virtio-serial-bus: Unexpected port id 2 for device virtio-serial0.0",the original guest script is frozen and port1 disappeared from "Devices and Printers". 
   (2).Doing hotplug port1:(qemu) device_add virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm1,bus=virtio-serial0.0,id=port1,nr=2
   The host qemu monitor show error "(qemu) qemu-kvm: virtio-serial-bus: Guest failure in adding port 2 for device virtio-serial0.0" and port1 still disappeared from "Devices and Printers".
   Note: If kill the original guest script after step(2), could hotplug port1.

 Test3.4
   (1).Hotunplug serial-bus: (qemu)device_del virtio-serial
   Could hotunplug serial-bus successfully, There is no error reported on both side.The two ports disappeared from "Devices and Printers".
   (2)Hotplug serial-bus&virtserialport
   Guest could receive data from host again(both scripts are original scripts).
  
 Test3.5.
    Guest could resume without BSOD
    The original host script is frozen, could not receive data from guest. if Kill it and restart again, host could receive data from the original guest script.
    
 Test3.6
    Test result:
    Guest could resume without BSOD
    The original guest script is frozen, could not receive data from host. if Kill it and restart again, guest could receive data from the original host script.

Comment 12 Mike Cao 2013-08-14 09:52:44 UTC
(In reply to guo jiang from comment #11)
> Hi, Gal
> 
> QE retested this issue in win7-32 with virtio-win-prewhql-0.1-67 on rhel6.5
> host. There is no problem for "continuous hotunplug serial-bus/hotplug
> serial-bus&virtserialport in a loop during virtio serial in use".
> "continuous hotunplug/plug virtserialport in a loop during transferring data
> from guest to host" is also pass without error, But "continuous
> hotunplug/plug virtserialport in a loop during transferring data from host
> to guest" still hit this issue. QE found some other issue about "hibernate
> during virtio-serial in use", The following is my test and summary.
> 
> 
Pls report new bugs if you find new issue and do not change bug status unless you verify it .

Based on comment #10.Re-Assigned this issue

Comment 13 Min Deng 2013-08-15 05:25:20 UTC
Hi Gal,

   Windows 2012 guest has similar issue via build 67 ,the virtio-serial-pci cannot be removed from the guest while data is transferring via those ports ride on the bus.A minor difference,there wasn't any warning message in windows 2012 guest when try to remove the bus.
   Any issues please let me know,thanks in advance.

Best Regards,
Min

Comment 14 Gal Hammer 2013-08-26 06:30:37 UTC
A simpler scenario to reproduce this bug:

1. Run a VM with one virtio-serial port.
2. On the guest start the listener (VirtIoChannel_guest_recieve.py).
3. On the host connect to the virtio's char device (for example /tmp/vport0) but do not send anything. I've used the "nc -U /tmp/vport0".
4. Remove the virtio-serial port.
5. Add the virtio-serial port.

A patch was posted and is waiting for a review.

Please note that the script which runs on the guest won't be able to recover after the device is restored. It needs to close and re-open the virtio port.

Comment 15 Mike Cao 2013-08-28 02:36:39 UTC
commit bc552e5619a976ebce666f2438f769925a3856e3

Comment 16 lijin 2013-08-28 09:18:51 UTC
Reproduced this issue on virtio-win-prewhql-59
Retest this issue on virtio-win-prewhql-68

steps same as comment #14

Actual Results:
both on virtio-win-prewhql-59 and virtio-win-prewhql-68,guest can remove the virtioserialport correctly,but still cannot remove the virtio-serial-pci,it prompts the warning as the attachment.

Based on above ,this issue has not been fixed.

Comment 17 Gal Hammer 2013-08-28 13:01:37 UTC
I only tested (and fixed) suprise removal of the ports.

I was able to reproduce the error message when the virtio-serial device is removed and I'm working on a solution.

Comment 18 Gal Hammer 2013-08-29 08:32:28 UTC
Moving back to QE after clarifying this issue with Michael Tsirkin.

QEMU emulates a PCI bus which includes an electro-mechanical lock. The mean that a request to remove a device (monitor's command "device_del") is forwarded to the guest and doesn't handled by QEMU itself. In this case, where the serial port is in use, Windows refuse to eject the device and notify the user.

Comment 19 Mike Cao 2013-10-10 08:19:27 UTC
(In reply to Gal Hammer from comment #18)
> Moving back to QE after clarifying this issue with Michael Tsirkin.
> 
> QEMU emulates a PCI bus which includes an electro-mechanical lock. The mean
> that a request to remove a device (monitor's command "device_del") is
> forwarded to the guest and doesn't handled by QEMU itself. In this case,
> where the serial port is in use, Windows refuse to eject the device and
> notify the user.

Hi, Gal 

QE tried netkvm driver ,hit not hit this issue .Does it control by driver ?

Comment 20 Gal Hammer 2013-10-10 08:52:51 UTC
(In reply to Mike Cao from comment #19)
> (In reply to Gal Hammer from comment #18)
> > Moving back to QE after clarifying this issue with Michael Tsirkin.
> > 
> > QEMU emulates a PCI bus which includes an electro-mechanical lock. The mean
> > that a request to remove a device (monitor's command "device_del") is
> > forwarded to the guest and doesn't handled by QEMU itself. In this case,
> > where the serial port is in use, Windows refuse to eject the device and
> > notify the user.
> 
> Hi, Gal 
> 
> QE tried netkvm driver ,hit not hit this issue .Does it control by driver ?

The driver can tell Windows that it support a surprise-removal. I assume that this will change the behavior that I described earlier.

Comment 21 Mike Cao 2013-10-12 03:13:52 UTC
Move status to VERIFIED based on comment #18 .Will report new bug to track it


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