Bug 985180

Summary: the md5 value is different after transfer big size data from guest to host with virtio serial through the TCP socket
Product: Red Hat Enterprise Linux 6 Reporter: Sibiao Luo <sluo>
Component: qemu-kvmAssignee: Amit Shah <amit.shah>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: acathrow, amit.shah, bsarathy, chayang, flang, juzhang, mdeng, michen, mkenneth, qzhang, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-12 10:14: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:

Description Sibiao Luo 2013-07-17 03:50:35 UTC
Description of problem:
boot guest with virtio serial though the unix socket, and try to transfer big size data from guest to host, it can complete transfer the big data but the md5 is not the same. btw, if transfer from host to guest that did not met this issue.

Version-Release number of selected component (if applicable):
host info:
2.6.32-398.el6.x86_64
qemu-kvm-0.12.1.2-2.378.el6.x86_64
guest info:
2.6.32-398.el6.x86_64

How reproducible:
almost every time.

Steps to Reproduce:
1.boot guest with virtio serial though the unix socket(two ports).
e.g:...-device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pci.0,addr=0x3 -chardev socket,id=channel1,host=localhost,port=12345,server,nowait -device virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port1 -chardev socket,id=channel2,host=localhost,port=12346,server,nowait -device virtserialport,chardev=channel2,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port2
2.dd a 2G file in the guest and check the md5 vaule.
guest ]# dd if=/dev/zero of=guest-file bs=1M count=2000
2000+0 records in
2000+0 records out
2097152000 bytes (2.1 GB) copied, 5.20488 s, 403 MB/s
guest ]# ls -lh guest-file 
-rw-r--r--. 1 root root 2.0G Jul 17 19:10 guest-file
guest ]# md5sum guest-file 
f3444be3893c1b9b6fa9dd1acde671a9  guest-file
3.transfer the data from guest to host via unix socket.

Actual results:
after step 3,
- Port1 testing:
guest]# cat guest-file > /dev/vport0p1
host ]# nc localhost 12345 >> port1-file1
^C
host ]# ls -lh port1-file1 
-rw-r--r--. 1 root root 2.0G Jul 17 11:15 port1-file1
host ]# md5sum port1-file1 
78b63635b9ab2287e4ad96728cfea103  port1-file1   <------md5 is not the same

guest]# cat guest-file > /dev/vport0p1
host ]# nc localhost 12345 >> port1-file2
^C
host ]# ls -lh port1-file2 
-rw-r--r--. 1 root root 2.0G Jul 17 11:17 port1-file2
host ]# md5sum port1-file2 
78b63635b9ab2287e4ad96728cfea103  port1-file2   <------md5 is not the same

guest]# cat guest-file > /dev/vport0p1
host ]# nc localhost 12345 >> port1-file3
^C
host ]# ls -lh port1-file3
-rw-r--r--. 1 root root 2.0G Jul 17 11:19 port1-file3
host ]# md5sum port1-file3
85e75c73e8ef5e954474524a84e22949  port1-file3   <------md5 is not the same

- Port2 testing:
guest]# cat guest-file > /dev/vport0p2
host ]# nc localhost 12346 >> port2-file1
^C
host ]# ls -lh port2-file1 
-rw-r--r--. 1 root root 2.0G Jul 17 11:22 port2-file1
host ]# md5sum port2-file1 
6fec2709eafe1a6f0d6099bfec419daa  port2-file1   <------md5 is not the same

guest]# cat guest-file > /dev/vport0p2
host ]# nc localhost 12346 >> port2-file2
^C
host ]# ls -lh port2-file2
-rw-r--r--. 1 root root 2.0G Jul 17 11:22 port2-file2
host ]# md5sum port2-file2
abfbe5b5b220033866fec2b972d625fc  port2-file2   <------md5 is not the same

guest]# cat guest-file > /dev/vport0p2
host ]# nc localhost 12346 >> port2-file3
^C
host ]# ls -lh port2-file3
-rw-r--r--. 1 root root 2.0G Jul 17 11:24 port2-file3
host ]# md5sum port2-file3
af67d0684bf3dc4af73f57e5c4c83c03  port2-file3   <------md5 is not the same

Expected results:
there should no any packet loss.

Additional info:

Comment 1 Sibiao Luo 2013-07-17 03:52:48 UTC
If use the tcp socket instead unix socket that did not met such issue.

My qemu-kvm command line:
# /usr/libexec/qemu-kvm -S -M rhel6.5.0 -cpu SandyBridge -enable-kvm -m 4096 -smp 4,sockets=2,cores=2,threads=1 -no-kvm-pit-reinjection -name sluo -uuid 43425b70-86e5-4664-bf2c-3b76699b8bec -rtc base=localtime,clock=host,driftfix=slew -device virtio-serial-pci,id=virtio-serial0,max_ports=16,vectors=0,bus=pci.0,addr=0x3 -chardev socket,id=channel1,host=localhost,port=12345,server,nowait -device virtserialport,chardev=channel1,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port1 -chardev socket,id=channel2,host=localhost,port=12346,server,nowait -device virtserialport,chardev=channel2,name=com.redhat.rhevm.vdsm,bus=virtio-serial0.0,id=port2 -drive file=/home/RHEL6.5-20130712.n.0-6.5-Server-x64.qcow2,if=none,id=drive-system-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,serial="QEMU-DISK1" -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-system-disk,id=system-disk,bootindex=1 -device virtio-balloon-pci,id=ballooning,bus=pci.0,addr=0x5 -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0 -netdev tap,id=hostnet0,vhost=on,script=/etc/qemu-ifup -device virtio-net-pci,netdev=hostnet0,id=virtio-net-pci0,mac=2C:41:38:B6:40:21,bus=pci.0,addr=0x6,bootindex=2 -drive file=/home/my-data-disk.qcow2,if=none,id=drive-data-disk,format=qcow2,cache=none,aio=native,werror=stop,rerror=stop,serial="QEMU-DISK2" -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x7,drive=drive-data-disk,id=data-disk,bootindex=3 -k en-us -boot menu=on -qmp tcp:0:4444,server,nowait -serial unix:/tmp/ttyS0,server,nowait -vnc :1 -spice port=5931,disable-ticketing -monitor stdio

Comment 2 Qunfang Zhang 2013-07-17 11:15:23 UTC
Is this a duplicate bug with the following one? 

Bug 677886 - MD5 of file is different from the original one after transferred via virtio seria

Comment 3 Sibiao Luo 2013-07-17 11:31:06 UTC
(In reply to Qunfang Zhang from comment #2)
> Is this a duplicate bug with the following one? 
> 
> Bug 677886 - MD5 of file is different from the original one after
> transferred via virtio seria

bug 677886 is about for the TCP socket, and this one is specified for Unix socket, maybe different issue.

Comment 4 Sibiao Luo 2013-07-17 11:41:06 UTC
Two-way stream socket to create, if path is specified, a Unix socket is created and if port is also specified, a TCP socket is created. 

Sorry for my mistake during all my description, just update a comment here to make clear for it.

Best Regards,
sluo

Comment 5 Amit Shah 2013-08-12 10:14:34 UTC
tcp and unix sockets share code paths, marking this a dup of the previous one.

*** This bug has been marked as a duplicate of bug 677886 ***