Bug 1788346

Summary: Viostor serial request sometimes returns garbage
Product: [Community] Virtualization Tools Reporter: Joshua Job <jjob>
Component: virtio-winAssignee: Vadim Rozenfeld <vrozenfe>
Status: CLOSED WONTFIX QA Contact: menli <menli>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: haoliu, juzhang, lijin, menli, virt-maint, vrozenfe, yvugenfi
Target Milestone: ---Keywords: MigratedToJIRA
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-08-16 13:34:34 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:
Attachments:
Description Flags
issue none

Description Joshua Job 2020-01-07 01:16:54 UTC
Description of problem:
When requesting a serial number from a device after installing windows 2012 with drivers from virtio-win-0.1.171-1.noarch


Version-Release number of selected component (if applicable):
virtio-win-0.1.171-1.noarch
qemu-kvm-1.5.3-167.el7_7.1.x86_64
CentOS Linux release 7.7.1908 (Core)


How reproducible:
somewhere around 4 requests were enough to see 1 error


Steps to Reproduce:
1. install libvirt/qemu/virtio-win
2. Instantiate vm with vioserial drives
3. request serial number with 'Get-WMIObject win32_physicalmedia | Format-List Tag,SerialNumber' in powershell

Actual results:

PS C:\Users\Administrator> Get-WMIObject win32_physicalmedia | Format-List Tag,SerialNumber


Tag          : \\.\PHYSICALDRIVE0
SerialNumber : 70daaa7d

Tag          : \\.\CDROM1
SerialNumber :

Tag          : \\.\CDROM0
SerialNumber :



PS C:\Users\Administrator> Get-WMIObject win32_physicalmedia | Format-List Tag,SerialNumber


Tag          : \\.\PHYSICALDRIVE0
SerialNumber : 70daaa7d

Tag          : \\.\CDROM1
SerialNumber :

Tag          : \\.\CDROM0
SerialNumber :



PS C:\Users\Administrator> Get-WMIObject win32_physicalmedia | Format-List Tag,SerialNumber


Tag          : \\.\PHYSICALDRIVE0
SerialNumber : ø☻ÿÿ4à!•Ð

Tag          : \\.\CDROM1
SerialNumber :

Tag          : \\.\CDROM0
SerialNumber :



PS C:\Users\Administrator> Get-WMIObject win32_physicalmedia | Format-List Tag,SerialNumber


Tag          : \\.\PHYSICALDRIVE0
SerialNumber : 70daaa7d

Tag          : \\.\CDROM1
SerialNumber :

Tag          : \\.\CDROM0
SerialNumber :



PS C:\Users\Administrator>


Expected results:

70daaa7d returned as serial number on every request.

Additional info:

domain xml:
<domain type='kvm' id='1'>
  <name>win-test</name>
  <uuid>963198a2-0c2a-4456-a066-c459e40d7bf7</uuid>
  <description>win-test</description>
  <metadata/>
  <memory unit='KiB'>67108864</memory>
  <currentMemory unit='KiB'>67108864</currentMemory>
  <vcpu placement='static'>8</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
    </hyperv>
  </features>
  <cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>Broadwell</model>
    <vendor>Intel</vendor>
    <feature policy='require' name='vme'/>
    <feature policy='disable' name='ds'/>
    <feature policy='disable' name='acpi'/>
    <feature policy='require' name='ss'/>
    <feature policy='disable' name='ht'/>
    <feature policy='disable' name='tm'/>
    <feature policy='disable' name='pbe'/>
    <feature policy='disable' name='dtes64'/>
    <feature policy='disable' name='monitor'/>
    <feature policy='disable' name='ds_cpl'/>
    <feature policy='disable' name='vmx'/>
    <feature policy='disable' name='smx'/>
    <feature policy='disable' name='est'/>
    <feature policy='disable' name='tm2'/>
    <feature policy='disable' name='xtpr'/>
    <feature policy='disable' name='pdcm'/>
    <feature policy='disable' name='dca'/>
    <feature policy='disable' name='osxsave'/>
    <feature policy='require' name='f16c'/>
    <feature policy='require' name='rdrand'/>
    <feature policy='disable' name='arat'/>
    <feature policy='disable' name='tsc_adjust'/>
    <feature policy='disable' name='intel-pt'/>
    <feature policy='require' name='xsaveopt'/>
    <feature policy='require' name='pdpe1gb'/>
    <feature policy='require' name='abm'/>
    <feature policy='require' name='hypervisor'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='hypervclock' present='yes'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' cache='writethrough'/>
      <source file='/home/win-test/win_2012_r2_x64_dvd_2707946.iso'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <boot order='1'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' cache='writethrough'/>
      <source file='/usr/share/virtio-win/virtio-win.iso'/>
      <backingStore/>
      <target dev='hdb' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='writethrough'/>
      <source file='/home/win-test/main.qcow2'/>
      <backingStore/>
      <geometry cyls='16383' heads='16' secs='63' trans='lba'/>
      <target dev='vda' bus='virtio'/>
      <serial>70daaa7d</serial>
      <boot order='2'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x0'/>
    </controller>
    <controller type='usb' index='0' model='piix3-uhci'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    </controller>
    <controller type='ide' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='bridge'>
      <mac address='7c:4c:58:25:d2:24'/>
      <source bridge='br0'/>
      <target dev='tap0'/>
      <model type='virtio'/>
      <driver queues='16'/>
      <link state='up'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <channel type='unix'>
      <source mode='bind' path='/tmp/win-test.agent'/>
      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>
      <alias name='channel0'/>
      <address type='virtio-serial' controller='0' bus='0' port='1'/>
    </channel>
    <input type='tablet' bus='usb'>
      <alias name='input0'/>
      <address type='usb' bus='0' port='1'/>
    </input>
    <input type='mouse' bus='ps2'>
      <alias name='input1'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input2'/>
    </input>
    <graphics type='vnc' port='5900' autoport='yes' listen='XXX.XXX.XXX.XXX'>
      <listen type='address' address='XXX.XXX.XXX.XXX'/>
    </graphics>
    <video>
      <model type='vga' vram='16384' heads='1' primary='yes'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='none'/>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>unconfined_u:unconfined_r:svirt_t:s0:c15,c453</label>
    <imagelabel>unconfined_u:object_r:svirt_image_t:s0:c15,c453</imagelabel>
  </seclabel>
</domain>

Comment 1 Vadim Rozenfeld 2020-01-07 02:12:39 UTC
Thank you for reporting the problem.
Do you all that "PS C:\Users\Administrator> Get-WMIObject win32_physicalmedia | Format-List Tag,SerialNumber"
sequentially, without reboots, viostor driver disabling/enabling or disk off-lining/on-lining in the middle?

Best,
Vadim.

Comment 2 Joshua Job 2020-01-07 03:30:55 UTC
Yes, those were run one after another, pasted the first time then, hitting up and enter a number of times in succession. No other actions were taken.

Comment 3 Vadim Rozenfeld 2020-01-07 12:46:47 UTC
Can QE help reproducing this issue ?

Thanks,
Vadim

Comment 4 menli@redhat.com 2020-01-13 10:30:25 UTC
Created attachment 1651808 [details]
issue

Comment 5 menli@redhat.com 2020-01-13 10:31:48 UTC

Description of problem:

Viostor serial request sometimes returns garbage.

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

Host:
qemu-kvm-1.5.3-167.el7_7.1.x86_64
kernel-3.10.0-1062.9.1.el7.x86_64
seabios-bin-1.11.0-2.el7.noarch

Guest:
windows 2012 with  virtio-win-1.9.9-3.el8(viostor driver version:62.77.104.17100)



How reproducible:
1/3


Steps to Reproduce:

1. boot guest with below cmd lines.

 /usr/libexec/qemu-kvm \
    -name 'avocado-vt-vm3' \
    -machine pc \
    -nodefaults \
    -device VGA,bus=pci.0 \
    -drive id=drive_stg,readonly=off,snapshot=off,if=none,aio=threads,cache=none,format=qcow2,file=win2012.qcow2 \
    -device virtio-blk-pci,id=stg,drive=drive_stg,serial=TARGET_DISK0,bus=pci.0,serial=70daaa7d \
    -device virtio-net-pci,mac=9a:36:83:b6:3d:05,id=idJVpmsF,netdev=id23ZUK6,bus=pci.0  \
    -netdev tap,id=id23ZUK6,vhost=on \
    -m 14336  \
    -smp 2,maxcpus=4 \
    -cpu 'Skylake-Server' \
    -drive id=drive_cd1,if=none,snapshot=off,aio=threads,cache=none,media=cdrom,file=/home/kvm_autotest_root/iso/ISO/Win2012/en_windows_server_2012_x64_dvd_915478.iso \
    -device ide-cd,id=cd2,drive=drive_cd1,bus=ide.0,unit=0 \
    -cdrom /home/kvm_autotest_root/iso/windows/virtio-win-1.9.9-3.el8.iso \
    -device piix3-usb-uhci,id=usb -device usb-tablet,id=input0 \
    -vnc :1  \
    -rtc base=localtime,clock=host,driftfix=slew  \
    -boot order=cdn,once=c,menu=off,strict=off \
    -enable-kvm \
    -qmp tcp:0:1231,server,nowait \
    -monitor stdio \

2. Open PowerShell.

3. Enter the command below into PowerShell, and press Enter. (see screenshot below)

 Get-WMIObject win32_physicalmedia | Format-List Tag,SerialNumber

Note:still reproduce on virtio-win-prewhql-0.1-176.iso (viostor driver version:62.81.104.17600)

Comment 6 Vadim Rozenfeld 2020-01-13 11:02:43 UTC
Can reproduce this issue on Win10 as well when using Power Shell.
But it seems to be working fine when reading VPD page 0x80 with
sg_inq utility.

Comment 7 Vadim Rozenfeld 2020-01-19 12:20:05 UTC
Can we try Win32_DiskDrive instead of win32_physicalmedia ? 
It doesn't look as viostor problem at all. Get-WmiObject doesn't
initiate access to miniport driver on each request, but seems to be
fully dependent on data already cached by WMI.

Comment 8 menli@redhat.com 2020-01-20 02:02:58 UTC
I try  Win32_DiskDrive instead of win32_physicalmedia  for 200 times,no garbage.

Comment 9 Vadim Rozenfeld 2020-01-20 02:35:27 UTC
(In reply to menli from comment #8)
> I try  Win32_DiskDrive instead of win32_physicalmedia  for 200 times,no
> garbage.

Thank you.
Vadim.

Comment 10 Joshua Job 2020-01-28 21:52:56 UTC
I have not seen this behavior with IDE or Virtio SCSI Drives, only Virtio blk.