Bug 951481

Summary: [virtio-win][serial]virtio serial doesn't work after uninstall driver and then re-install
Product: Red Hat Enterprise Linux 6 Reporter: Qunfang Zhang <qzhang>
Component: virtio-winAssignee: Gal Hammer <ghammer>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: acathrow, amit.shah, bcao, bsarathy, juzhang, lijin, mdeng, michen, rhod, vrozenfe, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virtio-win-prewhql-0.1-64 Doc Type: Bug Fix
Doc Text:
Cause: Uninstall and then re-install vioserial driver. Consequence: The virtio serial doesn't work, can not transfer data through the serial port. Fix: In virtio-serial driver code. Changes in qemu port ready notification sequence. Result: With the fix mentioned above, vioserial can operate normally after device driver uninstall/re-install sequence.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-22 00:08:33 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:
Bug Depends On:    
Bug Blocks: 967626    

Description Qunfang Zhang 2013-04-12 10:10:04 UTC
Description of problem:
Uninstall a virtio driver in the device manager, and then re-install it. The virtio serial doesn't work, can not transfer data through the serial port. A disable-enable cycle could make it work again.

Version-Release number of selected component (if applicable):
virtio-win-prewhql-55
Guest: win2k8-r2
Host:
kernel-2.6.32-358.6.1.el6.x86_64
qemu-kvm-0.12.1.2-2.360.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Boot a guest with virtio serial, eg:
/usr/libexec/qemu-kvm -cpu SandyBridge -M rhel6.4.0 -enable-kvm -m 4096 -smp 2,sockets=2,cores=1,threads=1 -name rhel6.4-64 -uuid 9a0e67ec-f286-d8e7-0548-0c1c9ec93009 -nodefconfig -nodefaults -monitor stdio -rtc base=utc,clock=host,driftfix=slew -no-kvm-pit-reinjection -no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/home/win2k8-r2.qcow2,if=none,id=drive-virtio-disk0,format=qcow2,cache=none -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -drive 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 -netdev tap,id=hostnet0,vhost=on -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:d5:51:8a,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x7  -chardev socket,id=channel1,path=/tmp/helloworld1,server,nowait -device virtserialport,chardev=channel1,name=port1,bus=virtio-serial0.0,id=port1 -chardev socket,id=channel2,path=/tmp/helloworld2,server,nowait -chardev spicevmc,id=charchannel0,name=vdagent -device usb-tablet,id=input0 -spice port=5900,addr=0.0.0.0,disable-ticketing,seamless-migration=on -vga qxl -global qxl-vga.vram_size=67108864 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6  -qmp tcp:0:5555,server,nowait -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0

2. Transfer data through the serial port "port1"

3. Uninstall the driver from device manager, even NO need to select the "Delete the driver software from this device"

4. Reinstall the driver by clicking right button or the mouse at the top level item of device manager and then select "Scan the hardware change"

5. Transfer data through the "port1" again.

  
Actual results:
After step 2: can transfer data.
After step 5: can not transfer data.

Expected results:
After step 5: should transfer data successfully.

Additional info:

Comment 2 Gal Hammer 2013-04-14 06:30:00 UTC
In step #3, did uninstall the driver while it was in use?

Did you see a dialog asking you to restart the computer?

Comment 3 Qunfang Zhang 2013-04-16 05:36:08 UTC
(In reply to comment #2)
> In step #3, did uninstall the driver while it was in use?
This issue is reproduced on both the following conditions: 1) uninstall driver while it is not in use; 2) uninstall driver while it's in use.

> 
> Did you see a dialog asking you to restart the computer?
Nope, there's no any dialog asking me to restart the computer.

Comment 4 Gal Hammer 2013-05-23 14:41:31 UTC
From setupapi.dev.log file:

>>>  [Device Install (Hardware initiated) - {6FDE7547-1B65-48ae-B628-80BE62016026}\VIOSerialPort\4&176259cf&21&01]
>>>  Section start 2013/05/23 07:53:25.718
     ump: Creating Install Process: DrvInst.exe 07:53:25.812
     ndv: Retrieving device info...
     ndv: Setting device parameters...
     ndv: Doing WU search last due to CM_DEVCAP_SILENTINSTALL flag.
     ndv: Searching Driver Store and Device Path...
     dvi: {Build Driver List} 07:53:25.859
     dvi:      Searching for hardware ID(s):
     dvi:           0001
     cpy:      Policy is set to make all digital signatures equal.
     dvi:      Enumerating INFs from path list 'C:\Windows\inf'
     inf:      Searched 0 potential matches in published INF directory
     inf:      Searched 35 INFs in directory: 'C:\Windows\inf'
     dvi: {Build Driver List - exit(0x00000000)} 07:53:26.531
     ndv: Selecting best match from Driver Store (including Device Path)...
     dvi: {DIF_SELECTBESTCOMPATDRV} 07:53:26.531
     dvi:      No class installer for 'vport0p1'
     dvi:      No CoInstallers found
     dvi:      Default installer: Enter 07:53:26.546
     dvi:           {Select Best Driver}
!    dvi:                Selecting driver failed(0xe0000228)
     dvi:           {Select Best Driver - exit(0xe0000228)}
!    dvi:      Default installer: failed!
!    dvi:      Error 0xe0000228: There are no compatible drivers for this device.
     dvi: {DIF_SELECTBESTCOMPATDRV - exit(0xe0000228)} 07:53:26.546
     ndv: Searching Windows Update for drivers... 07:53:26.593
     ndv: Acquired WU search serialization mutex. 07:53:26.593
     ndv: About to release WU search serialization mutex. 07:53:32.578
     ndv: No driver found on Windows Update. 07:53:32.578
     ndv: {Core Device Install} 07:53:32.578
!    ndv:      Installing NULL driver!
     dvi:      Set selected driver complete.
     dvi:      {DIF_ALLOW_INSTALL} 07:53:32.593
     dvi:           No class installer for 'vport0p1'
     dvi:           Default installer: Enter 07:53:32.593
     dvi:           Default installer: Exit
     dvi:      {DIF_ALLOW_INSTALL - exit(0xe000020e)} 07:53:32.593
     dvi:      {DIF_INSTALLDEVICE} 07:53:32.593
     dvi:           No class installer for 'vport0p1'
     dvi:           Default installer: Enter 07:53:32.609
!    dvi:                Installing NULL driver!
     dvi:                Writing common driver property settings.
     dvi:                {Restarting Devices} 07:53:32.671
     dvi:                     Restart: {6FDE7547-1B65-48AE-B628-80BE62016026}\VIOSERIALPORT\4&176259CF&21&01
     dvi:                     Restart complete.
     dvi:                {Restarting Devices exit} 07:53:32.812
     dvi:           Default installer: Exit
     dvi:      {DIF_INSTALLDEVICE - exit(0x00000000)} 07:53:32.828
     ndv:      Device install status=0xe0000203
     ndv:      Performing device install final cleanup...
!    ndv:      Queueing up error report since device installation failed...
     ndv: {Core Device Install - exit(0xe0000203)} 07:53:32.828
     ump: Server install process exited with code 0xe0000203 07:53:32.843
<<<  Section end 2013/05/23 07:53:32.843
<<<  [Exit status: FAILURE(0xe0000203)]

It's seems that after and upgrade (uninstall and install) Windows is trying to install a driver to the serial port device.

Vadim? Are you familiar with it? Do do you have an idea what might cause it?

Comment 5 Vadim Rozenfeld 2013-05-24 11:05:29 UTC
(In reply to Gal Hammer from comment #4)
> From setupapi.dev.log file:
> 
> >>>  [Device Install (Hardware initiated) - {6FDE7547-1B65-48ae-B628-80BE62016026}\VIOSerialPort\4&176259cf&21&01]
> >>>  Section start 2013/05/23 07:53:25.718
>      ump: Creating Install Process: DrvInst.exe 07:53:25.812
>      ndv: Retrieving device info...
>      ndv: Setting device parameters...
>      ndv: Doing WU search last due to CM_DEVCAP_SILENTINSTALL flag.
>      ndv: Searching Driver Store and Device Path...
>      dvi: {Build Driver List} 07:53:25.859
>      dvi:      Searching for hardware ID(s):
>      dvi:           0001
>      cpy:      Policy is set to make all digital signatures equal.
>      dvi:      Enumerating INFs from path list 'C:\Windows\inf'
>      inf:      Searched 0 potential matches in published INF directory
>      inf:      Searched 35 INFs in directory: 'C:\Windows\inf'
>      dvi: {Build Driver List - exit(0x00000000)} 07:53:26.531
>      ndv: Selecting best match from Driver Store (including Device Path)...
>      dvi: {DIF_SELECTBESTCOMPATDRV} 07:53:26.531
>      dvi:      No class installer for 'vport0p1'
>      dvi:      No CoInstallers found
>      dvi:      Default installer: Enter 07:53:26.546
>      dvi:           {Select Best Driver}
> !    dvi:                Selecting driver failed(0xe0000228)
>      dvi:           {Select Best Driver - exit(0xe0000228)}
> !    dvi:      Default installer: failed!
> !    dvi:      Error 0xe0000228: There are no compatible drivers for this
> device.
>      dvi: {DIF_SELECTBESTCOMPATDRV - exit(0xe0000228)} 07:53:26.546
>      ndv: Searching Windows Update for drivers... 07:53:26.593
>      ndv: Acquired WU search serialization mutex. 07:53:26.593
>      ndv: About to release WU search serialization mutex. 07:53:32.578
>      ndv: No driver found on Windows Update. 07:53:32.578
>      ndv: {Core Device Install} 07:53:32.578
> !    ndv:      Installing NULL driver!
>      dvi:      Set selected driver complete.
>      dvi:      {DIF_ALLOW_INSTALL} 07:53:32.593
>      dvi:           No class installer for 'vport0p1'
>      dvi:           Default installer: Enter 07:53:32.593
>      dvi:           Default installer: Exit
>      dvi:      {DIF_ALLOW_INSTALL - exit(0xe000020e)} 07:53:32.593
>      dvi:      {DIF_INSTALLDEVICE} 07:53:32.593
>      dvi:           No class installer for 'vport0p1'
>      dvi:           Default installer: Enter 07:53:32.609
> !    dvi:                Installing NULL driver!
>      dvi:                Writing common driver property settings.
>      dvi:                {Restarting Devices} 07:53:32.671
>      dvi:                     Restart:
> {6FDE7547-1B65-48AE-B628-80BE62016026}\VIOSERIALPORT\4&176259CF&21&01
>      dvi:                     Restart complete.
>      dvi:                {Restarting Devices exit} 07:53:32.812
>      dvi:           Default installer: Exit
>      dvi:      {DIF_INSTALLDEVICE - exit(0x00000000)} 07:53:32.828
>      ndv:      Device install status=0xe0000203
>      ndv:      Performing device install final cleanup...
> !    ndv:      Queueing up error report since device installation failed...
>      ndv: {Core Device Install - exit(0xe0000203)} 07:53:32.828
>      ump: Server install process exited with code 0xe0000203 07:53:32.843
> <<<  Section end 2013/05/23 07:53:32.843
> <<<  [Exit status: FAILURE(0xe0000203)]
> 
> It's seems that after and upgrade (uninstall and install) Windows is trying
> to install a driver to the serial port device.
> 
> Vadim? Are you familiar with it? Do do you have an idea what might cause it?

That's interesting. Is it a regression? 
the following sting in the inf file should cover this case:

%VirtioPort.DeviceDesc%=VirtioPort_Device, {6FDE7547-1B65-48ae-B628-80BE62016026}\VIOSerialPort

Does it work if you skip step 2 ?
"2. Transfer data through the serial port "port1""

If so - you probably don't close RAW PDO vport0p1 properly.

Best regards,
Vadim.

Comment 6 Gal Hammer 2013-05-26 15:05:02 UTC
(In reply to Vadim Rozenfeld from comment #5)

> That's interesting. Is it a regression? 

It seems that this behavior (Windows is trying to install a driver for a raw pdo device) exists in build 49 as well. It probably didn't show up until few of my changes that add pnp events callbacks to the port device object.

> the following sting in the inf file should cover this case:
> 
> %VirtioPort.DeviceDesc%=VirtioPort_Device,
> {6FDE7547-1B65-48ae-B628-80BE62016026}\VIOSerialPort

It doesn't work (the string exists in the inf file). The current device hardware id is set to "0000" and not "{6FDE7547-1B65-48ae-B628-80BE62016026}\VIOSerialPort". But it doesn't work even after I fixed it.
 
> Does it work if you skip step 2 ?
> "2. Transfer data through the serial port "port1""

Yep. It happens even if the port is not in used.
 
> If so - you probably don't close RAW PDO vport0p1 properly.
> 
> Best regards,
> Vadim.

Comment 7 lijin 2013-05-27 05:42:08 UTC
win7-64 guest also hit this issue in build 62.
guest can not use virtserialport after uninstall/re-install virtio-serial driver,but reboot guest can make it work.

Comment 8 lijin 2013-06-08 07:31:57 UTC
Reproduced this issue on virtio-win-prewhql-55 version
Verified this issue on virtio-win-prewhql-64 verion

steps same as comment #0

Actual Results:
on virtio-win-prewhql-55, virtserialport cannot use after reinstall
on virtio-win-prewhql-64,virtserialport can transfer data after reinstall

Based on above ,this issue has been fixed already.

Comment 9 Mike Cao 2013-06-13 07:03:13 UTC
Move status to VERIFIED according to comment #8

Comment 12 errata-xmlrpc 2013-11-22 00:08:33 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.

http://rhn.redhat.com/errata/RHBA-2013-1729.html