qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-block] Virtio-BLK/SCSI write requests and data payload checksums


From: Peter Lieven
Subject: [Qemu-block] Virtio-BLK/SCSI write requests and data payload checksums
Date: Tue, 6 Jun 2017 22:13:51 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1

Hi,


ich have spend several hours debugging a strange checksum error issue and 
finally found the cause, but I am totally unsure if whats happening

is correct or not.


Imagine a Protocol like iSCSI which has a Data Digest and which receives its 
data via zero copy straight from the guest kernel through Qemu and

then out of the socket to the network. It calculates the CRC32C data digest 
from the buffer it gets from Qemu. It totally relies thereby that the buffer

is not mangled after the write request has been submitted. But it seems this 
assumption is not true.


In my some virtual Debian based Virtual Machines I somewhere have the following 
code to generate a new network config:


---8<---

echo "# interfaces(5) file used by ifup(8) and ifdown(8)" 
>/etc/network/interfaces
echo >>/etc/network/interfaces
echo "auto lo" >>/etc/network/interfaces
echo "iface lo inet loopback" >>/etc/network/interfaces
echo >>/etc/network/interfaces
echo "auto eth0" >>/etc/network/interfaces
echo "iface eth0 inet $IP_CONFIG" >>/etc/network/interfaces

if [ "$IP_CONFIG" = "static" ]; then
 echo " address $IP_ADDRESS" >>/etc/network/interfaces
 echo " netmask $IP_NETMASK" >>/etc/network/interfaces
 echo " gateway $IP_GW" >>/etc/network/interfaces
 echo " dns-nameservers $IP_DNS1 $IP_DNS2" >>/etc/network/interfaces
fi

--->8---


I would suspect several /write cycles one for each echo line. Maybe some of the 
requests consolidated together.
However, the frist write request I see looks like this:

#offset=3316645888 bytes=4096 flags=0 niov=1 crc32c=0xeabc59bf

The submitted buffer has the following contents when I enter the write function:
---8<---
# interfaces(5) file used by ifup(8) and ifdown(8)

auto lo
--->8---

When the write completes the buffer has a different checksum and the following 
contents:
---8<---
# interfaces(5) file used by ifup(8) and ifdown(8)

auto lo
iface lo inet loopback

auto eth0
--->8---

So the contents of the buffer submitted to Qemu change while Qemu processes the 
write.
In the end several write requests follow and the /etc/network/interfaces file 
has the right content, but
is this at all legal? If yes, checksum calculation of payload and zero copy 
would not work together.

Thanks,
Peter




reply via email to

[Prev in Thread] Current Thread [Next in Thread]